Add option to select different editors for PC and mobile

This commit is contained in:
Kijin Sung 2020-07-09 00:23:54 +09:00
parent ee6c62a91e
commit e0f5678aba
13 changed files with 412 additions and 232 deletions

View file

@ -147,21 +147,25 @@ class editorAdminController extends editor
$config = new stdClass;
$config->editor_skin = $configVars->editor_skin;
$config->editor_colorset = $configVars->editor_colorset;
$config->editor_height = $configVars->editor_height;
$config->mobile_editor_height = $configVars->mobile_editor_height;
$config->editor_toolbar = $configVars->editor_toolbar;
$config->editor_toolbar_hide = $configVars->editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->mobile_editor_skin = $configVars->mobile_editor_skin;
$config->mobile_editor_colorset = $configVars->mobile_editor_colorset;
$config->mobile_editor_height = $configVars->mobile_editor_height;
$config->mobile_editor_toolbar = $configVars->mobile_editor_toolbar;
$config->mobile_editor_toolbar_hide = $configVars->mobile_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->comment_editor_skin = $configVars->comment_editor_skin;
$config->comment_editor_colorset = $configVars->comment_editor_colorset;
$config->comment_editor_height = $configVars->comment_editor_height;
$config->mobile_comment_editor_height = $configVars->mobile_comment_editor_height;
$config->comment_editor_toolbar = $configVars->comment_editor_toolbar;
$config->comment_editor_toolbar_hide = $configVars->comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->mobile_comment_editor_skin = $configVars->mobile_comment_editor_skin;
$config->mobile_comment_editor_colorset = $configVars->mobile_comment_editor_colorset;
$config->mobile_comment_editor_height = $configVars->mobile_comment_editor_height;
$config->mobile_comment_editor_toolbar = $configVars->mobile_comment_editor_toolbar;
$config->mobile_comment_editor_toolbar_hide = $configVars->mobile_comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->sel_editor_colorset = $configVars->sel_editor_colorset;
$config->sel_comment_editor_colorset = $configVars->sel_comment_editor_colorset;
if ($configVars->font_defined === 'Y')
{

View file

@ -20,16 +20,11 @@ class editorAdminView extends editor
*/
function dispEditorAdminIndex()
{
$component_count = 0;
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
// Get a type of component
// Get module config
$oEditorModel = getModel('editor');
$oModuleModel = getModel('module');
$editor_config = $oModuleModel->getModuleConfig('editor');
if(!$editor_config)
if (!is_object($editor_config))
{
$editor_config = new stdClass();
}
@ -42,36 +37,54 @@ class editorAdminView extends editor
$editor_config->$key = $val;
}
}
$component_list = $oEditorModel->getComponentList(false, $site_srl, true);
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
$editor_skin_list = array_filter($editor_skin_list, function($name) { return !starts_with('xpresseditor', $name) && !starts_with('dreditor', $name); });
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
$comment_skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->comment_editor_skin);
// Get install info, update info, count
$oAutoinstallModel = getModel('autoinstall');
foreach($component_list as $component_name => $xml_info)
// Get skin info
$editor_skin_list = array();
$skin_dir_list = FileHandler::readDir($this->module_path . 'skins');
foreach ($skin_dir_list as $skin)
{
if (starts_with('xpresseditor', $skin) || starts_with('dreditor', $skin))
{
continue;
}
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin);
foreach ($skin_info->colorset ?: [] as $colorset)
{
unset($colorset->screenshot);
}
$editor_skin_list[$skin] = $skin_info;
}
// Get editor component info
$oAutoinstallModel = getModel('autoinstall');
$component_list = $oEditorModel->getComponentList(false, 0, true);
$component_count = count($component_list);
$targetpackages = array();
foreach ($component_list as $xml_info)
{
$component_count++;
$xml_info->path = './modules/editor/components/'.$xml_info->component_name;
$xml_info->delete_url = $oAutoinstallModel->getRemoveUrlByPath($xml_info->path);
$xml_info->package_srl = $oAutoinstallModel->getPackageSrlByPath($xml_info->path);
if($xml_info->package_srl) $targetpackages[$xml_info->package_srl] = 0;
if ($xml_info->package_srl)
{
$targetpackages[$xml_info->package_srl] = 0;
}
}
if(is_array($targetpackages)) $packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
foreach($component_list as $component_name => $xml_info)
if (count($targetpackages))
{
if($packages[$xml_info->package_srl]) $xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
$packages = $oAutoinstallModel->getInstalledPackages(array_keys($targetpackages));
}
foreach ($component_list as $xml_info)
{
if ($packages[$xml_info->package_srl])
{
$xml_info->need_update = $packages[$xml_info->package_srl]->need_update;
}
}
Context::set('editor_config', $editor_config);
Context::set('editor_skin_list', $editor_skin_list);
Context::set('editor_colorset_list', $skin_info->colorset);
Context::set('comment_editor_colorset_list', $comment_skin_info->colorset);
Context::set('component_list', $component_list);
Context::set('component_count', $component_count);

View file

@ -23,21 +23,25 @@ class editor extends ModuleObject
*/
public $default_editor_config = array(
'editor_skin' => 'ckeditor',
'editor_colorset' => 'moono-lisa',
'editor_height' => 300,
'editor_toolbar' => 'default',
'editor_toolbar_hide' => 'N',
'mobile_editor_skin' => 'simpleeditor',
'mobile_editor_colorset' => 'light',
'mobile_editor_height' => 200,
'mobile_editor_toolbar' => 'simple',
'mobile_editor_toolbar_hide' => 'Y',
'sel_editor_colorset' => 'moono-lisa',
'comment_editor_skin' => 'ckeditor',
'comment_editor_colorset' => 'moono-lisa',
'comment_editor_height' => 100,
'comment_editor_toolbar' => 'simple',
'comment_editor_toolbar_hide' => 'N',
'mobile_comment_editor_skin' => 'simpleeditor',
'mobile_comment_editor_colorset' => 'light',
'mobile_comment_editor_height' => 100,
'mobile_comment_editor_toolbar' => 'simple',
'mobile_comment_editor_toolbar_hide' => 'Y',
'sel_comment_editor_colorset' => 'moono-lisa',
'content_font' => '',
'content_font_size' => '13px',
'content_line_height' => '160%',

View file

@ -85,8 +85,11 @@ class editorController extends editor
*/
function procEditorInsertModuleConfig()
{
// Get request vars
$vars = Context::getRequestVars();
// To configure many of modules at once
$target_module_srl = Context::get('target_module_srl');
$target_module_srl = $vars->target_module_srl;
$target_module_srl = array_map('trim', explode(',', $target_module_srl));
$logged_info = Context::get('logged_info');
$module_srl = array();
@ -110,56 +113,85 @@ class editorController extends editor
$module_srl[] = $srl;
}
$editor_config = new stdClass;
$editor_config->default_editor_settings = Context::get('default_editor_settings');
if($editor_config->default_editor_settings !== 'Y') $editor_config->default_editor_settings = 'N';
$editor_config->editor_skin = Context::get('editor_skin');
$editor_config->comment_editor_skin = Context::get('comment_editor_skin');
$editor_config->content_font = Context::get('content_font');
if($editor_config->content_font)
// Apply default settings?
$config = new stdClass;
$config->default_editor_settings = $vars->default_editor_settings;
if ($config->default_editor_settings !== 'Y')
{
$font_list = array();
$fonts = explode(',',$editor_config->content_font);
for($i=0,$c=count($fonts);$i<$c;$i++)
{
$font = trim(str_replace(array('"','\''),'',$fonts[$i]));
if(!$font) continue;
$font_list[] = $font;
}
if(count($font_list)) $editor_config->content_font = '"'.implode('","',$font_list).'"';
$config->default_editor_settings = 'N';
}
$editor_config->content_font_size = Context::get('content_font_size');
$editor_config->sel_editor_colorset = Context::get('sel_editor_colorset');
$editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset');
// Apply module-specific editor settings.
$config->editor_skin = $vars->editor_skin;
$config->editor_colorset = $vars->editor_colorset;
$config->editor_height = $vars->editor_height;
$config->editor_toolbar = $vars->editor_toolbar;
$config->editor_toolbar_hide = $vars->editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->mobile_editor_skin = $vars->mobile_editor_skin;
$config->mobile_editor_colorset = $vars->mobile_editor_colorset;
$config->mobile_editor_height = $vars->mobile_editor_height;
$config->mobile_editor_toolbar = $vars->mobile_editor_toolbar;
$config->mobile_editor_toolbar_hide = $vars->mobile_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->comment_editor_skin = $vars->comment_editor_skin;
$config->comment_editor_colorset = $vars->comment_editor_colorset;
$config->comment_editor_height = $vars->comment_editor_height;
$config->comment_editor_toolbar = $vars->comment_editor_toolbar;
$config->comment_editor_toolbar_hide = $vars->comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$config->mobile_comment_editor_skin = $vars->mobile_comment_editor_skin;
$config->mobile_comment_editor_colorset = $vars->mobile_comment_editor_colorset;
$config->mobile_comment_editor_height = $vars->mobile_comment_editor_height;
$config->mobile_comment_editor_toolbar = $vars->mobile_comment_editor_toolbar;
$config->mobile_comment_editor_toolbar_hide = $vars->mobile_comment_editor_toolbar_hide === 'Y' ? 'Y' : 'N';
$grants = array('enable_html_grant','enable_comment_html_grant','upload_file_grant','comment_upload_file_grant','enable_default_component_grant','enable_comment_default_component_grant','enable_component_grant','enable_comment_component_grant');
if ($vars->font_defined === 'Y')
{
$config->font_defined = 'Y';
$config->content_font = $vars->content_font_defined;
}
else
{
$config->font_defined = $vars->font_defined = 'N';
$config->content_font = $vars->content_font;
}
$config->content_font_size = trim($vars->content_font_size);
$config->enable_autosave = $vars->enable_autosave ?: 'Y';
$config->allow_html = $vars->allow_html ?: 'Y';
// Apply module-specific permissions.
$grants = array(
'enable_html_grant',
'enable_comment_html_grant',
'upload_file_grant',
'comment_upload_file_grant',
'enable_default_component_grant',
'enable_comment_default_component_grant',
'enable_component_grant',
'enable_comment_component_grant',
);
foreach($grants as $key)
{
$grant = Context::get($key);
if(!$grant)
{
$editor_config->{$key} = array();
$config->{$key} = array();
}
else if(is_array($grant))
{
$editor_config->{$key} = $grant;
$config->{$key} = $grant;
}
else
{
$editor_config->{$key} = explode('|@|', $grant);
$config->{$key} = explode('|@|', $grant);
}
}
$editor_config->editor_height = (int)Context::get('editor_height');
$editor_config->comment_editor_height = (int)Context::get('comment_editor_height');
$editor_config->enable_autosave = Context::get('enable_autosave') ?: 'Y';
$editor_config->allow_html = Context::get('allow_html') ?: 'Y';
// Save settings.
$oModuleController = getController('module');
foreach ($module_srl as $srl)
{
$oModuleController->insertModulePartConfig('editor', $srl, $editor_config);
$oModuleController->insertModulePartConfig('editor', $srl, $config);
}
$this->setError(-1);

View file

@ -53,7 +53,7 @@ class editorModel extends editor
if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
// Load the default config for editor module.
$editor_default_config = $oModuleModel->getModuleConfig('editor');
$editor_default_config = $oModuleModel->getModuleConfig('editor') ?: new stdClass;
// Check whether we should use the default config.
if($editor_config->default_editor_settings !== 'Y' && $editor_default_config->editor_skin && $editor_config->editor_skin && $editor_default_config->editor_skin !== $editor_config->editor_skin)
@ -122,21 +122,25 @@ class editorModel extends editor
{
$option->editor_skin = $this->default_editor_config['editor_skin'];
}
if (!$option->sel_editor_colorset)
if (!$option->editor_colorset)
{
$option->sel_editor_colorset = $option->colorset ?: $this->default_editor_config['sel_editor_colorset'];
$option->editor_colorset = $option->colorset ?: ($option->sel_editor_colorset ?: $this->default_editor_config['editor_colorset']);
}
if (!$option->editor_height)
{
$option->editor_height = $option->height ?: $this->default_editor_config['editor_height'];
}
if ($option->editor_skin === 'ckeditor' && preg_match('/^(?:white|black)(_text_(?:use|no)html)?$/', $option->sel_editor_colorset))
if ($option->editor_skin === 'ckeditor' && !in_array($option->editor_colorset, array('moono', 'moono-dark', 'moono-lisa')))
{
$option->sel_editor_colorset = 'moono-lisa';
$option->editor_colorset = 'moono-lisa';
}
if ($option->editor_skin === 'simpleeditor' && !in_array($option->editor_colorset, array('light', 'dark')))
{
$option->editor_colorset = 'light';
}
Context::set('skin', $option->editor_skin);
Context::set('editor_path', $this->module_path . 'skins/' . $option->editor_skin . '/');
Context::set('colorset', $option->sel_editor_colorset);
Context::set('colorset', $option->editor_colorset);
Context::set('editor_height', $option->editor_height);
Context::set('editor_toolbar', $option->editor_toolbar);
Context::set('editor_toolbar_hide', toBool($option->editor_toolbar_hide));
@ -269,6 +273,8 @@ class editorModel extends editor
}
if ($is_mobile)
{
$option->editor_skin = $option->mobile_editor_skin ?: $option->editor_skin;
$option->editor_colorset = $option->mobile_editor_colorset ?: ($option->editor_colorset ?: $option->sel_editor_colorset);
$option->editor_height = $option->mobile_editor_height;
$option->editor_toolbar = $option->mobile_editor_toolbar;
$option->editor_toolbar_hide = $option->mobile_editor_toolbar_hide;
@ -281,8 +287,6 @@ class editorModel extends editor
{
$option->$key = $val;
}
$option->editor_skin = $option->comment_editor_skin;
$option->sel_editor_colorset = $option->sel_comment_editor_colorset;
$option->upload_file_grant = $option->comment_upload_file_grant;
$option->enable_default_component_grant = $option->enable_comment_default_component_grant;
$option->enable_component_grant = $option->enable_comment_component_grant;
@ -293,6 +297,8 @@ class editorModel extends editor
$option->enable_autosave = 'N';
if ($is_mobile)
{
$option->editor_skin = $option->mobile_comment_editor_skin ?: ($option->comment_editor_skin ?: $option->editor_skin);
$option->editor_colorset = $option->mobile_comment_editor_colorset ?: ($option->comment_editor_colorset ?: ($option->editor_colorset ?: $option->sel_editor_colorset));
$option->editor_height = $option->mobile_comment_editor_height;
$option->editor_toolbar = $option->mobile_comment_editor_toolbar;
$option->editor_toolbar_hide = $option->mobile_comment_editor_toolbar_hide;

View file

@ -123,23 +123,46 @@ class editorView extends editor
$current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new BaseObject();
}
// Get editors settings
$oModuleModel = getModel('module');
$oEditorModel = getModel('editor');
$editor_config = $oEditorModel->getEditorConfig($current_module_srl);
if (!is_object($editor_config))
{
$editor_config = new stdClass();
}
// Use default config for missing values.
foreach ($this->default_editor_config as $key => $val)
{
if (!isset($editor_config->$key))
{
$editor_config->$key = $val;
}
}
// Get skin info
$editor_skin_list = array();
$skin_dir_list = FileHandler::readDir($this->module_path . 'skins');
foreach ($skin_dir_list as $skin)
{
if (starts_with('xpresseditor', $skin) || starts_with('dreditor', $skin))
{
continue;
}
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $skin);
foreach ($skin_info->colorset ?: [] as $colorset)
{
unset($colorset->screenshot);
}
$editor_skin_list[$skin] = $skin_info;
}
Context::set('editor_config', $editor_config);
$oModuleModel = getModel('module');
// Get a list of editor skin
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
$editor_skin_list = array_filter($editor_skin_list, function($name) { return !starts_with('xpresseditor', $name) && !starts_with('dreditor', $name); });
Context::set('editor_skin_list', $editor_skin_list);
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->editor_skin);
Context::set('editor_colorset_list', $skin_info->colorset);
$skin_info = $oModuleModel->loadSkinInfo($this->module_path,$editor_config->comment_editor_skin);
Context::set('editor_comment_colorset_list', $skin_info->colorset);
// Get a group list
$oMemberModel = getModel('member');
$site_module_info = Context::get('site_module_info');

View file

@ -2,13 +2,13 @@
$lang->editor_component = 'Editor Component';
$lang->main_editor = 'Main Editor';
$lang->comment_editor = 'Comment Editor';
$lang->guide_editor_skin = 'Editor Skin';
$lang->guide_editor_height = 'Height';
$lang->guide_editor_toolbar = 'Toolbar';
$lang->editor_toolbar_default = 'Default';
$lang->editor_toolbar_simple = 'Simple';
$lang->editor_toolbar_hide = 'Hidden';
$lang->editor_common_settings = 'Common Settings';
$lang->guide_choose_main_editor = 'Main editor';
$lang->guide_set_height_main_editor = 'Main editor height';
$lang->guide_set_main_editor_toolbar = 'Main editor toolbar';
$lang->guide_choose_comment_editor = 'Comment editor';
$lang->guide_set_height_comment_editor = 'Comment editor height';
$lang->guide_set_comment_editor_toolbar = 'Comment editor toolbar';
$lang->guide_additional_css = 'Additional CSS Files';
$lang->about_additional_css = 'To load additional CSS files inside the editor, such as web fonts, please enter one URL per line.';
$lang->guide_additional_mobile_css = 'Additional CSS Files for Mobile';

View file

@ -3,12 +3,9 @@ $lang->editor_now = '현재 설정 상태';
$lang->editor_component = '에디터 컴포넌트';
$lang->main_editor = '본문 에디터';
$lang->comment_editor = '댓글 에디터';
$lang->guide_choose_main_editor = '본문 에디터';
$lang->guide_set_height_main_editor = '본문 에디터 높이';
$lang->guide_set_main_editor_toolbar = '본문 에디터 도구상자';
$lang->guide_choose_comment_editor = '댓글 에디터';
$lang->guide_set_height_comment_editor = '댓글 에디터 높이';
$lang->guide_set_comment_editor_toolbar = '댓글 에디터 도구상자';
$lang->guide_editor_skin = '에디터 스킨';
$lang->guide_editor_height = '높이';
$lang->guide_editor_toolbar = '도구상자';
$lang->editor_toolbar_default = '기본';
$lang->editor_toolbar_simple = '간단';
$lang->editor_toolbar_hide = '숨김';

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<skin version="0.2">
<title xml:lang="ko">CKEditor 스킨</title>
<title xml:lang="ko">CKEditor</title>
<description xml:lang="ko">CKEditor</description>
<version>1.0.0</version>
<date>2015-02-24</date>

View file

@ -33,41 +33,61 @@
<input type="hidden" name="xe_validator_id" value="modules/editor/tpl/admin_index/1" />
<h1>{$lang->main_editor}</h1>
<div class="x_control-group">
<label for="change_lang_type" class="x_control-label">{$lang->guide_choose_main_editor}</label>
<label for="change_lang_type" class="x_control-label">{$lang->pc}</label>
<div class="x_controls">
<!--@foreach($editor_skin_list as $editor)-->
<label class="x_inline" id="label_doc_{$editor}">
<input type="radio" name="editor_skin" value="{$editor}" id="doc_{$editor}" onClick="getEditorSkinColorList(this.value, null, 'document','label_doc_{$editor}')" checked="checked"|cond="$editor==$editor_config->editor_skin" /> {$editor}
</label>
<label class="x_inline">
<select name="sel_editor_colorset" style="display:none"|cond="$editor!=$editor_config->editor_skin">
<option value="{$val->name}" selected="selected"|cond="$editor_config->sel_editor_colorset == $val->name" cond="$editor==$editor_config->editor_skin" loop="$editor_colorset_list=>$key,$val">{$val->title}</option>
<p>
<select name="editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
</label>
<br />
<!--@end-->
</div>
</div>
<div class="x_control-group">
<label for="editor_height" class="x_control-label">{$lang->guide_set_height_main_editor}</label>
<div class="x_controls">
<p><span class="editor_type">{$lang->pc}</span> <input type="number" name="editor_height" id="editor_height" value="{$editor_config->editor_height}" /> px</p>
<p><span class="editor_type">{$lang->mobile}</span> <input type="number" name="mobile_editor_height" id="mobile_editor_height" value="{$editor_config->mobile_editor_height}" /> px</p>
</div>
</div>
<div class="x_control-group">
<label for="editor_height" class="x_control-label">{$lang->guide_set_main_editor_toolbar}</label>
<div class="x_controls">
<p><span class="editor_type">{$lang->pc}</span>
<label class="x_inline"><input type="radio" name="editor_toolbar" value="default" checked="checked"|cond="!$editor_config->editor_toolbar || $editor_config->editor_toolbar === 'default'"> {$lang->editor_toolbar_default}</label>
<label class="x_inline"><input type="radio" name="editor_toolbar" value="simple" checked="checked"|cond="$editor_config->editor_toolbar === 'simple'"> {$lang->editor_toolbar_simple}</label>
<select name="editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="editor_height" value="{$editor_config->editor_height}" /> px
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->editor_toolbar || $editor_config->editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
<p><span class="editor_type">{$lang->mobile}</span>
<label class="x_inline"><input type="radio" name="mobile_editor_toolbar" value="default" checked="checked"|cond="!$editor_config->mobile_editor_toolbar || $editor_config->mobile_editor_toolbar === 'default'"> {$lang->editor_toolbar_default}</label>
<label class="x_inline"><input type="radio" name="mobile_editor_toolbar" value="simple" checked="checked"|cond="$editor_config->mobile_editor_toolbar === 'simple'"> {$lang->editor_toolbar_simple}</label>
</div>
</div>
<div class="x_control-group">
<label for="editor_height" class="x_control-label">{$lang->mobile}</label>
<div class="x_controls">
<p>
<select name="mobile_editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->mobile_editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
<select name="mobile_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->mobile_editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->mobile_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="mobile_editor_height" value="{$editor_config->mobile_editor_height}" /> px</p>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="mobile_editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->mobile_editor_toolbar || $editor_config->mobile_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->mobile_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="mobile_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->mobile_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
</div>
@ -76,40 +96,59 @@
<h1>{$lang->comment_editor}</h1>
<div class="x_control-group">
<label for="sel_comment_editor_colorset" class="x_control-label">{$lang->guide_choose_comment_editor}</label>
<label for="change_lang_type" class="x_control-label">{$lang->pc}</label>
<div class="x_controls">
<!--@foreach($editor_skin_list as $editor)-->
<label class="x_inline" id="label_com_{$editor}">
<input type="radio" name="comment_editor_skin" value="{$editor}" id="com_{$editor}" onclick="getEditorSkinColorList(this.value, null, 'reply','label_com_{$editor}')" checked="checked"|cond="$editor == $editor_config->comment_editor_skin" /> {$editor}
</label>
<label class="x_inline">
<select name="sel_comment_editor_colorset" style="display:none"|cond="$editor!=$editor_config->comment_editor_skin">
<option value="{$val->name}" selected="selected"|cond="$editor_config->sel_comment_editor_colorset == $val->name" cond="$editor==$editor_config->comment_editor_skin" loop="$comment_editor_colorset_list=>$key,$val">{$val->title}</option>
<p>
<select name="comment_editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->comment_editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
</label>
<br />
<!--@end-->
</div>
</div>
<div class="x_control-group">
<label for="comment_editor_height" class="x_control-label">{$lang->guide_set_height_comment_editor}</label>
<div class="x_controls">
<p><span class="editor_type">{$lang->pc}</span> <input type="number" name="comment_editor_height" id="comment_editor_height" value="{$editor_config->comment_editor_height}" /> px</p>
<p><span class="editor_type">{$lang->mobile}</span> <input type="number" name="mobile_comment_editor_height" id="mobile_comment_editor_height" value="{$editor_config->mobile_comment_editor_height}" /> px &nbsp;</p>
</div>
</div>
<div class="x_control-group">
<label for="editor_height" class="x_control-label">{$lang->guide_set_comment_editor_toolbar}</label>
<div class="x_controls">
<p><span class="editor_type">{$lang->pc}</span>
<label class="x_inline"><input type="radio" name="comment_editor_toolbar" value="default" checked="checked"|cond="!$editor_config->comment_editor_toolbar || $editor_config->comment_editor_toolbar === 'default'"> {$lang->editor_toolbar_default}</label>
<label class="x_inline"><input type="radio" name="comment_editor_toolbar" value="simple" checked="checked"|cond="$editor_config->comment_editor_toolbar === 'simple'"> {$lang->editor_toolbar_simple}</label>
<select name="comment_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->comment_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="comment_editor_height" value="{$editor_config->comment_editor_height}" /> px
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->comment_editor_toolbar || $editor_config->comment_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->comment_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="comment_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->comment_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
<p><span class="editor_type">{$lang->mobile}</span>
<label class="x_inline"><input type="radio" name="mobile_comment_editor_toolbar" value="default" checked="checked"|cond="!$editor_config->mobile_comment_editor_toolbar || $editor_config->mobile_comment_editor_toolbar === 'default'"> {$lang->editor_toolbar_default}</label>
<label class="x_inline"><input type="radio" name="mobile_comment_editor_toolbar" value="simple" checked="checked"|cond="$editor_config->mobile_comment_editor_toolbar === 'simple'"> {$lang->editor_toolbar_simple}</label>
</div>
</div>
<div class="x_control-group">
<label for="editor_height" class="x_control-label">{$lang->mobile}</label>
<div class="x_controls">
<p>
<select name="mobile_comment_editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->mobile_comment_editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
<select name="mobile_comment_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->mobile_editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->mobile_comment_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="mobile_comment_editor_height" value="{$editor_config->mobile_comment_editor_height}" /> px</p>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="mobile_comment_editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->mobile_comment_editor_toolbar || $editor_config->mobile_comment_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->mobile_comment_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="mobile_comment_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->mobile_comment_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
</div>
@ -120,10 +159,10 @@
<div class="x_control-group">
<label class="x_control-label">{$lang->guide_choose_font_body}</label>
<div class="x_controls">
<label style="font-family:''" class="fontSelector">
<label class="x_inline fontSelector">
<input type="radio" name="content_font" id="font_noFont" value="" checked="checked"|cond="!$editor_config->content_font && $editor_config->font_defined != 'Y'" /> none (inherit)
</label>
<label style="display:inline-block;margin-right:16px;font-family:{$detail}" class="fontSelector" loop="$lang->edit->fontlist=>$name,$detail">
<label style="font-family:{$detail}" class="x_inline fontSelector" loop="$lang->edit->fontlist=>$name,$detail">
{@ $fontname_simplified = trim(array_first(explode(',', $detail)), "'\" ")}
<input type="radio" name="content_font" id="font_{$name}" value="{$detail}" checked="checked"|cond="$editor_config->content_font == $detail && $editor_config->font_defined != 'Y'" /> {$fontname_simplified}
</label>

View file

@ -1,3 +1,7 @@
tr.editor_skin td p {
margin-bottom: 6px;
}
.editor_type {
display: inline-block;
min-width: 60px;

View file

@ -1,6 +1,6 @@
<!--%import("filter/insert_editor_module_config.xml")-->
<load target="css/editor_module_config.css" />
<load target="js/editor_module_config.js" />
<form action="./" method="post" class="section">
<input type="hidden" name="act" value="procEditorInsertModuleConfig" />
<input type="hidden" name="module" value="editor" />
@ -27,45 +27,137 @@
</td>
</tr>
<tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->editor_skin}</th>
<th scope="row" style="text-align:right">{$lang->pc}</th>
<td>
<select name="editor_skin" onchange="getEditorSkinColorList(this.value, null, 'document')">
<option loop="$editor_skin_list => $editor" value="{$editor}" selected="selected"|cond="$editor==$editor_config->editor_skin">{$editor}</option>
</select>
<br/>
<select name="sel_editor_colorset" id="sel_editor_colorset" data-display="none"|cond="!count($editor_colorset_list)">
<option loop="$editor_colorset_list => $key, $val" value="{$val->name}" selected="selected"|cond="$editor_config->sel_editor_colorset == $val->name">{$val->title}</option>
</select>
<p>
<select name="editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
<select name="editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="editor_height" value="{$editor_config->editor_height}" /> px
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->editor_toolbar || $editor_config->editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
</td>
<td>
<select name="comment_editor_skin" onchange="getEditorSkinColorList(this.value, null, 'comment')">
<option loop="$editor_skin_list => $editor" value="{$editor}" selected="selected"|cond="$editor==$editor_config->comment_editor_skin">{$editor}</option>
</select>
<br/>
<select name="sel_comment_editor_colorset" id="sel_comment_editor_colorset" data-display="none"|cond="!count($editor_comment_colorset_list)">
<option loop="$editor_comment_colorset_list => $key, $val" value="{$val->name}" selected="selected"|cond="$editor_config->sel_comment_editor_colorset == $val->name">{$val->title}</option>
</select>
<p>
<select name="comment_editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->comment_editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
<select name="comment_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->comment_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="comment_editor_height" value="{$editor_config->comment_editor_height}" /> px
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->comment_editor_toolbar || $editor_config->comment_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->comment_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="comment_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->comment_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
</td>
</tr>
<tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->editor_height}</th>
<th scope="row" style="text-align:right">{$lang->mobile}</th>
<td>
<input type="number" min="0" name="editor_height" value="{$editor_config->editor_height}" /> px
<p>
<select name="mobile_editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->mobile_editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
<select name="mobile_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->mobile_editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->mobile_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="mobile_editor_height" value="{$editor_config->mobile_editor_height}" /> px</p>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="mobile_editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->mobile_editor_toolbar || $editor_config->mobile_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->mobile_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="mobile_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->mobile_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
</td>
<td>
<input type="number" min="0" name="comment_editor_height" value="{$editor_config->comment_editor_height}" /> px
<p>
<select name="mobile_comment_editor_skin" class="editor_skin_selector">
<!--@foreach($editor_skin_list as $skin_name => $skin_info)-->
<option value="{$skin_name}" data-colorsets="{json_encode($skin_info->colorset)|escape}" selected="selected"|cond="$skin_name === $editor_config->mobile_comment_editor_skin">{$skin_info->title}</option>
<!--@endforeach-->
</select>
<select name="mobile_comment_editor_colorset" class="editor_colorset_selector">
<!--@foreach($editor_skin_list[$editor_config->mobile_editor_skin]->colorset ?: [] as $colorset)-->
<option value="{$colorset->name}" selected="selected"|cond="$colorset->name === $editor_config->mobile_comment_editor_colorset">{$colorset->title}</option>
<!--@endforeach-->
</select>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_height}</span>
<input type="number" name="mobile_comment_editor_height" value="{$editor_config->mobile_comment_editor_height}" /> px</p>
</p>
<p>
<span class="editor_type">{$lang->guide_editor_toolbar}</span>
<select name="mobile_comment_editor_toolbar" style="min-width:104px">
<option value="default" selected="selected"|cond="!$editor_config->mobile_comment_editor_toolbar || $editor_config->mobile_comment_editor_toolbar === 'default'">{$lang->editor_toolbar_default}</option>
<option value="default" selected="selected"|cond="$editor_config->mobile_comment_editor_toolbar === 'simple'">{$lang->editor_toolbar_simple}</option>
</select> &nbsp;
<label class="x_inline"><input type="checkbox" name="mobile_comment_editor_toolbar_hide" value="Y" checked="checked"|cond="$editor_config->mobile_comment_editor_toolbar_hide === 'Y'"> {$lang->editor_toolbar_hide}</label>
</p>
</td>
</tr>
<tr class="editor_skin">
<th scope="row" style="text-align:right"><label for="content_font">{$lang->content_font}</label></th>
<td colspan="2">
<input type="text" name="content_font" id="content_font" value="{str_replace(array('"','\''),'',$editor_config->content_font)}" placeholder="Ex) Tahoma, Geneva, sans-serif" />
{$lang->about_content_font}
<label class="x_inline fontSelector">
<input type="radio" name="content_font" id="font_noFont" value="" checked="checked"|cond="!$editor_config->content_font && $editor_config->font_defined != 'Y'" /> none (inherit)
</label>
<label style="font-family:{$detail}" class="x_inline fontSelector" loop="$lang->edit->fontlist=>$name,$detail">
{@ $fontname_simplified = trim(array_first(explode(',', $detail)), "'\" ")}
<input type="radio" name="content_font" id="font_{$name}" value="{$detail}" checked="checked"|cond="$editor_config->content_font == $detail && $editor_config->font_defined != 'Y'" /> {$fontname_simplified}
</label>
<label>
<input type="radio" class="fontSelector" name="font_defined" id="font_defined" value="Y" checked="checked"|cond="$editor_config->font_defined== 'Y'" /> {$lang->by_you} :
<input type="text" name="content_font_defined" value="{$editor_config->content_font}"|cond="$editor_config->font_defined == 'Y'" />
</label>
</td>
</tr>
<tr class="editor_skin">
<th scope="row" style="text-align:right"><label for="content_font_size">{$lang->content_font_size}</label></th>
<td colspan="2"><input type="text" name="content_font_size" id="content_font_size" value="{$editor_config->content_font_size}" style="width:50px" /> {$lang->about_content_font_size}</td>
<td colspan="2">
<input type="text" id="font_size" name="content_font_size" value="{$editor_config->content_font_size ?: 13}" />
<p class="x_help-inline">{$lang->about_unit_default_px}</p>
</td>
</tr>
<tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->enable_autosave}</th>

View file

@ -1,55 +1,21 @@
function getEditorSkinColorList(skin_name,selected_colorset,type,testid){
if(skin_name.length>0){
type = type || 'document';
var response_tags = new Array('error','message','colorset');
exec_xml('editor','dispEditorSkinColorset',{skin:skin_name},resultGetEditorSkinColorList,response_tags,{'selected_colorset':selected_colorset,'type':type,'testid':testid});
}
}
"use strict";
function resultGetEditorSkinColorList(ret_obj,response_tags, params) {
var selectbox = null;
jQuery(function($){
if(params.testid){
selectbox = $("#"+params.testid).next('label').children('select');
} else {
selectbox = (params.type == 'document') ? $('select[name=sel_editor_colorset]') : $('select[name=sel_comment_editor_colorset]');
}
selectbox.html('');
if(params.type == 'document'){
$("select[name=sel_editor_colorset]").hide()
.removeAttr('name');
selectbox.attr('name','sel_editor_colorset');
} else {
$("select[name=sel_comment_editor_colorset]").hide()
.removeAttr('name');
selectbox.attr('name','sel_comment_editor_colorset');
}
/* jshint -W041 */
if(ret_obj.error == 0 && ret_obj.colorset){
var it = [];
var items = ret_obj.colorset.item;
if(typeof(items[0]) == 'undefined'){
it[0] = items;
} else {
it = items;
(function($) {
$(function() {
$('.editor_skin_selector').on('change', function() {
var colorset_selector = $(this).siblings('.editor_colorset_selector').empty();
var colorset_list = $(this).find('option:selected').data('colorsets');
if (colorset_list && colorset_list.length) {
$.each(colorset_list, function(i, colorset) {
var option = $('<option></option>');
option.attr('value', colorset.name);
option.text(colorset.title);
option.appendTo(colorset_selector);
if (colorset.title.indexOf('L') > -1) {
option.attr('selected', 'selected');
}
});
}
var selectAttr = "";
for(var i=0;i<it.length;i++){
var $options = $('<option value="'+it[i].name+'" >'+it[i].title+'</option>');
if(params.selected_colorset == it[i].name){
$options.attr('selected', 'selected');
}
selectbox.append($options);
}
selectbox.show();
} else {
selectbox.hide();
selectbox.html('');
}
});
});
}
})(jQuery);