Browse Source

[svn r21910] FS#2867 - The FCKEditor: Starting to simplify configuration of the online editor.

Ivan Tcholakov 15 years ago
parent
commit
9fdbae7f41

+ 15 - 1
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;

+ 5 - 2
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';

+ 18 - 3
main/inc/lib/formvalidator/Element/html_editor.php

@@ -1,5 +1,5 @@
 <?php
-// $Id: html_editor.php 18283 2009-02-06 13:24:32Z ivantcholakov $
+// $Id: html_editor.php 21910 2009-07-08 19:49:15Z ivantcholakov $
 /*
 ==============================================================================
 	Dokeos - elearning and course management software
@@ -39,7 +39,7 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
 	 * @param   string  HTML editor  label
 	 * @param   string  Attributes for the textarea
 	 */
-	function HTML_QuickForm_html_editor($elementName = null, $elementLabel = null, $attributes = null)
+	function HTML_QuickForm_html_editor($elementName = null, $elementLabel = null, $attributes = null, $config = null)
 	{
 		global $fck_attribute;
 
@@ -54,9 +54,24 @@ class HTML_QuickForm_html_editor extends HTML_QuickForm_textarea
 		$this->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'];
+			}
+		}
 	}
 	
 	/**