From 9fdbae7f419642823737cb9300d5ec94a218851a Mon Sep 17 00:00:00 2001 From: Ivan Tcholakov Date: Wed, 8 Jul 2009 21:49:15 +0200 Subject: [PATCH] [svn r21910] FS#2867 - The FCKEditor: Starting to simplify configuration of the online editor. --- main/inc/lib/fckeditor/fckeditor.php | 16 +++++++++++++- .../lib/fckeditor/toolbars/introduction.php | 7 +++++-- .../lib/formvalidator/Element/html_editor.php | 21 ++++++++++++++++--- 3 files changed, 38 insertions(+), 6 deletions(-) diff --git a/main/inc/lib/fckeditor/fckeditor.php b/main/inc/lib/fckeditor/fckeditor.php index 8113f507e1..2a09b4c04d 100644 --- a/main/inc/lib/fckeditor/fckeditor.php +++ b/main/inc/lib/fckeditor/fckeditor.php @@ -305,7 +305,9 @@ class FCKeditor $chars = array( '&' => '%26', '=' => '%3D', - '"' => '%22' ) ; + '"' => '%22', + '%' => '%25' + ) ; return strtr( $valueToEncode, $chars ) ; } @@ -403,6 +405,18 @@ class FCKeditor } } break; + case 'Width': + if (!isset($this->Config[$key])) { + $this->Config[$key] = (string) $value; + $this->Width = $this->Config[$key]; + } + break; + case 'Height': + if (!isset($this->Config[$key])) { + $this->Config[$key] = (string) $value; + $this->Height = $this->Config[$key]; + } + break; default: if (!isset($this->Config[$key])) { $this->Config[$key] = $value; diff --git a/main/inc/lib/fckeditor/toolbars/introduction.php b/main/inc/lib/fckeditor/toolbars/introduction.php index 7ceabaeb11..a77dcc5622 100644 --- a/main/inc/lib/fckeditor/toolbars/introduction.php +++ b/main/inc/lib/fckeditor/toolbars/introduction.php @@ -12,9 +12,12 @@ $config['ToolbarSets']['Introduction'] = array( array('Bold','Italic','Underline'), array('JustifyLeft','JustifyCenter','JustifyRight') ); + /* $config['ToolbarSets']['IntroductionMaximized'] = array( - array('NewPage','FitWindow','-','PasteWord','-','Undo','Redo','-','SelectAll'), - ... + array('FitWindow','-') // ... ); */ + +//$config['Width'] = '100%'; +//$config['Height'] = '300'; diff --git a/main/inc/lib/formvalidator/Element/html_editor.php b/main/inc/lib/formvalidator/Element/html_editor.php index a29867bbd1..7f7165ce27 100644 --- a/main/inc/lib/formvalidator/Element/html_editor.php +++ b/main/inc/lib/formvalidator/Element/html_editor.php @@ -1,5 +1,5 @@ fck_editor->ToolbarSet = $fck_attribute['ToolbarSet'] ; $this -> fck_editor->Width = !empty($fck_attribute['Width']) ? $fck_attribute['Width'] : '990'; $this -> fck_editor->Height = !empty($fck_attribute['Height']) ? $fck_attribute['Height'] : '400'; - //We get the optionnals config parameters in $fck_attribute array $this -> fck_editor->Config = !empty($fck_attribute['Config']) ? $fck_attribute['Config'] : array(); + + // This is an alternative (a better) way to pass configuration data to the editor. + if (is_array($config)) { + foreach ($config as $key => $value) { + $this->fck_editor->Config[$key] = $config[$key]; + } + if (isset($config['ToolbarSet'])) { + $this->fck_editor->ToolbarSet = $config['ToolbarSet']; + } + if (isset($config['Width'])) { + $this->fck_editor->Width = $config['Width']; + } + if (isset($config['Height'])) { + $this->fck_editor->Height = $config['Height']; + } + } } /**