From c738b1997a429b11134cb209f4e351713578fa3f Mon Sep 17 00:00:00 2001 From: ngleader Date: Tue, 21 Feb 2012 00:46:09 +0000 Subject: [PATCH] Issue 1294 a bug of setting up grants on the editor. git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10139 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/editor/editor.controller.php | 47 +++++++------------- modules/editor/tpl/editor_module_config.html | 16 +++---- 2 files changed, 25 insertions(+), 38 deletions(-) diff --git a/modules/editor/editor.controller.php b/modules/editor/editor.controller.php index 443005077..ce029692f 100644 --- a/modules/editor/editor.controller.php +++ b/modules/editor/editor.controller.php @@ -96,37 +96,24 @@ $editor_config->sel_editor_colorset = Context::get('sel_editor_colorset'); $editor_config->sel_comment_editor_colorset = Context::get('sel_comment_editor_colorset'); - $enable_html_grant = trim(Context::get('enable_html_grant')); - if($enable_html_grant) $editor_config->enable_html_grant = explode('|@|', $enable_html_grant); - else $editor_config->enable_html_grant = array(); + $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'); - $enable_comment_html_grant = trim(Context::get('enable_comment_html_grant')); - if($enable_comment_html_grant) $editor_config->enable_comment_html_grant = explode('|@|', $enable_comment_html_grant); - else $editor_config->enable_comment_html_grant = array(); - - $upload_file_grant = trim(Context::get('upload_file_grant')); - if($upload_file_grant) $editor_config->upload_file_grant = explode('|@|', $upload_file_grant); - else $editor_config->upload_file_grant = array(); - - $comment_upload_file_grant = trim(Context::get('comment_upload_file_grant')); - if($comment_upload_file_grant) $editor_config->comment_upload_file_grant = explode('|@|', $comment_upload_file_grant); - else $editor_config->comment_upload_file_grant = array(); - - $enable_default_component_grant = trim(Context::get('enable_default_component_grant')); - if($enable_default_component_grant) $editor_config->enable_default_component_grant = explode('|@|', $enable_default_component_grant); - else $editor_config->enable_default_component_grant = array(); - - $enable_comment_default_component_grant = trim(Context::get('enable_comment_default_component_grant')); - if($enable_comment_default_component_grant) $editor_config->enable_comment_default_component_grant = explode('|@|', $enable_comment_default_component_grant); - else $editor_config->enable_comment_default_component_grant = array(); - - $enable_component_grant = trim(Context::get('enable_component_grant')); - if($enable_component_grant) $editor_config->enable_component_grant = explode('|@|', $enable_component_grant); - else $editor_config->enable_component_grant = array(); - - $enable_comment_component_grant = trim(Context::get('enable_comment_component_grant')); - if($enable_comment_component_grant) $editor_config->enable_comment_component_grant = explode('|@|', $enable_comment_component_grant); - else $editor_config->enable_comment_component_grant = array(); + foreach($grants as $key) + { + $grant = Context::get($key); + if(!$grant) + { + $editor_config->{$key} = array(); + } + else if(is_array($grant)) + { + $editor_config->{$key} = $grant; + } + else + { + $editor_config->{$key} = explode('|@|', $grant); + } + } $editor_config->editor_height = (int)Context::get('editor_height'); diff --git a/modules/editor/tpl/editor_module_config.html b/modules/editor/tpl/editor_module_config.html index a7330af14..21dcada8c 100644 --- a/modules/editor/tpl/editor_module_config.html +++ b/modules/editor/tpl/editor_module_config.html @@ -112,12 +112,12 @@ - enable_html_grant))-->checked="checked"/> + enable_html_grant))-->checked="checked"/> - enable_comment_html_grant))-->checked="checked"/> + enable_comment_html_grant))-->checked="checked"/> @@ -128,12 +128,12 @@ - upload_file_grant))-->checked="checked"/> + upload_file_grant))-->checked="checked"/> - comment_upload_file_grant))-->checked="checked"/> + comment_upload_file_grant))-->checked="checked"/> @@ -144,12 +144,12 @@ - enable_default_component_grant))-->checked="checked"/> + enable_default_component_grant))-->checked="checked"/> - enable_comment_default_component_grant))-->checked="checked"/> + enable_comment_default_component_grant))-->checked="checked"/> @@ -160,12 +160,12 @@ - enable_component_grant))-->checked="checked"/> + enable_component_grant))-->checked="checked"/> - enable_comment_component_grant))-->checked="checked"/> + enable_comment_component_grant))-->checked="checked"/>