From e1845c7d3b3cb19da2bcd783bf4840c45e0e03b9 Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Tue, 28 Apr 2015 13:54:39 +0200 Subject: [PATCH] Fix fullpage when creating/editing a document. --- .../lib/formvalidator/FormValidator.class.php | 4 +- .../javascript/editor/ckeditor/config_js.tpl | 2 +- .../Editor/CkEditor/Toolbar/Basic.php | 60 ++++++++-------- .../Editor/CkEditor/Toolbar/Documents.php | 43 +++++++++--- .../CkEditor/Toolbar/DocumentsStudent.php | 69 +++++++++++++++++-- .../CoreBundle/Component/Editor/Editor.php | 6 +- 6 files changed, 133 insertions(+), 51 deletions(-) diff --git a/main/inc/lib/formvalidator/FormValidator.class.php b/main/inc/lib/formvalidator/FormValidator.class.php index 0c3f4901d7..b9e4687833 100755 --- a/main/inc/lib/formvalidator/FormValidator.class.php +++ b/main/inc/lib/formvalidator/FormValidator.class.php @@ -676,7 +676,7 @@ EOT; /** * Adds a HTML-editor to the form * @param string $name - * @param string $label The label for the form-element + * @param string $label The label for the form-element * @param bool $required (optional) Is the form-element required (default=true) * @param bool $fullPage (optional) When it is true, the editor loads completed html code for a full page. * @param array $config (optional) Configuration settings for the online editor. @@ -695,7 +695,7 @@ EOT; $element = $this->getElement($name); if ($fullPage) { - $config['FullPage'] = true; + $config['fullPage'] = true; } if ($element->editor) { diff --git a/main/template/default/javascript/editor/ckeditor/config_js.tpl b/main/template/default/javascript/editor/ckeditor/config_js.tpl index 4f3438fa69..ea8e8b9871 100644 --- a/main/template/default/javascript/editor/ckeditor/config_js.tpl +++ b/main/template/default/javascript/editor/ckeditor/config_js.tpl @@ -1,6 +1,6 @@ /* Ckeditor global configuration file */ -CKEDITOR.editorConfig = function( config ) { +CKEDITOR.editorConfig = function (config) { // Define changes to default configuration here. // For complete reference see: // http://docs.ckeditor.com/#!/api/CKEDITOR.config diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php index 637e76d964..992a77ff02 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Basic.php @@ -17,7 +17,7 @@ class Basic extends Toolbar * @var array */ public $defaultPlugins = array( - 'adobeair', + 'adobeair', 'ajax', 'audio', 'bidi', @@ -26,7 +26,8 @@ class Basic extends Toolbar 'dialogui', 'dialogadvtab', 'div', - 'divarea', + //if you activate this plugin the html, head tags will not be saved + //'divarea', 'docprops', 'find', 'flash', @@ -34,30 +35,30 @@ class Basic extends Toolbar 'iframe', 'iframedialog', 'indentblock', - 'justify', - 'language', - 'lineutils', - 'liststyle', - 'newpage', - 'oembed', - 'pagebreak', - 'preview', - 'print', - 'save', - 'selectall', - 'sharedspace', - 'showblocks', - 'smiley', - 'sourcedialog', - 'stylesheetparser', - 'tableresize', - 'templates', - 'uicolor', - 'video', - 'widget', - 'wikilink', - 'wordcount', - 'xml' + 'justify', + 'language', + 'lineutils', + 'liststyle', + 'newpage', + 'oembed', + 'pagebreak', + 'preview', + 'print', + 'save', + 'selectall', + 'sharedspace', + 'showblocks', + 'smiley', + 'sourcedialog', + 'stylesheetparser', + 'tableresize', + 'templates', + 'uicolor', + 'video', + 'widget', + 'wikilink', + 'wordcount', + 'xml' ); /** @@ -114,9 +115,9 @@ class Basic extends Toolbar $plugins[] = 'mapping'; } - if (api_get_setting('block_copy_paste_for_students') == 'true') { + /*if (api_get_setting('block_copy_paste_for_students') == 'true') { // Missing - } + }*/ if (api_get_setting('more_buttons_maximized_mode') == 'true') { $plugins[] = 'toolbarswitch'; @@ -136,6 +137,7 @@ class Basic extends Toolbar */ public function getConfig() { + $config = array(); if (api_get_setting('more_buttons_maximized_mode') == 'true') { $config['toolbar_minToolbar'] = $this->getMinimizedToolbar(); @@ -156,8 +158,6 @@ class Basic extends Toolbar //$config['oembed_maxWidth'] = '560'; //$config['oembed_maxHeight'] = '315'; - //$config['allowedContent'] = true; - /*$config['wordcount'] = array( // Whether or not you want to show the Word Count 'showWordCount' => true, diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php index d50ac39d7d..0655a6a1ca 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/Documents.php @@ -6,7 +6,7 @@ namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar; /** * Documents toolbar configuration * - * @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar * + * @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar */ class Documents extends Basic { @@ -18,6 +18,7 @@ class Documents extends Basic */ public function getConfig() { + $config = array(); if (api_get_setting('more_buttons_maximized_mode') != 'true') { $config['toolbar'] = $this->getNormalToolbar(); } else { @@ -25,8 +26,6 @@ class Documents extends Basic } $config['extraPlugins'] = $this->getPluginsToString(); - //$config['mathJaxLib'] = $this->urlGenerator->generate('javascript').'/math_jax/MathJax.js?config=default'; - //$config['mathJaxLib'] = api_get_path(WEB_LIBRARY_JS_PATH).'/math_jax/MathJax.js?config=default'; $config['fullPage'] = true; return $config; @@ -53,9 +52,18 @@ class Documents extends Basic protected function getNormalToolbar() { return [ - ['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], + ['Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], ['Link', 'Unlink', 'Anchor', 'Glossary'], - ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio', 'Asciimath', 'Asciisvg'], + [ + 'Image', + 'Video', + 'Flash', + 'Oembed', + 'Youtube', + 'Audio', + 'Asciimath', + 'Asciisvg', + ], ['Table', 'SpecialChar'], [ 'Outdent', @@ -86,12 +94,31 @@ class Documents extends Basic return [ ['Save', 'NewPage', 'Templates', '-', 'PasteFromWord'], ['Undo', 'Redo'], - ['Link', 'Image', 'Video', 'Flash', 'Youtube', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + [ + 'Link', + 'Image', + 'Video', + 'Flash', + 'Youtube', + 'Audio', + 'Table', + 'Asciimath', + 'Asciisvg', + ], ['BulletedList', 'NumberedList', 'HorizontalRule'], ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'], - ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor', 'Source'], + [ + 'Format', + 'Font', + 'FontSize', + 'Bold', + 'Italic', + 'Underline', + 'TextColor', + 'BGColor', + 'Source', + ], ['Toolbarswitch', 'ShowBlocks'] ]; } - } diff --git a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php index 1a9981b6b9..b4c0a51a7f 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php +++ b/src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/DocumentsStudent.php @@ -24,6 +24,7 @@ class DocumentsStudent extends Basic $config['toolbar_maxToolbar'] = $this->getMaximizedToolbar(); } + $config['extraPlugins'] = $this->getPluginsToString(); $config['fullPage'] = true; return $config; @@ -36,7 +37,7 @@ class DocumentsStudent extends Basic protected function getMaximizedToolbar() { return [ - ['Save', 'NewPage', 'Templates', '-', 'Preview', 'Print'], + ['NewPage', 'Templates', '-', 'Preview', 'Print'], ['Cut', 'Copy', 'Paste', 'PasteText', 'PasteFromWord'], ['Undo', 'Redo', '-', 'SelectAll', 'Find', '-', 'RemoveFormat'], ['Link', 'Unlink', 'Anchor', 'Glossary'], @@ -56,9 +57,28 @@ class DocumentsStudent extends Basic ], '/', ['Table', '-', 'CreateDiv'], - ['BulletedList', 'NumberedList', 'HorizontalRule', '-', 'Outdent', 'Indent', 'Blockquote'], + [ + 'BulletedList', + 'NumberedList', + 'HorizontalRule', + '-', + 'Outdent', + 'Indent', + 'Blockquote', + ], ['JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyBlock'], - ['Bold', 'Italic', 'Underline', 'Strike', '-', 'Subscript', 'Superscript', '-', 'TextColor', 'BGColor'], + [ + 'Bold', + 'Italic', + 'Underline', + 'Strike', + '-', + 'Subscript', + 'Superscript', + '-', + 'TextColor', + 'BGColor', + ], [api_get_setting('allow_spellcheck') == 'true' ? 'Scayt' : ''], ['Styles', 'Format', 'Font', 'FontSize'], ['PageBreak', 'ShowBlocks'], @@ -75,9 +95,26 @@ class DocumentsStudent extends Basic return [ ['Save', 'Maximize', 'PasteFromWord', '-', 'Undo', 'Redo'], ['Link', 'Unlink', 'Anchor'], - ['Image', 'Video', 'Flash', 'Oembed', 'Youtube', 'Audio', 'Asciimath'], + [ + 'Image', + 'Video', + 'Flash', + 'Oembed', + 'Youtube', + 'Audio', + 'Asciimath', + ], ['Table', 'SpecialChar'], - ['Outdent', 'Indent', '-', 'TextColor', 'BGColor', '-', 'OrderedList', 'UnorderedList'], + [ + 'Outdent', + 'Indent', + '-', + 'TextColor', + 'BGColor', + '-', + 'OrderedList', + 'UnorderedList', + ], '/', ['Styles', 'Format', 'Font', 'FontSize'], ['Bold', 'Italic', 'Underline'], @@ -95,10 +132,28 @@ class DocumentsStudent extends Basic return [ ['Save', 'NewPage', 'Templates', '-', 'PasteFromWord'], ['Undo', 'Redo'], - ['Link', 'Image', 'Video', 'Flash', 'Audio', 'Table', 'Asciimath', 'Asciisvg'], + [ + 'Link', + 'Image', + 'Video', + 'Flash', + 'Audio', + 'Table', + 'Asciimath', + 'Asciisvg', + ], ['BulletedList', 'NumberedList', 'HorizontalRule'], ['JustifyLeft', 'JustifyCenter', 'JustifyBlock'], - ['Format', 'Font', 'FontSize', 'Bold', 'Italic', 'Underline', 'TextColor', 'BGColor'], + [ + 'Format', + 'Font', + 'FontSize', + 'Bold', + 'Italic', + 'Underline', + 'TextColor', + 'BGColor', + ], ['Toolbarswitch'] ]; } diff --git a/src/Chamilo/CoreBundle/Component/Editor/Editor.php b/src/Chamilo/CoreBundle/Component/Editor/Editor.php index d0ce012c1c..0a7ee99151 100644 --- a/src/Chamilo/CoreBundle/Component/Editor/Editor.php +++ b/src/Chamilo/CoreBundle/Component/Editor/Editor.php @@ -3,10 +3,9 @@ namespace Chamilo\CoreBundle\Component\Editor; -use Symfony\Component\Translation\Translator; -use Symfony\Component\Routing\RouterInterface; -use Chamilo\CoreBundle\Entity\Course; use Chamilo\CoreBundle\Framework\Template; +use Symfony\Component\Routing\RouterInterface; +use Symfony\Component\Translation\Translator; /** * Class Editor @@ -202,6 +201,7 @@ class Editor $this->setConfigAttribute('height', $value); break; case 'FullPage': + case 'fullPage': $this->setConfigAttribute('fullPage', $value); break; default: