1
|
|
|
<?php |
2
|
|
|
/* Copyright (C) NAVER <http://www.navercorp.com> */ |
3
|
|
|
/** |
4
|
|
|
* @class editorAdminView |
5
|
|
|
* @author NAVER ([email protected]) |
6
|
|
|
* @brief editor admin view of the module class |
7
|
|
|
*/ |
8
|
|
|
class editorAdminView extends editor |
9
|
|
|
{ |
10
|
|
|
/** |
11
|
|
|
* @brief Initialization |
12
|
|
|
*/ |
13
|
|
|
function init() |
14
|
|
|
{ |
15
|
|
|
} |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @brief Administrator Setting page |
19
|
|
|
* Settings to enable/disable editor component and other features |
20
|
|
|
*/ |
21
|
|
|
function dispEditorAdminIndex() |
22
|
|
|
{ |
23
|
|
|
$component_count = 0; |
24
|
|
|
$site_module_info = Context::get('site_module_info'); |
25
|
|
|
$site_srl = (int)$site_module_info->site_srl; |
26
|
|
|
|
27
|
|
|
// Get a type of component |
28
|
|
|
$oEditorModel = getModel('editor'); |
29
|
|
|
$oModuleModel = getModel('module'); |
30
|
|
|
$editor_config = $oModuleModel->getModuleConfig('editor'); |
31
|
|
|
|
32
|
|
|
if(!$editor_config) |
33
|
|
|
{ |
34
|
|
|
$editor_config = new stdClass(); |
35
|
|
|
} |
36
|
|
|
|
37
|
|
|
//editor_config init |
38
|
|
|
if(!$editor_config->editor_height) $editor_config->editor_height = 300; |
39
|
|
|
if(!$editor_config->comment_editor_height) $editor_config->comment_editor_height = 100; |
40
|
|
|
if(!$editor_config->editor_skin) $editor_config->editor_skin = 'ckeditor'; |
41
|
|
|
if(!$editor_config->comment_editor_skin) $editor_config->comment_editor_skin = 'ckeditor'; |
42
|
|
|
if(!$editor_config->sel_editor_colorset) $editor_config->sel_editor_colorset= 'moono'; |
43
|
|
|
if(!$editor_config->sel_comment_editor_colorset) $editor_config->sel_comment_editor_colorset= 'moono'; |
44
|
|
|
|
45
|
|
|
$component_list = $oEditorModel->getComponentList(false, $site_srl, true); |
46
|
|
|
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins'); |
47
|
|
|
|
48
|
|
|
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin); |
|
|
|
|
49
|
|
|
|
50
|
|
|
$contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles'); |
51
|
|
|
$content_style_list = array(); |
52
|
|
View Code Duplication |
for($i=0,$c=count($contents);$i<$c;$i++) |
53
|
|
|
{ |
54
|
|
|
$style = $contents[$i]; |
55
|
|
|
$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles'); |
|
|
|
|
56
|
|
|
$content_style_list[$style] = new stdClass(); |
57
|
|
|
$content_style_list[$style]->title = $info->title; |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
// Get install info, update info, count |
61
|
|
|
$oAutoinstallModel = getModel('autoinstall'); |
62
|
|
|
foreach($component_list as $component_name => $xml_info) |
63
|
|
|
{ |
64
|
|
|
$component_count++; |
65
|
|
|
$xml_info->path = './modules/editor/components/'.$xml_info->component_name; |
66
|
|
|
$xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path); |
67
|
|
|
$xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path); |
68
|
|
|
if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0; |
|
|
|
|
69
|
|
|
} |
70
|
|
|
|
71
|
|
|
if(is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages)); |
|
|
|
|
72
|
|
|
|
73
|
|
|
foreach($component_list as $component_name => $xml_info) |
74
|
|
|
{ |
75
|
|
|
if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update; |
|
|
|
|
76
|
|
|
} |
77
|
|
|
$editor_config_default = array( "editor_height" => "300", "comment_editor_height" => "100","content_font_size"=>"13"); |
78
|
|
|
|
79
|
|
|
//editor preview |
80
|
|
|
$config = $oEditorModel->getEditorConfig(); |
81
|
|
|
|
82
|
|
|
$option = new stdClass(); |
83
|
|
|
$option->allow_fileupload = false; |
84
|
|
|
$option->content_style = $config->content_style; |
85
|
|
|
$option->content_font = $config->content_font; |
86
|
|
|
$option->content_font_size = $config->content_font_size; |
87
|
|
|
$option->enable_autosave = false; |
88
|
|
|
$option->enable_default_component = true; |
89
|
|
|
$option->enable_component = true; |
90
|
|
|
$option->disable_html = false; |
91
|
|
|
$option->height = $config->editor_height; |
92
|
|
|
$option->skin = $config->editor_skin; |
93
|
|
|
$option->content_key_name = 'dummy_content'; |
94
|
|
|
$option->primary_key_name = 'dummy_key'; |
95
|
|
|
$option->colorset = $config->sel_editor_colorset; |
96
|
|
|
$editor = $oEditorModel->getEditor(0, $option); |
97
|
|
|
|
98
|
|
|
Context::set('preview_editor', $editor); |
99
|
|
|
|
100
|
|
|
$option_com = new stdClass(); |
101
|
|
|
$option_com->allow_fileupload = false; |
102
|
|
|
$option_com->content_style = $config->content_style; |
103
|
|
|
$option_com->content_font = $config->content_font; |
104
|
|
|
$option_com->content_font_size = $config->content_font_size; |
105
|
|
|
$option_com->enable_autosave = false; |
106
|
|
|
$option_com->enable_default_component = true; |
107
|
|
|
$option_com->enable_component = true; |
108
|
|
|
$option_com->disable_html = false; |
109
|
|
|
$option_com->height = $config->comment_editor_height; |
110
|
|
|
$option_com->skin = $config->comment_editor_skin; |
111
|
|
|
$option_com->content_key_name = 'dummy_content2'; |
112
|
|
|
$option_com->primary_key_name = 'dummy_key2'; |
113
|
|
|
$option_com->content_style = $config->comment_content_style; |
114
|
|
|
$option_com->colorset = $config->sel_comment_editor_colorset; |
115
|
|
|
|
116
|
|
|
$editor_comment = $oEditorModel->getEditor(0, $option_com); |
117
|
|
|
|
118
|
|
|
Context::set('preview_editor_comment', $editor_comment); |
119
|
|
|
|
120
|
|
|
Context::set('editor_config', $editor_config); |
121
|
|
|
Context::set('editor_skin_list', $editor_skin_list); |
|
|
|
|
122
|
|
|
Context::set('editor_colorset_list', $skin_info->colorset); |
123
|
|
|
Context::set('content_style_list', $content_style_list); |
|
|
|
|
124
|
|
|
Context::set('component_list', $component_list); |
125
|
|
|
Context::set('component_count', $component_count); |
126
|
|
|
Context::set('editor_config_default', $editor_config_default); |
|
|
|
|
127
|
|
|
|
128
|
|
|
$security = new Security(); |
129
|
|
|
$security->encodeHTML('component_list....'); |
130
|
|
|
|
131
|
|
|
$this->setTemplatePath($this->module_path.'tpl'); |
|
|
|
|
132
|
|
|
$this->setTemplateFile('admin_index'); |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
/** |
136
|
|
|
* @brief Component setup |
137
|
|
|
*/ |
138
|
|
|
function dispEditorAdminSetupComponent() |
139
|
|
|
{ |
140
|
|
|
$site_module_info = Context::get('site_module_info'); |
141
|
|
|
$site_srl = (int)$site_module_info->site_srl; |
142
|
|
|
|
143
|
|
|
$component_name = Context::get('component_name'); |
144
|
|
|
// Get information of the editor component |
145
|
|
|
$oEditorModel = getModel('editor'); |
146
|
|
|
$component = $oEditorModel->getComponent($component_name,$site_srl); |
147
|
|
|
Context::set('component', $component); |
148
|
|
|
// Get a group list to set a group |
149
|
|
|
$oMemberModel = getModel('member'); |
150
|
|
|
$group_list = $oMemberModel->getGroups($site_srl); |
151
|
|
|
Context::set('group_list', $group_list); |
152
|
|
|
// Get a mid list |
153
|
|
|
$oModuleModel = getModel('module'); |
154
|
|
|
|
155
|
|
|
$args =new stdClass(); |
156
|
|
|
$args->site_srl = $site_srl; |
157
|
|
|
$columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title'); |
158
|
|
|
$mid_list = $oModuleModel->getMidList($args, $columnList); |
159
|
|
|
// Combination of module_category and module |
160
|
|
View Code Duplication |
if(!$args->site_srl) |
161
|
|
|
{ |
162
|
|
|
// Get a list of module category |
163
|
|
|
$module_categories = $oModuleModel->getModuleCategories(); |
164
|
|
|
|
165
|
|
|
if(!is_array($mid_list)) $mid_list = array($mid_list); |
166
|
|
|
foreach($mid_list as $module_srl => $module) |
167
|
|
|
{ |
168
|
|
|
if($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module; |
169
|
|
|
} |
170
|
|
|
} |
171
|
|
|
else |
172
|
|
|
{ |
173
|
|
|
$module_categories[0]->list = $mid_list; |
|
|
|
|
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
Context::set('mid_list',$module_categories); |
|
|
|
|
177
|
|
|
|
178
|
|
|
//Security |
179
|
|
|
$security = new Security(); |
180
|
|
|
$security->encodeHTML('group_list..title'); |
181
|
|
|
$security->encodeHTML('component...'); |
182
|
|
|
$security->encodeHTML('mid_list..title','mid_list..list..browser_title'); |
183
|
|
|
|
184
|
|
|
$this->setTemplatePath($this->module_path.'tpl'); |
|
|
|
|
185
|
|
|
$this->setTemplateFile('setup_component'); |
186
|
|
|
} |
187
|
|
|
} |
188
|
|
|
/* End of file editor.admin.view.php */ |
189
|
|
|
/* Location: ./modules/editor/editor.admin.view.php */ |
190
|
|
|
|
This check looks for access to properties that are not accessible from the current context.
If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.