Index: og_vocab.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/og_vocab/Attic/og_vocab.module,v
retrieving revision 1.18.2.18
diff -u -p -r1.18.2.18 og_vocab.module
--- og_vocab.module	23 Jan 2009 09:56:17 -0000	1.18.2.18
+++ og_vocab.module	14 May 2009 19:39:59 -0000
@@ -146,6 +146,25 @@ function og_vocab_init() {
       og_set_group_context(node_load($gid));
     }
   }
+  // Adding the pertinet JS files that we need for this functionality
+  drupal_add_js(drupal_get_path('module', 'og_vocab') .'/og_vocab.js');
+  drupal_add_css(drupal_get_path('module', 'og_vocab') .'/og_vocab.css');
+  $settings = array();
+  $settings['og_vocab'] = array();
+  // Retrieving the vocabularies in og_vocab so we can map the nid
+  // To the vid in the javascript file so we can display the form elements
+  $vocabularies = db_query("SELECT nid, vid FROM {og_vocab}");
+  while ($vocabulary = db_fetch_object($vocabularies)) {
+    // Might be more than one VID per nid hence this handles those exceptions
+    if (isset($settings['og_vocab'][$vocabulary->nid])) {
+      $settings['og_vocab'][$vocabulary->nid][] = $vocabulary->vid;
+    }
+    else {
+      $settings['og_vocab'][$vocabulary->nid] = array($vocabulary->vid);
+    }
+  }
+  // Only put the settings in if we actually have information
+  drupal_add_js($settings, 'setting');
 }
 
 /**
@@ -210,10 +229,18 @@ function og_vocab_form_alter(&$form, $fo
     $result = db_query($sql, $gids);
     while ($row = db_fetch_object($result)) {
       if ($row->tags) {
-        unset($form['taxonomy']['tags'][$row->vid]);
+        if (isset($form['taxonomy']['tags'][$row->vid])) {
+          $form['taxonomy']['tags'][$row->vid]['#prefix'] = '<div class="og-vocab-hidden-select">';
+          $form['taxonomy']['tags'][$row->vid]['#suffix'] = '</div>';
+        }
       }
       else {
-        unset($form['taxonomy'][$row->vid]);
+        if (isset($form['taxonomy'][$row->vid])) {
+          if (empty($form['taxonomy'][$row->vid]['#default_value'])) {
+            $form['taxonomy'][$row->vid]['#prefix'] = '<div class="og-vocab-hidden-select">';
+            $form['taxonomy'][$row->vid]['#suffix'] = '</div>';
+          }
+        }
       }
     }
     // Remove categories fieldset if no vocabularies remain.
