mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'MDL-26875' of git://github.com/samhemelryk/moodle
This commit is contained in:
commit
c031f2c1e7
@ -118,6 +118,7 @@ class block_navigation extends block_base {
|
||||
'courselimit' => $limit,
|
||||
'expansionlimit' => $expansionlimit
|
||||
);
|
||||
$this->page->requires->string_for_js('viewallcourses', 'moodle');
|
||||
$this->page->requires->yui_module(array('core_dock', 'moodle-block_navigation-navigation'), 'M.block_navigation.init_add_tree', array($arguments));
|
||||
}
|
||||
|
||||
|
28
blocks/navigation/yui/navigation/navigation.js
vendored
28
blocks/navigation/yui/navigation/navigation.js
vendored
@ -310,11 +310,18 @@ BRANCH.prototype = {
|
||||
try {
|
||||
var object = Y.JSON.parse(outcome.responseText);
|
||||
if (object.children && object.children.length > 0) {
|
||||
var coursecount = 0;
|
||||
for (var i in object.children) {
|
||||
if (typeof(object.children[i])=='object') {
|
||||
if (object.children[i].type == 20) {
|
||||
coursecount++;
|
||||
}
|
||||
this.addChild(object.children[i]);
|
||||
}
|
||||
}
|
||||
if (this.get('type') == 10 && coursecount >= M.block_navigation.courselimit) {
|
||||
this.addViewAllCoursesChild(this);
|
||||
}
|
||||
this.get('tree').toggleExpansion({target:this.node});
|
||||
return true;
|
||||
}
|
||||
@ -345,16 +352,23 @@ BRANCH.prototype = {
|
||||
}
|
||||
}
|
||||
if (branch.get('type') == 10 && count >= M.block_navigation.courselimit) {
|
||||
branch.addChild({
|
||||
name : M.str.moodle.viewallcourses,
|
||||
title : M.str.moodle.viewallcourses,
|
||||
link : M.cfg.wwwroot+'/course/category.php?id='+branch.get('key'),
|
||||
haschildren : false,
|
||||
icon : {'pix':"i/navigationitem",'component':'moodle'}
|
||||
}, branch);
|
||||
this.addViewAllCoursesChild(branch);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Add a link to view all courses in a category
|
||||
*/
|
||||
addViewAllCoursesChild: function(branch) {
|
||||
branch.addChild({
|
||||
name : M.str.moodle.viewallcourses,
|
||||
title : M.str.moodle.viewallcourses,
|
||||
link : M.cfg.wwwroot+'/course/category.php?id='+branch.get('key'),
|
||||
haschildren : false,
|
||||
icon : {'pix':"i/navigationitem",'component':'moodle'}
|
||||
});
|
||||
}
|
||||
}
|
||||
Y.extend(BRANCH, Y.Base, BRANCH.prototype, {
|
||||
|
Loading…
x
Reference in New Issue
Block a user