? .project
Index: drupalorg_project/drupalorg_project.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalorg/drupalorg_project/drupalorg_project.css,v
retrieving revision 1.1
diff -u -p -r1.1 drupalorg_project.css
--- drupalorg_project/drupalorg_project.css	10 Feb 2009 17:07:19 -0000	1.1
+++ drupalorg_project/drupalorg_project.css	15 Jan 2010 22:06:25 -0000
@@ -4,3 +4,6 @@ html.js div.js-hide {
   display: none;
 }
 
+.theme-element {
+  width: 166px;
+}
\ No newline at end of file
Index: drupalorg_project/drupalorg_project.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalorg/drupalorg_project/drupalorg_project.js,v
retrieving revision 1.1
diff -u -p -r1.1 drupalorg_project.js
--- drupalorg_project/drupalorg_project.js	10 Feb 2009 17:03:19 -0000	1.1
+++ drupalorg_project/drupalorg_project.js	15 Jan 2010 22:06:25 -0000
@@ -26,3 +26,33 @@ if (Drupal.jsEnabled) {
     Drupal.drupalorgShowSecurityUpdateConfirmAutoAttach();
   });
 }
+
+//Override projectSetTaxononmy to take theme selects into account
+Drupal.projectSetTaxonomy = function (tid) {
+  $('div.project-taxonomy-element select').each(function () {
+    // If this is the selector for the currently selected
+    // term, show it (in case it was previously hidden).
+    if (this.id == 'edit-tid-' + tid) {
+      // Hide not the select but its containing div (which also contains
+      // the label).
+      $(this).parent().parent().show();
+    }
+    // Otherwise, empty it and hide it.
+    else {
+      // In case terms were previously selected, unselect them.
+      // They are no longer valid.
+      // Make sure we're not hiding the themes selects at the wrong time
+      if ($(this).hasClass('theme-category') && $("div.project-taxonomy-element > div.form-item label:contains('Themes') input").attr('checked')) {
+        $(this).parent().parent().show();
+      }
+      else {
+        this.selectedIndex = -1;
+        $(this).parent().parent().hide();
+      }
+    }
+  });
+}
+
+Drupal.behaviors.setThemeCategoryClasses = function (context) {
+  $('.theme-category').parent().parent().addClass('theme-element');
+}
Index: drupalorg_project/drupalorg_project.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/drupalorg/drupalorg_project/drupalorg_project.module,v
retrieving revision 1.24
diff -u -p -r1.24 drupalorg_project.module
--- drupalorg_project/drupalorg_project.module	18 Aug 2009 17:48:20 -0000	1.24
+++ drupalorg_project/drupalorg_project.module	15 Jan 2010 22:06:25 -0000
@@ -225,6 +225,50 @@ function drupalorg_project_form_alter(&$
   }
 }
 
+function drupalorg_project_form_project_project_node_form_alter(&$form, $form_state) {
+  drupal_add_js(drupal_get_path('module', 'drupalorg_project') .'/drupalorg_project.js', 'module', 'header', FALSE, TRUE, FALSE);
+  drupal_add_css(drupal_get_path('module', 'drupalorg_project') . '/drupalorg_project.css', 'module', 'all', FALSE);
+   
+  // Get the project types -> themes vocabulary term
+  $themes_term = taxonomy_get_term_by_name("Themes");
+  
+  // Get rid of the current themes options select
+  unset($form['project_taxonomy']['tid_' . $themes_term[0]->tid]);
+  
+  // Get the immediate children of the themes term
+  $themes_children = taxonomy_get_children($themes_term[0]->tid);
+  
+  // Build a new select for each child of the themes term
+  $node = $form['#node'];
+  $current_taxonomy = $node->taxonomy;
+  
+  foreach ($themes_children as $term) { 
+    // Get the term's children
+    $term_children = taxonomy_get_children($term->tid);
+    
+    $options = array();
+    $current_value = array();
+    
+    // Use them as the select options
+    foreach ($term_children as $child) {
+      $options[$child->tid] = $child->name;
+      
+      if ($current_taxonomy && in_array($child->tid, array_keys($current_taxonomy))) {
+        $current_value[$child->tid] = $child->tid;
+      }
+    }
+    
+    // Create the form select
+    $form['project_taxonomy']['tid_' . $term->tid] = array(
+        '#title' => t('!type categories', array('!type' => $term->name)),
+        '#type' => 'select',
+        '#options' => $options,
+        '#default_value' => $current_value,
+        '#attributes' => array('class' => 'theme-category'),
+     );
+  }
+}
+
 // == Security release restrictions ============================================
 
 /**
@@ -465,6 +509,28 @@ function drupalorg_project_nodeapi(&$nod
     }
     $node->content['body']['#value'] .= $extra;
   }
+  
+  // Prep the themes taxonomy for a project node before saving
+  if ($node->type == 'project_project' && $op == 'presave') {
+    // Check if the node is a theme project
+    $themes_term = taxonomy_get_term_by_name('Themes');
+    
+    if ($node->project_type && $node->project_type == $themes_term[0]->tid) {
+      // Get the themes category children
+      $themes_children = taxonomy_get_children($themes_term[0]->tid);
+      $themes_values = array();
+      
+      // Check the value of each one
+      foreach ($themes_children as $term) {
+        $id_to_check = 'tid_' . $term->tid;
+        $themes_values[] = $node->$id_to_check;
+      }
+      
+      // Convert the values to the format that the project module expects
+      $expected_attribute = 'tid_' . $themes_term[0]->tid;
+      $node->$expected_attribute = $themes_values;
+    }
+  }
 }
 
 /**
