aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio <s1lv10@uol.com.br>2009-09-29 16:49:36 -0300
committerSilvio <s1lv10@uol.com.br>2009-09-29 16:49:36 -0300
commit1ca668c4937be08c43bd0ab2d9270c5c4ac68130 (patch)
treee9a9e383d237e6e17b469936510e08a1a2155c14
parentf694b9c31d070a2abecb34e7124ec5a4d6aacfb1 (diff)
downloadfinder_menu-1ca668c4937be08c43bd0ab2d9270c5c4ac68130.tar.gz
finder_menu-1ca668c4937be08c43bd0ab2d9270c5c4ac68130.tar.bz2
Initial working version
-rw-r--r--finder_menu.css60
-rw-r--r--finder_menu.module36
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>';