Skip to content

Commit

Permalink
MDL-23308 reverting previously reverted deprecation of legacy course …
Browse files Browse the repository at this point in the history
…files - we have agreed during the meeting on Thursday that we add new setting to allow this, not keeping the course files everywhere forever
  • Loading branch information
skodak committed Sep 3, 2010
1 parent 1332e4b commit 57ebd15
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
5 changes: 5 additions & 0 deletions file.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,11 @@
// security: limit access to existing course subdirectories
$course = $DB->get_record('course', array('id'=>$courseid), '*', MUST_EXIST);

if ($course->legacyfiles != 2) {
// course files disabled
send_file_not_found();
}

if ($course->id != SITEID) {
require_login($course->id, true, null, false);

Expand Down
26 changes: 13 additions & 13 deletions lib/navigationlib.php
Original file line number Diff line number Diff line change
Expand Up @@ -2905,7 +2905,7 @@ protected function load_course_settings($forceopen = false) {
}

// Manage files
if (has_capability('moodle/course:managefiles', $coursecontext)) {
if ($course->legacyfiles == 2 and has_capability('moodle/course:managefiles', $coursecontext)) {
// hidden in new courses and courses where legacy files were turned off
$url = new moodle_url('/files/index.php', array('contextid'=>$coursecontext->id));
$coursenode->add(get_string('courselegacyfiles'), $url, self::TYPE_SETTING, null, 'coursefiles', new pix_icon('i/files', ''));
Expand Down Expand Up @@ -3280,16 +3280,16 @@ protected function generate_user_settings($courseid, $userid, $gstitle='usercurr
$url = new moodle_url('/user/editadvanced.php', array('id'=>$user->id, 'course'=>$course->id));
$usersetting->add(get_string('editmyprofile'), $url, self::TYPE_SETTING);
} else if ((has_capability('moodle/user:editprofile', $usercontext) && !is_siteadmin($user)) || ($currentuser && has_capability('moodle/user:editownprofile', $systemcontext))) {
if (!empty($user->auth)) {
$userauth = get_auth_plugin($user->auth);
if ($userauth->can_edit_profile()) {
$url = $userauth->edit_profile_url();
if (empty($url)) {
$url = new moodle_url('/user/edit.php', array('id'=>$user->id, 'course'=>$course->id));
}
$usersetting->add(get_string('editmyprofile'), $url, self::TYPE_SETTING);
}
}
if (!empty($user->auth)) {
$userauth = get_auth_plugin($user->auth);
if ($userauth->can_edit_profile()) {
$url = $userauth->edit_profile_url();
if (empty($url)) {
$url = new moodle_url('/user/edit.php', array('id'=>$user->id, 'course'=>$course->id));
}
$usersetting->add(get_string('editmyprofile'), $url, self::TYPE_SETTING);
}
}
}
}

Expand Down Expand Up @@ -3582,9 +3582,9 @@ protected function load_front_page_settings($forceopen = false) {
}

// Manage files
if (has_capability('moodle/course:managefiles', $this->context)) {
if ($course->legacyfiles == 2 and has_capability('moodle/course:managefiles', $this->context)) {
//hiden in new installs
$url = new moodle_url('/files/index.php', array('contextid'=>$coursecontext->id));
$url = new moodle_url('/files/index.php', array('contextid'=>$coursecontext->id, 'itemid'=>0, 'component' => 'course', 'filearea'=>'legacy'));
$frontpage->add(get_string('sitelegacyfiles'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/files', ''));
}
return $frontpage;
Expand Down

0 comments on commit 57ebd15

Please sign in to comment.