diff --git a/lib/form/editor.php b/lib/form/editor.php
index 509b3de2985..46afcae474b 100644
--- a/lib/form/editor.php
+++ b/lib/form/editor.php
@@ -2,7 +2,6 @@
require_once('HTML/QuickForm/element.php');
-
//TODO:
// * locking
// * freezing
@@ -104,7 +103,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
}
function toHtml() {
- global $CFG;
+ global $CFG, $COURSE;
if ($this->_flagFrozen) {
return $this->getFrozenHtml();
@@ -178,21 +177,36 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
$str .= ''; // TODO: localise, fix styles, etc.
$str .= '';
- /// TODO: somehow pass 'itemid' to tinymce so that image chooser known where to look for and upload files,
- // also include list of expected file types handled by editor array('image', 'video', 'media')
- // JS code by Dongsheng goes here - uncomment following block when finished
+ require_once($CFG->dirroot.'/repository/lib.php');
+ if(empty($COURSE->context)) {
+ $ctx = get_context_instance(CONTEXT_SYSTEM);
+ } else {
+ $ctx = $COURSE->context;
+ }
+ $ret = repository_get_client($ctx, array('image', 'video', 'media'), '*');
- /// TODO: hide embedded file manager if tinymce used
-/* if ($editorclass === 'form-textarea-advanced') {
- $str .= '
+EOD;
+
+ /// TODO: hide embedded file manager if tinymce used
+ if ($editorclass === 'form-textarea-advanced') {
+ $str .= <<
//
-';
+
+EOD;
- }*/
+ }
}
diff --git a/lib/javascript.php b/lib/javascript.php
index a691468e363..776392ce4e3 100644
--- a/lib/javascript.php
+++ b/lib/javascript.php
@@ -29,6 +29,7 @@ setTimeout('fix_column_widths()', 20);