]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-14741: use the default html editor, as chosen in the admin settings
authorscyrma <scyrma>
Thu, 5 Jun 2008 09:36:55 +0000 (09:36 +0000)
committerscyrma <scyrma>
Thu, 5 Jun 2008 09:36:55 +0000 (09:36 +0000)
lib/form/htmleditor.php
lib/moodlelib.php
lib/weblib.php

index 20d1109a888f8e442bc57720e87e5a01da189d93..8eb68debdc00b02e5d4cb689f64e20b246982927 100644 (file)
@@ -61,9 +61,8 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
 
     function toHtml(){
         if ($this->_canUseHtmlEditor && !$this->_flagFrozen){
-            ob_start();
-            use_html_editor($this->getName(), '', $this->getAttribute('id'));
-            $script=ob_get_clean();
+            global $htmlEditorObject;
+            $script = $htmlEditorObject->activateEditor($this->getName(), $this->getAttribute('id'));
         } else {
             $script='';
         }
@@ -96,4 +95,4 @@ class MoodleQuickForm_htmleditor extends MoodleQuickForm_textarea{
         return $html . $this->_getPersistantData();
     } //end func getFrozenHtml
 }
-?>
\ No newline at end of file
+?>
index 12f551258c4bbbc9c1bd01c7a52a50e57d285f4d..6d0e8c9146cb63888a219fe753f4113ac9f4600e 100644 (file)
@@ -6131,6 +6131,33 @@ function ini_get_bool($ini_get_arg) {
     return false;
 }
 
+ /**
+ * Get the list of available HTML editors
+ */
+function get_available_html_editors() {
+    global $CFG;
+    static $editors = null;
+
+    if ($editors != null) {
+        return $editors;
+    }
+
+    $editors = array();
+
+    $dir = opendir($CFG->libdir .'/editor');
+    while (($file = readdir($dir)) !== false) {
+        if ($file != '.' and $file != '..') {
+            $path_file = $CFG->libdir ."/editor/{$file}";
+            if (is_dir($path_file) and file_exists($path_file .'.js.php')) {
+                $editors[] = $file;
+            }
+        }
+    }
+    closedir($dir);
+
+    return $editors;
+}
+
 /**
  * Determines if the HTML editor is enabled.
  *
index af9fe8881212c7821750cfd88df25b4b857ca358..616878b3562d537ccddab7a8b8c8dd122478acf5 100644 (file)
@@ -2557,11 +2557,18 @@ function print_header ($title='', $heading='', $navigation='', $focus='',
 
     $bodytags .= ' class="'.$pageclass.'" id="'.$pageid.'"';
 
+    require_once($CFG->libdir .'/editor/htmlEditor.class.php');
+    global $htmlEditorObject;
+    $htmlEditorObject = new htmlEditor();
+    $htmlEditor = $htmlEditorObject->configure();
+
     ob_start();
     include($CFG->header);
     $output = ob_get_contents();
     ob_end_clean();
 
+    $output = str_replace('</head>', "\n\n$htmlEditor\n\n</head>", $output);
+
     // container debugging info
     $THEME->open_header_containers = open_containers();