? taxonomy_super_select-collapse-switch.patch
Index: taxonomy_super_select.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_super_select/taxonomy_super_select.install,v
retrieving revision 1.2
diff -u -p -r1.2 taxonomy_super_select.install
--- taxonomy_super_select.install	12 Jan 2009 22:03:08 -0000	1.2
+++ taxonomy_super_select.install	5 Feb 2009 08:46:35 -0000
@@ -25,5 +25,7 @@ function taxonomy_super_select_uninstall
   $result = db_query("SELECT vid FROM {vocabulary}");
   while ($vid = db_result($result)) {
     variable_del('taxonomy_super_select_vid_'. $vid);
+    variable_del('taxonomy_super_select_collapsible_vid_'. $vid);
+    variable_del('taxonomy_super_select_collapsed_vid_'. $vid);
   }
 }
Index: taxonomy_super_select.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/taxonomy_super_select/taxonomy_super_select.module,v
retrieving revision 1.10.2.1
diff -u -p -r1.10.2.1 taxonomy_super_select.module
--- taxonomy_super_select.module	21 Jan 2009 22:44:21 -0000	1.10.2.1
+++ taxonomy_super_select.module	5 Feb 2009 08:46:35 -0000
@@ -56,6 +56,20 @@ function taxonomy_super_select_form_alte
           '#weight' => 2,
           );
       }
+      $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['tss_collapsible'] = array(
+        '#type'          => 'checkbox',
+        '#title'         => t('Vocabularies are collapsible'),
+        '#default_value' => variable_get('taxonomy_super_select_collapsible_vid_'. $vid, '1'),
+        '#description'   => t('Vocabularies are collapsible.'),
+        '#weight'         => 10,
+      );
+      $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['tss_collapsed'] = array(
+        '#type'          => 'checkbox',
+        '#title'         => t('Collapse vocabularies'),
+        '#default_value' => variable_get('taxonomy_super_select_collapsed_vid_'. $vid, '1'),
+        '#description'   => t('Collapse all vocabulary boxes by default. Requires vocabularies to be collapsible.'),
+        '#weight'         => 20,
+      );
     }
   }
 
@@ -147,7 +161,8 @@ function _tss_branch($vid, $term, $value
     case 'fieldset':
       // In this section, $term is actually the vocabulary.
       // Automatically expand required vocabs or if the parent term is selected
-      $collapsed = ($required OR $term->parent_value) ? FALSE : TRUE;
+      $collapsed = (variable_get('taxonomy_super_select_collapsed_vid_'. $vid, '1') && !$required && !$term->parent_value) ? TRUE : FALSE;
+      $collapsible = (!variable_get('taxonomy_super_select_collapsible_vid_'. $vid, '1') && !$collapsed) ? FALSE : TRUE;
       if ($term->help) {
         $help = '<div class="taxonomy-super-select-help">'. $term->help .'</div>';
       }
@@ -157,7 +172,7 @@ function _tss_branch($vid, $term, $value
       $form = array(
         '#type' => 'fieldset',
         '#title' => check_plain($term->name) . $required,
-        '#collapsible' => TRUE,
+        '#collapsible' => $collapsible,
         '#collapsed' => $collapsed,
         '#weight' => ($fieldweight >= 0) ? $fieldweight : $term->weight,
         '#parents' => array('taxonomy', $vid),
@@ -316,6 +331,8 @@ function taxonomy_super_select_submit(&$
         'image' => $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['image']['#value'],
       );
     variable_set('taxonomy_super_select_vid_'. $vid, $tostore);    
+    variable_set('taxonomy_super_select_collapsible_vid_'. $vid, $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['tss_collapsible']['#value']);    
+    variable_set('taxonomy_super_select_collapsed_vid_'. $vid, $form['settings']['tss']['taxonomy_super_select_vid_'. $vid]['tss_collapsed']['#value']);    
   }
   else{
     variable_del('taxonomy_super_select_vid_'. $vid);
