This repository was archived by the owner on Jul 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathwiki.admin.controller.php
More file actions
144 lines (130 loc) · 3.56 KB
/
wiki.admin.controller.php
File metadata and controls
144 lines (130 loc) · 3.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
/**
* @class wikiAdminController
* @developer NHN ([email protected])
* @brief wiki admin controller class
*/
class WikiAdminController extends Wiki
{
/**
* @brief Add a wiki module
* @developer NHN ([email protected])
* @access public
* @param $args
* @return
*/
function procWikiAdminInsertWiki($args = NULL)
{
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
$args = Context::getRequestVars();
$args->module = 'wiki';
if($args->use_comment != 'N')
{
$args->use_comment = 'Y';
}
if($args->use_comment_validation != 'N')
{
$args->use_comment_validation = 'Y';
}
if(is_array($args->use_status))
{
$args->use_status = implode('|@|', $args->use_status);
}
if($args->module_srl)
{
$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl);
if($module_info->module_srl != $args->module_srl)
{
unset($args->module_srl);
}
}
if(!$args->module_srl)
{
$output = $oModuleController->insertModule($args);
$msg_code = 'success_registed';
if($output->toBool())
{
// If insert was succesful, enable document history
$document_config->use_history = 'Y';
$oModuleController = &getController('module');
$oModuleController->insertModulePartConfig('document', $output->get('module_srl'), $document_config);
}
}
else
{
$output = $oModuleController->updateModule($args);
$msg_code = 'success_updated';
}
if(!$output->toBool())
{
return $output;
}
$this->add('page', Context::get('page'));
$this->add('module_srl', $output->get('module_srl'));
$this->setMessage($msg_code);
$returnUrl = Context::get('success_return_url');
$this->setRedirectUrl($returnUrl);
}
/**
* @brief Deleting a wiki module
* @developer NHN ([email protected])
* @access public
* @return
*/
function procWikiAdminDeleteWiki()
{
$module_srl = Context::get('module_srl');
$oModuleController = &getController('module');
$output = $oModuleController->deleteModule($module_srl);
if(!$output->toBool())
{
return $output;
}
$this->add('module', 'wiki');
$this->add('page', Context::get('page'));
$this->setMessage('success_deleted');
$returnUrl = Context::get('success_return_url');
$this->setRedirectUrl($returnUrl);
}
/**
* @brief Adds alias to documents which are missing it
* @developer NHN ([email protected])
* @access public
* @return
*/
function procWikiAdminArrangeList()
{
$oModuleModel = &getModel('module');
$oDocumentController = &getController('document');
// Verification target Wiki
$module_srl = Context::get('module_srl');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$module_info->module_srl || $module_info->module != 'wiki')
{
return new Object(-1, 'msg_invalid_request');
}
// Wiki article of the target entry has no value extraction
$args->module_srl = $module_srl;
$output = executeQueryArray('wiki.getDocumentWithoutAlias', $args);
if(!$output->toBool() || !$output->data)
{
return new Object();
}
foreach($output->data as $key => $val)
{
if($val->alias_srl)
{
continue;
}
$val->alias_title = wiki::beautifyEntryName($val->alias_title);
$result = $oDocumentController->insertAlias($module_srl, $val->document_srl, $val->alias_title);
if(!$result->toBool())
{
$oDocumentController->insertAlias($module_srl, $val->document_srl, $val->alias_title . '_' . $val->document_srl);
}
}
}
}
/* End of file wiki.admin.controller.php */
/* Location: wiki.admin.controller.php */