navigation MDL-14632 Very significant navigation commit

This patch introduces two new blocks global_navigation_tree and settings_navigation_tree
both of which have been designed to make full use of the new navigation objects available through
the $PAGE object.
Bulk of this code is within lib/navigationlib.php
This commit is contained in:
samhemelryk
2009-08-28 08:47:31 +00:00
parent 4460e25d2b
commit 7d2a049292
55 changed files with 6787 additions and 712 deletions
+36 -9
View File
@@ -721,18 +721,45 @@ function addonload(fn) {
fn();
}
}
function getElementsByClassName(oElm, strTagName, oClassNames) {
/**
* Replacement for getElementsByClassName in browsers that aren't cool enough
*
* Relying on the built-in getElementsByClassName is far, far faster than
* using YUI.
*
* Note: the third argument used to be an object with odd behaviour. It now
* acts like the 'name' in the HTML5 spec, though the old behaviour is still
* mimicked if you pass an object.
*
* @param {Node} oElm The top-level node for searching. To search a whole
* document, use `document`.
* @param {String} strTagName filter by tag names
* @param {String} name same as HTML5 spec
*/
function getElementsByClassName(oElm, strTagName, name) {
// for backwards compatibility
if(typeof name == "object") {
var names = new Array();
for(var i=0; i<name.length; i++) names.push(names[i]);
name = names.join('');
}
// use native implementation if possible
if (oElm.getElementsByClassName && Array.filter) {
if (strTagName == '*') {
return oElm.getElementsByClassName(name);
} else {
return Array.filter(oElm.getElementsByClassName(name), function(el) {
return el.nodeName.toLowerCase() == strTagName.toLowerCase();
});
}
}
// native implementation unavailable, fall back to slow method
var arrElements = (strTagName == "*" && oElm.all)? oElm.all : oElm.getElementsByTagName(strTagName);
var arrReturnElements = new Array();
var arrRegExpClassNames = new Array();
if(typeof oClassNames == "object") {
for(var i=0; i<oClassNames.length; i++) {
arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames[i].replace(/\-/g, "\\-") + "(\\s|$)"));
}
}
else{
arrRegExpClassNames.push(new RegExp("(^|\\s)" + oClassNames.replace(/\-/g, "\\-") + "(\\s|$)"));
var names = name.split(' ');
for(var i=0; i<names.length; i++) {
arrRegExpClassNames.push(new RegExp("(^|\\s)" + names[i].replace(/\-/g, "\\-") + "(\\s|$)"));
}
var oElement;
var bMatchesAll;