XpressEngine Core  1.11.2
 All Classes Namespaces Files Functions Variables Pages
editor.view.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) NAVER <http://www.navercorp.com> */
3 
9 class editorView extends editor
10 {
14  function init()
15  {
16  }
17 
21  function dispEditorPopup()
22  {
23  // add a css file
24  Context::loadFile($this->module_path."tpl/css/editor.css", true);
25  // List variables
26  $editor_sequence = Context::get('editor_sequence');
27  $component = Context::get('component');
28 
29  $site_module_info = Context::get('site_module_info');
30  $site_srl = (int)$site_module_info->site_srl;
31  // Get compoenet object
32  $oEditorModel = getModel('editor');
33  $oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl);
34  if(!$oComponent->toBool())
35  {
36  Context::set('message', sprintf(Context::getLang('msg_component_is_not_founded'), $component));
37  $this->setTemplatePath($this->module_path.'tpl');
38  $this->setTemplateFile('component_not_founded');
39  }
40  else
41  {
42  // Get the result after executing a method to display popup url of the component
43  $popup_content = $oComponent->getPopupContent();
44  Context::set('popup_content', $popup_content);
45  // Set layout to popup_layout
46  $this->setLayoutFile('popup_layout');
47  // Set a template
48  $this->setTemplatePath($this->module_path.'tpl');
49  $this->setTemplateFile('popup');
50  }
51  }
52 
57  {
58  $component_name = Context::get('component_name');
59 
60  $site_module_info = Context::get('site_module_info');
61  $site_srl = (int)$site_module_info->site_srl;
62 
63  $oEditorModel = getModel('editor');
64  $component = $oEditorModel->getComponent($component_name, $site_srl);
65 
66  if(!$component->component_name) {
67  $this->stop('msg_invalid_request');
68  return;
69  }
70 
71  Context::set('component', $component);
72 
73  $this->setTemplatePath($this->module_path.'tpl');
74  $this->setTemplateFile('view_component');
75  $this->setLayoutFile("popup_layout");
76  }
77 
82  {
83  $current_module_srl = Context::get('module_srl');
84  $current_module_srls = Context::get('module_srls');
85 
86  if(!$current_module_srl && !$current_module_srls)
87  {
88  // Get information of the current module
89  $current_module_info = Context::get('current_module_info');
90  $current_module_srl = $current_module_info->module_srl;
91  if(!$current_module_srl) return new BaseObject();
92  }
93  // Get editors settings
94  $oEditorModel = getModel('editor');
95  $editor_config = $oEditorModel->getEditorConfig($current_module_srl);
96 
97  Context::set('editor_config', $editor_config);
98 
99  $oModuleModel = getModel('module');
100  // Get a list of editor skin
101  $editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
102  Context::set('editor_skin_list', $editor_skin_list);
103 
104  $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
105  Context::set('editor_colorset_list', $skin_info->colorset);
106  $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->comment_editor_skin);
107  Context::set('editor_comment_colorset_list', $skin_info->colorset);
108 
109  $contents = FileHandler::readDir(_XE_PATH_.'modules/editor/styles');
110  $content_style_list = array();
111  for($i=0,$c=count($contents);$i<$c;$i++)
112  {
113  $style = $contents[$i];
114  $info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
115  $content_style_list[$style] = new stdClass();
116  $content_style_list[$style]->title = $info->title;
117  }
118  Context::set('content_style_list', $content_style_list);
119  // Get a group list
120  $oMemberModel = getModel('member');
121  $site_module_info = Context::get('site_module_info');
122  $group_list = $oMemberModel->getGroups($site_module_info->site_srl);
123  Context::set('group_list', $group_list);
124 
125  //Security
126  $security = new Security();
127  $security->encodeHTML('group_list..title');
128  $security->encodeHTML('group_list..description');
129  $security->encodeHTML('content_style_list..');
130  $security->encodeHTML('editor_comment_colorset_list..title');
131 
132  // Set a template file
133  $oTemplate = &TemplateHandler::getInstance();
134  $tpl = $oTemplate->compile($this->module_path.'tpl', 'editor_module_config');
135  $obj .= $tpl;
136 
137  return new BaseObject();
138  }
139 
140 
141  function dispEditorPreview()
142  {
143  $this->setTemplatePath($this->module_path.'tpl');
144  $this->setTemplateFile('preview');
145  }
146 
148  {
149  $skin = Context::get('skin');
150  $oModuleModel = getModel('module');
151  $skin_info = $oModuleModel->loadSkinInfo($this->module_path,$skin);
152  $colorset = $skin_info->colorset;
153  Context::set('colorset', $colorset);
154  }
155 
157  {
158  $oEditorModel = getModel('editor');
159  $config = $oEditorModel->getEditorConfig();
160 
161  $mode = Context::get('mode');
162 
163  if($mode != 'main')
164  {
165  $option_com = new stdClass();
166  $option_com->allow_fileupload = false;
167  $option_com->content_style = $config->content_style;
168  $option_com->content_font = $config->content_font;
169  $option_com->content_font_size = $config->content_font_size;
170  $option_com->enable_autosave = false;
171  $option_com->enable_default_component = true;
172  $option_com->enable_component = true;
173  $option_com->disable_html = false;
174  $option_com->height = $config->comment_editor_height;
175  $option_com->skin = $config->comment_editor_skin;
176  $option_com->content_key_name = 'dummy_content';
177  $option_com->primary_key_name = 'dummy_key';
178  $option_com->content_style = $config->comment_content_style;
179  $option_com->colorset = $config->sel_comment_editor_colorset;
180  $editor = $oEditorModel->getEditor(0, $option_com);
181  }
182  else
183  {
184  $option = new stdClass();
185  $option->allow_fileupload = false;
186  $option->content_style = $config->content_style;
187  $option->content_font = $config->content_font;
188  $option->content_font_size = $config->content_font_size;
189  $option->enable_autosave = false;
190  $option->enable_default_component = true;
191  $option->enable_component = true;
192  $option->disable_html = false;
193  $option->height = $config->editor_height;
194  $option->skin = $config->editor_skin;
195  $option->content_key_name = 'dummy_content';
196  $option->primary_key_name = 'dummy_key';
197  $option->colorset = $config->sel_editor_colorset;
198  $editor = $oEditorModel->getEditor(0, $option);
199  }
200 
201  Context::set('editor', $editor);
202 
203  $this->setLayoutFile('popup_layout');
204  $this->setTemplatePath($this->module_path.'tpl');
205  $this->setTemplateFile('config_preview');
206  }
207 }
208 /* End of file editor.view.php */
209 /* Location: ./modules/editor/editor.view.php */
setTemplateFile($filename)
$oModuleModel
Definition: ko.install.php:236
loadFile($args)
triggerDispEditorAdditionSetup(&$obj)
Add a form for editor addition setup.
Definition: editor.view.php:81
$obj
Definition: ko.install.php:262
setLayoutFile($filename)
set($key, $val, $set_to_get_vars=0)
init()
Initialization.
Definition: editor.view.php:14
dispEditorSkinColorset()
dispEditorPopup()
Action to get a request to display compoenet pop-up.
Definition: editor.view.php:21
dispEditorConfigPreview()
getLang($code)
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
dispEditorComponentInfo()
Get component information.
Definition: editor.view.php:56
readDir($path, $filter= '', $to_lower=FALSE, $concat_prefix=FALSE)
view class of the editor module
Definition: editor.view.php:9