From: samhemelryk Date: Mon, 31 Aug 2009 03:58:17 +0000 (+0000) Subject: navigation MDL-14632 Minor tweaking as suggested on this issue. X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=9da1ec271f5a7330e45ed1d75b9dfc6fa66f81ea;p=moodle.git navigation MDL-14632 Minor tweaking as suggested on this issue. * Fixed focus on search closing tab * Added spacing to refresh/moveto icons * Made all text in navigation tree's expandable * Final element on navbar no longer a link --- diff --git a/lib/javascript-navigation.js b/lib/javascript-navigation.js index 6fe7d9c8d8..1b90d61946 100644 --- a/lib/javascript-navigation.js +++ b/lib/javascript-navigation.js @@ -146,6 +146,9 @@ navigation_tree.prototype.toggleexpansion = function(e) { YAHOO.util.Event.stopPropagation(e); var target = YAHOO.util.Event.getTarget(e); var parent = target.parentNode; + while (parent.nodeName.toUpperCase()!='LI') { + parent = parent.parentNode; + } if (YAHOO.util.Dom.hasClass(parent, 'collapsed')) { YAHOO.util.Dom.removeClass(parent, 'collapsed'); } else { @@ -441,6 +444,9 @@ navigation_tab_panel.prototype.create_tab_panel = function () { var navbar = document.createElement('div'); navbar.style.display = 'none'; navbar.setAttribute('id', 'sidebarpopup'); + var navbarspacer = document.createElement('div'); + navbarspacer.style.height = '10px'; + navbar.appendChild(navbarspacer); YAHOO.util.Dom.addClass(navbar, 'navigation_bar'); if (YAHOO.env.ua.ie > 0 && YAHOO.env.ua.ie < 7) { YAHOO.util.Dom.setStyle(navbar, 'height', YAHOO.util.Dom.getViewportHeight()+'px'); @@ -625,6 +631,7 @@ navigation_tab_panel.prototype.show_tab = function (e, tabname) { this.tabpanels[tabname].show(e, this.tabpanel); YAHOO.util.Dom.addClass(tabname+'_title', 'active_tab'); YAHOO.util.Event.removeListener(tabname+'_sidebarpopup', "mouseover", this.show_tab); + YAHOO.util.Event.addListener('navigation_tab_panel_'+tabname, "click", function (e){YAHOO.util.Event.stopPropagation(e);}); YAHOO.util.Event.addListener(tabname+'_sidebarpopup', "click", this.hide_tab, tabname, this); YAHOO.util.Event.addListener(window, 'resize', this.resize_tab, this, true); YAHOO.util.Event.addListener(document.body, "click", this.hide_tab, tabname, this); diff --git a/lib/navigationlib.php b/lib/navigationlib.php index c165446040..fc38ec42ad 100644 --- a/lib/navigationlib.php +++ b/lib/navigationlib.php @@ -586,6 +586,20 @@ class navigation_node { } } + /** + * Returns the child marked as active if there is one, false otherwise. + * + * @return navigation_node|bool The active node or false + */ + public function get_active_node() { + foreach ($this->children as $child) { + if ($child->isactive) { + return $child; + } + } + return false; + } + /** * Mark this node as active * @@ -1839,21 +1853,22 @@ class navbar extends navigation_node { $output = get_accesshide(get_string('youarehere','access'), 'h2')."\n"; $this->content = $output; @@ -1866,7 +1881,7 @@ class navbar extends navigation_node { * @param bool $firstnode * @return string HTML */ - protected function parse_branch_to_html($navarray, $firstnode=true) { + protected function parse_branch_to_html($navarray, $firstnode=true, $moreafterthis) { $separator = get_separator(); $output = ''; if ($firstnode===true) { @@ -1881,6 +1896,7 @@ class navbar extends navigation_node { // on the navbar. If we get to 20 items just stop! $count++; if ($count>20) { + // Maximum number of nodes in the navigation branch return $output; } $child = false; @@ -1900,8 +1916,17 @@ class navbar extends navigation_node { // We found an/the active node, set navarray to it's children so that // we come back through this while with the children of the active node $navarray = $child->children; + // If there are not more arrays being processed after this AND this is the last element + // then we want to set the action to null so that it is not used + if (!$moreafterthis && (!$child->contains_active_node() || ($child->find_active_node()==false || $child->find_active_node()->mainnavonly))) { + $oldaction = $child->action; + $child->action = null; + } // Now display the node $output .= '
  • '.$separator.' '.$child->content(true).'
  • '; + if (isset($oldaction)) { + $child->action = $oldaction; + } } } // XHTML diff --git a/theme/standard/styles_layout.css b/theme/standard/styles_layout.css index 41c15a2d3c..4ea1795873 100644 --- a/theme/standard/styles_layout.css +++ b/theme/standard/styles_layout.css @@ -1792,7 +1792,13 @@ a.skip:focus, a.skip:active { padding:3px; } -/* Navigation and settings block */ +/** + * Navigation and settings block + **/ +.customcommand img { + margin-left:2px; + margin-right:2px; +} .sideblock .block_tree_box { margin:2px; } @@ -1888,7 +1894,7 @@ body.has_navigation_bar { padding:0px; } .ie6 .navigation_bar li p { - background-color:inherit; + background-color:inherit; } .navigation_bar .sideblock_tab { @@ -1902,8 +1908,6 @@ body.has_navigation_bar { cursor:pointer; } .navigation_bar .bd.oversized_content { - background-color:red; - margin:3px; overflow-y:auto; overflow-x:visible; height:inherit;