From fc11edbfa0a70cd2eb6966d8112723c53973ef73 Mon Sep 17 00:00:00 2001 From: dongsheng Date: Mon, 8 Dec 2008 06:53:58 +0000 Subject: [PATCH] "MDL-17391, enable repository filter in html editor" --- lib/editor/tinymce/tinymce.js.php | 2 +- lib/filelib.php | 3 +- repository/javascript.php | 73 +++++++++++++++++++++---------- repository/lib.php | 2 + 4 files changed, 55 insertions(+), 25 deletions(-) diff --git a/lib/editor/tinymce/tinymce.js.php b/lib/editor/tinymce/tinymce.js.php index 61fdaf808b..8ef02b279c 100644 --- a/lib/editor/tinymce/tinymce.js.php +++ b/lib/editor/tinymce/tinymce.js.php @@ -99,7 +99,7 @@ $output .= <<result = array(); - if (in_array('*', $types)) { + if ((is_array($types) && in_array('*', $types)) || + $types == '*') { return '*'; } foreach ($types as $key=>$value){ diff --git a/repository/javascript.php b/repository/javascript.php index 33ed7bb2c5..bf123c68c6 100644 --- a/repository/javascript.php +++ b/repository/javascript.php @@ -122,6 +122,16 @@ EOD; $js .= << //ajax_info(); $js .= "\r\n"; @@ -993,6 +1013,9 @@ foreach ($repos as $repo) { } $js .= "\r\n"; +$ft = new file_type_to_ext(); +$image_file_ext = json_encode($ft->get_file_ext(array('image'))); +$video_file_ext = json_encode($ft->get_file_ext(array('video'))); $js .= <<id = $this->id; $repo->name = $this->get_name(); $repo->type = $this->options['type']; $repo->icon = $CFG->httpswwwroot.'/repository/'.$repo->type.'/icon.png'; + $repo->filetype = $ft->get_file_ext($this->supported_filetypes()); return $repo; } -- 2.39.5