diff options
-rw-r--r-- | jquery_drawer.info | 2 | ||||
-rw-r--r-- | jquery_drawer.module | 38 |
2 files changed, 2 insertions, 38 deletions
diff --git a/jquery_drawer.info b/jquery_drawer.info index 9a55330..964b777 100644 --- a/jquery_drawer.info +++ b/jquery_drawer.info @@ -3,4 +3,4 @@ name = jQuery Drawer description = Show menu with jQuery.drawer functionality. core = 6.x version = "6.x-0.1" -dependencies[] = menu +dependencies[] = menu taxonomy_node_tree diff --git a/jquery_drawer.module b/jquery_drawer.module index 276c162..76e0856 100644 --- a/jquery_drawer.module +++ b/jquery_drawer.module @@ -164,29 +164,7 @@ function jquery_drawer_page($tid = null) { AND node.status = "1"'; $result = db_query(db_rewrite_sql($query), implode(',', $filter)); - - while ($node = db_fetch_object($result)) { - foreach ($terms as $term) { - // add nodes into the term - if ($node->tid == $term->tid) { - $term->nodes[] = $node; - } - // update an index of terms - $tree[$term->tid] = $term; - } - } - - // add children relationship just for terms present in the tree - foreach ($tree as $term) { - if ($term->parents[0] != 0 && isset($tree[$term->parents[0]])) { - $tree[$term->parents[0]]->children[] = $term->tid; - } - } - - // build menu with hierarchy - foreach ($tree as $term) { - jquery_drawer_build_tree($tree, $term); - } + $tree = taxonomy_node_tree_build($result, $terms); // format output $output .= '<ul id="drw_item" class="hidden">'; @@ -202,20 +180,6 @@ function jquery_drawer_page($tid = null) { exit(); } -function jquery_drawer_build_tree(&$tree, $term) { - if ($term->parents[0] != 0 && isset($tree[$term->parents[0]])) { - // is child - if (isset($term->children)) { - // is also parent, so go down one level - foreach($term->children as $child) { - jquery_drawer_build_tree($tree, $tree[$child]); - } - } - $tree[$term->parents[0]]->below[] = drupal_clone($term); - unset($tree[$term->tid]); - } -} - /** * Recursively build the menu. * |