? .svn
? 220328.patch
? po/.svn
Index: taxonomy_menu.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_menu/taxonomy_menu.inc,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 taxonomy_menu.inc
--- taxonomy_menu.inc	31 Jan 2008 16:23:34 -0000	1.1.2.10
+++ taxonomy_menu.inc	11 Feb 2008 13:38:08 -0000
@@ -8,71 +8,40 @@
  */
 
 /**
- * Admin area. Configure the module, setting which
- * vocabularies will be converted into menus items
+ * Admin area. Configure the module.
  *
  * @return
  *   Array. The form fields.
  */
 function _taxonomy_menu_admin() {
-  $options = array(
-    TAXONOMY_MENU_NONE    => t('No'),
-    TAXONOMY_MENU_NORMAL  => t('Normal')
-  );
+  $form = array();
+  extract(_taxonomy_menu_admin_init_options());
 
-  // If the Views module is enabled, add some special
-  // new features
-  if (module_exists('views')) {
-    // Add the Views file with more functions
-    require_once(drupal_get_path('module', 'views') .'/views_cache.inc');
+  // Create some options for each of the vocabularies
+  $header = array(t('Vocabulary'), t('Status'), t('Operations'));
 
-    // Add a new options on Categories
-    $options[TAXONOMY_MENU_VIEW] = t('Views');
+  $rows = array();
+  foreach (taxonomy_get_vocabularies() as $vocab) {
+    $vid = $vocab->vid;
+    $edit_path = "admin/settings/taxonomy_menu/$vid";
+    $show = variable_get("taxonomy_menu_show_$vid", TAXONOMY_MENU_NONE);
 
-    // Get the list of User generated views
-    $views = db_query("SELECT * FROM {view_view}");
-    while ($view = db_fetch_array($views)) {
-      $views_list[$view['name']] = $view['page_title'];
+    if ($show != TAXONOMY_MENU_VIEW) {
+      $status = $options[$show];
     }
-
-    // Now get a list of default Views
-    foreach (_views_get_default_views() as $view => $viewdata) {
-      $views_list[$view] = $viewdata->name;
+    else {
+      $status = t('View: %view', array('%view' => variable_get("taxonomy_menu_show_view_$vid", '')));
     }
-  }
-
-  // Create some options for each of the vocabularies
-  foreach (taxonomy_get_vocabularies() as $vocab) {
-    $form[$vocab->vid] = array(
-      '#title'          => $vocab->name,
-      '#tree'           => FALSE,
-      '#type'           => 'fieldset'
-    );
-    $form[$vocab->vid]['taxonomy_menu_show_'. $vocab->vid] = array(
-      '#default_value'  => variable_get('taxonomy_menu_show_'. $vocab->vid, TAXONOMY_MENU_NONE),
-      '#options'        => $options,
-      '#title'          => t('Show this category in menu'),
-      '#type'           => 'radios'
-    );
 
-    // In case of View options selected, select Views
-    if (module_exists('views')) {
-      $form[$vocab->vid]['taxonomy_menu_show_view_'. $vocab->vid] = array(
-        '#default_value'  => variable_get('taxonomy_menu_show_view_'. $vocab->vid, ''),
-        '#options'        => $views_list,
-        '#title'          => t('Views available'),
-        '#type'           => 'select'
-      );
-    }
+    $rows[] = array(l($vocab->name, $edit_path), $status, l(t('Edit'), $edit_path));
   }
+  
+  $form['taxonomy_menu_vocabs'] = array(
+    '#type' => 'markup',
+    '#value' => theme('table', $header, $rows),
+  );
 
   // General options
-  $form['taxonomy_menu_display_page'] = array(
-    '#default_value'  => variable_get('taxonomy_menu_display_page', 'category'),
-    '#description'    => t('How should be the first item on the menu? Example: categories/1/2/3, technology/1/2/3'),
-    '#title'          => t('Module page'),
-    '#type'           => 'textfield',
-  );
   $form['taxonomy_menu_display_num'] = array(
     '#default_value'  => variable_get('taxonomy_menu_display_num', FALSE),
     '#description'    => t('If checked, number of node per term will be displayed in the menu.'),
@@ -101,6 +70,99 @@ function _taxonomy_menu_admin() {
 }
 
 /**
+ * Configure each vocabulary
+ *
+ * @return
+ *   Array.  The form fields.
+ */
+function _taxonomy_menu_admin_vid($vid) {
+  $form = array('#redirect' => 'admin/settings/taxonomy_menu');
+  extract(_taxonomy_menu_admin_init_options());
+  $show = variable_get("taxonomy_menu_show_$vid", TAXONOMY_MENU_NONE);
+
+  $form['vid'] = array(
+    '#type'   => 'hidden',
+    '#value'  => $vid, 
+  );
+
+  $form["taxonomy_menu_own_menu_$vid"] = array(
+    '#default_value'  => variable_get("taxonomy_menu_own_menu_$vid", FALSE),
+    '#description'    => t('If checked, a new menu will be created for the vocabulary.'),
+    '#title'          => t('New menu'),
+    '#type'           => 'checkbox',
+  );
+
+  $form["taxonomy_menu_show_$vid"] = array(
+    '#default_value'  => $show,
+    '#options'        => $options,
+    '#title'          => t('Show this category in menu'),
+    '#type'           => 'radios',
+  );
+
+  // In case of View options selected, select Views
+  if (module_exists('views')) {
+    $form["taxonomy_menu_show_view_$vid"] = array(
+      '#default_value'  => variable_get("taxonomy_menu_show_view_$vid", ''),
+      '#options'        => $views_list,
+      '#title'          => t('Views available'),
+      '#type'           => 'select',
+    );
+  }
+
+  $form["taxonomy_menu_display_page_$vid"] = array(
+    '#default_value'  => variable_get("taxonomy_menu_display_page_$vid", 'category'),
+    '#description'    => t('How should be the first item on the menu? Example: categories/1/2/3, technology/1/2/3'),
+    '#title'          => t('Module page'),
+    '#type'           => 'textfield',
+  );
+
+  $form['submit'] = array(
+    '#value'          => t('Submit'),
+    '#type'           => 'submit',
+  );
+
+  return $form;
+}
+
+/**
+ * Assembles and returns a list of options and views for admin forms.
+ *
+ * @return
+ *   Array. 
+ *      options;    A list of values and titles for vocabulary settings.
+ *      views_list; A list of views that can be selected for vocabularies.
+ */
+function _taxonomy_menu_admin_init_options() {
+  $options = array(
+    TAXONOMY_MENU_NONE    => t('No'),
+    TAXONOMY_MENU_NORMAL  => t('Normal')
+  );
+
+  // If the Views module is enabled, add some special
+  // new features
+  if (module_exists('views')) {
+    // Add the Views file with more functions
+    require_once(drupal_get_path('module', 'views') .'/views_cache.inc');
+
+    // Add a new options on Categories
+    $options[TAXONOMY_MENU_VIEW] = t('Views');
+
+    // Get the list of User generated views
+    $views = db_query("SELECT * FROM {view_view}");
+    while ($view = db_fetch_array($views)) {
+      $views_list[$view['name']] = $view['page_title'];
+    }
+
+    // Now get a list of default Views
+    foreach (_views_get_default_views() as $view => $viewdata) {
+      $views_list[$view] = $viewdata->name;
+    }
+  }
+
+  return compact('options', 'views_list');
+}
+
+/**
  * Implementation of hook_menu().
  *
  * Its the main function for this module.
@@ -110,30 +172,48 @@ function _taxonomy_menu_menu() {
     'access'              => user_access('administer site configuration'),
     'callback'            => 'drupal_get_form',
     'callback arguments'  => array('__taxonomy_menu_admin'),
-    'file'                => 'taxonomy_menu.inc',
     'description'         => t('Global configuration of taxonomy menu functionality.'),
     'path'                => 'admin/settings/taxonomy_menu',
     'title'               => t('Taxonomy Menu'),
-    'type'                => MENU_NORMAL_ITEM
   );
 
+  foreach (taxonomy_get_vocabularies() as $vocab) {
+    $vid = $vocab->vid;
+    $path = "admin/settings/taxonomy_menu/$vid";
+    $t_vars =  array('!vocab' => $vocab->name);
+
+    $items[$path] = array(
+      'access'              => user_access('administer site configuration'),
+      'callback'            => 'drupal_get_form',
+      'callback arguments'  => array('__taxonomy_menu_admin_vid', $vid),
+      'description'         => t('Configuration of taxonomy menu functionality for the !vocab vocabulary.', $t_vars),
+      'path'                => $path,
+      'title'               => t('Taxonomy Menu: !vocab', $t_vars),
+      'type'                => MENU_CALLBACK,
+    );
+  }
+
   // This user access function will be used for
   // all menu items
   $access = user_access('access content');
 
   foreach (taxonomy_get_vocabularies() as $vocabulary) {
-    if (variable_get('taxonomy_menu_show_'. $vocabulary->vid, TAXONOMY_MENU_NONE)) {
-      $path =  variable_get('taxonomy_menu_display_page', 'category') .'/'. $vocabulary->vid;
+    $vid = $vocabulary->vid;
+    if (variable_get("taxonomy_menu_show_$vid", TAXONOMY_MENU_NONE)) {
+      $path =  variable_get("taxonomy_menu_display_page_$vid", 'category') ."/$vid";
       $items[$path] = array(
         'access'          => $access,
         'callback'        => '__taxonomy_menu_page',
-        'file'            => 'taxonomy_menu.inc',
-        'page callback'   => '__taxonomy_menu_page',
         'path'            => $path,
         'title'           => t($vocabulary->name),
-        'weight'          => $vocabulary->weight
+        'weight'          => $vocabulary->weight,
       );
 
+      if (variable_get("taxonomy_menu_own_menu_$vid", FALSE)) {
+        $items[$path]['pid'] = 0;
+        $items[$path]['type'] = 115;
+      }
+
       $tree = taxonomy_get_tree($vocabulary->vid);
       $old_depth = -1;
       $old_path = $path;
@@ -164,8 +244,6 @@ function _taxonomy_menu_menu() {
             'access'          => $access,
             'callback'        => '__taxonomy_menu_page',
             'description'     => t($term->description),
-            'file'            => 'taxonomy_menu.inc',
-            'page callback'   => '__taxonomy_menu_page',
             'path'            => $path,
             'title'           => $name,
             'weight'          => $term->weight
@@ -174,6 +252,7 @@ function _taxonomy_menu_menu() {
       }
     }
   }
+
   return $items;
 }
 
@@ -190,7 +269,7 @@ function _taxonomy_menu_menu() {
  */
 function _taxonomy_menu_node_view(&$node, &$vocabs) {
   foreach ($vocabs as $vid => $vocab) {
-    $path = variable_get('taxonomy_menu_display_page', 'category') .'/'. $vid;
+    $path = variable_get("taxonomy_menu_display_page_$vid", 'category') .'/'. $vid;
 
     $tree = taxonomy_get_tree($vid);
     $old_depth = -1;
Index: taxonomy_menu.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_menu/taxonomy_menu.module,v
retrieving revision 1.17.2.1.2.12
diff -u -p -r1.17.2.1.2.12 taxonomy_menu.module
--- taxonomy_menu.module	31 Jan 2008 16:23:34 -0000	1.17.2.1.2.12
+++ taxonomy_menu.module	11 Feb 2008 13:38:08 -0000
@@ -14,8 +14,7 @@ define('TAXONOMY_MENU_VIEW',        2);
 define('TAXONOMY_MENU_DEFAULT_TAX', 3);
 
 /**
- * Admin area. Configure the module, setting which
- * vocabularies will be converted into menus items
+ * Admin area. Configure the module.
  *
  * @return
  *   Array. The form fields.
@@ -26,22 +25,41 @@ function __taxonomy_menu_admin() {
 }
 
 /**
- * Admin area. Configure the module, setting which
- * vocabularies will be converted into menus items
+ * Admin area. Configure the module.
  */
 function __taxonomy_menu_admin_submit(&$form_id, &$form) {
   // Save these options
-  variable_set('taxonomy_menu_display_page',        $form['taxonomy_menu_display_page']);
   variable_set('taxonomy_menu_display_num',         $form['taxonomy_menu_display_num']);
   variable_set('taxonomy_menu_hide_empty',          $form['taxonomy_menu_hide_empty']);
   variable_set('taxonomy_menu_display_descendants', $form['taxonomy_menu_display_descendants']);
 
-  // Save which category should be displayed on menu
-  foreach (taxonomy_get_vocabularies() as $vocab) {
-    variable_set('taxonomy_menu_show_'. $vocab->vid, $form['taxonomy_menu_show_'. $vocab->vid]);
-    if (module_exists('views')) {
-      variable_set('taxonomy_menu_show_views_'. $vocab->vid, $form['taxonomy_menu_show_view_'. $vocab->vid]);
-    }
+  // Rebuild the menu to include these features
+  menu_rebuild();
+}
+
+/**
+ * Admin for each vocabulary.
+ *
+ * @return
+ *   Array. The form fields.
+ */
+function __taxonomy_menu_admin_vid($vid) {
+  require_once(drupal_get_path('module', 'taxonomy_menu') .'/taxonomy_menu.inc');
+  return _taxonomy_menu_admin_vid($vid);
+}
+
+/**
+ * Admin for each vocabulary.
+ */
+function __taxonomy_menu_admin_vid_submit(&$form_id, &$form) {
+  $vid = $form['vid'];
+
+  variable_set("taxonomy_menu_show_$vid",         $form["taxonomy_menu_show_$vid"]);
+  variable_set("taxonomy_menu_display_page_$vid", $form["taxonomy_menu_display_page_$vid"]);
+  variable_set("taxonomy_menu_own_menu_$vid",     $form["taxonomy_menu_own_menu_$vid"]);
+
+  if (module_exists('views')) {
+    variable_set("taxonomy_menu_show_view_$vid", $form["taxonomy_menu_show_view_$vid"]);
   }
 
   // Rebuild the menu to include these features
