1
|
|
|
<?php |
2
|
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */ |
3
|
|
|
|
4
|
|
|
/** |
5
|
|
|
* @class boardView |
6
|
|
|
* @author NAVER ([email protected]) |
7
|
|
|
* @brief board module View class |
8
|
|
|
**/ |
9
|
|
|
class boardView extends board |
10
|
|
|
{ |
11
|
|
|
var $listConfig; |
12
|
|
|
var $columnList; |
13
|
|
|
|
14
|
|
|
/** |
15
|
|
|
* @brief initialization |
16
|
|
|
* board module can be used in either normal mode or admin mode.\n |
17
|
|
|
**/ |
18
|
|
|
function init() |
19
|
|
|
{ |
20
|
|
|
$oSecurity = new Security(); |
21
|
|
|
$oSecurity->encodeHTML('document_srl', 'comment_srl', 'vid', 'mid', 'page', 'category', 'search_target', 'search_keyword', 'sort_index', 'order_type', 'trackback_srl'); |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* setup the module general information |
25
|
|
|
**/ |
26
|
|
|
if($this->module_info->list_count) |
27
|
|
|
{ |
28
|
|
|
$this->list_count = $this->module_info->list_count; |
29
|
|
|
} |
30
|
|
|
if($this->module_info->search_list_count) |
31
|
|
|
{ |
32
|
|
|
$this->search_list_count = $this->module_info->search_list_count; |
|
|
|
|
33
|
|
|
} |
34
|
|
|
if($this->module_info->page_count) |
35
|
|
|
{ |
36
|
|
|
$this->page_count = $this->module_info->page_count; |
37
|
|
|
} |
38
|
|
|
$this->except_notice = $this->module_info->except_notice == 'N' ? FALSE : TRUE; |
|
|
|
|
39
|
|
|
|
40
|
|
|
// $this->_getStatusNameListecret option backward compatibility |
41
|
|
|
$oDocumentModel = getModel('document'); |
42
|
|
|
|
43
|
|
|
$statusList = $this->_getStatusNameList($oDocumentModel); |
44
|
|
|
if(isset($statusList['SECRET'])) |
45
|
|
|
{ |
46
|
|
|
$this->module_info->secret = 'Y'; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
// use_category <=1.5.x, hide_category >=1.7.x |
50
|
|
|
$count_category = count($oDocumentModel->getCategoryList($this->module_info->module_srl)); |
51
|
|
View Code Duplication |
if($count_category) |
52
|
|
|
{ |
53
|
|
|
if($this->module_info->hide_category) |
54
|
|
|
{ |
55
|
|
|
$this->module_info->use_category = ($this->module_info->hide_category == 'Y') ? 'N' : 'Y'; |
56
|
|
|
} |
57
|
|
|
else if($this->module_info->use_category) |
58
|
|
|
{ |
59
|
|
|
$this->module_info->hide_category = ($this->module_info->use_category == 'Y') ? 'N' : 'Y'; |
60
|
|
|
} |
61
|
|
|
else |
62
|
|
|
{ |
63
|
|
|
$this->module_info->hide_category = 'N'; |
64
|
|
|
$this->module_info->use_category = 'Y'; |
65
|
|
|
} |
66
|
|
|
} |
67
|
|
|
else |
68
|
|
|
{ |
69
|
|
|
$this->module_info->hide_category = 'Y'; |
70
|
|
|
$this->module_info->use_category = 'N'; |
71
|
|
|
} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* check the consultation function, if the user is admin then swich off consultation function |
75
|
|
|
* if the user is not logged, then disppear write document/write comment./ view document |
76
|
|
|
**/ |
77
|
|
|
if($this->module_info->consultation == 'Y' && !$this->grant->manager) |
78
|
|
|
{ |
79
|
|
|
$this->consultation = TRUE; |
|
|
|
|
80
|
|
|
if(!Context::get('is_logged')) |
81
|
|
|
{ |
82
|
|
|
$this->grant->list = FALSE; |
|
|
|
|
83
|
|
|
$this->grant->write_document = FALSE; |
84
|
|
|
$this->grant->write_comment = FALSE; |
85
|
|
|
$this->grant->view = FALSE; |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
else |
89
|
|
|
{ |
90
|
|
|
$this->consultation = FALSE; |
91
|
|
|
} |
92
|
|
|
|
93
|
|
|
/** |
94
|
|
|
* setup the template path based on the skin |
95
|
|
|
* the default skin is default |
96
|
|
|
**/ |
97
|
|
|
$template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); |
98
|
|
View Code Duplication |
if(!is_dir($template_path)||!$this->module_info->skin) |
99
|
|
|
{ |
100
|
|
|
$this->module_info->skin = 'default'; |
101
|
|
|
$template_path = sprintf("%sskins/%s/",$this->module_path, $this->module_info->skin); |
102
|
|
|
} |
103
|
|
|
$this->setTemplatePath($template_path); |
104
|
|
|
|
105
|
|
|
/** |
106
|
|
|
* use context::set to setup extra variables |
107
|
|
|
**/ |
108
|
|
|
$oDocumentModel = getModel('document'); |
109
|
|
|
$extra_keys = $oDocumentModel->getExtraKeys($this->module_info->module_srl); |
110
|
|
|
Context::set('extra_keys', $extra_keys); |
111
|
|
|
|
112
|
|
|
/** |
113
|
|
|
* add extra variables to order(sorting) target |
114
|
|
|
**/ |
115
|
|
|
if (is_array($extra_keys)) |
116
|
|
|
{ |
117
|
|
|
foreach($extra_keys as $val) |
118
|
|
|
{ |
119
|
|
|
$this->order_target[] = $val->eid; |
120
|
|
|
} |
121
|
|
|
} |
122
|
|
|
/** |
123
|
|
|
* load javascript, JS filters |
124
|
|
|
**/ |
125
|
|
|
Context::addJsFilter($this->module_path.'tpl/filter', 'input_password.xml'); |
126
|
|
|
Context::addJsFile($this->module_path.'tpl/js/board.js'); |
|
|
|
|
127
|
|
|
|
128
|
|
|
// remove [document_srl]_cpage from get_vars |
129
|
|
|
$args = Context::getRequestVars(); |
130
|
|
|
foreach($args as $name => $value) |
131
|
|
|
{ |
132
|
|
|
if(preg_match('/[0-9]+_cpage/', $name)) |
133
|
|
|
{ |
134
|
|
|
Context::set($name, '', TRUE); |
|
|
|
|
135
|
|
|
Context::set($name, $value); |
136
|
|
|
} |
137
|
|
|
} |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* @brief display board contents |
142
|
|
|
**/ |
143
|
|
|
function dispBoardContent() |
144
|
|
|
{ |
145
|
|
|
/** |
146
|
|
|
* check the access grant (all the grant has been set by the module object) |
147
|
|
|
**/ |
148
|
|
|
if(!$this->grant->access || !$this->grant->list) |
149
|
|
|
{ |
150
|
|
|
return $this->dispBoardMessage('msg_not_permitted'); |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
/** |
154
|
|
|
* display the category list, and then setup the category list on context |
155
|
|
|
**/ |
156
|
|
|
$this->dispBoardCategoryList(); |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* display the search options on the screen |
160
|
|
|
* add extra vaiables to the search options |
161
|
|
|
**/ |
162
|
|
|
// use search options on the template (the search options key has been declared, based on the language selected) |
163
|
|
|
foreach($this->search_option as $opt) $search_option[$opt] = Context::getLang($opt); |
|
|
|
|
164
|
|
|
$extra_keys = Context::get('extra_keys'); |
165
|
|
|
if($extra_keys) |
166
|
|
|
{ |
167
|
|
|
foreach($extra_keys as $key => $val) |
|
|
|
|
168
|
|
|
{ |
169
|
|
|
if($val->search == 'Y') $search_option['extra_vars'.$val->idx] = $val->name; |
|
|
|
|
170
|
|
|
} |
171
|
|
|
} |
172
|
|
|
// remove a search option that is not public in member config |
173
|
|
|
$memberConfig = getModel('module')->getModuleConfig('member'); |
|
|
|
|
174
|
|
|
foreach($memberConfig->signupForm as $signupFormElement) |
175
|
|
|
{ |
176
|
|
|
if(in_array($signupFormElement->title, $search_option)) |
177
|
|
|
{ |
178
|
|
|
if($signupFormElement->isPublic == 'N') |
179
|
|
|
unset($search_option[$signupFormElement->name]); |
180
|
|
|
} |
181
|
|
|
} |
182
|
|
|
Context::set('search_option', $search_option); |
|
|
|
|
183
|
|
|
|
184
|
|
|
$oDocumentModel = getModel('document'); |
185
|
|
|
$statusNameList = $this->_getStatusNameList($oDocumentModel); |
186
|
|
|
if(count($statusNameList) > 0) |
187
|
|
|
{ |
188
|
|
|
Context::set('status_list', $statusNameList); |
|
|
|
|
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
// display the board content |
192
|
|
|
$this->dispBoardContentView(); |
193
|
|
|
|
194
|
|
|
// list config, columnList setting |
195
|
|
|
$oBoardModel = getModel('board'); |
196
|
|
|
$this->listConfig = $oBoardModel->getListConfig($this->module_info->module_srl); |
197
|
|
|
if(!$this->listConfig) $this->listConfig = array(); |
198
|
|
|
$this->_makeListColumnList(); |
199
|
|
|
|
200
|
|
|
// display the notice list |
201
|
|
|
$this->dispBoardNoticeList(); |
202
|
|
|
|
203
|
|
|
// list |
204
|
|
|
$this->dispBoardContentList(); |
205
|
|
|
|
206
|
|
|
/** |
207
|
|
|
* add javascript filters |
208
|
|
|
**/ |
209
|
|
|
Context::addJsFilter($this->module_path.'tpl/filter', 'search.xml'); |
210
|
|
|
|
211
|
|
|
$oSecurity = new Security(); |
212
|
|
|
$oSecurity->encodeHTML('search_option.'); |
213
|
|
|
|
214
|
|
|
// setup the tmeplate file |
215
|
|
|
$this->setTemplateFile('list'); |
216
|
|
|
} |
217
|
|
|
|
218
|
|
|
/** |
219
|
|
|
* @brief display the category list |
220
|
|
|
**/ |
221
|
|
|
function dispBoardCategoryList(){ |
222
|
|
|
// check if the use_category option is enabled |
223
|
|
|
if($this->module_info->use_category=='Y') |
224
|
|
|
{ |
225
|
|
|
// check the grant |
226
|
|
|
if(!$this->grant->list) |
227
|
|
|
{ |
228
|
|
|
Context::set('category_list', array()); |
|
|
|
|
229
|
|
|
return; |
230
|
|
|
} |
231
|
|
|
|
232
|
|
|
$oDocumentModel = getModel('document'); |
233
|
|
|
Context::set('category_list', $oDocumentModel->getCategoryList($this->module_srl)); |
234
|
|
|
|
235
|
|
|
$oSecurity = new Security(); |
236
|
|
|
$oSecurity->encodeHTML('category_list.', 'category_list.childs.'); |
237
|
|
|
} |
238
|
|
|
} |
239
|
|
|
|
240
|
|
|
/** |
241
|
|
|
* @brief display the board conent view |
242
|
|
|
**/ |
243
|
|
|
function dispBoardContentView(){ |
244
|
|
|
// get the variable value |
245
|
|
|
$document_srl = Context::get('document_srl'); |
246
|
|
|
$page = Context::get('page'); |
|
|
|
|
247
|
|
|
|
248
|
|
|
// generate document model object |
249
|
|
|
$oDocumentModel = getModel('document'); |
250
|
|
|
|
251
|
|
|
/** |
252
|
|
|
* if the document exists, then get the document information |
253
|
|
|
**/ |
254
|
|
|
if($document_srl) |
255
|
|
|
{ |
256
|
|
|
$oDocument = $oDocumentModel->getDocument($document_srl, false, true); |
257
|
|
|
|
258
|
|
|
// if the document is existed |
259
|
|
|
if($oDocument->isExists()) |
260
|
|
|
{ |
261
|
|
|
// if the module srl is not consistent |
262
|
|
|
if($oDocument->get('module_srl')!=$this->module_info->module_srl ) |
263
|
|
|
{ |
264
|
|
|
return $this->stop('msg_invalid_request'); |
265
|
|
|
} |
266
|
|
|
|
267
|
|
|
// check the manage grant |
268
|
|
|
if($this->grant->manager) $oDocument->setGrant(); |
269
|
|
|
|
270
|
|
|
// if the consultation function is enabled, and the document is not a notice |
271
|
|
|
if($this->consultation && !$oDocument->isNotice()) |
272
|
|
|
{ |
273
|
|
|
$logged_info = Context::get('logged_info'); |
274
|
|
|
if($oDocument->get('member_srl')!=$logged_info->member_srl) |
275
|
|
|
{ |
276
|
|
|
$oDocument = $oDocumentModel->getDocument(0); |
277
|
|
|
} |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
// if the document is TEMP saved, check Grant |
281
|
|
|
if($oDocument->getStatus() == 'TEMP') |
282
|
|
|
{ |
283
|
|
|
if(!$oDocument->isGranted()) |
284
|
|
|
{ |
285
|
|
|
$oDocument = $oDocumentModel->getDocument(0); |
286
|
|
|
} |
287
|
|
|
} |
288
|
|
|
|
289
|
|
|
} |
290
|
|
|
else |
291
|
|
|
{ |
292
|
|
|
// if the document is not existed, then alert a warning message |
293
|
|
|
Context::set('document_srl','',true); |
|
|
|
|
294
|
|
|
$this->alertMessage('msg_not_founded'); |
295
|
|
|
} |
296
|
|
|
|
297
|
|
|
/** |
298
|
|
|
* if the document is not existed, get an empty document |
299
|
|
|
**/ |
300
|
|
|
} |
301
|
|
|
else |
302
|
|
|
{ |
303
|
|
|
$oDocument = $oDocumentModel->getDocument(0); |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
*check the document view grant |
308
|
|
|
**/ |
309
|
|
|
if($oDocument->isExists()) |
310
|
|
|
{ |
311
|
|
|
if(!$this->grant->view && !$oDocument->isGranted()) |
312
|
|
|
{ |
313
|
|
|
$oDocument = $oDocumentModel->getDocument(0); |
314
|
|
|
Context::set('document_srl','',true); |
|
|
|
|
315
|
|
|
$this->alertMessage('msg_not_permitted'); |
316
|
|
|
} |
317
|
|
|
else |
318
|
|
|
{ |
319
|
|
|
// add the document title to the browser |
320
|
|
|
Context::addBrowserTitle($oDocument->getTitleText()); |
321
|
|
|
|
322
|
|
|
// update the document view count (if the document is not secret) |
323
|
|
|
if(!$oDocument->isSecret() || $oDocument->isGranted()) |
324
|
|
|
{ |
325
|
|
|
$oDocument->updateReadedCount(); |
326
|
|
|
} |
327
|
|
|
|
328
|
|
|
// disappear the document if it is secret |
329
|
|
|
if($oDocument->isSecret() && !$oDocument->isGranted()) |
330
|
|
|
{ |
331
|
|
|
$oDocument->add('content',Context::getLang('thisissecret')); |
332
|
|
|
} |
333
|
|
|
} |
334
|
|
|
} |
335
|
|
|
|
336
|
|
|
// setup the document oject on context |
337
|
|
|
$oDocument->add('module_srl', $this->module_srl); |
338
|
|
|
Context::set('oDocument', $oDocument); |
339
|
|
|
|
340
|
|
|
/** |
341
|
|
|
* add javascript filters |
342
|
|
|
**/ |
343
|
|
|
Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml'); |
344
|
|
|
|
345
|
|
|
// return new Object(); |
346
|
|
|
} |
347
|
|
|
|
348
|
|
|
/** |
349
|
|
|
* @brief display the document file list (can be used by API) |
350
|
|
|
**/ |
351
|
|
|
function dispBoardContentFileList(){ |
352
|
|
|
/** |
353
|
|
|
* check the access grant (all the grant has been set by the module object) |
354
|
|
|
**/ |
355
|
|
|
if(!$this->grant->access) |
356
|
|
|
{ |
357
|
|
|
return $this->dispBoardMessage('msg_not_permitted'); |
358
|
|
|
} |
359
|
|
|
|
360
|
|
|
// check document view grant |
361
|
|
|
$this->dispBoardContentView(); |
362
|
|
|
|
363
|
|
|
// Check if a permission for file download is granted |
364
|
|
|
// Get configurations (using module model object) |
365
|
|
|
$oModuleModel = getModel('module'); |
366
|
|
|
$file_module_config = $oModuleModel->getModulePartConfig('file',$this->module_srl); |
367
|
|
|
|
368
|
|
|
$downloadGrantCount = 0; |
369
|
|
|
if(is_array($file_module_config->download_grant)) |
370
|
|
|
{ |
371
|
|
|
foreach($file_module_config->download_grant AS $value) |
372
|
|
|
if($value) $downloadGrantCount++; |
373
|
|
|
} |
374
|
|
|
|
375
|
|
View Code Duplication |
if(is_array($file_module_config->download_grant) && $downloadGrantCount>0) |
376
|
|
|
{ |
377
|
|
|
if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); |
378
|
|
|
$logged_info = Context::get('logged_info'); |
379
|
|
|
if($logged_info->is_admin != 'Y') |
380
|
|
|
{ |
381
|
|
|
$oModuleModel =& getModel('module'); |
382
|
|
|
$columnList = array('module_srl', 'site_srl'); |
383
|
|
|
$module_info = $oModuleModel->getModuleInfoByModuleSrl($this->module_srl, $columnList); |
384
|
|
|
|
385
|
|
|
if(!$oModuleModel->isSiteAdmin($logged_info, $module_info->site_srl)) |
386
|
|
|
{ |
387
|
|
|
$oMemberModel =& getModel('member'); |
388
|
|
|
$member_groups = $oMemberModel->getMemberGroups($logged_info->member_srl, $module_info->site_srl); |
389
|
|
|
|
390
|
|
|
$is_permitted = false; |
391
|
|
|
for($i=0;$i<count($file_module_config->download_grant);$i++) |
|
|
|
|
392
|
|
|
{ |
393
|
|
|
$group_srl = $file_module_config->download_grant[$i]; |
394
|
|
|
if($member_groups[$group_srl]) |
395
|
|
|
{ |
396
|
|
|
$is_permitted = true; |
397
|
|
|
break; |
398
|
|
|
} |
399
|
|
|
} |
400
|
|
|
if(!$is_permitted) return $this->stop('msg_not_permitted_download'); |
401
|
|
|
} |
402
|
|
|
} |
403
|
|
|
} |
404
|
|
|
|
405
|
|
|
$oDocumentModel = getModel('document'); |
406
|
|
|
$document_srl = Context::get('document_srl'); |
407
|
|
|
$oDocument = $oDocumentModel->getDocument($document_srl); |
408
|
|
|
Context::set('file_list',$oDocument->getUploadedFiles()); |
409
|
|
|
|
410
|
|
|
$oSecurity = new Security(); |
411
|
|
|
$oSecurity->encodeHTML('file_list..source_filename'); |
412
|
|
|
} |
413
|
|
|
|
414
|
|
|
/** |
415
|
|
|
* @brief display the document comment list (can be used by API) |
416
|
|
|
**/ |
417
|
|
|
function dispBoardContentCommentList(){ |
418
|
|
|
// check document view grant |
419
|
|
|
$this->dispBoardContentView(); |
420
|
|
|
|
421
|
|
|
$oDocumentModel = getModel('document'); |
422
|
|
|
$document_srl = Context::get('document_srl'); |
423
|
|
|
$oDocument = $oDocumentModel->getDocument($document_srl); |
424
|
|
|
$comment_list = $oDocument->getComments(); |
425
|
|
|
|
426
|
|
|
// setup the comment list |
427
|
|
|
if(is_array($comment_list)) |
428
|
|
|
{ |
429
|
|
|
foreach($comment_list as $key => $val) |
430
|
|
|
{ |
431
|
|
|
if(!$val->isAccessible()) |
432
|
|
|
{ |
433
|
|
|
$val->add('content',Context::getLang('thisissecret')); |
434
|
|
|
} |
435
|
|
|
} |
436
|
|
|
} |
437
|
|
|
Context::set('comment_list',$comment_list); |
438
|
|
|
|
439
|
|
|
} |
440
|
|
|
|
441
|
|
|
/** |
442
|
|
|
* @brief display notice list (can be used by API) |
443
|
|
|
**/ |
444
|
|
|
function dispBoardNoticeList(){ |
445
|
|
|
// check the grant |
446
|
|
|
if(!$this->grant->list) |
447
|
|
|
{ |
448
|
|
|
Context::set('notice_list', array()); |
|
|
|
|
449
|
|
|
return; |
450
|
|
|
} |
451
|
|
|
|
452
|
|
|
$oDocumentModel = getModel('document'); |
453
|
|
|
$args = new stdClass(); |
454
|
|
|
$args->module_srl = $this->module_srl; |
455
|
|
|
$notice_output = $oDocumentModel->getNoticeList($args, $this->columnList); |
456
|
|
|
Context::set('notice_list', $notice_output->data); |
457
|
|
|
} |
458
|
|
|
|
459
|
|
|
/** |
460
|
|
|
* @brief display board content list |
461
|
|
|
**/ |
462
|
|
|
function dispBoardContentList(){ |
463
|
|
|
// check the grant |
464
|
|
|
if(!$this->grant->list) |
465
|
|
|
{ |
466
|
|
|
Context::set('document_list', array()); |
|
|
|
|
467
|
|
|
Context::set('total_count', 0); |
468
|
|
|
Context::set('total_page', 1); |
469
|
|
|
Context::set('page', 1); |
470
|
|
|
Context::set('page_navigation', new PageHandler(0,0,1,10)); |
|
|
|
|
471
|
|
|
return; |
472
|
|
|
} |
473
|
|
|
|
474
|
|
|
$oDocumentModel = getModel('document'); |
475
|
|
|
|
476
|
|
|
// setup module_srl/page number/ list number/ page count |
477
|
|
|
$args = new stdClass(); |
478
|
|
|
$args->module_srl = $this->module_srl; |
479
|
|
|
$args->page = Context::get('page'); |
480
|
|
|
$args->list_count = $this->list_count; |
481
|
|
|
$args->page_count = $this->page_count; |
482
|
|
|
|
483
|
|
|
// get the search target and keyword |
484
|
|
|
$args->search_target = Context::get('search_target'); |
485
|
|
|
$args->search_keyword = Context::get('search_keyword'); |
486
|
|
|
|
487
|
|
|
$search_option = Context::get('search_option'); |
488
|
|
|
if($search_option==FALSE) |
|
|
|
|
489
|
|
|
{ |
490
|
|
|
$search_option = $this->search_option; |
491
|
|
|
} |
492
|
|
|
if(isset($search_option[$args->search_target])==FALSE) |
|
|
|
|
493
|
|
|
{ |
494
|
|
|
$args->search_target = ''; |
495
|
|
|
} |
496
|
|
|
|
497
|
|
|
// if the category is enabled, then get the category |
498
|
|
|
if($this->module_info->use_category=='Y') |
499
|
|
|
{ |
500
|
|
|
$args->category_srl = Context::get('category'); |
501
|
|
|
} |
502
|
|
|
|
503
|
|
|
// setup the sort index and order index |
504
|
|
|
$args->sort_index = Context::get('sort_index'); |
505
|
|
|
$args->order_type = Context::get('order_type'); |
506
|
|
|
if(!in_array($args->sort_index, $this->order_target)) |
507
|
|
|
{ |
508
|
|
|
$args->sort_index = $this->module_info->order_target?$this->module_info->order_target:'list_order'; |
509
|
|
|
} |
510
|
|
|
if(!in_array($args->order_type, array('asc','desc'))) |
511
|
|
|
{ |
512
|
|
|
$args->order_type = $this->module_info->order_type?$this->module_info->order_type:'asc'; |
513
|
|
|
} |
514
|
|
|
|
515
|
|
|
// set the current page of documents |
516
|
|
|
$document_srl = Context::get('document_srl'); |
517
|
|
|
if(!$args->page && $document_srl) |
518
|
|
|
{ |
519
|
|
|
$oDocument = $oDocumentModel->getDocument($document_srl); |
520
|
|
|
if($oDocument->isExists() && !$oDocument->isNotice()) |
521
|
|
|
{ |
522
|
|
|
$page = $oDocumentModel->getDocumentPage($oDocument, $args); |
523
|
|
|
Context::set('page', $page); |
524
|
|
|
$args->page = $page; |
525
|
|
|
} |
526
|
|
|
} |
527
|
|
|
|
528
|
|
|
// setup the list count to be serach list count, if the category or search keyword has been set |
529
|
|
|
if($args->category_srl || $args->search_keyword) |
530
|
|
|
{ |
531
|
|
|
$args->list_count = $this->search_list_count; |
|
|
|
|
532
|
|
|
} |
533
|
|
|
|
534
|
|
|
// if the consultation function is enabled, the get the logged user information |
535
|
|
|
if($this->consultation) |
536
|
|
|
{ |
537
|
|
|
$logged_info = Context::get('logged_info'); |
538
|
|
|
$args->member_srl = $logged_info->member_srl; |
539
|
|
|
} |
540
|
|
|
|
541
|
|
|
// setup the list config variable on context |
542
|
|
|
Context::set('list_config', $this->listConfig); |
|
|
|
|
543
|
|
|
// setup document list variables on context |
544
|
|
|
$output = $oDocumentModel->getDocumentList($args, $this->except_notice, TRUE, $this->columnList); |
545
|
|
|
Context::set('document_list', $output->data); |
546
|
|
|
Context::set('total_count', $output->total_count); |
547
|
|
|
Context::set('total_page', $output->total_page); |
548
|
|
|
Context::set('page', $output->page); |
549
|
|
|
Context::set('page_navigation', $output->page_navigation); |
550
|
|
|
} |
551
|
|
|
|
552
|
|
|
function _makeListColumnList() |
553
|
|
|
{ |
554
|
|
|
$configColumList = array_keys($this->listConfig); |
555
|
|
|
$tableColumnList = array('document_srl', 'module_srl', 'category_srl', 'lang_code', 'is_notice', |
556
|
|
|
'title', 'title_bold', 'title_color', 'content', 'readed_count', 'voted_count', |
557
|
|
|
'blamed_count', 'comment_count', 'trackback_count', 'uploaded_count', 'password', 'user_id', |
558
|
|
|
'user_name', 'nick_name', 'member_srl', 'email_address', 'homepage', 'tags', 'extra_vars', |
559
|
|
|
'regdate', 'last_update', 'last_updater', 'ipaddress', 'list_order', 'update_order', |
560
|
|
|
'allow_trackback', 'notify_message', 'status', 'comment_status'); |
561
|
|
|
$this->columnList = array_intersect($configColumList, $tableColumnList); |
562
|
|
|
|
563
|
|
|
if(in_array('summary', $configColumList)) array_push($this->columnList, 'content'); |
564
|
|
|
|
565
|
|
|
// default column list add |
566
|
|
|
$defaultColumn = array('document_srl', 'module_srl', 'category_srl', 'lang_code', 'member_srl', 'last_update', 'comment_count', 'trackback_count', 'uploaded_count', 'status', 'regdate', 'title_bold', 'title_color'); |
567
|
|
|
|
568
|
|
|
//TODO guestbook, blog style supports legacy codes. |
569
|
|
|
if($this->module_info->skin == 'xe_guestbook' || $this->module_info->default_style == 'blog') |
570
|
|
|
{ |
571
|
|
|
$defaultColumn = $tableColumnList; |
572
|
|
|
} |
573
|
|
|
|
574
|
|
|
if (in_array('last_post', $configColumList)){ |
575
|
|
|
array_push($this->columnList, 'last_updater'); |
576
|
|
|
} |
577
|
|
|
|
578
|
|
|
// add is_notice |
579
|
|
|
if ($this->except_notice) |
580
|
|
|
{ |
581
|
|
|
array_push($this->columnList, 'is_notice'); |
582
|
|
|
} |
583
|
|
|
$this->columnList = array_unique(array_merge($this->columnList, $defaultColumn)); |
584
|
|
|
|
585
|
|
|
// add table name |
586
|
|
|
foreach($this->columnList as $no => $value) |
587
|
|
|
{ |
588
|
|
|
$this->columnList[$no] = 'documents.' . $value; |
589
|
|
|
} |
590
|
|
|
} |
591
|
|
|
|
592
|
|
|
/** |
593
|
|
|
* @brief display tag list |
594
|
|
|
**/ |
595
|
|
|
function dispBoardTagList() |
596
|
|
|
{ |
597
|
|
|
// check if there is not grant fot view list, then alert an warning message |
598
|
|
|
if(!$this->grant->list) |
599
|
|
|
{ |
600
|
|
|
return $this->dispBoardMessage('msg_not_permitted'); |
601
|
|
|
} |
602
|
|
|
|
603
|
|
|
// generate the tag module model object |
604
|
|
|
$oTagModel = getModel('tag'); |
605
|
|
|
|
606
|
|
|
$obj = new stdClass; |
607
|
|
|
$obj->mid = $this->module_info->mid; |
608
|
|
|
$obj->list_count = 10000; |
609
|
|
|
$output = $oTagModel->getTagList($obj); |
610
|
|
|
|
611
|
|
|
// automatically order |
612
|
|
|
if(count($output->data)) |
613
|
|
|
{ |
614
|
|
|
$numbers = array_keys($output->data); |
615
|
|
|
shuffle($numbers); |
616
|
|
|
|
617
|
|
|
if(count($output->data)) |
618
|
|
|
{ |
619
|
|
|
foreach($numbers as $k => $v) |
620
|
|
|
{ |
621
|
|
|
$tag_list[] = $output->data[$v]; |
|
|
|
|
622
|
|
|
} |
623
|
|
|
} |
624
|
|
|
} |
625
|
|
|
|
626
|
|
|
Context::set('tag_list', $tag_list); |
|
|
|
|
627
|
|
|
|
628
|
|
|
$oSecurity = new Security(); |
629
|
|
|
$oSecurity->encodeHTML('tag_list.'); |
630
|
|
|
|
631
|
|
|
$this->setTemplateFile('tag_list'); |
632
|
|
|
} |
633
|
|
|
|
634
|
|
|
/** |
635
|
|
|
* @brief display document write form |
636
|
|
|
**/ |
637
|
|
|
function dispBoardWrite() |
638
|
|
|
{ |
639
|
|
|
// check grant |
640
|
|
|
if(!$this->grant->write_document) |
641
|
|
|
{ |
642
|
|
|
return $this->dispBoardMessage('msg_not_permitted'); |
643
|
|
|
} |
644
|
|
|
|
645
|
|
|
$oDocumentModel = getModel('document'); |
646
|
|
|
|
647
|
|
|
/** |
648
|
|
|
* check if the category option is enabled not not |
649
|
|
|
**/ |
650
|
|
|
if($this->module_info->use_category=='Y') |
651
|
|
|
{ |
652
|
|
|
// get the user group information |
653
|
|
View Code Duplication |
if(Context::get('is_logged')) |
654
|
|
|
{ |
655
|
|
|
$logged_info = Context::get('logged_info'); |
656
|
|
|
$group_srls = array_keys($logged_info->group_list); |
657
|
|
|
} |
658
|
|
|
else |
659
|
|
|
{ |
660
|
|
|
$group_srls = array(); |
661
|
|
|
} |
662
|
|
|
$group_srls_count = count($group_srls); |
|
|
|
|
663
|
|
|
|
664
|
|
|
// check the grant after obtained the category list |
665
|
|
|
$normal_category_list = $oDocumentModel->getCategoryList($this->module_srl); |
666
|
|
|
if(count($normal_category_list)) |
667
|
|
|
{ |
668
|
|
|
foreach($normal_category_list as $category_srl => $category) |
669
|
|
|
{ |
670
|
|
|
$is_granted = TRUE; |
671
|
|
|
if($category->group_srls) |
672
|
|
|
{ |
673
|
|
|
$category_group_srls = explode(',',$category->group_srls); |
674
|
|
|
$is_granted = FALSE; |
675
|
|
|
if(count(array_intersect($group_srls, $category_group_srls))) $is_granted = TRUE; |
676
|
|
|
|
677
|
|
|
} |
678
|
|
|
if($is_granted) $category_list[$category_srl] = $category; |
|
|
|
|
679
|
|
|
} |
680
|
|
|
} |
681
|
|
|
Context::set('category_list', $category_list); |
|
|
|
|
682
|
|
|
} |
683
|
|
|
|
684
|
|
|
// GET parameter document_srl from request |
685
|
|
|
$document_srl = Context::get('document_srl'); |
686
|
|
|
$oDocument = $oDocumentModel->getDocument(0, $this->grant->manager); |
687
|
|
|
$oDocument->setDocument($document_srl); |
688
|
|
|
|
689
|
|
|
if($oDocument->get('module_srl') == $oDocument->get('member_srl')) $savedDoc = TRUE; |
690
|
|
|
$oDocument->add('module_srl', $this->module_srl); |
691
|
|
|
|
692
|
|
View Code Duplication |
if($oDocument->isExists() && $this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
693
|
|
|
{ |
694
|
|
|
return new Object(-1, 'msg_protect_content'); |
695
|
|
|
} |
696
|
|
|
|
697
|
|
|
// if the document is not granted, then back to the password input form |
698
|
|
|
$oModuleModel = getModel('module'); |
699
|
|
|
if($oDocument->isExists()&&!$oDocument->isGranted()) |
700
|
|
|
{ |
701
|
|
|
return $this->setTemplateFile('input_password_form'); |
702
|
|
|
} |
703
|
|
|
|
704
|
|
|
if(!$oDocument->isExists()) |
705
|
|
|
{ |
706
|
|
|
$point_config = $oModuleModel->getModulePartConfig('point',$this->module_srl); |
707
|
|
|
$logged_info = Context::get('logged_info'); |
708
|
|
|
$oPointModel = getModel('point'); |
709
|
|
|
$pointForInsert = $point_config["insert_document"]; |
710
|
|
|
if($pointForInsert < 0) |
711
|
|
|
{ |
712
|
|
|
if( !$logged_info ) |
713
|
|
|
{ |
714
|
|
|
return $this->dispBoardMessage('msg_not_permitted'); |
715
|
|
|
} |
716
|
|
|
else if (($oPointModel->getPoint($logged_info->member_srl) + $pointForInsert )< 0 ) |
717
|
|
|
{ |
718
|
|
|
return $this->dispBoardMessage('msg_not_enough_point'); |
719
|
|
|
} |
720
|
|
|
} |
721
|
|
|
} |
722
|
|
|
if(!$oDocument->get('status')) $oDocument->add('status', $oDocumentModel->getDefaultStatus()); |
723
|
|
|
|
724
|
|
|
$statusList = $this->_getStatusNameList($oDocumentModel); |
725
|
|
|
if(count($statusList) > 0) Context::set('status_list', $statusList); |
|
|
|
|
726
|
|
|
|
727
|
|
|
// get Document status config value |
728
|
|
|
Context::set('document_srl',$document_srl); |
729
|
|
|
Context::set('oDocument', $oDocument); |
730
|
|
|
|
731
|
|
|
// apply xml_js_filter on header |
732
|
|
|
$oDocumentController = getController('document'); |
733
|
|
|
$oDocumentController->addXmlJsFilter($this->module_info->module_srl); |
734
|
|
|
|
735
|
|
|
// if the document exists, then setup extra variabels on context |
736
|
|
|
if($oDocument->isExists() && !$savedDoc) Context::set('extra_keys', $oDocument->getExtraVars()); |
|
|
|
|
737
|
|
|
|
738
|
|
|
/** |
739
|
|
|
* add JS filters |
740
|
|
|
**/ |
741
|
|
|
if(Context::get('logged_info')->is_admin=='Y') Context::addJsFilter($this->module_path.'tpl/filter', 'insert_admin.xml'); |
742
|
|
|
else Context::addJsFilter($this->module_path.'tpl/filter', 'insert.xml'); |
743
|
|
|
|
744
|
|
|
$oSecurity = new Security(); |
745
|
|
|
$oSecurity->encodeHTML('category_list.text', 'category_list.title'); |
746
|
|
|
|
747
|
|
|
$this->setTemplateFile('write_form'); |
748
|
|
|
} |
749
|
|
|
|
750
|
|
|
function _getStatusNameList(&$oDocumentModel) |
751
|
|
|
{ |
752
|
|
|
$resultList = array(); |
753
|
|
|
if(!empty($this->module_info->use_status)) |
754
|
|
|
{ |
755
|
|
|
$statusNameList = $oDocumentModel->getStatusNameList(); |
756
|
|
|
$statusList = explode('|@|', $this->module_info->use_status); |
757
|
|
|
|
758
|
|
|
if(is_array($statusList)) |
759
|
|
|
{ |
760
|
|
|
foreach($statusList as $key => $value) |
761
|
|
|
{ |
762
|
|
|
$resultList[$value] = $statusNameList[$value]; |
763
|
|
|
} |
764
|
|
|
} |
765
|
|
|
} |
766
|
|
|
return $resultList; |
767
|
|
|
} |
768
|
|
|
|
769
|
|
|
/** |
770
|
|
|
* @brief display board module deletion form |
771
|
|
|
**/ |
772
|
|
|
function dispBoardDelete() |
773
|
|
|
{ |
774
|
|
|
// check grant |
775
|
|
|
if(!$this->grant->write_document) |
776
|
|
|
{ |
777
|
|
|
return $this->dispBoardMessage('msg_not_permitted'); |
778
|
|
|
} |
779
|
|
|
|
780
|
|
|
// get the document_srl from request |
781
|
|
|
$document_srl = Context::get('document_srl'); |
782
|
|
|
|
783
|
|
|
// if document exists, get the document information |
784
|
|
|
if($document_srl) |
785
|
|
|
{ |
786
|
|
|
$oDocumentModel = getModel('document'); |
787
|
|
|
$oDocument = $oDocumentModel->getDocument($document_srl); |
788
|
|
|
} |
789
|
|
|
|
790
|
|
|
// if the document is not existed, then back to the board content page |
791
|
|
|
if(!$oDocument || !$oDocument->isExists()) |
|
|
|
|
792
|
|
|
{ |
793
|
|
|
return $this->dispBoardContent(); |
794
|
|
|
} |
795
|
|
|
|
796
|
|
|
// if the document is not granted, then back to the password input form |
797
|
|
|
if(!$oDocument->isGranted()) |
798
|
|
|
{ |
799
|
|
|
return $this->setTemplateFile('input_password_form'); |
800
|
|
|
} |
801
|
|
|
|
802
|
|
View Code Duplication |
if($this->module_info->protect_content=="Y" && $oDocument->get('comment_count')>0 && $this->grant->manager==false) |
803
|
|
|
{ |
804
|
|
|
return $this->dispBoardMessage('msg_protect_content'); |
805
|
|
|
} |
806
|
|
|
|
807
|
|
|
Context::set('oDocument',$oDocument); |
808
|
|
|
|
809
|
|
|
/** |
810
|
|
|
* add JS filters |
811
|
|
|
**/ |
812
|
|
|
Context::addJsFilter($this->module_path.'tpl/filter', 'delete_document.xml'); |
813
|
|
|
|
814
|
|
|
$this->setTemplateFile('delete_form'); |
815
|
|
|
} |
816
|
|
|
|
817
|
|
|
/** |
818
|
|
|
* @brief display comment wirte form |
819
|
|
|
**/ |
820
|
|
|
function dispBoardWriteComment() |
821
|
|
|
{ |
822
|
|
|
$document_srl = Context::get('document_srl'); |
823
|
|
|
|
824
|
|
|
// check grant |
825
|
|
|
if(!$this->grant->write_comment) |
826
|
|
|
{ |
827
|
|
|
return $this->dispBoardMessage('msg_not_permitted'); |
828
|
|
|
} |
829
|
|
|
|
830
|
|
|
// get the document information |
831
|
|
|
$oDocumentModel = getModel('document'); |
832
|
|
|
$oDocument = $oDocumentModel->getDocument($document_srl); |
833
|
|
|
if(!$oDocument->isExists()) |
834
|
|
|
{ |
835
|
|
|
return $this->dispBoardMessage('msg_invalid_request'); |
836
|
|
|
} |
837
|
|
|
|
838
|
|
|
// Check allow comment |
839
|
|
|
if(!$oDocument->allowComment()) |
840
|
|
|
{ |
841
|
|
|
return $this->dispBoardMessage('msg_not_allow_comment'); |
842
|
|
|
} |
843
|
|
|
|
844
|
|
|
// obtain the comment (create an empty comment document for comment_form usage) |
845
|
|
|
$oCommentModel = getModel('comment'); |
846
|
|
|
$oSourceComment = $oComment = $oCommentModel->getComment(0); |
847
|
|
|
$oComment->add('document_srl', $document_srl); |
848
|
|
|
$oComment->add('module_srl', $this->module_srl); |
849
|
|
|
|
850
|
|
|
// setup document variables on context |
851
|
|
|
Context::set('oDocument',$oDocument); |
852
|
|
|
Context::set('oSourceComment',$oSourceComment); |
853
|
|
|
Context::set('oComment',$oComment); |
854
|
|
|
|
855
|
|
|
/** |
856
|
|
|
* add JS filter |
857
|
|
|
**/ |
858
|
|
|
Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml'); |
859
|
|
|
|
860
|
|
|
$this->setTemplateFile('comment_form'); |
861
|
|
|
} |
862
|
|
|
|
863
|
|
|
/** |
864
|
|
|
* @brief display comment replies page |
865
|
|
|
**/ |
866
|
|
|
function dispBoardReplyComment() |
867
|
|
|
{ |
868
|
|
|
// check grant |
869
|
|
|
if(!$this->grant->write_comment) |
870
|
|
|
{ |
871
|
|
|
return $this->dispBoardMessage('msg_not_permitted'); |
872
|
|
|
} |
873
|
|
|
|
874
|
|
|
// get the parent comment ID |
875
|
|
|
$parent_srl = Context::get('comment_srl'); |
876
|
|
|
|
877
|
|
|
// if the parent comment is not existed |
878
|
|
|
if(!$parent_srl) |
879
|
|
|
{ |
880
|
|
|
return new Object(-1, 'msg_invalid_request'); |
881
|
|
|
} |
882
|
|
|
|
883
|
|
|
// get the comment |
884
|
|
|
$oCommentModel = getModel('comment'); |
885
|
|
|
$oSourceComment = $oCommentModel->getComment($parent_srl, $this->grant->manager); |
886
|
|
|
|
887
|
|
|
// if the comment is not existed, opoup an error message |
888
|
|
|
if(!$oSourceComment->isExists()) |
889
|
|
|
{ |
890
|
|
|
return $this->dispBoardMessage('msg_invalid_request'); |
891
|
|
|
} |
892
|
|
|
if(Context::get('document_srl') && $oSourceComment->get('document_srl') != Context::get('document_srl')) |
893
|
|
|
{ |
894
|
|
|
return $this->dispBoardMessage('msg_invalid_request'); |
895
|
|
|
} |
896
|
|
|
|
897
|
|
|
// Check allow comment |
898
|
|
|
$oDocumentModel = getModel('document'); |
899
|
|
|
$oDocument = $oDocumentModel->getDocument($oSourceComment->get('document_srl')); |
900
|
|
|
if(!$oDocument->allowComment()) |
901
|
|
|
{ |
902
|
|
|
return $this->dispBoardMessage('msg_not_allow_comment'); |
903
|
|
|
} |
904
|
|
|
|
905
|
|
|
// get the comment information |
906
|
|
|
$oComment = $oCommentModel->getComment(); |
907
|
|
|
$oComment->add('parent_srl', $parent_srl); |
908
|
|
|
$oComment->add('document_srl', $oSourceComment->get('document_srl')); |
909
|
|
|
|
910
|
|
|
// setup comment variables |
911
|
|
|
Context::set('oSourceComment',$oSourceComment); |
912
|
|
|
Context::set('oComment',$oComment); |
913
|
|
|
Context::set('module_srl',$this->module_info->module_srl); |
914
|
|
|
|
915
|
|
|
/** |
916
|
|
|
* add JS filters |
917
|
|
|
**/ |
918
|
|
|
Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml'); |
919
|
|
|
|
920
|
|
|
$this->setTemplateFile('comment_form'); |
921
|
|
|
} |
922
|
|
|
|
923
|
|
|
/** |
924
|
|
|
* @brief display the comment modification from |
925
|
|
|
**/ |
926
|
|
|
function dispBoardModifyComment() |
927
|
|
|
{ |
928
|
|
|
// check grant |
929
|
|
|
if(!$this->grant->write_comment) |
930
|
|
|
{ |
931
|
|
|
return $this->dispBoardMessage('msg_not_permitted'); |
932
|
|
|
} |
933
|
|
|
|
934
|
|
|
// get the document_srl and comment_srl |
935
|
|
|
$document_srl = Context::get('document_srl'); |
|
|
|
|
936
|
|
|
$comment_srl = Context::get('comment_srl'); |
937
|
|
|
|
938
|
|
|
// if the comment is not existed |
939
|
|
|
if(!$comment_srl) |
940
|
|
|
{ |
941
|
|
|
return new Object(-1, 'msg_invalid_request'); |
942
|
|
|
} |
943
|
|
|
|
944
|
|
|
// get comment information |
945
|
|
|
$oCommentModel = getModel('comment'); |
946
|
|
|
$oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
947
|
|
|
|
948
|
|
|
// if the comment is not exited, alert an error message |
949
|
|
|
if(!$oComment->isExists()) |
950
|
|
|
{ |
951
|
|
|
return $this->dispBoardMessage('msg_invalid_request'); |
952
|
|
|
} |
953
|
|
|
|
954
|
|
|
// if the comment is not granted, then back to the password input form |
955
|
|
|
if(!$oComment->isGranted()) |
956
|
|
|
{ |
957
|
|
|
return $this->setTemplateFile('input_password_form'); |
958
|
|
|
} |
959
|
|
|
|
960
|
|
|
// setup the comment variables on context |
961
|
|
|
Context::set('oSourceComment', $oCommentModel->getComment()); |
962
|
|
|
Context::set('oComment', $oComment); |
963
|
|
|
|
964
|
|
|
/** |
965
|
|
|
* add JS fitlers |
966
|
|
|
**/ |
967
|
|
|
Context::addJsFilter($this->module_path.'tpl/filter', 'insert_comment.xml'); |
968
|
|
|
|
969
|
|
|
$this->setTemplateFile('comment_form'); |
970
|
|
|
} |
971
|
|
|
|
972
|
|
|
/** |
973
|
|
|
* @brief display the delete comment form |
974
|
|
|
**/ |
975
|
|
|
function dispBoardDeleteComment() |
976
|
|
|
{ |
977
|
|
|
// check grant |
978
|
|
|
if(!$this->grant->write_comment) |
979
|
|
|
{ |
980
|
|
|
return $this->dispBoardMessage('msg_not_permitted'); |
981
|
|
|
} |
982
|
|
|
|
983
|
|
|
// get the comment_srl to be deleted |
984
|
|
|
$comment_srl = Context::get('comment_srl'); |
985
|
|
|
|
986
|
|
|
// if the comment exists, then get the comment information |
987
|
|
|
if($comment_srl) |
988
|
|
|
{ |
989
|
|
|
$oCommentModel = getModel('comment'); |
990
|
|
|
$oComment = $oCommentModel->getComment($comment_srl, $this->grant->manager); |
991
|
|
|
} |
992
|
|
|
|
993
|
|
|
// if the comment is not existed, then back to the board content page |
994
|
|
|
if(!$oComment->isExists() ) |
|
|
|
|
995
|
|
|
{ |
996
|
|
|
return $this->dispBoardContent(); |
997
|
|
|
} |
998
|
|
|
|
999
|
|
|
// if the comment is not granted, then back to the password input form |
1000
|
|
|
if(!$oComment->isGranted()) |
1001
|
|
|
{ |
1002
|
|
|
return $this->setTemplateFile('input_password_form'); |
1003
|
|
|
} |
1004
|
|
|
|
1005
|
|
|
Context::set('oComment',$oComment); |
1006
|
|
|
|
1007
|
|
|
/** |
1008
|
|
|
* add JS filters |
1009
|
|
|
**/ |
1010
|
|
|
Context::addJsFilter($this->module_path.'tpl/filter', 'delete_comment.xml'); |
1011
|
|
|
|
1012
|
|
|
$this->setTemplateFile('delete_comment_form'); |
1013
|
|
|
} |
1014
|
|
|
|
1015
|
|
|
/** |
1016
|
|
|
* @brief display the delete trackback form |
1017
|
|
|
**/ |
1018
|
|
|
function dispBoardDeleteTrackback() |
1019
|
|
|
{ |
1020
|
|
|
$oTrackbackModel = getModel('trackback'); |
1021
|
|
|
|
1022
|
|
|
if(!$oTrackbackModel) |
1023
|
|
|
{ |
1024
|
|
|
return; |
1025
|
|
|
} |
1026
|
|
|
|
1027
|
|
|
// get the trackback_srl |
1028
|
|
|
$trackback_srl = Context::get('trackback_srl'); |
1029
|
|
|
|
1030
|
|
|
// get the trackback data |
1031
|
|
|
$columnList = array('trackback_srl'); |
1032
|
|
|
$output = $oTrackbackModel->getTrackback($trackback_srl, $columnList); |
|
|
|
|
1033
|
|
|
$trackback = $output->data; |
1034
|
|
|
|
1035
|
|
|
// if no trackback, then display the board content |
1036
|
|
|
if(!$trackback) |
1037
|
|
|
{ |
1038
|
|
|
return $this->dispBoardContent(); |
1039
|
|
|
} |
1040
|
|
|
|
1041
|
|
|
//Context::set('trackback',$trackback); //perhaps trackback variables not use in UI |
1042
|
|
|
|
1043
|
|
|
/** |
1044
|
|
|
* add JS filters |
1045
|
|
|
**/ |
1046
|
|
|
Context::addJsFilter($this->module_path.'tpl/filter', 'delete_trackback.xml'); |
1047
|
|
|
|
1048
|
|
|
$this->setTemplateFile('delete_trackback_form'); |
1049
|
|
|
} |
1050
|
|
|
|
1051
|
|
|
/** |
1052
|
|
|
* @brief display board message |
1053
|
|
|
**/ |
1054
|
|
|
function dispBoardMessage($msg_code) |
1055
|
|
|
{ |
1056
|
|
|
$msg = Context::getLang($msg_code); |
1057
|
|
|
if(!$msg) $msg = $msg_code; |
1058
|
|
|
Context::set('message', $msg); |
1059
|
|
|
$this->setTemplateFile('message'); |
1060
|
|
|
} |
1061
|
|
|
|
1062
|
|
|
/** |
1063
|
|
|
* @brief the method for displaying the warning messages |
1064
|
|
|
* display an error message if it has not a special design |
1065
|
|
|
**/ |
1066
|
|
|
function alertMessage($message) |
1067
|
|
|
{ |
1068
|
|
|
$script = sprintf('<script> jQuery(function(){ alert("%s"); } );</script>', Context::getLang($message)); |
1069
|
|
|
Context::addHtmlFooter( $script ); |
1070
|
|
|
} |
1071
|
|
|
|
1072
|
|
|
} |
1073
|
|
|
|
An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.
If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.