Skip to content

Commit

Permalink
MDL-33397 Filepicker: cancel button always present in private files
Browse files Browse the repository at this point in the history
  • Loading branch information
Frederic Massart committed May 29, 2012
1 parent 4631e39 commit a960dfa
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 1 addition & 3 deletions user/files.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,10 +33,8 @@
} }


$returnurl = optional_param('returnurl', '', PARAM_URL); $returnurl = optional_param('returnurl', '', PARAM_URL);
$returnbutton = true;


if (empty($returnurl)) { if (empty($returnurl)) {
$returnbutton = false;
$returnurl = new moodle_url('/user/files.php'); $returnurl = new moodle_url('/user/files.php');
} }


Expand All @@ -58,7 +56,7 @@
$options = array('subdirs'=>1, 'maxbytes'=>$CFG->userquota, 'maxfiles'=>-1, 'accepted_types'=>'*'); $options = array('subdirs'=>1, 'maxbytes'=>$CFG->userquota, 'maxfiles'=>-1, 'accepted_types'=>'*');
file_prepare_standard_filemanager($data, 'files', $options, $context, 'user', 'private', 0); 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()) { if ($mform->is_cancelled()) {
redirect($returnurl); redirect($returnurl);
Expand Down
3 changes: 1 addition & 2 deletions user/files_form.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -33,12 +33,11 @@ function definition() {


$data = $this->_customdata['data']; $data = $this->_customdata['data'];
$options = $this->_customdata['options']; $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('filemanager', 'files_filemanager', get_string('files'), null, $options);
$mform->addElement('hidden', 'returnurl', $data->returnurl); $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); $this->set_data($data);
} }
Expand Down

0 comments on commit a960dfa

Please sign in to comment.