Merge branch 'MDL-49985_master' of git://github.com/markn86/moodle

Conflicts:
	mod/forum/post.php
This commit is contained in:
Andrew Nicols 2015-05-06 11:11:21 +08:00
commit 43ef409276
17 changed files with 22 additions and 54 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

@ -108,7 +108,11 @@ if (!$forms) {
} else if ($returnurl) {
notice(get_string('notenrollable', 'enrol'), $returnurl);
} else {
notice(get_string('notenrollable', 'enrol'), "$CFG->wwwroot/index.php");
$url = clean_param(get_referer(false), PARAM_LOCALURL);
if (empty($url)) {
$url = new moodle_url('/index.php');
}
notice(get_string('notenrollable', 'enrol'), $url);
}
}

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

@ -2802,11 +2802,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

@ -118,7 +118,9 @@ if (!empty($forum)) { // User is starting a new discussion in a forum
if (enrol_selfenrol_available($course->id)) {
$SESSION->wantsurl = qualified_me();
$SESSION->enrolcancel = clean_param($_SERVER['HTTP_REFERER'], PARAM_LOCALURL);
redirect($CFG->wwwroot.'/enrol/index.php?id='.$course->id, get_string('youneedtoenrol'));
redirect(new moodle_url('/enrol/index.php', array('id' => $course->id,
'returnurl' => '/mod/forum/view.php?f=' . $forum->id)),
get_string('youneedtoenrol'));
}
}
}
@ -187,12 +189,9 @@ 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 = clean_param($_SERVER['HTTP_REFERER'], PARAM_LOCALURL);
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(new moodle_url('/enrol/index.php', array('id' => $course->id,
'returnurl' => '/mod/forum/view.php?f=' . $forum->id)),
get_string('youneedtoenrol'));
}
}
print_error('nopostforum', 'forum');