Merge pull request #466 from misol/improvement/board-default-editor

에디터 기본 설정을 사용할 수 있도록 개선
This commit is contained in:
MinSoo Kim 2016-04-27 19:50:41 +09:00
commit 6012d28ada
6 changed files with 58 additions and 17 deletions

View file

@ -86,6 +86,8 @@ class editorController extends editor
else $module_srl = array($module_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_style = Context::get('content_style');

View file

@ -46,45 +46,54 @@ class editorModel extends editor
if(!is_array($editor_config->enable_component_grant)) $editor_config->enable_component_grant = array();
if(!is_array($editor_config->enable_comment_component_grant)) $editor_config->enable_comment_component_grant= array();
if(!$editor_config->editor_height)
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)
{
$editor_config->default_editor_settings = 'N';
}
if(!$editor_config->default_editor_settings)
{
$editor_config->default_editor_settings = 'Y';
}
if(!$editor_config->editor_height || $editor_config->default_editor_settings === 'Y')
{
$editor_config->editor_height = ($editor_default_config->editor_height) ? $editor_default_config->editor_height : 500;
}
if(!$editor_config->comment_editor_height)
if(!$editor_config->comment_editor_height || $editor_config->default_editor_settings === 'Y')
{
$editor_config->comment_editor_height = ($editor_default_config->comment_editor_height) ? $editor_default_config->comment_editor_height : 120;
}
if(!$editor_config->editor_skin)
if(!$editor_config->editor_skin || $editor_config->default_editor_settings === 'Y')
{
$editor_config->editor_skin = ($editor_default_config->editor_skin) ? $editor_default_config->editor_skin : 'ckeditor';
}
if(!$editor_config->comment_editor_skin)
if(!$editor_config->comment_editor_skin || $editor_config->default_editor_settings === 'Y')
{
$editor_config->comment_editor_skin = ($editor_default_config->comment_editor_skin) ? $editor_default_config->comment_editor_skin : 'ckeditor';
}
if(!$editor_config->content_style)
if(!$editor_config->content_style || $editor_config->default_editor_settings === 'Y')
{
$editor_config->content_style = ($editor_default_config->content_style) ? $editor_default_config->content_style : 'ckeditor_light';
}
if(!$editor_config->content_font && $editor_default_config->content_font)
if((!$editor_config->content_font && $editor_default_config->content_font) || $editor_config->default_editor_settings === 'Y')
{
$editor_config->content_font = $editor_default_config->content_font;
}
if(!$editor_config->content_font_size && $editor_default_config->content_font_size)
if((!$editor_config->content_font_size && $editor_default_config->content_font_size) || $editor_config->default_editor_settings === 'Y')
{
$editor_config->content_font_size = $editor_default_config->content_font_size;
}
if(!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset)
if((!$editor_config->sel_editor_colorset && $editor_default_config->sel_editor_colorset) || $editor_config->default_editor_settings === 'Y')
{
$editor_config->sel_editor_colorset = $editor_default_config->sel_editor_colorset;
}
if(!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset)
if((!$editor_config->sel_comment_editor_colorset && $editor_default_config->sel_comment_editor_colorset) || $editor_config->default_editor_settings === 'Y')
{
$editor_config->sel_comment_editor_colorset = $editor_default_config->sel_comment_editor_colorset;
}
if(!$editor_config->comment_content_style && $editor_default_config->comment_content_style)
if(!$editor_config->comment_content_style || $editor_config->default_editor_settings === 'Y')
{
$editor_config->comment_content_style = $editor_default_config->comment_content_style;
$editor_config->comment_content_style = ($editor_default_config->comment_content_style) ? $editor_default_config->comment_content_style : 'ckeditor_light';
}
return $editor_config;

View file

@ -108,7 +108,7 @@ class editorView extends editor
$info = $oModuleModel->loadSkinInfo($this->module_path,$style,'styles');
$content_style_list[$style] = new stdClass();
$content_style_list[$style]->title = $info->title;
}
}
Context::set('content_style_list', $content_style_list);
// Get a group list
$oMemberModel = getModel('member');
@ -121,7 +121,7 @@ class editorView extends editor
$security->encodeHTML('group_list..title');
$security->encodeHTML('group_list..description');
$security->encodeHTML('content_style_list..');
$security->encodeHTML('editor_comment_colorset_list..title');
$security->encodeHTML('editor_comment_colorset_list..title');
// Set a template file
$oTemplate = &TemplateHandler::getInstance();

View file

@ -41,6 +41,7 @@ $lang->msg_auto_saved = 'Automatically Saved.';
$lang->cmd_disable = 'Inactive';
$lang->cmd_enable = 'Active';
$lang->cmd_select_cover = 'Be a cover image';
$lang->default_editor_settings = 'Default settings for this module';
$lang->editor_skin = 'Editor Skin';
$lang->upload_file_grant = 'Permission to upload files';
$lang->enable_default_component_grant = 'Permission to use default components';
@ -49,6 +50,7 @@ $lang->enable_html_grant = 'Permission to edit HTML';
$lang->enable_autosave = 'Enable Auto-Save';
$lang->height_resizable = 'Height Resizable';
$lang->editor_height = 'Height of Editor';
$lang->about_default_editor_settings = 'Follow editor settings of Rhymix Admin page through whole site.';
$lang->about_content_font = 'Please use comma for multiple input.';
$lang->about_content_font_size = 'Please input units such as px or em.';
$lang->about_enable_autosave = 'You may decide whether the auto-save function will be used.';

View file

@ -42,6 +42,7 @@ $lang->msg_auto_saved = '자동 저장되었습니다.';
$lang->cmd_disable = '비활성';
$lang->cmd_enable = '활성';
$lang->cmd_select_cover = '커버이미지로 선택';
$lang->default_editor_settings = '기본 에디터 설정 사용';
$lang->editor_skin = '에디터 스킨';
$lang->upload_file_grant = '파일 첨부 권한';
$lang->enable_default_component_grant = '기본 컴포넌트 사용 권한';
@ -50,6 +51,7 @@ $lang->enable_html_grant = 'HTML 편집 권한';
$lang->enable_autosave = '자동저장 사용';
$lang->height_resizable = '높이 조절 가능';
$lang->editor_height = '에디터 높이';
$lang->about_default_editor_settings = '사이트 전체 에디터 설정을 통일하여서 모듈별 에디터 설정을 단순하게 합니다.';
$lang->about_content_font = '콤마(,)로 여러 폰트를 지정할 수 있습니다.';
$lang->about_content_font_size = '12px, 1em등 단위까지 포함해서 입력해주세요.';
$lang->about_enable_autosave = '글 작성 시 자동 저장 기능을 활성화 시킬 수 있습니다.';

View file

@ -18,6 +18,15 @@
</thead>
<tbody>
<tr>
<th scope="row" style="text-align:right">{$lang->default_editor_settings}</th>
<td colspan="2">
<label for="default_editor_settings" class="x_inline">
<input type="checkbox" value="Y" id="default_editor_settings" name="default_editor_settings" checked="checked"|cond="$editor_config->default_editor_settings!=='N'" />
{$lang->about_default_editor_settings}
</label>
</td>
</tr>
<tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->editor_skin}</th>
<td>
<select name="editor_skin" onchange="getEditorSkinColorList(this.value, null, 'document')">
@ -38,7 +47,7 @@
</select>
</td>
</tr>
<tr>
<tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->content_style}</th>
<td>
<select name="content_style">
@ -51,7 +60,7 @@
</select>
</td>
</tr>
<tr>
<tr class="editor_skin">
<th scope="row" style="text-align:right">{$lang->editor_height}</th>
<td>
<input type="number" min="0" name="editor_height" value="{$editor_config->editor_height}" /> px
@ -60,14 +69,14 @@
<input type="number" min="0" name="comment_editor_height" value="{$editor_config->comment_editor_height}" /> px
</td>
</tr>
<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}
</td>
</tr>
<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>
</tr>
@ -122,3 +131,20 @@
<button class="x_btn x_btn-primary x_pull-right" type="submit">{$lang->cmd_save}</button>
</div>
</form>
<script>
jQuery(function($){
var editor_skiin_module_cfg = $('tr.editor_skin');
if($('#default_editor_settings').prop( 'checked' ))
{
editor_skiin_module_cfg.hide();
}
$('#default_editor_settings').change(function(){
if($(this).prop( 'checked' )){
editor_skiin_module_cfg.slideUp(200);
} else {
editor_skiin_module_cfg.slideDown(200);
}
});
});
</script>