Browse Source

Add toolbar "TitleAsHtml" when conf value "save_titles_as_html" is set BT#15259

Julio Montoya 5 years ago
parent
commit
550e3dc7c0

+ 1 - 1
main/admin/course_category.php

@@ -106,7 +106,7 @@ if ($action == 'add' || $action == 'edit') {
             get_lang('CategoryName'),
             true,
             false,
-            ['ToolbarSet' => 'Minimal']
+            ['ToolbarSet' => 'TitleAsHtml']
         );
     } else {
         $form->addElement('text', 'name', get_lang("CategoryName"));

+ 1 - 1
main/course_description/add.php

@@ -68,7 +68,7 @@ if (api_get_configuration_value('save_titles_as_html')) {
         get_lang('Title'),
         true,
         false,
-        ['ToolbarSet' => 'Minimal']
+        ['ToolbarSet' => 'TitleAsHtml']
     );
 } else {
     $form->addText('title', get_lang('Title'));

+ 1 - 1
main/course_description/edit.php

@@ -86,7 +86,7 @@ if (api_get_configuration_value('save_titles_as_html')) {
         get_lang('Title'),
         true,
         false,
-        ['ToolbarSet' => 'Minimal']
+        ['ToolbarSet' => 'TitleAsHtml']
     );
 } else {
     $form->addText('title', get_lang('Title'));

+ 1 - 1
main/course_progress/thematic.php

@@ -237,7 +237,7 @@ if ($action == 'thematic_list') {
             get_lang('Title'),
             true,
             false,
-            ['ToolbarSet' => 'Minimal']
+            ['ToolbarSet' => 'TitleAsHtml']
         );
     } else {
         $form->addText('title', get_lang('Title'), true, ['size' => '50']);

+ 1 - 1
main/exercise/ReadingComprehension.php

@@ -141,7 +141,7 @@ class ReadingComprehension extends UniqueAnswer
         $form->addTextarea('questionDescription', get_lang('Text'), ['rows' => 20]);
         // question name
         if (api_get_configuration_value('save_titles_as_html')) {
-            $editorConfig = ['ToolbarSet' => 'Minimal'];
+            $editorConfig = ['ToolbarSet' => 'TitleAsHtml'];
             $form->addHtmlEditor(
                 'questionName',
                 get_lang('Question'),

+ 1 - 1
main/exercise/exercise.class.php

@@ -1902,7 +1902,7 @@ class Exercise
                 get_lang('ExerciseName'),
                 false,
                 false,
-                ['ToolbarSet' => 'Minimal']
+                ['ToolbarSet' => 'TitleAsHtml']
             );
         } else {
             $form->addElement(

+ 1 - 1
main/exercise/question.class.php

@@ -1600,7 +1600,7 @@ abstract class Question
 
         // question name
         if (api_get_configuration_value('save_titles_as_html')) {
-            $editorConfig = ['ToolbarSet' => 'Minimal'];
+            $editorConfig = ['ToolbarSet' => 'TitleAsHtml'];
             $form->addHtmlEditor(
                 'questionName',
                 get_lang('Question'),

+ 2 - 2
main/glossary/index.php

@@ -93,7 +93,7 @@ switch ($action) {
                 get_lang('TermName'),
                 false,
                 false,
-                ['ToolbarSet' => 'Minimal']
+                ['ToolbarSet' => 'TitleAsHtml']
             );
         } else {
             $form->addElement('text', 'name', get_lang('TermName'), ['id' => 'glossary_title']);
@@ -157,7 +157,7 @@ switch ($action) {
                     get_lang('TermName'),
                     false,
                     false,
-                    ['ToolbarSet' => 'Minimal']
+                    ['ToolbarSet' => 'TitleAsHtml']
                 );
             } else {
                 $form->addElement('text', 'name', get_lang('TermName'), ['id' => 'glossary_title']);

+ 1 - 1
main/lp/lp_add.php

@@ -103,7 +103,7 @@ if (api_get_configuration_value('save_titles_as_html')) {
         get_lang('LPName'),
         true,
         false,
-        ['ToolbarSet' => 'Minimal', 'Height' => '100']
+        ['ToolbarSet' => 'TitleAsHtml']
     );
 } else {
     $form->addElement(

+ 1 - 1
main/lp/lp_add_category.php

@@ -37,7 +37,7 @@ if (api_get_configuration_value('save_titles_as_html')) {
         get_lang('Name'),
         true,
         false,
-        ['ToolbarSet' => 'Minimal', 'Height' => '100']
+        ['ToolbarSet' => 'TitleAsHtml']
     );
 } else {
     $form->addText('name', get_lang('Name'), true);

+ 2 - 2
main/lp/lp_edit.php

@@ -65,7 +65,7 @@ $form = new FormValidator(
 );
 
 // Form title
-$form->addElement('header', get_lang('EditLPSettings'));
+$form->addElement('header', get_lang('Edit'));
 
 // Title
 if (api_get_configuration_value('save_titles_as_html')) {
@@ -74,7 +74,7 @@ if (api_get_configuration_value('save_titles_as_html')) {
         get_lang('LPName'),
         true,
         false,
-        ['ToolbarSet' => 'Minimal', 'Height' => '100']
+        ['ToolbarSet' => 'TitleAsHtml']
     );
 } else {
     $form->addElement('text', 'lp_name', api_ucfirst(get_lang('LearnpathTitle')), ['size' => 43]);

+ 1 - 1
main/portfolio/add_category.php

@@ -5,7 +5,7 @@ use Chamilo\CoreBundle\Entity\PortfolioCategory;
 
 $form = new FormValidator('add_category', 'post', "$baseUrl&action=add_category");
 if (api_get_configuration_value('save_titles_as_html')) {
-    $form->addHtmlEditor('title', get_lang('Title'), true, false, ['ToolbarSet' => 'NotebookStudent']);
+    $form->addHtmlEditor('title', get_lang('Title'), true, false, ['ToolbarSet' => 'TitleAsHtml']);
 } else {
     $form->addText('title', get_lang('Title'));
     $form->applyFilter('title', 'trim');

+ 1 - 1
main/portfolio/add_item.php

@@ -11,7 +11,7 @@ $categories = $em
 
 $form = new FormValidator('add_portfolio', 'post', $baseUrl.'action=add_item');
 if (api_get_configuration_value('save_titles_as_html')) {
-    $form->addHtmlEditor('title', get_lang('Title'), true, false, ['ToolbarSet' => 'NotebookStudent']);
+    $form->addHtmlEditor('title', get_lang('Title'), true, false, ['ToolbarSet' => 'TitleAsHtml']);
 } else {
     $form->addText('title', get_lang('Title'));
     $form->applyFilter('title', 'trim');

+ 1 - 1
main/portfolio/edit_category.php

@@ -3,7 +3,7 @@
 
 $form = new FormValidator('edit_category', 'post', $baseUrl."action=edit_category&id={$category->getId()}");
 if (api_get_configuration_value('save_titles_as_html')) {
-    $form->addHtmlEditor('title', get_lang('Title'), true, false, ['ToolbarSet' => 'NotebookStudent']);
+    $form->addHtmlEditor('title', get_lang('Title'), true, false, ['ToolbarSet' => 'TitleAsHtml']);
 } else {
     $form->addText('title', get_lang('Title'));
     $form->applyFilter('title', 'trim');

+ 1 - 1
main/portfolio/edit_item.php

@@ -9,7 +9,7 @@ $categories = $em
 
 $form = new FormValidator('edit_portfolio', 'post', $baseUrl."action=edit_item&id={$item->getId()}");
 if (api_get_configuration_value('save_titles_as_html')) {
-    $form->addHtmlEditor('title', get_lang('Title'), true, false, ['ToolbarSet' => 'NotebookStudent']);
+    $form->addHtmlEditor('title', get_lang('Title'), true, false, ['ToolbarSet' => 'TitleAsHtml']);
 } else {
     $form->addText('title', get_lang('Title'));
     $form->applyFilter('title', 'trim');

+ 44 - 0
src/Chamilo/CoreBundle/Component/Editor/CkEditor/Toolbar/TitleAsHtml.php

@@ -0,0 +1,44 @@
+<?php
+/* For licensing terms, see /license.txt */
+
+namespace Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar;
+
+/**
+ * Toolbar used to allow titles to have an HTML format.
+ *
+ * @package Chamilo\CoreBundle\Component\Editor\CkEditor\Toolbar
+ */
+class TitleAsHtml extends Basic
+{
+    /**
+     * @return mixed
+     */
+    public function getConfig()
+    {
+        $config['toolbar'] = [
+            [
+                'name' => 'clipboard',
+                'groups' => ['clipboard', 'undo'],
+                'items' => ['Cut', 'Copy', 'Paste', '-', 'Undo', 'Redo'],
+            ],
+            [
+                'name' => 'basicstyles',
+                'groups' => ['basicstyles', 'cleanup'],
+                'items' => ['Bold', 'Italic', 'Underline', 'Strike', 'TextColor', 'BGColor'],
+            ],
+//            [
+//                'name' => 'paragraph',
+//                'groups' => ['list', 'indent', 'blocks', 'align', 'bidi'],
+//                'items' => ['NumberedList', 'BulletedList', '-', 'Outdent', 'Indent'],
+//            ],
+            [
+                'name' => 'links',
+                'items' => ['Link', 'Unlink', 'Source'],
+            ],
+        ];
+
+        $config['height'] = '100';
+
+        return $config;
+    }
+}