mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
MDL-33397 Filepicker: cancel button always present in private files
This commit is contained in:
parent
4631e39533
commit
a960dfa900
@ -33,10 +33,8 @@ if (isguestuser()) {
|
||||
}
|
||||
|
||||
$returnurl = optional_param('returnurl', '', PARAM_URL);
|
||||
$returnbutton = true;
|
||||
|
||||
if (empty($returnurl)) {
|
||||
$returnbutton = false;
|
||||
$returnurl = new moodle_url('/user/files.php');
|
||||
}
|
||||
|
||||
@ -58,7 +56,7 @@ $data->returnurl = $returnurl;
|
||||
$options = array('subdirs'=>1, 'maxbytes'=>$CFG->userquota, 'maxfiles'=>-1, 'accepted_types'=>'*');
|
||||
file_prepare_standard_filemanager($data, 'files', $options, $context, 'user', 'private', 0);
|
||||
|
||||
$mform = new user_files_form(null, array('data'=>$data, 'options'=>$options, 'cancelbutton'=>$returnbutton));
|
||||
$mform = new user_files_form(null, array('data'=>$data, 'options'=>$options));
|
||||
|
||||
if ($mform->is_cancelled()) {
|
||||
redirect($returnurl);
|
||||
|
@ -33,12 +33,11 @@ class user_files_form extends moodleform {
|
||||
|
||||
$data = $this->_customdata['data'];
|
||||
$options = $this->_customdata['options'];
|
||||
$cancelbutton = isset($this->_customdata['cancelbutton']) ? $this->_customdata['cancelbutton'] : true;
|
||||
|
||||
$mform->addElement('filemanager', 'files_filemanager', get_string('files'), null, $options);
|
||||
$mform->addElement('hidden', 'returnurl', $data->returnurl);
|
||||
|
||||
$this->add_action_buttons($cancelbutton, get_string('savechanges'));
|
||||
$this->add_action_buttons(true, get_string('savechanges'));
|
||||
|
||||
$this->set_data($data);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user