From: Aparup Banerjee Date: Tue, 20 Dec 2011 03:08:42 +0000 (+0800) Subject: Merge branch 'MDL-30569-master' of git://github.com/ankitagarwal/moodle X-Git-Tag: v2.3.0-beta~1519 X-Git-Url: http://git.moodle.org/gw?p=moodle.git;a=commitdiff_plain;h=74f0b722545b508a1d3a33f85ddce2b3ef812783 Merge branch 'MDL-30569-master' of git://github.com/ankitagarwal/moodle --- 74f0b722545b508a1d3a33f85ddce2b3ef812783 diff --cc course/view.php index 73095db91b8,a930df34519..7317094058f --- a/course/view.php +++ b/course/view.php @@@ -114,27 -119,30 +119,32 @@@ $USER->activitycopy = false; $USER->activitycopycourse = NULL; } - redirect($PAGE->url); + // Redirect to site root if Editing is toggled on frontpage + if ($course->id == SITEID) { + redirect($CFG->wwwroot .'/?redirect=0'); + } else { + redirect($PAGE->url); + } } - if ($hide && confirm_sesskey()) { - set_section_visible($course->id, $hide, '0'); - } + if (has_capability('moodle/course:update', $context)) { + if ($hide && confirm_sesskey()) { + set_section_visible($course->id, $hide, '0'); + } - if ($show && confirm_sesskey()) { - set_section_visible($course->id, $show, '1'); - } + if ($show && confirm_sesskey()) { + set_section_visible($course->id, $show, '1'); + } - if (!empty($section)) { - if (!empty($move) and confirm_sesskey()) { - if (!move_section($course, $section, $move)) { - echo $OUTPUT->notification('An error occurred while moving a section'); + if (!empty($section)) { + if (!empty($move) and confirm_sesskey()) { + if (!move_section($course, $section, $move)) { + echo $OUTPUT->notification('An error occurred while moving a section'); + } + // Clear the navigation cache at this point so that the affects + // are seen immediately on the navigation. + $PAGE->navigation->clear_cache(); } - // Clear the navigation cache at this point so that the affects - // are seen immediately on the navigation. - $PAGE->navigation->clear_cache(); } } } else {