MDL-48371 editors: Option for removing managefiles

We want to remove the managefiles button from the
editors in the wiki so that students don't delete
each others files.
This commit is contained in:
Adrian Greeve
2015-09-07 09:59:33 +01:00
committed by Dan Poltawski
parent a64e1f3684
commit 037e05e8b2
5 changed files with 20 additions and 2 deletions
+5
View File
@@ -103,6 +103,11 @@ class atto_texteditor extends texteditor {
continue;
}
// Remove manage files if requested.
if ($plugin == 'managefiles' && isset($options['enable_filemanagement']) && !$options['enable_filemanagement']) {
continue;
}
$jsplugin = array();
$jsplugin['name'] = $plugin;
$jsplugin['params'] = array();
+7
View File
@@ -108,6 +108,13 @@ class tinymce_texteditor extends texteditor {
$config->disabledsubplugins = '';
}
// Remove the manage files button if requested.
if (isset($options['enable_filemanagement']) && !$options['enable_filemanagement']) {
if (!strpos($config->disabledsubplugins, 'managefiles')) {
$config->disabledsubplugins .= ',managefiles';
}
}
$fontselectlist = empty($config->fontselectlist) ? '' : $config->fontselectlist;
$langrev = -1;
+1 -1
View File
@@ -53,7 +53,7 @@ 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,
'areamaxbytes' => FILE_AREA_MAX_BYTES_UNLIMITED, 'context' => null, 'noclean' => 0, 'trusttext' => 0,
'return_types' => 7);
'return_types' => 7, 'enable_filemanagement' => true);
// $_options['return_types'] = FILE_INTERNAL | FILE_EXTERNAL | FILE_REFERENCE
/** @var array values for editor */
+1
View File
@@ -7,6 +7,7 @@ information provided here is intended especially for developers.
i.e. a call to M.core.actionmenu.instance.hideMenu() can be changed to M.core.actionmenu.instance.hideMenu(e) to ensure good
behaviour when using custom action menus.
* Users of the text editor API to manually create a text editor should call set_text before calling use_editor. See MDL-51179.
* In the html_editors (tinyMCE, Atto), the manage files button can be hidden by changing the 'enable_filemanagement' option to false.
=== 2.9.1 ===
+6 -1
View File
@@ -381,7 +381,12 @@ class page_wiki_edit extends page_wiki {
function __construct($wiki, $subwiki, $cm) {
global $CFG, $PAGE;
parent::__construct($wiki, $subwiki, $cm);
self::$attachmentoptions = array('subdirs' => false, 'maxfiles' => - 1, 'maxbytes' => $CFG->maxbytes, 'accepted_types' => '*');
$showfilemanager = false;
if (has_capability('mod/wiki:managefiles', context_module::instance($cm->id))) {
$showfilemanager = true;
}
self::$attachmentoptions = array('subdirs' => false, 'maxfiles' => - 1, 'maxbytes' => $CFG->maxbytes,
'accepted_types' => '*', 'enable_filemanagement' => $showfilemanager);
$PAGE->requires->js_init_call('M.mod_wiki.renew_lock', null, true);
}