mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 04:22:07 +02:00
MDL-33446 Editor form field can filter return types
- Added possibility for editor form field to specify return_types (default FILE_INTERNAL | FILE_EXTERNAL | FILE_REFERENCE) - For assignment, workshop, quiz essay submissions and form posts do not allow FILE_REFERENCE - Fixed mod_resource return_types, reset them to default, because filemanager does not know how to work with FILE_EXTERNAL links
This commit is contained in:
parent
f8dfdb524b
commit
c469b3963b
@ -52,7 +52,8 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
|
||||
|
||||
/** @var array options provided to initalize filepicker */
|
||||
protected $_options = array('subdirs'=>0, 'maxbytes'=>0, 'maxfiles'=>0, 'changeformat'=>0,
|
||||
'context'=>null, 'noclean'=>0, 'trusttext'=>0);
|
||||
'context'=>null, 'noclean'=>0, 'trusttext'=>0, 'return_types'=>7);
|
||||
// $_options['return_types'] = FILE_INTERNAL | FILE_EXTERNAL | FILE_REFERENCE
|
||||
|
||||
/** @var array values for editor */
|
||||
protected $_values = array('text'=>null, 'format'=>null, 'itemid'=>null);
|
||||
@ -303,7 +304,7 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element {
|
||||
$args = new stdClass();
|
||||
// need these three to filter repositories list
|
||||
$args->accepted_types = array('web_image');
|
||||
$args->return_types = (FILE_INTERNAL | FILE_EXTERNAL | FILE_REFERENCE);
|
||||
$args->return_types = $this->_options['return_types'];
|
||||
$args->context = $ctx;
|
||||
$args->env = 'filepicker';
|
||||
// advimage plugin
|
||||
|
@ -106,7 +106,8 @@ class assign_submission_onlinetext extends assign_submission_plugin {
|
||||
'noclean' => false,
|
||||
'maxfiles' => EDITOR_UNLIMITED_FILES,
|
||||
'maxbytes' => $this->assignment->get_course()->maxbytes,
|
||||
'context' => $this->assignment->get_context()
|
||||
'context' => $this->assignment->get_context(),
|
||||
'return_types' => FILE_INTERNAL | FILE_EXTERNAL
|
||||
);
|
||||
return $editoroptions;
|
||||
}
|
||||
|
@ -42,7 +42,8 @@ class assignment_online extends assignment_base {
|
||||
'noclean' => false,
|
||||
'maxfiles' => EDITOR_UNLIMITED_FILES,
|
||||
'maxbytes' => $this->course->maxbytes,
|
||||
'context' => $this->context
|
||||
'context' => $this->context,
|
||||
'return_types' => FILE_INTERNAL | FILE_EXTERNAL
|
||||
);
|
||||
|
||||
$data = new stdClass();
|
||||
|
@ -45,7 +45,8 @@ class mod_forum_post_form extends moodleform {
|
||||
$forum->maxbytes = $course->maxbytes;
|
||||
}
|
||||
// TODO: add max files and max size support
|
||||
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'trusttext'=>true, 'context'=>$modcontext);
|
||||
$editoroptions = array('maxfiles' => EDITOR_UNLIMITED_FILES, 'trusttext'=>true,
|
||||
'context'=>$modcontext, 'return_types'=>FILE_INTERNAL | FILE_EXTERNAL);
|
||||
|
||||
$mform->addElement('header', 'general', '');//fill in the data depending on page params later using set_data
|
||||
$mform->addElement('text', 'subject', get_string('subject', 'forum'), 'size="48"');
|
||||
|
@ -61,9 +61,6 @@ class mod_resource_mod_form extends moodleform_mod {
|
||||
$mform->addElement('header', 'contentsection', get_string('contentheader', 'resource'));
|
||||
|
||||
$filemanager_options = array();
|
||||
// 3 == FILE_EXTERNAL | FILE_INTERNAL | FILE_REFERENCE
|
||||
// These two constant names are defined in repository/lib.php
|
||||
$filemanager_options['return_types'] = 7;
|
||||
$filemanager_options['accepted_types'] = '*';
|
||||
$filemanager_options['maxbytes'] = 0;
|
||||
$filemanager_options['maxfiles'] = -1;
|
||||
|
@ -144,7 +144,8 @@ if ($edit) {
|
||||
'subdirs' => false,
|
||||
'maxfiles' => $maxfiles,
|
||||
'maxbytes' => $maxbytes,
|
||||
'context' => $workshop->context
|
||||
'context' => $workshop->context,
|
||||
'return_types' => FILE_INTERNAL | FILE_EXTERNAL
|
||||
);
|
||||
|
||||
$attachmentopts = array('subdirs' => true, 'maxfiles' => $maxfiles, 'maxbytes' => $maxbytes, 'return_types' => FILE_INTERNAL);
|
||||
|
@ -109,6 +109,7 @@ class qtype_essay_renderer extends qtype_renderer {
|
||||
$pickeroptions->itemid = $qa->prepare_response_files_draft_itemid(
|
||||
'attachments', $options->context->id);
|
||||
$pickeroptions->context = $options->context;
|
||||
$pickeroptions->return_types = FILE_INTERNAL;
|
||||
|
||||
$pickeroptions->itemid = $qa->prepare_response_files_draft_itemid(
|
||||
'attachments', $options->context->id);
|
||||
@ -280,7 +281,7 @@ class qtype_essay_format_editor_renderer extends plugin_renderer_base {
|
||||
* @return array filepicker options for the editor.
|
||||
*/
|
||||
protected function get_filepicker_options($context, $draftitemid) {
|
||||
return array();
|
||||
return array('return_types' => FILE_INTERNAL | FILE_EXTERNAL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user