Index: project.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/project.module,v
retrieving revision 1.309.2.8
diff -u -F^f -u -F^f -r1.309.2.8 project.module
--- project.module	24 Oct 2008 02:56:10 -0000	1.309.2.8
+++ project.module	24 Oct 2008 22:53:40 -0000
@@ -570,11 +570,13 @@ function project_page_overview($termname
   $sort_methods = module_invoke_all('project_sort_methods', 'methods');
 
   $output = '';
+  $active_tids = array();
   if (module_exists('project_release') && variable_get('project_release_browse_versions', 0)) {
     $version_form = drupal_get_form('project_release_version_filter_form');
     $output .= $version_form;
     // Read in requested version, if any.
     $version = isset($_SESSION['project_version']) ? $_SESSION['project_version'] : variable_get('project_release_overview', -1);
+    $active_tids = project_release_compatibility_list();
   }
 
   // If browsing by taxonomy, only fetch projects for this term.
@@ -607,7 +609,12 @@ function project_page_overview($termname
         $terms = array();
         if ($tree) {
           $tids = array();
-          if (variable_get('project_release_browse_versions', 0)) {
+          // Make sure the API compatability term contains one or more terms
+          // (not including the term with key of -1, which is always
+          // automatically added to the array of terms. If not then browsing
+          // by version is not possible.  project_release_compatibility_list()
+          // only returns active tids if browsing by version is enabled.
+          if (count($active_tids) > 1) {
             $version_params = array();
             if ($version != -1) {
               $version_where = 'tr.tid = %d';
@@ -615,7 +622,6 @@ function project_page_overview($termname
             }
             else {
               $placeholders = array();
-              $active_tids = project_release_compatibility_list();
               foreach ($active_tids as $tid => $api_term) {
                 $placeholders[] = '%d';
                 $version_params[] = $tid;
@@ -699,15 +705,22 @@ function project_page_overview($termname
         $sql_settings = array();
       }
 
+      $active_tids = array();
       if (module_exists('project_release')) {
         $project_release_sql = array(
           'joins' => array('INNER JOIN {project_release_projects} prp ON n.nid = prp.nid'),
           'wheres' => array('prp.releases = 1'),
         );
         $sql_settings = array_merge_recursive($sql_settings, $project_release_sql);
+        $active_tids = project_release_compatibility_list();
       }
 
-      if (variable_get('project_release_browse_versions', 0)) {
+      // Make sure the API compatability term contains one or more terms
+      // (not including the term with key of -1, which is always
+      // automatically added to the array of terms. If not then browsing
+      // by version is not possible.  project_release_compatibility_list()
+      // only returns active tids if browsing by version is enabled.
+      if (count($active_tids) > 1) {
         $release_settings = array(
           'fields' => array('prn.file_path', 'prn.version', 'MAX(prn.file_date) AS changed', 'COUNT(*) AS release_count'),
           'group_bys' => array('n.nid'),
@@ -726,7 +739,6 @@ function project_page_overview($termname
         }
         else {
           $placeholders = array();
-          $active_tids = project_release_compatibility_list();
           foreach ($active_tids as $tid => $compatibility_term) {
             $placeholders[] = '%d';
             $release_settings['parameters'][] = $tid;
Index: release/project_release.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/release/project_release.module,v
retrieving revision 1.66.2.4
diff -u -F^f -u -F^f -r1.66.2.4 project_release.module
--- release/project_release.module	28 Jul 2008 18:42:58 -0000	1.66.2.4
+++ release/project_release.module	24 Oct 2008 22:53:40 -0000
@@ -1102,23 +1102,29 @@ function project_release_project_edit_re
 }
 
 function project_release_project_edit_form($node) {
-  // Get all the data about major versions for this project.
-  $data = _project_release_get_version_major_data($node);
+  $active_tids = project_release_compatibility_list();
+  // Make sure there is more than 1 active tid because
+  // project_release_compatibility_list() will always
+  // add $terms[-1] = 'all'.
+  if (count($active_tids) > 1) {
+    // Get all the data about major versions for this project.
+    $data = _project_release_get_version_major_data($node);
 
-  // Build all the form elements for supported and recommended major versions.
-  $form = _project_release_edit_version_major_form($data);
+    // Build all the form elements for supported and recommended major versions.
+    $form = _project_release_edit_version_major_form($data);
 
-  // Now, add a header and some help text for those elements.
-  $form['header'] = array(
-    '#type' => 'markup',
-    '#value' => t('Supported versions'),
-  );
+    // Now, add a header and some help text for those elements.
+    $form['header'] = array(
+      '#type' => 'markup',
+      '#value' => t('Supported versions'),
+    );
 
-  $vocab = taxonomy_get_vocabulary(_project_release_get_api_vid());
-  $form['help'] = array(
-    '#type' => 'markup',
-    '#value' => t('For each term in the %api_vocabulary_name vocabulary, the following tables allow you to define which major versions are supported. If there are releases from more than one major version number, you can select which major version should be recommended for new users to download. You can also control if the development snapshot releases should be displayed on the front page of the project. Finally, for each term in the %api_vocabulary_name vocabulary, the current recommended release is shown. If no official releases have been made, the development snapshot from the corresponding branch will be listed. Otherwise, the most recent official release will be listed.', array('%api_vocabulary_name' => $vocab->name)),
-  );
+    $vocab = taxonomy_get_vocabulary(_project_release_get_api_vid());
+    $form['help'] = array(
+      '#type' => 'markup',
+      '#value' => t('For each term in the %api_vocabulary_name vocabulary, the following tables allow you to define which major versions are supported. If there are releases from more than one major version number, you can select which major version should be recommended for new users to download. You can also control if the development snapshot releases should be displayed on the front page of the project. Finally, for each term in the %api_vocabulary_name vocabulary, the current recommended release is shown. If no official releases have been made, the development snapshot from the corresponding branch will be listed. Otherwise, the most recent official release will be listed.', array('%api_vocabulary_name' => $vocab->name)),
+    );
+  }
 
   // Finally, add everything else (currently, the "Advanced options").
   $form['advanced'] = array(
@@ -1166,11 +1172,18 @@ function _project_release_get_version_ma
   $params[] = $node->nid;
   $placeholders = array();
   $active_tids = project_release_compatibility_list();
+  // Get rid of -1 => 'all' element inserted by project_release_compatibility_list().
+  if (isset($active_tids[-1])) {
+    unset($active_tids[-1]);
+  }
   foreach ($active_tids as $tid => $api_term) {
     $placeholders[] = '%d';
     $params[] = $tid;
   }
-  $tid_where = 'prsv.tid IN ('. implode(',', $placeholders) .')';
+  $tid_where = '';
+  if (!empty($active_tids)) {
+    $tid_where = 'prsv.tid IN ('. implode(',', $placeholders) .')';
+  }
   $result = db_query("SELECT prsv.*, td.name AS term_name FROM {project_release_supported_versions} prsv INNER JOIN {term_data} td ON prsv.tid = td.tid WHERE prsv.nid = %d AND $tid_where ORDER BY td.weight, td.name", $params);
   while ($obj = db_fetch_object($result)) {
     $tid = $obj->tid;
@@ -1728,7 +1741,10 @@ function project_release_table($project,
     case 'snapshot':
       // For snapshot tables, restrict to snapshot nodes from branches where
       // the maintainer wants the snapshot visible.
-      $where = 'AND r.rebuild = 1 AND prsv.snapshot = 1';
+      $where = 'AND r.rebuild = 1';
+      if ($tids) {
+        $where .= ' AND prsv.snapshot = 1';
+      }
       break;
     case 'all':
       // If we're generating the default releases table, we want the
@@ -2183,3 +2199,51 @@ function project_release_pick_project_fo
 function project_release_pick_project_form_submit($form_id, $form_values) {
   return 'node/add/project-release/'. $form_values['pid'];
 }
+
+/**
+ * Determines taxonomy-specific functionality for releases.
+ */
+function project_release_use_taxonomy() {
+  return module_exists('taxonomy') && _project_release_get_api_vid();
+}
+
+/**
+ * Implementation of hook_help().
+ */
+function project_release_help($section) {
+  switch ($section) {
+    case 'admin/project/project-release-settings':
+      if (project_release_use_taxonomy()) {
+        return _project_release_taxonomy_help();
+      }
+      break;
+  }
+  if (arg(0) == 'admin' && arg(1) == 'content' && arg(2) == 'taxonomy') {
+    $vid = _project_release_get_api_vid();
+    if (arg(3) == $vid) {
+      return _project_release_taxonomy_help($vid, FALSE);
+    }
+  }
+}
+
+/**
+ * Prints help message for release compatibility vocabulary configuration.
+ *
+ * @param $vid
+ *   Vocabulary ID of the project taxonomy.
+ * @param $vocab_link
+ *   Boolean that controls if a link to the vocabulary admin page is added.
+ */
+function _project_release_taxonomy_help($vid = 0, $vocab_link = TRUE) {
+  if (!$vid) {
+    $vid = _project_release_get_api_vid();
+  }
+  $vocabulary = taxonomy_get_vocabulary($vid);
+  $text = '<p>'. t('The Project release module makes special use of the taxonomy (category) system. A special vocabulary, %vocabulary_name, has been created automatically.', array('%vocabulary_name' => $vocabulary->name)) .'</p>';
+  $text .= '<p>'. t('To categorize project releases by their compatibility with a version of some outside software (eg. a library or API of some sort), add at least one term to this vocabulary. For example, you might add the following terms: "5.x", "6.x", "7.x".') .'</p>';
+  $text .='<p>'. t('For more information, please see !url.', array('!url' => l('http://drupal.org/node/116544', 'http://drupal.org/node/116544'))) .'</p>';
+  if ($vocab_link) {
+    $text .= '<p>'. t('Use the <a href="@taxonomy-admin">vocabulary admininistration page</a> to view and add terms.', array('@taxonomy-admin' => url('admin/content/taxonomy/'. $vid))) .'</p>';
+  }
+  return $text;
+}
