From 63da71bc57140949072a8b5999708ab228d1d2e4 Mon Sep 17 00:00:00 2001 From: scyrma Date: Thu, 5 Jun 2008 09:09:24 +0000 Subject: [PATCH] MDL-14741 - Adding default configuration for tinymce --- lib/editor/htmlEditor.class.php | 129 ++++++++++++++++++++++++++++ lib/editor/tinymce.js.php | 146 ++++++++++++++++++++++++++++++++ 2 files changed, 275 insertions(+) create mode 100644 lib/editor/htmlEditor.class.php create mode 100644 lib/editor/tinymce.js.php diff --git a/lib/editor/htmlEditor.class.php b/lib/editor/htmlEditor.class.php new file mode 100644 index 0000000000..588fa7d3b1 --- /dev/null +++ b/lib/editor/htmlEditor.class.php @@ -0,0 +1,129 @@ +defaulthtmleditor; + } + +/* + if ($editor == '') { + switch ($CFG->htmleditorselection) { + case '0': + return ''; + break; + + case '1': + $editor = 'tinymce'; + break; + + case '2': + $editor = 'fckeditor'; + break; + + case '3': + $editor = 'xinha'; + break; + + case '4': + $editor = 'yuirte'; + break; + + default: + return ''; + break; + } + } +*/ + $configuration = ''; + + switch ($editor) { + + case 'tinymce': + $configuration = << + +EOF; + break; + + case 'fckeditor': + $configuration = << + +EOF; + break; + + + case 'xinha': + $configuration = << + _editor_url = "{$CFG->wwwroot}/lib/editor/xinha/" + _editor_lang = "en"; + _editor_skin = "blue-look"; + + + +EOF; + break; + + case 'yuirte': + $configuration = << + + + + + + + + + + + + + + + +EOF; + break; + + default: + break; + + } + + return $configuration; + + } + + public function activateEditor($name='', $id='') { + + $configuration = << +createHTMLArea('$id'); + +EOF; + + return $configuration; + + } + +} + +?> diff --git a/lib/editor/tinymce.js.php b/lib/editor/tinymce.js.php new file mode 100644 index 0000000000..cdb4f4b1d9 --- /dev/null +++ b/lib/editor/tinymce.js.php @@ -0,0 +1,146 @@ +editorhidebuttons); + +$editorhidebuttons1 = $editorhidebuttons . ',visualaid,styleselect'; + +$editorhidebuttons = 'theme_advanced_disable : "'.$editorhidebuttons1.'",'; + +$editorhidebuttons = str_replace('fontsize', 'fontsizeselect', $editorhidebuttons); +$editorhidebuttons = str_replace('subscript', 'sub', $editorhidebuttons); +$editorhidebuttons = str_replace('superscript', 'sup', $editorhidebuttons); +$editorhidebuttons = str_replace('insertorderedlist', 'numlist', $editorhidebuttons); +$editorhidebuttons = str_replace('insertunorderedlist', 'bullist', $editorhidebuttons); +$editorhidebuttons = str_replace('createanchor', 'anchor', $editorhidebuttons); +$editorhidebuttons = str_replace('createlink', 'link', $editorhidebuttons); +$editorhidebuttons = str_replace('htmlmode', 'code', $editorhidebuttons); +$editorhidebuttons = str_replace('insertchar', 'charmap', $editorhidebuttons); +$editorhidebuttons = str_replace('insertimage', 'image', $editorhidebuttons); +$editorhidebuttons = str_replace('inserthorizontalrule', 'hr', $editorhidebuttons); +$editorhidebuttons = str_replace('formatblock', 'formatselect', $editorhidebuttons); +$editorhidebuttons = str_replace('clean', 'cleanup,removeformat', $editorhidebuttons); + +// insertsmile, + +$pieces = explode(",", $editorhidebuttons1); + +$spellcheck = ''; +if (! in_array("spellcheck", $pieces)) { + $spellcheck = 'spellchecker,'; +} +$inserttable = ''; +if (! in_array("inserttable", $pieces)) { + $inserttable = 'tablecontrols,separator,'; +} +$search_replace = ''; +if (! in_array("search_replace", $pieces)) { + $search_replace = 'search,replace,separator,'; +} +$lefttoright = ''; +if (! in_array("lefttoright", $pieces)) { + $lefttoright = 'ltr,separator,'; +} +$righttoleft = ''; +if (! in_array("righttoleft", $pieces)) { + $righttoleft = 'rtl,separator,'; +} +$cleanup = ''; +if (! in_array("cleanup", $pieces)) { + $cleanup = 'cleanup,removeformat,separator,'; +} +$fontselect = ''; +if (! in_array("fontname", $pieces)) { + $fontselect = 'fontselect,'; +} +$fontsize = ''; +if (! in_array("fontsize", $pieces)) { + $fontsize = 'fontsizeselect,'; +} +$forecolor = ''; +if (! in_array("forecolor", $pieces)) { + $forecolor = 'forecolor,'; +} +$hilitecolor = ''; +if (! in_array("hilitecolor", $pieces)) { + $hilitecolor = 'backcolor,'; +} +$popupeditor = ''; +if (! in_array("popupeditor", $pieces)) { + $popupeditor = 'fullscreen,'; +} + +$editoraddbuttons3 = 'theme_advanced_buttons3_add : "'.$fontselect.$fontsize.$forecolor.$hilitecolor.'",'; +$editoraddbuttons4 = 'theme_advanced_buttons4 : "'.$spellcheck.$search_replace.$inserttable.$lefttoright.$righttoleft.$popupeditor.$cleanup.'",'; + +/* + * + * ******************************************************************************************************** + * + */ + + +$temp = $_SERVER["REQUEST_URI"]; +$temp = explode('/', $temp); +$root = $temp[1]; + +$configuration = << -- 2.39.5