From 226908f7abbe4e81cb8edda36c1c0943708f03cf Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Thu, 27 May 2010 14:37:37 +0000 Subject: [PATCH] enable toggling of plain to CKEDITOR in felamimail; documenting changes to ckeditor with phpgwapi/js/ckeditor3/egw_integration.txt --- phpgwapi/inc/class.html.inc.php | 22 ++++++++++------- phpgwapi/js/ckeditor3/ckeditor_php5.php | 4 +-- phpgwapi/js/ckeditor3/egw_integration.txt | 30 +++++++++++++++++++++++ 3 files changed, 45 insertions(+), 11 deletions(-) create mode 100644 phpgwapi/js/ckeditor3/egw_integration.txt diff --git a/phpgwapi/inc/class.html.inc.php b/phpgwapi/inc/class.html.inc.php index 4ab406bcd3..b7621a886f 100644 --- a/phpgwapi/inc/class.html.inc.php +++ b/phpgwapi/inc/class.html.inc.php @@ -584,7 +584,13 @@ class html } // run content through htmlpurifier if ($_purify && !empty($_content)) $_content = self::purify($_content); + $oCKeditor = self::initCKEditor($_height, $_mode); + + return $oCKeditor->editor($_name, $_content); + } + static function &initCKEditor($_height, $_mode) + { include_once(EGW_INCLUDE_ROOT."/phpgwapi/js/ckeditor3/ckeditor.php"); //Get the ckeditor base url @@ -592,12 +598,8 @@ class html $oCKeditor = new CKeditor($basePath); $oCKeditor->returnOutput = true; - - //Only heights with "px" set are supported - $pxheight = (strpos('px', $_height) === false) ? 400 : str_replace('px', '', $_height); $oCKeditor->config['customConfig'] = 'ckeditor.egwconfig.js'; - $oCKeditor->config['height'] = $pxheight; $oCKeditor->config['resize_enabled'] = false; //switching the encoding as html entities off, as we correctly handle charsets and it messes up the wiki totally @@ -609,6 +611,9 @@ class html $oCKeditor->config['filebrowserBrowseUrl'] = 'index.php?menuaction=filemanager.filemanager_select.select&mode=open&method=ckeditor_return&path='.urlencode($_start_path); $oCKeditor->config['filebrowserWindowWidth'] = 640; $oCKeditor->config['filebrowserWindowHeight'] = 580; + //Only heights with "px" set are supported + $pxheight = (strpos('px', $_height) === false) ? 400 : str_replace('px', '', $_height); + $oCKeditor->config['height'] = $pxheight; // By default the editor start expanded if ($_options['toolbar_expanded'] == 'false') @@ -630,13 +635,13 @@ class html switch ($GLOBALS['egw_info']['user']['preferences']['common']['rte_enter_mode']) { case 'p': - $oCKeditor->config['enterMode'] = '@@CKEDITOR.ENTER_P'; + $oCKeditor->config['enterMode'] = 1;//'@@CKEDITOR.ENTER_P'; break; case 'br': - $oCKeditor->config['enterMode'] = '@@CKEDITOR.ENTER_BR'; + $oCKeditor->config['enterMode'] = 2;//'@@CKEDITOR.ENTER_BR'; break; case 'div': - $oCKeditor->config['enterMode'] = '@@CKEDITOR.ENTER_DIV'; + $oCKeditor->config['enterMode'] = 3;//'@@CKEDITOR.ENTER_DIV'; break; } } @@ -680,8 +685,7 @@ class html $oCKeditor->config['toolbar'] = 'egw_advanced'; break; } - - return $oCKeditor->editor($_name, $_content); + return $oCKeditor; } /** diff --git a/phpgwapi/js/ckeditor3/ckeditor_php5.php b/phpgwapi/js/ckeditor3/ckeditor_php5.php index 112577684a..f823b59a47 100644 --- a/phpgwapi/js/ckeditor3/ckeditor_php5.php +++ b/phpgwapi/js/ckeditor3/ckeditor_php5.php @@ -431,7 +431,7 @@ class CKEditor /** * Initializes CKEditor (executed only once). */ - private function init() + public function init() { static $initComplete; $out = ""; @@ -522,7 +522,7 @@ class CKEditor * @param mixed $val * @return string */ - private function jsEncode($val) + public function jsEncode($val) { if (is_null($val)) { return 'null'; diff --git a/phpgwapi/js/ckeditor3/egw_integration.txt b/phpgwapi/js/ckeditor3/egw_integration.txt new file mode 100644 index 0000000000..8519c8c97b --- /dev/null +++ b/phpgwapi/js/ckeditor3/egw_integration.txt @@ -0,0 +1,30 @@ +--------------- step 1 -------------------------------------- +removed _samples directory +--------------- step 2 -------------------------------------- +making functions init() and jsEncode Public +(used in felamimail/inc/class.uicompose.inc.php to initalize the ckeditor in any case (plaintext/html)) +see patch below: + +Index: phpgwapi/js/ckeditor3/ckeditor_php5.php +=================================================================== +--- phpgwapi/js/ckeditor3/ckeditor_php5.php (Revision 30397) ++++ phpgwapi/js/ckeditor3/ckeditor_php5.php (Arbeitskopie) +@@ -431,7 +431,7 @@ + /** + * Initializes CKEditor (executed only once). + */ +- private function init() ++ public function init() + { + static $initComplete; + $out = ""; +@@ -522,7 +522,7 @@ + * @param mixed $val + * @return string + */ +- private function jsEncode($val) ++ public function jsEncode($val) + { + if (is_null($val)) { + return 'null'; +