Changeset 1307

Show
Ignore:
Timestamp:
11/15/07 22:01:36 (6 years ago)
Author:
benoitg
Message:
  • Menu.php: Make individual submenus, and individual menu items CSS-targetable.
Location:
trunk/wifidog-auth
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/CHANGELOG

    r1306 r1307  
    11# $Id$ 
     22007-11-15 Benoit Grégoire  <bock@step.polymtl.ca> 
     3        * Menu.php: Make individual submenus, and individual menu items CSS-targetable. 
     4 
    252007-11-05 Benoit Grégoire  <bock@step.polymtl.ca> 
    36        * Commit most of Robin Jones install script improvements. 
  • trunk/wifidog-auth/wifidog/classes/Menu.php

    r1298 r1307  
    102102        } 
    103103        !empty($menuItemArray['title'])?$title=$menuItemArray['title']:$title=$menuItemArray['path']; 
     104        $class = preg_replace ("/.*?([^\/]*$)/", "$1", $menuItemArray['path']);//Only take the last fragment of the path as CSS class 
    104105        if(!empty($menuItemArray['url'])) { 
    105             $html .= "<li><a href='{$menuItemArray['url']}'>{$menuItemArray['title']}</a>\n"; 
     106            $html .= "<li class='$class'><a href='{$menuItemArray['url']}'>{$menuItemArray['title']}</a>\n"; 
    106107        } 
    107108        else if(!empty($menuItemArray['childrens'])){ 
    108             $html .= "<li><a href='#'>{$menuItemArray['title']}</a>\n"; 
     109            $html .= "<li class='$class'><a href='#'>{$menuItemArray['title']}</a>\n"; 
    109110        } 
    110111 
    111112        if(!empty($menuItemArray['childrens'])) { 
    112             $html .= "<ul>\n"; 
    113         } else { 
     113            $html .= "<ul class='$class'>\n"; 
     114        } else if(!empty($menuItemArray['url'])){ 
    114115            $html .= "\n</li>\n"; 
    115116        } 
     
    147148        return strcoll ( utf8_decode($object1['title']), utf8_decode($object2['title']) ); 
    148149    } 
    149      
     150 
    150151    /** Sort the menu using a user defined sort function */ 
    151152    private static function menuArraySort(&$menuArray, $funcname, &$userdata = null) { 
     
    195196        $this->processHookMenu('ContentTypeFilter'); 
    196197        $this->processHookMenu('ProfileTemplate'); 
    197                 $this->processHookMenu('DependenciesList'); 
     198        $this->processHookMenu('DependenciesList'); 
    198199        self::menuArraySort($this->_menuArray, array('Menu','titlestrcoll')); 
    199200        //pretty_print_r($this->_menuArray); 
     
    206207     */ 
    207208    static public function getIEWorkaroundJS() { 
    208                 $html = <<<EOT 
     209        $html = <<<EOT 
    209210        <script type="text/javascript"><!--//--><![CDATA[//><!-- 
    210211 
     
    226227//--><!]]></script> 
    227228EOT; 
    228 return $html; 
     229        return $html; 
    229230    } 
    230231    public function getUserUI() 
     
    234235        //Deal with internet explorer's baindeadness.  From http://www.htmldog.com/articles/suckerfish/dropdowns/example/vertical.html 
    235236 
    236 $html .= "<ul id='nav'>\n"; 
     237        $html .= "<ul id='nav'>\n"; 
    237238        $userData=null; 
    238239        self::menuArrayWalkRecursive(array('Menu','buildHtmlMenuItemCallback'), $userData); 
     
    242243        } 
    243244        $html .= "</ul>\n"; 
    244                 $html .= "<br/ class='clearbr'>\n"; 
     245        $html .= "<br/ class='clearbr'>\n"; 
    245246        //echo htmlspecialchars($userData['html']); 
    246247        return $html;