MDL-49985 core_course: revert commit belonging to MDL-18309

This reverts commit 6601690202764d786a5ee4b7bbd9afb5b91dd0ec.

This commit was adding the 'returnurl' param unnecessarily to the
course links in the navigation block, causing a lot of long URLs
to be created.
This commit is contained in:
Mark Nelson 2015-05-04 13:13:19 -07:00
parent 24a2babdd3
commit b3cb726431
17 changed files with 12 additions and 55 deletions

View File

@ -634,8 +634,7 @@ BRANCH.prototype = {
id : this.get('key'),
type : this.get('type'),
sesskey : M.cfg.sesskey,
instance : this.get('tree').get('instance'),
returnurl : location.href
instance : this.get('tree').get('instance')
};
var ajaxfile = '/lib/ajax/getnavbranch.php';

View File

@ -632,8 +632,7 @@ BRANCH.prototype = {
id : this.get('key'),
type : this.get('type'),
sesskey : M.cfg.sesskey,
instance : this.get('tree').get('instance'),
returnurl : location.href
instance : this.get('tree').get('instance')
};
var ajaxfile = '/lib/ajax/getnavbranch.php';

View File

@ -632,8 +632,7 @@ BRANCH.prototype = {
id : this.get('key'),
type : this.get('type'),
sesskey : M.cfg.sesskey,
instance : this.get('tree').get('instance'),
returnurl : location.href
instance : this.get('tree').get('instance')
};
var ajaxfile = '/lib/ajax/getnavbranch.php';

View File

@ -29,14 +29,11 @@ define('AJAX_SCRIPT', true);
require_once(dirname(__dir__) . '/config.php');
$returnurl = optional_param('returnurl', 0, PARAM_LOCALURL);
if ($CFG->forcelogin) {
require_login();
}
$PAGE->set_context(context_system::instance());
$courserenderer = $PAGE->get_renderer('core', 'course');
$courserenderer->returnurl = $returnurl;
echo json_encode($courserenderer->coursecat_ajax());

View File

@ -44,7 +44,6 @@ if ($categoryid) {
$PAGE->set_pagelayout('coursecategory');
$courserenderer = $PAGE->get_renderer('core', 'course');
$courserenderer->returnurl = $PAGE->url;
if ($CFG->forcelogin) {
require_login();

View File

@ -49,9 +49,6 @@ class core_course_renderer extends plugin_renderer_base {
*/
protected $strings;
/** @var moodle_url|null stores page where to return to from the enrolment page */
public $returnurl;
/**
* Override the constructor so that we can initialise the string cache
*
@ -1210,8 +1207,7 @@ class core_course_renderer extends plugin_renderer_base {
// course name
$coursename = $chelper->get_course_formatted_name($course);
$coursenamelink = html_writer::link(new moodle_url('/course/view.php',
array('id' => $course->id, 'returnurl' => $this->returnurl)),
$coursenamelink = html_writer::link(new moodle_url('/course/view.php', array('id' => $course->id)),
$coursename, array('class' => $course->visible ? '' : 'dimmed'));
$content .= html_writer::tag($nametag, $coursenamelink, array('class' => 'coursename'));
// If we display course in collapsed form but the course has summary or course contacts, display the link to the info page.

View File

@ -19,7 +19,6 @@
$switchrole = optional_param('switchrole',-1, PARAM_INT); // Deprecated, use course/switchrole.php instead.
$modchooser = optional_param('modchooser', -1, PARAM_BOOL);
$return = optional_param('return', 0, PARAM_LOCALURL);
$returnurl = optional_param('returnurl', 0, PARAM_LOCALURL);
$params = array();
if (!empty($name)) {
@ -43,9 +42,6 @@
if ($section) {
$urlparams['section'] = $section;
}
if ($returnurl) {
$urlparams['returnurl'] = $returnurl;
}
$PAGE->set_url('/course/view.php', $urlparams); // Defined here to avoid notices on errors etc

View File

@ -181,8 +181,7 @@ NS._toggle_category_expansion = function(e) {
categoryid: categoryid,
depth: depth,
showcourses: categorynode.getData('showcourses'),
type: TYPE_CATEGORY,
returnurl: location.href
type: TYPE_CATEGORY
}
});
};

File diff suppressed because one or more lines are too long

View File

@ -180,8 +180,7 @@ NS._toggle_category_expansion = function(e) {
categoryid: categoryid,
depth: depth,
showcourses: categorynode.getData('showcourses'),
type: TYPE_CATEGORY,
returnurl: location.href
type: TYPE_CATEGORY
}
});
};

View File

@ -179,8 +179,7 @@ NS._toggle_category_expansion = function(e) {
categoryid: categoryid,
depth: depth,
showcourses: categorynode.getData('showcourses'),
type: TYPE_CATEGORY,
returnurl: location.href
type: TYPE_CATEGORY
}
});
};

View File

@ -26,7 +26,6 @@ require('../config.php');
require_once("$CFG->libdir/formslib.php");
$id = required_param('id', PARAM_INT);
$returnurl = optional_param('returnurl', 0, PARAM_LOCALURL);
if (!isloggedin()) {
$referer = clean_param(get_referer(), PARAM_LOCALURL);
@ -105,8 +104,6 @@ foreach ($forms as $form) {
if (!$forms) {
if (isguestuser()) {
notice(get_string('noguestaccess', 'enrol'), get_login_url());
} else if ($returnurl) {
notice(get_string('notenrollable', 'enrol'), $returnurl);
} else {
notice(get_string('notenrollable', 'enrol'), "$CFG->wwwroot/index.php");
}

View File

@ -43,8 +43,6 @@ try {
$branchtype = required_param('type', PARAM_INT);
// This identifies the block instance requesting AJAX extension
$instanceid = optional_param('instance', null, PARAM_INT);
// URL of referrer page.
$returnurl = optional_param('returnurl', null, PARAM_LOCALURL);
$PAGE->set_context(context_system::instance());
@ -104,18 +102,9 @@ try {
if (!$linkcategories) {
foreach ($branch->find_all_of_type(navigation_node::TYPE_CATEGORY) as $category) {
$category->action = null;
foreach ($category->find_all_of_type(navigation_node::TYPE_COURSE) as $course) {
$course->action->param('returnurl', $returnurl);
}
}
foreach ($branch->find_all_of_type(navigation_node::TYPE_MY_CATEGORY) as $category) {
$category->action = null;
foreach ($category->find_all_of_type(navigation_node::TYPE_COURSE) as $course) {
$course->action->param('returnurl', $returnurl);
}
}
foreach ($branch->find_all_of_type(navigation_node::TYPE_COURSE) as $course) {
$course->action->param('returnurl', $returnurl);
}
}

View File

@ -2796,11 +2796,7 @@ function require_login($courseorid = null, $autologinguest = true, $cm = null, $
if ($setwantsurltome) {
$SESSION->wantsurl = qualified_me();
}
$redirecturl = new moodle_url($CFG->wwwroot .'/enrol/index.php', array('id' => $course->id));
if ($PAGE->url->get_param('returnurl')) {
$redirecturl->param('returnurl', $PAGE->url->get_param('returnurl'));
}
redirect($redirecturl);
redirect($CFG->wwwroot .'/enrol/index.php?id='. $course->id);
}
}

View File

@ -186,9 +186,7 @@ if (!$choiceformshown) {
echo $OUTPUT->box_start('generalbox', 'notice');
echo '<p align="center">'. get_string('notenrolledchoose', 'choice') .'</p>';
echo $OUTPUT->container_start('continuebutton');
echo $OUTPUT->single_button(new moodle_url('/enrol/index.php?',
array('id' => $course->id, 'returnurl' => $PAGE->url)),
get_string('enrolme', 'core_enrol', $courseshortname));
echo $OUTPUT->single_button(new moodle_url('/enrol/index.php?', array('id'=>$course->id)), get_string('enrolme', 'core_enrol', $courseshortname));
echo $OUTPUT->container_end();
echo $OUTPUT->box_end();

View File

@ -187,12 +187,7 @@ if (!empty($forum)) { // User is starting a new discussion in a forum
if (!is_enrolled($coursecontext)) { // User is a guest here!
$SESSION->wantsurl = qualified_me();
$SESSION->enrolcancel = $_SERVER['HTTP_REFERER'];
redirect(new moodle_url('/enrol/index.php', array(
'id' => $course->id,
'returnurl' => new moodle_url('/mod/forum/view.php',
array('f' => $forum->id))
)),
get_string('youneedtoenrol'));
redirect($CFG->wwwroot.'/enrol/index.php?id='.$course->id, get_string('youneedtoenrol'));
}
}
print_error('nopostforum', 'forum');