"none"); $vocabularies = taxonomy_get_vocabularies(); foreach ($vocabularies as $vocabulary) { $vocabs[$vocabulary->vid] = $vocabulary->name; } $form['jsdomenu_css'] = array( '#type' => 'select', '#title' => t('jsdomenu style'), '#default_value' => variable_get('jsdomenu_css', 'default'), '#options' => jsdomenu_available_themes(), '#description' => t('Choose the menu theme.'), ); $form["jsdomenu_placement"] = array( '#type' => 'select', '#title' => t("Menu placement"), '#default_value' => variable_get("jsdomenu_placement", 'absolute'), '#options' => array('absolute' => t('Compressed in jsDoMenu block'), 'static' => t('Visible in jsDoMenu block'), 'cursor' => t('Appears at cursor position on click')), '#description' => t("Placement of the menu on the page)."), ); $form["jsdomenu_navigation_vocab"] = array( '#type' => 'select', '#title' => t("Menu vocabulary"), '#default_value' => variable_get("jsdomenu_navigation_vocab", 1), '#options' => $vocabs, '#description' => t("Vocabulary from which navigation links will be generated (one link for each first-level term in vocabulary)."), ); $form['jsdomenu_block_title'] = array( '#type' => 'textfield', '#title' => t("Block title"), '#default_value' => variable_get("jsdomenu_block_title", 'Shortcuts'), '#size' => 30, '#maxlength' => 30, '#description' => t("This title will be the block heading if a placement other than cursor positioning is used"), '#attributes' => NULL, '#required' => TRUE, ); $form['jsdomenu_block_instructions'] = array( '#type' => 'textfield', '#title' => t("Block instructions"), '#default_value' => variable_get("jsdomenu_block_instructions", 'Click here for menu'), '#size' => 30, '#maxlength' => 30, '#description' => t("These instructions will appear in the block, and MUST be present if you select the placement mode 'Compressed in jsDoMenu block"), '#attributes' => NULL, '#required' => TRUE, ); $form['jsdomenu_navigation_nodes'] = array( '#type' => 'checkbox', '#title' => "Nodes included in menu", '#return_value' => TRUE, '#default_value' => variable_get('jsdomenu_navigation_nodes', FALSE), '#description' => "Check this box if you want to return nodes in the menus as well as taxonomy terms", ); return $form; } /** * Implementation of hook_onload(). */ function jsdomenu_onload() { return array("initjsDOMenu()"); } /** * Implementation of hook_menu(). */ function jsdomenu_menu($may_cache) { if ($may_cache) { jsdomenu_set_head(); } } /** * Get the css file corresponding to the current theme */ function jsdomenu_get_theme($theme) { $css = glob("$theme/*.css"); $theme_config['css'] = $css[0]; if (file_exists("modules/jsdomenu/lib/jsdomenu.config.js")) { $theme_config['config'] = "modules/jsdomenu/lib/jsdomenu.config.js"; } else { $theme_config['config'] = "$theme/jsdomenu.config.js"; } return $theme_config; } /** * Add script elements to HTML head. */ function jsdomenu_set_head() { global $base_url; $theme_config = jsdomenu_get_theme(variable_get("jsdomenu_css", "modules/jsdomenu/lib/themes/classic")); $output .= "\n"; $output .= "\n"; $output .= "\n"; drupal_set_html_head($output); } /** * Implementation of hook_block(). */ function jsdomenu_block($op = "list", $delta = 0) { $content = ''; if($op == "list") { $blocks[]["info"] = "jsdomenu dynamic menu"; return $blocks; } else { if (variable_get("jsdomenu_placement", 'absolute') != 'cursor') { $block["subject"] = variable_get("jsdomenu_block_title", 'Shortcuts'); } $vid = variable_get("jsdomenu_navigation_vocab", 1); $tree = taxonomy_get_tree($vid); if (variable_get("jsdomenu_placement", 'absolute') == 'absolute') { $content = "
" . variable_get("jsdomenu_block_instructions", 'Click here for menu') . "
\n"; } else { $content = "
\n"; } $content .= jsdomenu_make("term", $tree); $block["content"] = $content; return $block; } } /** * Construct menu calls. */ function jsdomenu_make($type = "term", $tree) { $depth = -1; $gen[$depth] = "main"; $output .= "\n"; return $output; } /** * Implementation of hook_help(). */ function jsdomenu_help($section = "admin/help#jsdomenu") { switch ($section) { case 'admin/help#jsdomenu': return t("

This module can be used to display dynamic menus. It has three different modes of operation:

In addition, it is possible to choose whether nodes should appear in the menus, or whether they should be limited to displaying taxonomies

By default, jsDoMenu is installed with two menu themes: 'classic' and 'XP Office'. To create different themes, create a new directory under 'themes', and modify one of the default themes as you please. It is also possible to alter the configuration file and make it specific to a theme by copying it into the appropriate directory"); case 'admin/modules#description': return t("A utility module to generate dynamic menus."); } } ?>