Skip to content
Browse files

Merge branch 'MDL-32981-master' of github.com:FMCorz/moodle

  • Loading branch information...
2 parents cba59b3 + c598ea5 commit 3e832fe3e5c903fd40691ae12f1ffed863787d8e @danpoltawski danpoltawski committed May 22, 2012
Showing with 9 additions and 10 deletions.
  1. +1 −1 lib/navigationlib.php
  2. +4 −6 user/filesedit.php
  3. +4 −3 user/filesedit_form.php
View
2 lib/navigationlib.php
@@ -2324,7 +2324,7 @@ protected function load_for_user($user=null, $forceforcontext=false) {
$context = get_context_instance(CONTEXT_USER, $USER->id);
if ($iscurrentuser && has_capability('moodle/user:manageownfiles', $context)) {
- $url = new moodle_url('/user/files.php');
+ $url = new moodle_url('/user/filesedit.php');
$usernode->add(get_string('myfiles'), $url, self::TYPE_SETTING);
}
View
10 user/filesedit.php
@@ -33,13 +33,11 @@
}
$returnurl = optional_param('returnurl', '', PARAM_URL);
+$returnbutton = true;
if (empty($returnurl)) {
- if (!empty($_SERVER["HTTP_REFERER"])) {
- $returnurl = $_SERVER["HTTP_REFERER"];
- } else {
- $returnurl = new moodle_url('/user/files.php');
- }
+ $returnbutton = false;
+ $returnurl = new moodle_url('/user/filesedit.php');
}
$context = get_context_instance(CONTEXT_USER, $USER->id);
@@ -60,7 +58,7 @@
$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_filesedit_form(null, array('data'=>$data, 'options'=>$options));
+$mform = new user_filesedit_form(null, array('data'=>$data, 'options'=>$options, 'cancelbutton'=>$returnbutton));
if ($mform->is_cancelled()) {
redirect($returnurl);
View
7 user/filesedit_form.php
@@ -31,13 +31,14 @@ class user_filesedit_form extends moodleform {
function definition() {
$mform = $this->_form;
- $data = $this->_customdata['data'];
- $options = $this->_customdata['options'];
+ $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(true, get_string('savechanges'));
+ $this->add_action_buttons($cancelbutton, get_string('savechanges'));
$this->set_data($data);
}

0 comments on commit 3e832fe

Please sign in to comment.
Something went wrong with that request. Please try again.