navigation MDL-25596 Improvements for the navigation blocks JS

The biggest change is that the navigation block has been converted to a proper YUI module.
The following are the other changes made at the same time:
 * A loading icon is displayed when a branch is being loaded by AJAX.
 * Fixed a bug where you could trigger multiple AJAX requests by rapidly clicking an unloaded branch.
 * Fixed a bug where empty branches weren't being marked as such after a successful AJAX load.
 * When docked the width of the blocks dock panel is now inspected an increased if required to try avoid horizontal scrolling.
 * Removed the no longer needed inclusion of the YUI2 dom library from the navigation and settings block.
 * Expandable nodes are now passed as JS data allowing the navigation JS to be initialised through block_navigation::get_required_javascript.
 * AJAX is now focused around the branch in question rather than the tree in general.
 * Expansion of branches is now delegated to the tree rather than being an individual event on all branches.
 * Tidied up the code in general removing unneeded-unused parameters.
This commit is contained in:
Sam Hemelryk
2010-12-23 11:21:07 +08:00
parent f056cb544d
commit 48d8d09063
7 changed files with 479 additions and 410 deletions
+2 -2
View File
@@ -540,7 +540,7 @@ class navigation_node implements renderable {
if ($child->nodetype == self::NODETYPE_BRANCH && $child->children->count()==0 && $child->display) {
$child->id = 'expandable_branch_'.(count($expandable)+1);
$this->add_class('canexpand');
$expandable[] = array('id'=>$child->id,'branchid'=>$child->key,'type'=>$child->type);
$expandable[] = array('id'=>$child->id,'key'=>$child->key,'type'=>$child->type);
}
$child->find_expandable($expandable);
}
@@ -3699,7 +3699,7 @@ class navigation_json {
*/
public function set_expandable($expandable) {
foreach ($expandable as $node) {
$this->expandable[$node['branchid'].':'.$node['type']] = $node;
$this->expandable[$node['key'].':'.$node['type']] = $node;
}
}
/**