diff options
-rw-r--r-- | finder_menu.css | 60 | ||||
-rw-r--r-- | finder_menu.module | 36 |
2 files changed, 86 insertions, 10 deletions
diff --git a/finder_menu.css b/finder_menu.css new file mode 100644 index 0000000..83386b1 --- /dev/null +++ b/finder_menu.css @@ -0,0 +1,60 @@ +body +{ + margin:0; + padding:0; + font-family:arial,sans-serif; +} +.domenabled #finderparent +{ + border:1px solid #000; + position:relative; + height:150px; +} +.domenabled #finder +{ + position:absolute; + top:1em; + left:1em; +} +.domenabled ul#finder, +.domenabled ul#finder li, +.domenabled ul#finder ul +{ + width:200px; + list-style-type:none; + margin:0; + padding:0; +} +.domenabled ul#finder ul.hidden +{ + top:0px; + left:-2000px; + position:absolute; +} +.domenabled ul#finder ul.shown +{ + top:0px; + left:200px; + position:absolute; +} +.domenabled #finder a.open +{ + background:url(arrowon.gif) no-repeat 90% 50% #eee; + padding-right:16px; + padding-left:0px; + display:block; +} +.domenabled #finder a.parent +{ + background:url(arrow.gif) no-repeat #fff 100% 50%; + padding-right:16px; + padding-left:0px; +} +.domenabled ul#finder li a +{ + color:#000; + background:url(normal.gif) no-repeat #fff 0 50% ; + padding-left:16px; + text-decoration:none; +} + diff --git a/finder_menu.module b/finder_menu.module index 02b1edb..91a749d 100644 --- a/finder_menu.module +++ b/finder_menu.module @@ -2,6 +2,14 @@ // $Id$ /** + * Implementation of hook_init(). + * Adds CSS, Javascript and settings to the page. + */ +function finder_menu_init() { + drupal_add_css(drupal_get_path('module', 'finder_menu') .'/finder_menu.css'); +} + +/** * Implementation of hook_block(); */ function finder_menu_block($op = 'list', $delta = 0, $edit = array()) { @@ -102,9 +110,9 @@ function theme_finder_menu($menu_name, $mlid) { // Build the menus - $output = '<ul style="display:inline" class="finder-menu-menu">'; - $output = finder_menu_build($menu); - $output .= '</ul>'; + $output = '<div id="finderparent">'; + $output .= finder_menu_build($menu, TRUE); + $output .= '</div>'; drupal_add_js(drupal_get_path('module', 'finder_menu') .'/finder_menu.js'); return $output; @@ -115,17 +123,25 @@ function theme_finder_menu($menu_name, $mlid) { * * @ingroup themeable */ -function finder_menu_build($menu) { +function finder_menu_build($menu, $first = FALSE) { - $output = '<ul>'; + if ($first === TRUE) { + $output = '<ul id="finder">'; + } else { + $output = '<ul>'; + } foreach($menu as $menu_item) { - $output .= '<li>'; - $output .= $menu_item['link']['title']; - if ($menu_item['below'] !== FALSE) { - $output .= finder_menu_build($menu_item['below']); + if ($menu_item['link']['hidden'] == 0) { + $output .= '<li>'; + if ($menu_item['below'] !== FALSE) { + $output .= $menu_item['link']['title']; + $output .= finder_menu_build($menu_item['below']); + } else { + $output .= theme('menu_item_link', $menu_item['link']); + } + $output .= '</li>'; } - $output .= '</li>'; } $output .= '</ul>'; |