Index: project.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/project.inc,v
retrieving revision 1.140
diff -u -p -r1.140 project.inc
--- project.inc	21 Feb 2009 22:24:07 -0000	1.140
+++ project.inc	10 Apr 2009 19:38:31 -0000
@@ -334,75 +334,8 @@ function project_project_view($node, $te
       );
     }
 
-    // Build a nested array of sections of links to display on project_project node pages.
-    $all_links = array();
-
-    // Resources section
-    $all_links['resources'] = array(
-      'name' => t('Resources'),
-      'weight' => 4,
-    );
-    foreach (array('homepage' => t('Home page'), 'documentation' => t('Read documentation'), 'license' => t('Read license'), 'changelog' => t('Read complete log of changes'), 'demo' => t('Try out a demonstration'), 'screenshots' => t('Look at screenshots')) as $uri => $name) {
-      if (!empty($node->project[$uri])) {
-        $all_links['resources']['links'][$uri] = l($name, $node->project[$uri]);
-      }
-    }
-
-
-    // Flags that indicate what kind of access to project issues to allow.
-    $has_issues = module_exists('project_issue') && !empty($node->project_issue['issues']);
-    $view_issues = $has_issues && (user_access('access project issues') || user_access('access own project issues') || user_access('administer projects'));
-    $make_issues = $has_issues && node_access('create', 'project_issue');
-
-    // Support section.
-    $all_links['support'] = array(
-      'name' => t('Support'),
-      'weight' => 6,
-    );
-    $links = array();
-    if ($view_issues) {
-      $links['all_support'] = l(t('View all support requests'), 'project/issues/'. $node->project['uri'], array('query' => 'categories=support&status=All'));
-      $links['pending_support'] = l(t('View pending support requests'), 'project/issues/'. $node->project['uri'], array('query' => 'categories=support'));
-      $links['pending_bugs'] = l(t('View pending bug reports'), 'project/issues/'. $node->project['uri'], array('query' => 'categories=bug'));
-      $links['pending_features'] = l(t('View pending feature requests'), 'project/issues/'. $node->project['uri'], array('query' => 'categories=feature'));
-      $links['search_issues'] = l(t('Search issues'), 'project/issues/search/'. $node->project['uri']);
-    }
-    if ($make_issues) {
-      $links['request_support'] = l(t('Request support'), 'node/add/project-issue/'. $node->project['uri'] .'/support');
-      $links['report_bug'] = l(t('Report new bug'), 'node/add/project-issue/'. $node->project['uri'] .'/bug');
-      $links['request_feature'] = l(t('Request new feature'), 'node/add/project-issue/'. $node->project['uri'] .'/feature');
-      $links['subscribe'] = l(t('Subscribe to issues'), 'project/issues/subscribe-mail/'. $node->project['uri'], array('query' => drupal_get_destination()));
-    }
-    elseif ($has_issues) {
-      $links['create_forbidden'] = theme('project_issue_create_forbidden', $node->project['uri']);
-    }
-    $all_links['support']['links'] = $links;
-
-
-    // Developer section
-    $all_links['development'] = array(
-      'name' => t('Development'),
-      'weight' => 8,
-    );
-    $links = array();
-    if ($view_issues) {
-      $links['pending_patches'] = l(t('View pending patches'), 'project/issues/search/'. $node->project['uri'], array('query' => 'status[]=8&status[]=13&status[]=14'));
-      $links['available_tasks'] = l(t('View available tasks'), 'project/issues/'. $node->project['uri'], array('query' => 'categories=task'));
-      $links['pending_issues'] = l(t('View all pending issues'), 'project/issues/'. $node->project['uri']);
-    }
-
-    if ($node->project['cvs']) {
-      $links['browse_repository'] = l(t('Browse the CVS repository'), $node->project['cvs']);
-    }
-
-    if (project_use_cvs($node)) {
-      $links['view_cvs_messages'] = l(t('View CVS messages'), 'project/cvs/'. $node->nid);
-      $links['developers'] = l(t('Developers'), 'project/developers/'. $node->nid);
-    }
-    $all_links['development']['links'] = $links;
-
-    // Allow other modules to add sections of links and/or links to the sections defined above.
-    drupal_alter('project_page_link', $all_links, $node);
+    // Retrieve nested array of sections of links to display on node page.
+    $all_links = project_get_project_link_info($node);
 
     // Format links in $all_links for display in the project_project node.
     // Keep track of the section with the heaviest weight (which will be last)
@@ -411,8 +344,8 @@ function project_project_view($node, $te
     $max_weight = -10000;
     $last_section = '';
     foreach($all_links as $section => $values) {
-      // Only add the section if there are links for the section.
-      if (!empty($values['links'])) {
+      // Only add the section if there are links for the section, and section type is not "block".
+      if (!empty($values['links']) && (empty($values['type']) || $values['type'] == 'inline')) {
         $weight = !empty($values['weight']) ? $values['weight'] : 0;
         $node->content[$section] = array(
           '#value' => theme('item_list', $values['links'], isset($values['name']) ? $values['name'] : NULL),
@@ -613,3 +546,84 @@ function theme_project_project_node_form
   return $output;
 }
 
+/**
+ * Build a nested array of sections of links to display on project_project node pages.
+ */
+function project_get_project_link_info($node = NULL) {
+  static $all_links;
+
+  // We only need to build the links array once per page.
+  if (is_array($all_links)) {
+    return $all_links;
+  }
+
+  // Resources section
+  $all_links['resources'] = array(
+    'name' => t('Resources'),
+    'weight' => 4,
+    'type' => 'inline',
+  );
+  foreach (array('homepage' => t('Home page'), 'documentation' => t('Read documentation'), 'license' => t('Read license'), 'changelog' => t('Read complete log of changes'), 'demo' => t('Try out a demonstration'), 'screenshots' => t('Look at screenshots')) as $uri => $name) {
+    if (!empty($node->project[$uri])) {
+      $all_links['resources']['links'][$uri] = l($name, $node->project[$uri]);
+    }
+  }
+
+  // Flags that indicate what kind of access to project issues to allow.
+  $has_issues = module_exists('project_issue') && !empty($node->project_issue['issues']);
+  $view_issues = $has_issues && (user_access('access project issues') || user_access('access own project issues') || user_access('administer projects'));
+  $make_issues = $has_issues && node_access('create', 'project_issue');
+
+  // Support section.
+  $all_links['support'] = array(
+    'name' => t('Support'),
+    'weight' => 6,
+    'type' => 'inline',
+  );
+  $links = array();
+  if ($view_issues && !empty($node->project[$uri])) {
+    $links['all_support'] = l(t('View all support requests'), 'project/issues/'. $node->project['uri'], array('query' => 'categories=support&status=All'));
+    $links['pending_support'] = l(t('View pending support requests'), 'project/issues/'. $node->project['uri'], array('query' => 'categories=support'));
+    $links['pending_bugs'] = l(t('View pending bug reports'), 'project/issues/'. $node->project['uri'], array('query' => 'categories=bug'));
+    $links['pending_features'] = l(t('View pending feature requests'), 'project/issues/'. $node->project['uri'], array('query' => 'categories=feature'));
+    $links['search_issues'] = l(t('Search issues'), 'project/issues/search/'. $node->project['uri']);
+  }
+  if ($make_issues && !empty($node->project[$uri])) {
+    $links['request_support'] = l(t('Request support'), 'node/add/project-issue/'. $node->project['uri'] .'/support');
+    $links['report_bug'] = l(t('Report new bug'), 'node/add/project-issue/'. $node->project['uri'] .'/bug');
+    $links['request_feature'] = l(t('Request new feature'), 'node/add/project-issue/'. $node->project['uri'] .'/feature');
+    $links['subscribe'] = l(t('Subscribe to issues'), 'project/issues/subscribe-mail/'. $node->project['uri'], array('query' => drupal_get_destination()));
+  }
+  elseif ($has_issues && !empty($node->project[$uri])) {
+    $links['create_forbidden'] = theme('project_issue_create_forbidden', $node->project['uri']);
+  }
+  $all_links['support']['links'] = $links;
+
+  // Developer section
+  $all_links['development'] = array(
+    'name' => t('Development'),
+    'weight' => 8,
+    'type' => 'inline',
+  );
+  $links = array();
+  if ($view_issues && !empty($node->project[$uri])) {
+    $links['pending_patches'] = l(t('View pending patches'), 'project/issues/search/'. $node->project['uri'], array('query' => 'status[]=8&status[]=13&status[]=14'));
+    $links['available_tasks'] = l(t('View available tasks'), 'project/issues/'. $node->project['uri'], array('query' => 'categories=task'));
+    $links['pending_issues'] = l(t('View all pending issues'), 'project/issues/'. $node->project['uri']);
+  }
+
+  if (!empty($node->project['cvs'])) {
+    $links['browse_repository'] = l(t('Browse the CVS repository'), $node->project['cvs']);
+  }
+
+  if (project_use_cvs($node)) {
+    $links['view_cvs_messages'] = l(t('View CVS messages'), 'project/cvs/'. $node->nid);
+    $links['developers'] = l(t('Developers'), 'project/developers/'. $node->nid);
+  }
+  $all_links['development']['links'] = $links;
+
+  // Allow other modules to add sections of links and/or links to the sections defined above.
+  drupal_alter('project_page_link', $all_links, $node);
+
+  return $all_links;
+}
Index: project.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project/project.module,v
retrieving revision 1.347
diff -u -p -r1.347 project.module
--- project.module	3 Apr 2009 22:05:28 -0000	1.347
+++ project.module	10 Apr 2009 19:38:31 -0000
@@ -71,6 +71,17 @@ function project_block($op = 'list', $de
       'info' => t('Project navigation (text field)'),
       'cache' => BLOCK_CACHE_PER_ROLE,
     );
+
+    module_load_include('inc', 'project', 'project');
+    foreach (project_get_project_link_info() as $key => $links) {
+      if (isset($links['type']) && $links['type'] == 'block') {
+        $blocks[$key] = array(
+          'info' => $links['name'],
+          'cache' => BLOCK_CACHE_PER_ROLE | BLOCK_CACHE_PER_PAGE,
+        );
+      }
+    }
+
     return $blocks;
   }
   else if ($op == 'view') {
@@ -89,6 +100,7 @@ function project_block($op = 'list', $de
             'content' => drupal_get_form('project_search_block_form', 'project_project'),
           );
         }
+        break;
 
       case 2:
         $block = array(
@@ -97,6 +109,17 @@ function project_block($op = 'list', $de
         );
         break;
     }
+    if (empty($block) && ($node = menu_get_object()) && $node->type == 'project_project' && node_access('view', $node)) {
+      module_load_include('inc', 'project', 'project');
+      foreach (project_get_project_link_info($node) as $key => $links) {
+        if ($delta == $key && isset($links['type']) && $links['type'] == 'block' && !empty($links['links'])) {
+          $block = array(
+            'subject' => $links['name'],
+            'content' => theme('item_list', $links['links']),
+          );
+        }
+      }
+    }
     return $block;
   }
   elseif ($op == 'configure' && $delta == 1) {
