XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
editor.admin.view.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
8 class editorAdminView extends editor
9 {
13  function init()
14  {
15  }
16 
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  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 
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 
148  if(!$component->component_name) {
149  $this->stop('msg_invalid_request');
150  return;
151  }
152 
153  Context::set('component', $component);
154  // Get a group list to set a group
155  $oMemberModel = getModel('member');
156  $group_list = $oMemberModel->getGroups($site_srl);
157  Context::set('group_list', $group_list);
158  // Get a mid list
159  $oModuleModel = getModel('module');
160 
161  $args =new stdClass();
162  $args->site_srl = $site_srl;
163  $columnList = array('module_srl', 'mid', 'module_category_srl', 'browser_title');
164  $mid_list = $oModuleModel->getMidList($args, $columnList);
165  // Combination of module_category and module
166  if(!$args->site_srl)
167  {
168  // Get a list of module category
169  $module_categories = $oModuleModel->getModuleCategories();
170 
171  if(!is_array($mid_list)) $mid_list = array($mid_list);
172  foreach($mid_list as $module_srl => $module)
173  {
174  if($module) $module_categories[$module->module_category_srl]->list[$module_srl] = $module;
175  }
176  }
177  else
178  {
179  $module_categories[0]->list = $mid_list;
180  }
181 
182  Context::set('mid_list',$module_categories);
183 
184  //Security
185  $security = new Security();
186  $security->encodeHTML('group_list..title');
187  $security->encodeHTML('component...', 'component_name');
188  $security->encodeHTML('mid_list..title','mid_list..list..browser_title');
189 
190  $this->setTemplatePath($this->module_path.'tpl');
191  $this->setTemplateFile('setup_component');
192  }
193 }
194 /* End of file editor.admin.view.php */
195 /* Location: ./modules/editor/editor.admin.view.php */
setTemplateFile($filename)
$oModuleModel
Definition: ko.install.php:236
init()
Initialization.
set($key, $val, $set_to_get_vars=0)
$xml_info
an object containing the module description extracted from XML file
$module_srl
integer value to represent a run-time instance of Module (XE Module)
dispEditorAdminSetupComponent()
Component setup.
$args
Definition: ko.install.php:185
dispEditorAdminIndex()
Administrator Setting page Settings to enable/disable editor component and other features.
editor admin view of the module class
const _XE_PATH_
Definition: config.inc.php:49
high class of the editor odule
Definition: editor.class.php:8
getModel($module_name)
Definition: func.inc.php:145
readDir($path, $filter= '', $to_lower=FALSE, $concat_prefix=FALSE)
$module
Class name of Xe Module that is identified by mid.