From e91a88e80d65c1b3ab865c555eb9b9bdd4db4e4c Mon Sep 17 00:00:00 2001 From: Hadi Nategh Date: Fri, 7 Aug 2015 15:51:15 +0000 Subject: [PATCH] WIP image upload via drag into ckeditor 4.5: -Add extraPlugins into ckeditor config -Activate imageUpload for mail compose htmlarea --- mail/templates/default/compose.xet | 2 +- .../inc/class.egw_ckeditor_config.inc.php | 29 +++++++++++++++++-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/mail/templates/default/compose.xet b/mail/templates/default/compose.xet index 4ff56ee26c..1876add68d 100644 --- a/mail/templates/default/compose.xet +++ b/mail/templates/default/compose.xet @@ -86,7 +86,7 @@ - + diff --git a/phpgwapi/inc/class.egw_ckeditor_config.inc.php b/phpgwapi/inc/class.egw_ckeditor_config.inc.php index e1d34d5cf6..a81bc896c5 100644 --- a/phpgwapi/inc/class.egw_ckeditor_config.inc.php +++ b/phpgwapi/inc/class.egw_ckeditor_config.inc.php @@ -309,7 +309,7 @@ drwxr-xr-x 3 kl kl 4096 Dez 9 14:26 office2013 ) { $spellchecker_button = 'SpellCheck'; - $config['extraPlugins'] = "aspell"; + self::append_extraPlugins_config_array($config, array("aspell")); } if ($GLOBALS['egw_info']['server']['enabled_spellcheck']!='YesNoSCAYT' && $GLOBALS['egw_info']['server']['enabled_spellcheck']!='YesBrowserBased' @@ -423,9 +423,34 @@ drwxr-xr-x 3 kl kl 4096 Dez 9 14:26 office2013 self::add_spellchecker_options($config, $spellchecker_button, $scayt_button); self::add_toolbar_options($config, $mode, $spellchecker_button, $scayt_button); //error_log(__METHOD__."('$mode', $height, ".array2string($expanded_toolbar).") returning ".array2string($config)); + // Add extra plugins + self::append_extraPlugins_config_array($config, array('uploadimage','uploadwidget','widget','notification','notificationaggregator','lineutils')); return $config; } - + + /** + * Adds extra + * @param array $config + * @param array $plugins plugins name which needs to be appended into extraPlugins + */ + public static function append_extraPlugins_config_array (&$config, $plugins) + { + if (is_array($plugins)) + { + foreach ($plugins as &$plugin) + { + if (!empty($config['extraPlugins']) && $config['extraPlugins'] !== '') + { + $config['extraPlugins'] .= ',' . $plugin; + } + else + { + $config['extraPlugins'] = $plugin; + } + } + } + } + /** * Returns a json encoded string containing the configuration for the ckeditor. * @param string $mode specifies the count of toolbar buttons available to the user. Possible