diff --git a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js index 836d1263717..2d587027658 100644 --- a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js +++ b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-debug.js @@ -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'; diff --git a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js index 6c14e8eb62d..7c67d98753c 100644 --- a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js +++ b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation-min.js @@ -1,2 +1,2 @@ YUI.add("moodle-block_navigation-navigation",function(e,t){M.block_navigation=M.block_navigation||{},M.block_navigation.expandablebranchcount=1,M.block_navigation.courselimit=20,M.block_navigation.init_add_tree=function(e){e.courselimit&&(this.courselimit=e.courselimit),new u(e)},e.Event.define("actionkey",{_event:e.UA.webkit||e.UA.ie?"keydown":"keypress",_keys:{37:"collapse",39:"expand",32:"toggle",13:"enter"},_keyHandler:function(e,t,n){var r;n.actions?r=n.actions:r={collapse:!0,expand:!0,toggle:!0,enter:!0},this._keys[e.keyCode]&&r[this._keys[e.keyCode]]&&(e.action=this._keys[e.keyCode],t.fire(e))},on:function(e,t,n){t.args===null?t._detacher=e.on(this._event,this._keyHandler,this,n,{actions:!1}):t._detacher=e.on(this._event,this._keyHandler,this,n,t.args[0])},detach:function(e,t){t._detacher.detach()},delegate:function(e,t,n,r){t.args===null?t._delegateDetacher=e.delegate(this._event,this._keyHandler,r,this,n,{actions:!1}):t._delegateDetacher=e.delegate(this._event,this._keyHandler,r,this,n,t.args[0])},detachDelegate:function(e,t){t._delegateDetacher.detach()}});var n=0,r=20,i=30,s=40,o={ROOTNODE:0,SYSTEM:1,CATEGORY:10,MYCATEGORY:11,COURSE:20,SECTION:30,ACTIVITY:40,RESOURCE:50,CUSTOM:60,SETTING:70,SITEADMIN:71,USER:80,CONTAINER:90},u=function(){u.superclass.constructor.apply(this,arguments)};u.prototype={id:null,branches:[],initializer:function(t){this.id=parseInt(t.id,10);var n=e.one("#inst"+t.id);if(n===null)return;e.delegate("click",this.toggleExpansion,n.one(".block_tree"),".tree_item.branch",this),e.delegate("actionkey",this.toggleExpansion,n.one(".block_tree"),".tree_item.branch",this);var r=[];t.expansions?r=t.expansions:window["navtreeexpansions"+t.id]&&(r=window["navtreeexpansions"+t.id]);for(var i in r){var s=(new a({tree:this,branchobj:r[i],overrides:{expandable:!0,children:[],haschildren:!0}})).wire();M.block_navigation.expandablebranchcount++,this.branches[s.get("id")]=s}if(window.siteadminexpansion){var o=(new a({tree:this,branchobj:window.siteadminexpansion,overrides:{expandable:!0,children:[],haschildren:!0}})).wire();M.block_navigation.expandablebranchcount++,this.branches[o.get("id")]=o;if(o.node){var u=o.node.get("childNodes").item(0);if(u){var f=e.Node.create(''+u.get("innerHTML")+"");o.node.replaceChild(f,u)}}}M.block_navigation.expandablebranchcount>0&&(e.delegate("click",this.fire_branch_action,n.one(".block_tree"),".tree_item.branch[data-expandable]",this),e.delegate("actionkey",this.fire_branch_action,n.one(".block_tree"),".tree_item.branch[data-expandable]",this))},fire_branch_action:function(e){var t=e.currentTarget.getAttribute("id"),n=this.branches[t];n.ajaxLoad(e)},toggleExpansion:function(e){if(!e.target.test("a")||e.keyCode!==0&&e.keyCode!==13){var t=e.target;t.test("li")||(t=t.ancestor("li"));if(!t)return;if(!t.hasClass("depth_1"))if(e.type==="actionkey"){switch(e.action){case"expand":t.removeClass("collapsed"),t.set("aria-expanded",!0);break;case"collapse":t.addClass("collapsed"),t.set("aria-expanded",!1);break;default:t.toggleClass("collapsed"),t.set("aria-expanded",!t.hasClass("collapsed"))}e.halt()}else t.toggleClass("collapsed"),t.set("aria-expanded",!t.hasClass("collapsed"));return this.get("accordian")&&t.siblings("li").each(function(){this.get("id")!==t.get("id")&&!this.hasClass("collapsed")&&(this.addClass("collapsed"),this.set("aria-expanded",!1))}),this.get("candock")&&M.core.dock.notifyBlockChange&&M.core.dock.notifyBlockChange(this.id),!0}e.stopPropagation();return}},e.extend(u,e.Base,u.prototype,{NAME:"navigation-tree",ATTRS:{candock:{validator:e.Lang.isBool,value:!1},accordian:{validator:e.Lang.isBool,value:!1},expansionlimit:{value:0,setter:function(e){return e=parseInt(e,10),e!==n&&e!==r&&e!==i&&e!==s&&(e=n),e}},instance:{value:!1,setter:function(e){return parseInt(e,10)}}}});var a=function(){a.superclass.constructor.apply(this,arguments)};a.prototype={node:null,initializer:function(t){var r,i;if(t.branchobj!==null){for(r in t.branchobj)this.set(r,t.branchobj[r]);i=this.get("children"),this.set("haschildren",i.length>0)}if(t.overrides!==null)for(r in t.overrides)this.set(r,t.overrides[r]);this.node=e.one("#"+this.get("id"));var o=this.get("tree").get("expansionlimit"),u=this.get("type");o!==n&&u>=o&&u<=s&&(this.set("expandable",!1),this.set("haschildren",!1))},draw:function(t){var n=this.get("expandable")||this.get("haschildren"),r=e.Node.create("
  • "),i=this.get("link"),s=e.Node.create('

    ').setAttribute("id",this.get("id")),u;i||s.setAttribute("tabindex","0"),n&&(r.addClass("collapsed").addClass("contains_branch"),r.set("aria-expanded",!1),s.addClass("branch"));var a=!1,f=this.get("icon");if(f&&(!n||this.get("type")===o.ACTIVITY||this.get("type")===o.RESOURCE)){a=e.Node.create(''),a.setAttribute("src",M.util.image_url(f.pix,f.component)),r.addClass("item_with_icon"),s.addClass("hasicon"),f.alt&&a.setAttribute("alt",f.alt),f.title&&a.setAttribute("title",f.title);if(f.classes)for(var l in f.classes)a.addClass(f.classes[l])}if(!i){var c=e.Node.create("");a?(c.appendChild(a),u=''+this.get("name")+""):u=this.get("name"),c.append(u),this.get("hidden")&&c.addClass("dimmed_text"),s.appendChild(c)}else{var h=e.Node.create('');a?(h.appendChild(a),u=''+this.get("name")+""):u=this.get("name"),h.append(u),this.get("hidden")&&h.addClass("dimmed"),s.appendChild(h)}return r.appendChild(s),t.appendChild(r),this.node=s,this},wire:function(){return this.node=this.node||e.one("#"+this.get("id")),this.node?(this.get("expandable")&&(this.node.setAttribute("data-expandable","1"),this.node.setAttribute("data-loaded","0")),this):this},getChildrenUL:function(){var t=this.node.next("ul");return t||(t=e.Node.create(""),this.node.ancestor().append(t)),t},ajaxLoad:function(t){t.type==="actionkey"&&t.action!=="enter"?t.halt():t.stopPropagation();if( -t.type==="actionkey"&&t.action==="enter"||t.target.test("a"))return this.node.setAttribute("data-expandable","0"),this.node.setAttribute("data-loaded","1"),!0;if(this.node.hasClass("loadingbranch"))return!0;if(this.node.getAttribute("data-loaded")==="1")return!0;this.node.addClass("loadingbranch");var n={elementid:this.get("id"),id:this.get("key"),type:this.get("type"),sesskey:M.cfg.sesskey,instance:this.get("tree").get("instance"),returnurl:location.href},r="/lib/ajax/getnavbranch.php";return this.get("type")===o.SITEADMIN&&(r="/lib/ajax/getsiteadminbranch.php"),e.io(M.cfg.wwwroot+r,{method:"POST",data:n,on:{complete:this.ajaxProcessResponse},context:this}),!0},ajaxProcessResponse:function(t,n){this.node.removeClass("loadingbranch"),this.node.setAttribute("data-loaded","1");try{var r=e.JSON.parse(n.responseText);if(r.error)return e.use("moodle-core-notification-ajaxexception",function(){return(new M.core.ajaxException(r)).show()}),!1;if(r.children&&r.children.length>0){var i=0;for(var s in r.children)typeof r.children[s]=="object"&&(r.children[s].type===o.COURSE&&i++,this.addChild(r.children[s]));return(this.get("type")===o.CATEGORY||this.get("type")===o.ROOTNODE||this.get("type")===o.MYCATEGORY)&&i>=M.block_navigation.courselimit&&this.addViewAllCoursesChild(this),this.get("tree").get("candock")&&M.core.dock.notifyBlockChange&&M.core.dock.notifyBlockChange(this.get("tree").id),!0}}catch(u){return n&&n.status&&n.status>0&&e.use("moodle-core-notification-exception",function(){return(new M.core.exception(u)).show()}),!1}return this.node.replaceClass("branch","emptybranch"),!0},addChild:function(e){var t=new a({tree:this.get("tree"),branchobj:e});if(t.draw(this.getChildrenUL())){this.get("tree").branches[t.get("id")]=t,t.wire();var n=0,r,i=t.get("children");for(r in i)i[r].type===o.COURSE&&n++,typeof i[r]=="object"&&t.addChild(i[r]);(t.get("type")===o.CATEGORY||t.get("type")===o.MYCATEGORY)&&n>=M.block_navigation.courselimit&&this.addViewAllCoursesChild(t)}return!0},addViewAllCoursesChild:function(e){var t=null;e.get("type")===o.ROOTNODE?e.get("key")==="mycourses"?t=M.cfg.wwwroot+"/my":t=M.cfg.wwwroot+"/course/index.php":t=M.cfg.wwwroot+"/course/index.php?categoryid="+e.get("key"),e.addChild({name:M.util.get_string("viewallcourses","moodle"),title:M.util.get_string("viewallcourses","moodle"),link:t,haschildren:!1,icon:{pix:"i/navigationitem",component:"moodle"}})}},e.extend(a,e.Base,a.prototype,{NAME:"navigation-branch",ATTRS:{tree:{writeOnce:"initOnly",validator:e.Lang.isObject},name:{value:"",validator:e.Lang.isString,setter:function(e){return e.replace(/\n/g,"
    ")}},title:{value:"",validator:e.Lang.isString},id:{value:"",validator:e.Lang.isString,getter:function(e){return e===""&&(e="expandable_branch_"+M.block_navigation.expandablebranchcount,M.block_navigation.expandablebranchcount++),e}},key:{value:null},type:{value:null,setter:function(e){return parseInt(e,10)}},link:{value:!1},icon:{value:!1,validator:e.Lang.isObject},expandable:{value:!1,validator:e.Lang.isBool},hidden:{value:!1,validator:e.Lang.isBool},haschildren:{value:!1,validator:e.Lang.isBool},children:{value:[],validator:e.Lang.isArray}}})},"@VERSION@",{requires:["base","io-base","node","event-synthetic","event-delegate","json-parse"]}); +t.type==="actionkey"&&t.action==="enter"||t.target.test("a"))return this.node.setAttribute("data-expandable","0"),this.node.setAttribute("data-loaded","1"),!0;if(this.node.hasClass("loadingbranch"))return!0;if(this.node.getAttribute("data-loaded")==="1")return!0;this.node.addClass("loadingbranch");var n={elementid:this.get("id"),id:this.get("key"),type:this.get("type"),sesskey:M.cfg.sesskey,instance:this.get("tree").get("instance")},r="/lib/ajax/getnavbranch.php";return this.get("type")===o.SITEADMIN&&(r="/lib/ajax/getsiteadminbranch.php"),e.io(M.cfg.wwwroot+r,{method:"POST",data:n,on:{complete:this.ajaxProcessResponse},context:this}),!0},ajaxProcessResponse:function(t,n){this.node.removeClass("loadingbranch"),this.node.setAttribute("data-loaded","1");try{var r=e.JSON.parse(n.responseText);if(r.error)return e.use("moodle-core-notification-ajaxexception",function(){return(new M.core.ajaxException(r)).show()}),!1;if(r.children&&r.children.length>0){var i=0;for(var s in r.children)typeof r.children[s]=="object"&&(r.children[s].type===o.COURSE&&i++,this.addChild(r.children[s]));return(this.get("type")===o.CATEGORY||this.get("type")===o.ROOTNODE||this.get("type")===o.MYCATEGORY)&&i>=M.block_navigation.courselimit&&this.addViewAllCoursesChild(this),this.get("tree").get("candock")&&M.core.dock.notifyBlockChange&&M.core.dock.notifyBlockChange(this.get("tree").id),!0}}catch(u){return n&&n.status&&n.status>0&&e.use("moodle-core-notification-exception",function(){return(new M.core.exception(u)).show()}),!1}return this.node.replaceClass("branch","emptybranch"),!0},addChild:function(e){var t=new a({tree:this.get("tree"),branchobj:e});if(t.draw(this.getChildrenUL())){this.get("tree").branches[t.get("id")]=t,t.wire();var n=0,r,i=t.get("children");for(r in i)i[r].type===o.COURSE&&n++,typeof i[r]=="object"&&t.addChild(i[r]);(t.get("type")===o.CATEGORY||t.get("type")===o.MYCATEGORY)&&n>=M.block_navigation.courselimit&&this.addViewAllCoursesChild(t)}return!0},addViewAllCoursesChild:function(e){var t=null;e.get("type")===o.ROOTNODE?e.get("key")==="mycourses"?t=M.cfg.wwwroot+"/my":t=M.cfg.wwwroot+"/course/index.php":t=M.cfg.wwwroot+"/course/index.php?categoryid="+e.get("key"),e.addChild({name:M.util.get_string("viewallcourses","moodle"),title:M.util.get_string("viewallcourses","moodle"),link:t,haschildren:!1,icon:{pix:"i/navigationitem",component:"moodle"}})}},e.extend(a,e.Base,a.prototype,{NAME:"navigation-branch",ATTRS:{tree:{writeOnce:"initOnly",validator:e.Lang.isObject},name:{value:"",validator:e.Lang.isString,setter:function(e){return e.replace(/\n/g,"
    ")}},title:{value:"",validator:e.Lang.isString},id:{value:"",validator:e.Lang.isString,getter:function(e){return e===""&&(e="expandable_branch_"+M.block_navigation.expandablebranchcount,M.block_navigation.expandablebranchcount++),e}},key:{value:null},type:{value:null,setter:function(e){return parseInt(e,10)}},link:{value:!1},icon:{value:!1,validator:e.Lang.isObject},expandable:{value:!1,validator:e.Lang.isBool},hidden:{value:!1,validator:e.Lang.isBool},haschildren:{value:!1,validator:e.Lang.isBool},children:{value:[],validator:e.Lang.isArray}}})},"@VERSION@",{requires:["base","io-base","node","event-synthetic","event-delegate","json-parse"]}); diff --git a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js index fc967261122..b661bfdfbd3 100644 --- a/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js +++ b/blocks/navigation/yui/build/moodle-block_navigation-navigation/moodle-block_navigation-navigation.js @@ -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'; diff --git a/blocks/navigation/yui/src/navigation/js/navigation.js b/blocks/navigation/yui/src/navigation/js/navigation.js index c4874a884f9..3678bffeff2 100644 --- a/blocks/navigation/yui/src/navigation/js/navigation.js +++ b/blocks/navigation/yui/src/navigation/js/navigation.js @@ -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'; diff --git a/course/category.ajax.php b/course/category.ajax.php index 8bc204aff38..b85f158ea38 100644 --- a/course/category.ajax.php +++ b/course/category.ajax.php @@ -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()); diff --git a/course/index.php b/course/index.php index acf816d877f..3b16759c5d9 100644 --- a/course/index.php +++ b/course/index.php @@ -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(); diff --git a/course/renderer.php b/course/renderer.php index f46cf4f9c41..574aea47c8a 100644 --- a/course/renderer.php +++ b/course/renderer.php @@ -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. diff --git a/course/view.php b/course/view.php index de47a0ac0e6..e15a0226b89 100644 --- a/course/view.php +++ b/course/view.php @@ -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 diff --git a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-debug.js b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-debug.js index d0fc0e84789..92f0c020fd7 100644 --- a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-debug.js +++ b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-debug.js @@ -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 } }); }; diff --git a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-min.js b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-min.js index 3036bf36197..49f5138141a 100644 --- a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-min.js +++ b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander-min.js @@ -1 +1 @@ -YUI.add("moodle-course-categoryexpander",function(e,t){var n={CONTENTNODE:"content",COLLAPSEALL:"collapse-all",DISABLED:"disabled",LOADED:"loaded",NOTLOADED:"notloaded",SECTIONCOLLAPSED:"collapsed",HASCHILDREN:"with_children"},r={LOADEDTREES:".with_children.loaded",CONTENTNODE:".content",CATEGORYLISTENLINK:".category .info .categoryname",CATEGORYSPINNERLOCATION:".categoryname",CATEGORYWITHCOLLAPSEDLOADEDCHILDREN:".category.with_children.loaded.collapsed",CATEGORYWITHMAXIMISEDLOADEDCHILDREN:".category.with_children.loaded:not(.collapsed)",COLLAPSEEXPAND:".collapseexpand",COURSEBOX:".coursebox",COURSEBOXLISTENLINK:".coursebox .moreinfo",COURSEBOXSPINNERLOCATION:".coursename a",COURSECATEGORYTREE:".course_category_tree",PARENTWITHCHILDREN:".category"},i=e.namespace("Moodle.course.categoryexpander"),s=0,o=1,u=M.cfg.wwwroot+"/course/category.ajax.php";i.init=function(){var t=e.one(e.config.doc);t.delegate("click",this.toggle_category_expansion,r.CATEGORYLISTENLINK,this),t.delegate("click",this.toggle_coursebox_expansion,r.COURSEBOXLISTENLINK,this),t.delegate("click",this.collapse_expand_all,r.COLLAPSEEXPAND,this),t.once("key",this.setup_keyboard_listeners,"tab",this)},i.setup_keyboard_listeners=function(){var t=e.one(e.config.doc);t.all(r.CATEGORYLISTENLINK,r.COURSEBOXLISTENLINK,r.COLLAPSEEXPAND).setAttribute("tabindex","0"),e.one(e.config.doc).delegate("key",this.toggle_category_expansion,"enter",r.CATEGORYLISTENLINK,this),e.one(e.config.doc).delegate("key",this.toggle_coursebox_expansion,"enter",r.COURSEBOXLISTENLINK,this),e.one(e.config.doc).delegate("key",this.collapse_expand_all,"enter",r.COLLAPSEEXPAND,this)},i.toggle_category_expansion=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.toggle_category_expansion=i._toggle_category_expansion,i.toggle_category_expansion(t)})},i.toggle_coursebox_expansion=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.toggle_coursebox_expansion=i._toggle_coursebox_expansion,i.toggle_coursebox_expansion(t)}),t.preventDefault()},i._toggle_coursebox_expansion=function(e){var t;t=e.target.ancestor(r.COURSEBOX,!0),e.preventDefault();if(t.hasClass(n.LOADED)){this.run_expansion(t);return}this._toggle_generic_expansion({parentnode:t,childnode:t.one(r.CONTENTNODE),spinnerhandle:r.COURSEBOXSPINNERLOCATION,data:{courseid:t.getData("courseid"),type:o}})},i._toggle_category_expansion=function(e){var t,i,o;if(e.target.test("a")||e.target.test("img"))return;t=e.target.ancestor(r.PARENTWITHCHILDREN,!0);if(!t.hasClass(n.HASCHILDREN))return;if(t.hasClass(n.LOADED)){this.run_expansion(t);return}i=t.getData("categoryid"),o=t.getData("depth");if(typeof i=="undefined"||typeof o=="undefined")return;this._toggle_generic_expansion({parentnode:t,childnode:t.one(r.CONTENTNODE),spinnerhandle:r.CATEGORYSPINNERLOCATION,data:{categoryid:i,depth:o,showcourses:t.getData("showcourses"),type:s,returnurl:location.href}})},i._toggle_generic_expansion=function(t){var n;t.spinnerhandle&&(n=M.util.add_spinner(e,t.parentnode.one(t.spinnerhandle)).show()),e.io(u,{method:"POST",context:this,on:{complete:this.process_results},data:t.data,arguments:{parentnode:t.parentnode,childnode:t.childnode,spinner:n}})},i.run_expansion=function(e){var t=e.one(r.CONTENTNODE),i=this,s=e.ancestor(r.COURSECATEGORYTREE);this.add_animation(t),e.hasClass(n.SECTIONCOLLAPSED)?(t.setStyle("height","0"),e.removeClass(n.SECTIONCOLLAPSED),e.setAttribute("aria-expanded","true"),t.fx.set("reverse",!1)):(t.fx.set("reverse",!0),t.fx.once("end",function(e,t){t.addClass(n.SECTIONCOLLAPSED),t.setAttribute("aria-expanded","false")},this,e)),t.fx.once("end",function(e,t){t.setStyles({height:"",opacity:""}),this.destroy(),i.update_collapsible_actions(s)},t.fx,t),t.fx.run()},i.collapse_expand_all=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.collapse_expand_all=i._collapse_expand_all,i.collapse_expand_all(t)}),t.preventDefault()},i._collapse_expand_all=function(e){e.preventDefault();if(e.currentTarget.hasClass(n.DISABLED))return;var t=e.currentTarget.ancestor(r.COURSECATEGORYTREE);if(!t)return;var i=t.one(r.COLLAPSEEXPAND);i.hasClass(n.COLLAPSEALL)?this.collapse_all(t):this.expand_all(t),this.update_collapsible_actions(t)},i.expand_all=function(t){var i=[];t.all(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN).each(function(e){e.ancestor(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)?(e.removeClass(n.SECTIONCOLLAPSED),e.all(r.LOADEDTREES).removeClass(n.SECTIONCOLLAPSED)):i.push(e)},this),e.all(i).each(function(e){this.run_expansion(e)},this)},i.collapse_all=function(t){var i=[];t.all(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN).each(function(e){e.ancestor(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN)?i.push(e):this.run_expansion(e)},this),e.all(i).each(function(e){e.addClass(n.SECTIONCOLLAPSED),e.all(r.LOADEDTREES).addClass(n.SECTIONCOLLAPSED)},this)},i.update_collapsible_actions=function(e){var t=!1,i=e.one(r.COLLAPSEEXPAND);if(!i)return;e.all(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN).each(function(e){return e.ancestor(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)?!1:(t=!0,!0)}),t?i.setHTML(M.util.get_string("collapseall","moodle")).addClass(n.COLLAPSEALL).removeClass(n.DISABLED):i.setHTML(M.util.get_string("expandall","moodle")).removeClass(n.COLLAPSEALL).removeClass(n.DISABLED)},i.process_results=function(t,r,i){var s,o;try{o=e.JSON.parse(r.responseText);if(o.error)return new M.core.ajaxException(o)}catch(u){return new M.core.exception(u)}s=e.Node.create(o),i.childnode.appendChild(s),i.parentnode.addClass(n.LOADED).removeClass(n.NOTLOADED),this.run_expansion(i.parentnode),i.spinner&&i.spinner.hide().destroy()},i.add_animation=function(t){return typeof t.fx!="undefined"?t:(t.plug(e.Plugin.NodeFX,{from:{height:0,opacity:0},to:{height:function(e){return e.get("scrollHeight")},opacity:1},duration:.2}),t)}},"@VERSION@",{requires:["node","event-key"]}); +YUI.add("moodle-course-categoryexpander",function(e,t){var n={CONTENTNODE:"content",COLLAPSEALL:"collapse-all",DISABLED:"disabled",LOADED:"loaded",NOTLOADED:"notloaded",SECTIONCOLLAPSED:"collapsed",HASCHILDREN:"with_children"},r={LOADEDTREES:".with_children.loaded",CONTENTNODE:".content",CATEGORYLISTENLINK:".category .info .categoryname",CATEGORYSPINNERLOCATION:".categoryname",CATEGORYWITHCOLLAPSEDLOADEDCHILDREN:".category.with_children.loaded.collapsed",CATEGORYWITHMAXIMISEDLOADEDCHILDREN:".category.with_children.loaded:not(.collapsed)",COLLAPSEEXPAND:".collapseexpand",COURSEBOX:".coursebox",COURSEBOXLISTENLINK:".coursebox .moreinfo",COURSEBOXSPINNERLOCATION:".coursename a",COURSECATEGORYTREE:".course_category_tree",PARENTWITHCHILDREN:".category"},i=e.namespace("Moodle.course.categoryexpander"),s=0,o=1,u=M.cfg.wwwroot+"/course/category.ajax.php";i.init=function(){var t=e.one(e.config.doc);t.delegate("click",this.toggle_category_expansion,r.CATEGORYLISTENLINK,this),t.delegate("click",this.toggle_coursebox_expansion,r.COURSEBOXLISTENLINK,this),t.delegate("click",this.collapse_expand_all,r.COLLAPSEEXPAND,this),t.once("key",this.setup_keyboard_listeners,"tab",this)},i.setup_keyboard_listeners=function(){var t=e.one(e.config.doc);t.all(r.CATEGORYLISTENLINK,r.COURSEBOXLISTENLINK,r.COLLAPSEEXPAND).setAttribute("tabindex","0"),e.one(e.config.doc).delegate("key",this.toggle_category_expansion,"enter",r.CATEGORYLISTENLINK,this),e.one(e.config.doc).delegate("key",this.toggle_coursebox_expansion,"enter",r.COURSEBOXLISTENLINK,this),e.one(e.config.doc).delegate("key",this.collapse_expand_all,"enter",r.COLLAPSEEXPAND,this)},i.toggle_category_expansion=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.toggle_category_expansion=i._toggle_category_expansion,i.toggle_category_expansion(t)})},i.toggle_coursebox_expansion=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.toggle_coursebox_expansion=i._toggle_coursebox_expansion,i.toggle_coursebox_expansion(t)}),t.preventDefault()},i._toggle_coursebox_expansion=function(e){var t;t=e.target.ancestor(r.COURSEBOX,!0),e.preventDefault();if(t.hasClass(n.LOADED)){this.run_expansion(t);return}this._toggle_generic_expansion({parentnode:t,childnode:t.one(r.CONTENTNODE),spinnerhandle:r.COURSEBOXSPINNERLOCATION,data:{courseid:t.getData("courseid"),type:o}})},i._toggle_category_expansion=function(e){var t,i,o;if(e.target.test("a")||e.target.test("img"))return;t=e.target.ancestor(r.PARENTWITHCHILDREN,!0);if(!t.hasClass(n.HASCHILDREN))return;if(t.hasClass(n.LOADED)){this.run_expansion(t);return}i=t.getData("categoryid"),o=t.getData("depth");if(typeof i=="undefined"||typeof o=="undefined")return;this._toggle_generic_expansion({parentnode:t,childnode:t.one(r.CONTENTNODE),spinnerhandle:r.CATEGORYSPINNERLOCATION,data:{categoryid:i,depth:o,showcourses:t.getData("showcourses"),type:s}})},i._toggle_generic_expansion=function(t){var n;t.spinnerhandle&&(n=M.util.add_spinner(e,t.parentnode.one(t.spinnerhandle)).show()),e.io(u,{method:"POST",context:this,on:{complete:this.process_results},data:t.data,arguments:{parentnode:t.parentnode,childnode:t.childnode,spinner:n}})},i.run_expansion=function(e){var t=e.one(r.CONTENTNODE),i=this,s=e.ancestor(r.COURSECATEGORYTREE);this.add_animation(t),e.hasClass(n.SECTIONCOLLAPSED)?(t.setStyle("height","0"),e.removeClass(n.SECTIONCOLLAPSED),e.setAttribute("aria-expanded","true"),t.fx.set("reverse",!1)):(t.fx.set("reverse",!0),t.fx.once("end",function(e,t){t.addClass(n.SECTIONCOLLAPSED),t.setAttribute("aria-expanded","false")},this,e)),t.fx.once("end",function(e,t){t.setStyles({height:"",opacity:""}),this.destroy(),i.update_collapsible_actions(s)},t.fx,t),t.fx.run()},i.collapse_expand_all=function(t){e.use("io-base","json-parse","moodle-core-notification","anim-node-plugin",function(){i.collapse_expand_all=i._collapse_expand_all,i.collapse_expand_all(t)}),t.preventDefault()},i._collapse_expand_all=function(e){e.preventDefault();if(e.currentTarget.hasClass(n.DISABLED))return;var t=e.currentTarget.ancestor(r.COURSECATEGORYTREE);if(!t)return;var i=t.one(r.COLLAPSEEXPAND);i.hasClass(n.COLLAPSEALL)?this.collapse_all(t):this.expand_all(t),this.update_collapsible_actions(t)},i.expand_all=function(t){var i=[];t.all(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN).each(function(e){e.ancestor(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)?(e.removeClass(n.SECTIONCOLLAPSED),e.all(r.LOADEDTREES).removeClass(n.SECTIONCOLLAPSED)):i.push(e)},this),e.all(i).each(function(e){this.run_expansion(e)},this)},i.collapse_all=function(t){var i=[];t.all(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN).each(function(e){e.ancestor(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN)?i.push(e):this.run_expansion(e)},this),e.all(i).each(function(e){e.addClass(n.SECTIONCOLLAPSED),e.all(r.LOADEDTREES).addClass(n.SECTIONCOLLAPSED)},this)},i.update_collapsible_actions=function(e){var t=!1,i=e.one(r.COLLAPSEEXPAND);if(!i)return;e.all(r.CATEGORYWITHMAXIMISEDLOADEDCHILDREN).each(function(e){return e.ancestor(r.CATEGORYWITHCOLLAPSEDLOADEDCHILDREN)?!1:(t=!0,!0)}),t?i.setHTML(M.util.get_string("collapseall","moodle")).addClass(n.COLLAPSEALL).removeClass(n.DISABLED):i.setHTML(M.util.get_string("expandall","moodle")).removeClass(n.COLLAPSEALL).removeClass(n.DISABLED)},i.process_results=function(t,r,i){var s,o;try{o=e.JSON.parse(r.responseText);if(o.error)return new M.core.ajaxException(o)}catch(u){return new M.core.exception(u)}s=e.Node.create(o),i.childnode.appendChild(s),i.parentnode.addClass(n.LOADED).removeClass(n.NOTLOADED),this.run_expansion(i.parentnode),i.spinner&&i.spinner.hide().destroy()},i.add_animation=function(t){return typeof t.fx!="undefined"?t:(t.plug(e.Plugin.NodeFX,{from:{height:0,opacity:0},to:{height:function(e){return e.get("scrollHeight")},opacity:1},duration:.2}),t)}},"@VERSION@",{requires:["node","event-key"]}); diff --git a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander.js b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander.js index 801e93422c4..b7e1e9bdb99 100644 --- a/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander.js +++ b/course/yui/build/moodle-course-categoryexpander/moodle-course-categoryexpander.js @@ -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 } }); }; diff --git a/course/yui/src/categoryexpander/js/categoryexpander.js b/course/yui/src/categoryexpander/js/categoryexpander.js index b942f94285f..a679c796088 100644 --- a/course/yui/src/categoryexpander/js/categoryexpander.js +++ b/course/yui/src/categoryexpander/js/categoryexpander.js @@ -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 } }); }; diff --git a/enrol/index.php b/enrol/index.php index 45dac25271d..5e3d331611a 100644 --- a/enrol/index.php +++ b/enrol/index.php @@ -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); } } diff --git a/lib/ajax/getnavbranch.php b/lib/ajax/getnavbranch.php index 67738dbf066..e2e319a68b7 100644 --- a/lib/ajax/getnavbranch.php +++ b/lib/ajax/getnavbranch.php @@ -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); } } diff --git a/lib/moodlelib.php b/lib/moodlelib.php index ec4692d5619..33b03249a50 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -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); } } diff --git a/mod/choice/view.php b/mod/choice/view.php index f2b21077fa9..f8c4a3885e0 100644 --- a/mod/choice/view.php +++ b/mod/choice/view.php @@ -186,9 +186,7 @@ if (!$choiceformshown) { echo $OUTPUT->box_start('generalbox', 'notice'); echo '

    '. get_string('notenrolledchoose', 'choice') .'

    '; 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(); diff --git a/mod/forum/post.php b/mod/forum/post.php index 47a4edd6b20..6a18d21c4af 100644 --- a/mod/forum/post.php +++ b/mod/forum/post.php @@ -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');