DCL 3.7.4
Loading...
Searching...
No Matches
UpdateLink Class Reference

#include <LinkUtility.h>

Public Member Functions

 UpdateLink (TextTemplate *pSource, const String &strDetailPage, const String &strToEdit, const String &strThisEnc, const String &strListEnc)
void assign (TextTemplate *pDest, _CONST SQLFields &fields, const Session &session, const String &strMessageID, const String &strToList, const MessageTree &mt, const MessageTree::Position &pos)

Protected Attributes

TextTemplate__pSource
TextTemplate__pADD
TextTemplate__pREPLY
TextTemplate__pAGREE
TextTemplate__pDISAGREE
TextTemplate__pMODIFY
TextTemplate__pDELETE
TextTemplate__pNADD
TextTemplate__pNREPLY
TextTemplate__pNAGREE
TextTemplate__pNDISAGREE
TextTemplate__pNMODIFY
TextTemplate__pNDELETE

Detailed Description

Definition at line 83 of file LinkUtility.h.

Constructor & Destructor Documentation

◆ UpdateLink()

UpdateLink::UpdateLink ( TextTemplate * pSource,
const String & strDetailPage,
const String & strToEdit,
const String & strThisEnc,
const String & strListEnc )

Definition at line 176 of file LinkUtility.cpp.

183{
184 __pSource = pSource;
185
186 __pADD = NULL;
187 __pREPLY = NULL;
188 __pAGREE = NULL;
190 __pMODIFY = NULL;
191 __pDELETE = NULL;
192
193 __pNADD = NULL;
194 __pNREPLY = NULL;
195 __pNAGREE = NULL;
199
200 if (__pSource) {
201 __pADD = __pSource->atP(L"_ADD");
202 if (__pADD) {
203 __pNADD = &(*__pSource)[L"N_ADD"];
204 __pADD->assign(L"DETAIL", strDetailPage);
205 __pADD->assign(L"EDIT", strToEdit);
206 __pADD->assign(L"_THIS", strThisEnc);
207 __pADD->assign(L"_LIST", strListEnc);
208 }
209 __pREPLY = __pSource->atP(L"_REPLY");
210 if (__pREPLY) {
211 __pNREPLY = &(*__pSource)[L"N_REPLY"];
212 __pREPLY->assign(L"DETAIL", strDetailPage);
213 __pREPLY->assign(L"EDIT", strToEdit);
214 __pREPLY->assign(L"_THIS", strThisEnc);
215 __pREPLY->assign(L"_LIST", strListEnc);
216 }
217 __pAGREE = __pSource->atP(L"_AGREE");
218 if (__pAGREE) {
219 __pNAGREE = &(*__pSource)[L"N_AGREE"];
220 __pAGREE->assign(L"EDIT", strToEdit);
221 __pAGREE->assign(L"_THIS", strThisEnc);
222 __pAGREE->assign(L"_LIST", strListEnc);
223 }
224 __pDISAGREE = __pSource->atP(L"_DISAGREE");
225 if (__pDISAGREE) {
226 __pNDISAGREE = &(*__pSource)[L"N_DISAGREE"];
227 __pDISAGREE->assign(L"EDIT", strToEdit);
228 __pDISAGREE->assign(L"_THIS", strThisEnc);
229 __pDISAGREE->assign(L"_LIST", strListEnc);
230 }
231 __pMODIFY = __pSource->atP(L"_MODIFY");
232 if (__pMODIFY) {
233 __pNMODIFY= &(*__pSource)[L"N_MODIFY"];
234 __pMODIFY->assign(L"DETAIL", strDetailPage);
235 __pMODIFY->assign(L"EDIT", strToEdit);
236 __pMODIFY->assign(L"_THIS", strThisEnc);
237 __pMODIFY->assign(L"_LIST", strListEnc);
238 }
239 __pDELETE = __pSource->atP(L"_DELETE");
240 if (__pDELETE) {
241 __pNDELETE = &(*__pSource)[L"N_DELETE"];
242 __pDELETE->assign(L"EDIT", strToEdit);
243 __pDELETE->assign(L"_THIS", strThisEnc);
244 __pDELETE->assign(L"_LIST", strListEnc);
245 }
246 }
247}
#define NULL
Definition Config.h:312

Member Function Documentation

◆ assign()

void UpdateLink::assign ( TextTemplate * pDest,
_CONST SQLFields & fields,
const Session & session,
const String & strMessageID,
const String & strToList,
const MessageTree & mt,
const MessageTree::Position & pos )

Definition at line 249 of file LinkUtility.cpp.

258{
259 if (__pSource) {
260 // 추가, 답글, 추천, 비난, 수정, 삭제
261 if (session.isSysGuest()) {
262 if (__pADD) {
264 // __pNADD->assign(L"TITLE", L"권한이 없습니다");
265 pDest->assign(L"_ADD", *__pNADD);
266 }
267 if (__pREPLY) {
269 // __pNREPLY->assign(L"TITLE", L"권한이 없습니다");
270 pDest->assign(L"_REPLY", *__pNREPLY);
271 }
272 if (__pAGREE) {
274 // __pNAGREE->assign(L"TITLE", L"권한이 없습니다");
275 pDest->assign(L"_AGREE", *__pNAGREE);
276 }
277 if (__pDISAGREE) {
279 // __pNDISAGREE->assign(L"TITLE", L"권한이 없습니다");
280 pDest->assign(L"_DISAGREE", *__pNDISAGREE);
281 }
282 if (__pMODIFY) {
284 // __pNMODIFY->assign(L"TITLE", L"권한이 없습니다");
285 pDest->assign(L"_MODIFY", *__pNMODIFY);
286 }
287 if (__pDELETE) {
289 // __pNDELETE->assign(L"TITLE", L"권한이 없습니다");
290 pDest->assign(L"_DELETE", *__pNDELETE);
291 }
292 }
293 else {
294 if (__pADD) {
295 __pADD->assign(L"PARENT_ID", fields.byName(L"PARENT_ID").asString());
296 pDest->assign(L"_ADD", *__pADD);
297 }
298
299 if (__pREPLY) {
301 int nChild = fields.byName(L"NCHILD").asInteger();
302 if (nChild == mt.width()) {
303 // __pNREPLY->assign(L"TITLE", L"최대 답글개수에 도달했습니다");
304 pDest->assign(L"_REPLY", *__pNREPLY);
305 }
306 else if (pos.nDepthIndex == (mt.depth() - 1)) {
307 // __pNREPLY->assign(L"TITLE", L"답글을 위한 최대 깊이에 도달했습니다");
308 pDest->assign(L"_REPLY", *__pNREPLY);
309 }
310 else {
311 __pREPLY->assign(L"MESSAGE_ID", strMessageID);
312 pDest->assign(L"_REPLY", *__pREPLY);
313 }
314 }
315
316 int nUserID = fields.byName(L"USER_ID").asInteger();
317 if (__pAGREE || __pDISAGREE) {
318 if (session.__nUserID == nUserID) {
319 if (__pAGREE) {
321 // __pNAGREE->assign(L"TITLE", L"자신의 글에 투표를 할 수 없습니다");
322 pDest->assign(L"_AGREE", *__pNAGREE);
323 }
324
325 if (__pDISAGREE) {
327 // __pNDISAGREE->assign(L"TITLE", L"자신의 글에 투표를 할 수 없습니다");
328 pDest->assign(L"_DISAGREE", *__pNDISAGREE);
329 }
330 }
331 else {
332 SQLField& VOTE_END = fields.byName(L"VOTE_END");
333 if (!VOTE_END.isNull() &&
334 VOTE_END.asDateTime() < DateTime::getCurrentLocalTime()
335 ) {
336 if (__pAGREE) {
338 // __pNAGREE->assign(L"TITLE", L"투표기간이 지났습니다");
339 pDest->assign(L"_AGREE", *__pNAGREE);
340 }
341 if (__pDISAGREE) {
343 // __pNDISAGREE->assign(L"TITLE", L"투표기간이 지났습니다");
344 pDest->assign(L"_DISAGREE", *__pNDISAGREE);
345 }
346 }
347 else {
348 if (__pAGREE) {
349 __pAGREE->assign(L"MESSAGE_ID", strMessageID);
350 pDest->assign(L"_AGREE", *__pAGREE);
351 }
352 if (__pDISAGREE) {
353 __pDISAGREE->assign(L"MESSAGE_ID", strMessageID);
354 pDest->assign(L"_DISAGREE", *__pDISAGREE);
355 }
356 }
357 }
358 }
359 if (__pMODIFY) {
360 if (session.__nUserID == nUserID) {
361 __pMODIFY->assign(L"MESSAGE_ID", strMessageID);
362 pDest->assign(L"_MODIFY", *__pMODIFY);
363 }
364 else {
366 // __pNMODIFY->assign(L"TITLE", L"권한이 없습니다");
367 pDest->assign(L"_MODIFY", *__pNMODIFY);
368 }
369 }
370 if (__pDELETE) {
371 if (session.__nUserID == nUserID || session.isSysAdmin()) {
372 __pDELETE->assign(L"MESSAGE_ID", strMessageID);
373 pDest->assign(L"_DELETE", *__pDELETE);
374 }
375 else {
377 // __pNDELETE->assign(L"TITLE", L"권한이 없습니다");
378 pDest->assign(L"_DELETE", *__pNDELETE);
379 }
380 }
381 }
382 } // if (__pSource)
383}
#define __DCL_ASSERT(expr)
Definition Object.h:394
static DateTime getCurrentLocalTime()
Definition DateTime.cpp:954
int depth() const
Definition MessageTree.h:91
int width() const
Definition MessageTree.h:96
int __nUserID
Definition Session.h:33
bool isSysAdmin() const
Definition Session.h:75
bool isSysGuest() const
Definition Session.h:70

Member Data Documentation

◆ __pADD

TextTemplate* UpdateLink::__pADD
protected

Definition at line 88 of file LinkUtility.h.

◆ __pAGREE

TextTemplate* UpdateLink::__pAGREE
protected

Definition at line 90 of file LinkUtility.h.

◆ __pDELETE

TextTemplate* UpdateLink::__pDELETE
protected

Definition at line 93 of file LinkUtility.h.

◆ __pDISAGREE

TextTemplate* UpdateLink::__pDISAGREE
protected

Definition at line 91 of file LinkUtility.h.

◆ __pMODIFY

TextTemplate* UpdateLink::__pMODIFY
protected

Definition at line 92 of file LinkUtility.h.

◆ __pNADD

TextTemplate* UpdateLink::__pNADD
protected

Definition at line 95 of file LinkUtility.h.

◆ __pNAGREE

TextTemplate* UpdateLink::__pNAGREE
protected

Definition at line 97 of file LinkUtility.h.

◆ __pNDELETE

TextTemplate* UpdateLink::__pNDELETE
protected

Definition at line 100 of file LinkUtility.h.

◆ __pNDISAGREE

TextTemplate* UpdateLink::__pNDISAGREE
protected

Definition at line 98 of file LinkUtility.h.

◆ __pNMODIFY

TextTemplate* UpdateLink::__pNMODIFY
protected

Definition at line 99 of file LinkUtility.h.

◆ __pNREPLY

TextTemplate* UpdateLink::__pNREPLY
protected

Definition at line 96 of file LinkUtility.h.

◆ __pREPLY

TextTemplate* UpdateLink::__pREPLY
protected

Definition at line 89 of file LinkUtility.h.

◆ __pSource

TextTemplate* UpdateLink::__pSource
protected

Definition at line 86 of file LinkUtility.h.


The documentation for this class was generated from the following files: