Index: project_issue.css
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.css,v
retrieving revision 1.12
diff -u -p -r1.12 project_issue.css
--- project_issue.css	16 Aug 2007 00:10:02 -0000	1.12
+++ project_issue.css	2 Dec 2007 21:14:02 -0000
@@ -132,3 +132,13 @@ table.projects .project-project-links {
   text-align: right;
   color: #999;
 }
+
+/* Automatic issue links */
+.project-issue-status-2,
+.project-issue-status-3,
+.project-issue-status-4,
+.project-issue-status-5,
+.project-issue-status-6,
+.project-issue-status-7 {
+  text-decoration: line-through;
+}
Index: project_issue.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.module,v
retrieving revision 1.38.2.5
diff -u -p -r1.38.2.5 project_issue.module
--- project_issue.module	13 Nov 2007 01:28:24 -0000	1.38.2.5
+++ project_issue.module	2 Dec 2007 21:14:06 -0000
@@ -874,3 +874,76 @@ function _project_issue_roles($permissio
   }
   return $roles;
 }
+
+
+/**
+ * @defgroup project_issue_filter Project Issue number to link filter
+ */
+
+/**
+ * Theme automatic Project Issue links
+ * @ingroup project_issue_filter
+ */
+function theme_project_issue_issue_link($node) {
+  $output = '';
+  if ($node->type=='project_issue') {
+    $state = project_issue_state($node->sid);
+    $class = "project-issue-status-$node->sid";
+    $output .= "<span class=$class>";
+    $output .= l(check_plain("#$node->nid: $node->title"),
+                 "/node/$node->nid",
+                 array('title' => $state));
+    $output .= '</span>';
+  }
+  else {
+    $output = "#$node->nid";
+  }
+  return $output;
+}
+
+/**
+ * Implementation of hook_form_filter_tips()
+ * @ingroup project_issue_filter
+ */
+function project_release_filter_tips($delta, $format, $long = FALSE) {
+  if ($long) {
+    return t('References to project issues (in the form of #12345) turn into links automatically, with the title of the issue appended. Issues with certain statuses are crossed out.');
+  }
+  else {
+    return t('Project issue numbers (ex. #12345) turn into links automatically.');
+  }
+}
+
+/**
+ * Implementation of hook_form_filter()
+ * @ingroup project_issue_filter
+ */
+function project_release_filter($op, $delta = 0, $format = -1, $text = '') {
+  switch ($op) {
+    case 'list':
+      return array(0 => t('Project Issue to link filter'));
+    case 'description':
+      return t('Converts references to project issues (in the form of #12345) into links.');
+    case 'prepare':
+      return $text;
+    case 'process':
+      $regex = '(#\d+)';
+      $regex = '(?<!\w)'.$regex.'(?![^<]*<\/a>|\w)';
+      $offset = 0;
+      while(preg_match('/'.$regex.'/', $text, $preg_matches, PREG_OFFSET_CAPTURE, $offset)) {
+        $match = $preg_matches[1];
+        $offset++;
+        $nid = substr($match[0],1);
+        $node = node_load($nid);
+        if (is_object($node)) {
+          $link = theme_project_issue_issue_link($node);
+          $text = substr_replace($text, $link, $match[1], strlen($match[0]));
+          $offset = max($offset, $match[1]+strlen($link));
+        }
+        else {
+          $offset = max($offset, $match[1]+strlen($match[0]));
+        }
+      }
+      return $text;
+  }
+}
