From: scyrma <scyrma>
Date: Fri, 20 Jun 2008 09:31:19 +0000 (+0000)
Subject: MDL-14741: use the value of the main killswitch, and add back missing functions
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=c020cec265e80a36074de576b679ca1b72363499;p=moodle.git

MDL-14741: use the value of the main killswitch, and add back missing functions
---

diff --git a/lib/editor/htmlEditor.class.php b/lib/editor/htmlEditor.class.php
index 1466301199..385277005f 100644
--- a/lib/editor/htmlEditor.class.php
+++ b/lib/editor/htmlEditor.class.php
@@ -19,6 +19,10 @@ class htmlEditor {
         global $CFG;
         static $configured = Array();
 
+        if (!$CFG->htmleditor) {
+            return;
+        }
+
         if ($editor == '') {
             $editor = (isset($CFG->defaulthtmleditor) ? $CFG->defaulthtmleditor : '');
         }
diff --git a/lib/editor/tinymce.js.php b/lib/editor/tinymce.js.php
index b9957c93ed..4221831ceb 100644
--- a/lib/editor/tinymce.js.php
+++ b/lib/editor/tinymce.js.php
@@ -110,7 +110,7 @@ function createHTMLArea(id) {
         elements : id,
         theme    : "advanced",
 
-        plugins : "safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,imagemanager,filemanager",
+        plugins : "safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,",
         spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv",
 
         plugin_insertdate_dateFormat : "%Y-%m-%d",
@@ -180,6 +180,7 @@ echo <<<EOF
         theme_advanced_resizing: true,
         theme_advanced_toolbar_location : "top",
         theme_advanced_statusbar_location : "bottom",
+        file_browser_callback : "moodlefilemanager",
 
 EOF;
 // the xhtml ruleset must be the last one - no comma at the end of the file
@@ -193,5 +194,19 @@ echo <<<EOF
 	    else
 		    tinyMCE.execCommand('mceRemoveControl', false, id);
     }
+    function moodlefilemanager(field_name, url, type, win) {
+        tinyMCE.activeEditor.windowManager.open({
+            file: "{$CFG->httpswwwroot}/lib/editor/tinymce/jscripts/tiny_mce/plugins/moodlelink/link.php?id={$COURSE->id}",
+            width: 480,  
+            height: 380,
+            resizable: "yes",
+            inline: "yes",  
+            close_previous: "no"
+        }, {
+            window: win,
+            input: field_name
+        });
+        return false;
+    }
 EOF;
 ?>