"MDL-21400, fixed image & media filepicker in editor"

This commit is contained in:
Dongsheng Cai
2010-03-11 07:45:06 +00:00
parent 894af28473
commit 875f4e7b54
2 changed files with 25 additions and 9 deletions
+6 -1
View File
@@ -51,7 +51,12 @@ M.editor_tinymce.filepicker_callback = function(args) {
M.editor_tinymce.filepicker = function(target_id, url, type, win) {
YUI(M.yui.loader).use('core_filepicker', function (Y) {
var editor_id = tinyMCE.selectedInstance.editorId;
var options = M.editor_tinymce.filepicker_options[editor_id];
var options = null;
if (type == 'media') {
options = M.editor_tinymce.filepicker_options[editor_id]['media'];
} else {
options = M.editor_tinymce.filepicker_options[editor_id]['image'];
}
options.formcallback = M.editor_tinymce.filepicker_callback;
options.editor_target = win.document.getElementById(target_id);
+19 -8
View File
@@ -149,7 +149,8 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
}
// get filepicker info
$fpoptions = null;
//
$fpoptions = array();
if ($maxfiles != 0 ) {
if (empty($draftitemid)) {
// no existing area info provided - let's use fresh new draft area
@@ -160,18 +161,28 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
$args = new stdclass;
// need these three to filter repositories list
$args->accepted_types = array('image', 'video', 'media');
$args->accepted_types = array('image');
$args->return_types = (FILE_INTERNAL | FILE_EXTERNAL);
$args->context = $ctx;
$args->env = 'filepicker';
$fpoptions = initialise_filepicker($args);
$image_options = initialise_filepicker($args);
$fpoptions->client_id = uniqid();
$fpoptions->maxbytes = $this->_options['maxbytes'];
$fpoptions->maxfiles = 1;
$fpoptions->env = 'editor';
$fpoptions->itemid = $draftitemid;
$args->accepted_types = array('video', 'media');
$media_options = initialise_filepicker($args);
$image_options->client_id = uniqid();
$media_options->client_id = uniqid();
$image_options->maxbytes = $this->_options['maxbytes'];
$media_options->maxbytes = $this->_options['maxbytes'];
$image_options->maxfiles = 1;
$media_options->maxfiles = 1;
$image_options->env = 'editor';
$media_options->env = 'editor';
$image_options->itemid = $draftitemid;
$media_options->itemid = $draftitemid;
$fpoptions['image'] = $image_options;
$fpoptions['media'] = $media_options;
}
/// print text area - TODO: add on-the-fly switching, size configuration, etc.