Index: comment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/comment.inc,v
retrieving revision 1.85
diff -u -F^f -r1.85 comment.inc
--- comment.inc	19 Aug 2007 23:23:37 -0000	1.85
+++ comment.inc	1 Sep 2007 20:50:51 -0000
@@ -1,151 +1,93 @@
 <?php
-// $Id: comment.inc,v 1.85 2007/08/19 23:23:37 dww Exp $
-// $Name:  $
+// $Id: comment.inc,v 1.83 2007/07/30 14:31:36 dww Exp $
+// $Name: HEAD $
 
-function project_comment_page($op, $nid) {
-
-  // Load the parent node.
-  $node = node_load($nid);
-
-  if (node_access('create', 'project_issue')) {
-    $edit = (object)$_POST;
-
-    if ($_POST['op'] == t('Preview') || $_POST['op'] == t('Submit')) {
-      project_comment_validate($edit);
-    } else {
-      foreach (array('nid', 'type', 'pid', 'rid', 'category', 'component', 'priority', 'assigned', 'sid', 'title') as $var) {
-        $edit->$var = $node->$var;
-      }
-      project_comment_validate($edit);
-    }
-    $output .= drupal_get_form('project_comment_form', $edit);
-
-    // set breadcrumb
-    $project = node_load(array('nid' => $node->pid));
-    $breadcrumb[] = l($project->title, 'node/'. $project->nid);
-    $breadcrumb[] = l(t('Issues'), 'project/issues/'. $project->uri);
-    $breadcrumb[] = l($node->title, 'node/'. $node->nid);
-    project_project_set_breadcrumb($project, $breadcrumb);
-
-    drupal_set_title(t('New comment'));
-    switch ($_POST['op'] ? $_POST['op'] : arg(2)) {
-      case 'add':
-        $output .= node_view($node, NULL, TRUE);
-        return $output;
-        break;
-      case t('Preview'):
-          return $output;
-        break;
-      case t('Submit'):
-          if (!form_get_errors()) {
-            $edit->nid = $node->nid;
-
-            project_comment_save($edit);
-            drupal_goto("node/$node->nid");
-          } else {
-            return $output;
-          }
-        break;
-    }
-  }
-  else {
-    drupal_set_message(t('You are not authorized to follow up on issues.'), 'error');
-    drupal_goto("node/$nid");
+function project_issue_comment(&$arg, $op) {
+  static $edit;
+  // $arg can be a comment object, or a form or form_values.
+  if (is_object($arg)) {
+    $nid = $arg->nid;
   }
-}
-
-function project_comment_form($edit, $param = NULL) {
-  $op = $_POST['op'];
-  if (isset($param)) {
-    $form = array(
-      '#method' => $param['method'],
-      '#action' => $param['action'],
-      '#attributes' => $param['options'],
-    );
-  } else {
-    $form['#attributes'] = array('enctype' => 'multipart/form-data');
-  }
-  $form['#prefix'] = '<div class="project-issue"><div class="node-form"><div class="standard">';
-  $form['#suffix'] = '</div></div></div>';
-  $form['project_issue_form'] = project_issue_form($edit, $param);
-  unset($form['project_issue_form']['#prefix']);
-  unset($form['project_issue_form']['#suffix']);
-
-  // Add any CCK fields to the follow-up form.
-  if (function_exists('_content_widget_invoke')) {
-    $db_node = node_load(array('nid' => arg(3), 'type' => 'project_issue'));
-    $type = content_types($db_node->type);
-    _content_widget_invoke('prepare form values', $db_node);
-    $form = array_merge($form, _content_widget_invoke('form', $db_node));
-  }
-
-  _project_issue_form_add_required_fields($form['project_issue_form'], FALSE);
-  if ($edit->cid) {
-    $form['cid']= array('#type' => 'hidden', '#value' => $edit->cid);
+  elseif (is_array($arg)) {
+    $nid = is_array($arg['nid']) ? $arg['nid']['#value'] : $arg['nid'];
   }
-  $form['preview'] = array('#type' => 'button', '#value' => t('Preview'));
-  if (!form_get_errors()) {
-    $form['submit'] = array('#type' => 'button', '#value' => t('Submit'));
-  }
-  if ($op == t('Preview')) {
-    $form['#after_build'] = array('project_comment_form_add_preview');
-  }
-  return $form;
-}
-
-function project_comment_validate(&$edit) {
-  global $user;
-
-  $edit->uid = $user->uid;
-  $edit->name = $user->name;
-
-  if ($edit->cid) {
-    $comment = project_comment_load($edit->cid);
-    $edit->nid = $comment->nid;
+  $node = node_load($nid);
+  if ($node->type != 'project_issue') {
+    return;
   }
 
-  $edit->comment = true;
-
-  project_issue_comment_validate($edit);
-  $edit->validated = true;
-}
-
-function project_comment_view($node, $main = 0) {
-  global $user;
-  $rows = array();
-  $result = db_query('SELECT p.*, u.name FROM {project_comments} p INNER JOIN {users} u USING (uid) WHERE p.nid = %d ORDER BY p.created ASC', $node->nid);
-  if (db_num_rows($result)) {
-    $output = '<div class="project-issue">';
-    $i = 0;
-    while ($comment = db_fetch_object($result)) {
-      $comment->body = db_decode_blob($comment->body);
-      $comment->data = db_decode_blob($comment->data);
-      $i++;
-      $output .= _project_comment_view_single($comment, $i);
+  switch ($op) {
+    case 'form':
+      // $arg is a form
+      if (!$node->comment_count) {
+        foreach (array('nid', 'pid', 'category', 'component', 'priority', 'assigned', 'sid', 'title') as $var) {
+          $edit->$var = $node->$var;
+        }
+      }
+      else {
+        $edit = db_fetch_object(db_query_range('SELECT nid, title, pid, rid, component, category, priority, assigned, sid, timestamp FROM {project_issue_comments} WHERE nid = %d ORDER BY timestamp DESC ', $node->nid, 0, 1));
+      }
+      // We need to ask for almost the same metadata as project issue itself
+      // so let's reuse the form.
+      $form = drupal_retrieve_form('project_issue_form', $edit, NULL);
+      // We need this otherwise pid collides with comment.
+      $form['project_info']['#tree'] = TRUE;
+      $form['project_info']['#weight'] = -2;
+      $form['issue_info']['#weight'] = -1;
+      $form['#prefix'] = '<div class="project-issue"><div class="node-form"><div class="standard">';
+      $form['#suffix'] = '</div></div></div>';
+      $form['title'] = array(
+        '#type' => 'textfield',
+        '#title' => t('Issue title'),
+        '#maxlength' => 64,
+        '#default_value' => $edit->title,
+        '#weight' => 0,
+      );
+      unset($form['page'], $form['issue_details']);
+      return $form;
+    case 'insert': case 'update':
+      // $arg is form_values
+      db_query("INSERT INTO {project_issue_comments} (nid, cid, pid, rid, component, category, priority, assigned, sid, title, timestamp) VALUES (%d, %d, %d, %d, '%s', '%s', %d, %d, %d, '%s', %d)", $arg['nid'], $arg['cid'], $arg['project_info']['pid'], $arg['rid'], $arg['project_info']['component'], $arg['category'], $arg['priority'], $arg['assigned'], $arg['sid'], $arg['title'], $arg['timestamp']);
+      project_issue_update($arg);
+      break;
+    case 'view':
+      if (isset($arg->cid)) {
+        $project_issue_table = project_issue_comment_view($node, $arg);
+      }
+      else {
+        $test = drupal_clone($arg);
+        $test->pid = $arg->project_info['pid'];
+        $test->component = $arg->project_info['component'];
+        // Add a dummy rid if necessary -- prevents incorrect change data
+        if (!isset($arg->rid)) {
+          $test->rid = 0;
+        }
+        $project_issue_table = _project_issue_comment_table(_project_issue_comment_labels(), $edit, $test);
+      }
+      if ($project_issue_table) {
+        $arg->comment = '<div class="project-issue"><div class="summary">'. $project_issue_table .'</div></div>' . $arg->comment;
+      }
+      break;
     }
-    $output .= '</div>';
-    return theme('box', t('Updates'), $output);
-  }
 }
 
 /**
- * Private method to view a single project comment (issue followup).
- *
- * @param $comment
- *   An array or object of the comment to view.
- * @param $count
- *   The integer that shows what number of comment this is.
- *
- * @return
- *   A string of validated output to theme/display.
- *
+ * Implementation of hook_form_alter.
  */
-function _project_comment_view_single($comment, $count) {
-  $comment = (object)$comment;
-  $summary = array();
-  $output = '';
+function project_issue_form_alter($form_id, &$form) {
+  if ($form_id == 'comment_form') {
+    $node = node_load($form['nid']['#value']);
+    if ($node->type == 'project_issue') {
+      // Comment is not required for project issue followups, we have our own
+      // validate handler.
+      // The 'your name' item just wastes screen estate.
+      unset($form['comment_filter']['comment']['#required'], $form['_author']);
+    }
+  }
+}
 
-  $fields = array(
+function _project_issue_comment_labels() {
+  return array(
     'title' => t('Title'),
     'pid' => t('Project'),
     'rid' => t('Version'),
@@ -155,154 +97,58 @@ function _project_comment_view_single($c
     'assigned' => t('Assigned to'),
     'sid' => t('Status'),
   );
-
-  // If we got this from the DB, we'll have a $data field to unserialize.
-  $comment = drupal_unpack($comment);
-
-  // Print out what changed about the issue with this comment. If the
-  // comment is in the DB, we'll have 'old' and 'new' fields from the
-  // 'data' field, which record exactly what changed. If not, we'll
-  // load the origial node and compare against that.
-  if (!isset($comment->data)) {
-    $node = node_load(array('nid' => arg(3), 'type' => 'project_issue'));
-  }
-  foreach ($fields as $field => $text) {
-    if (isset($comment->old->$field) && isset($comment->new->$field)) {
-      $summary[] = array(
-        $text .':',
-        project_mail_summary($field, $comment->old->$field),
-        '&raquo; '. project_mail_summary($field, $comment->new->$field)
-      );
-    }
-    elseif (isset($node->$field) && isset($comment->$field) && $node->$field != $comment->$field ) {
-      $summary[] = array(
-        $text .':',
-        project_mail_summary($field, $node->$field),
-        '&raquo; '. project_mail_summary($field, $comment->$field)
-      );
-    }
-  }
-
-  if ($comment->file_path && file_exists($comment->file_path)) {
-    $summary[] = array(t('Attachment:'), '<a href="'. file_create_url($comment->file_path). '">'. basename($comment->file_path) .'</a> ('. format_size($comment->file_size) .')');
-  }
-
-  if ($summary || $comment->body) {
-    if ($count) {
-      $output .= '<div class="header">';
-      $output .= t('!count submitted by !user on !date', array('!count' => l("#$count", "node/$comment->nid", array ('id' => "comment-$comment->cid", 'name' => "comment-$comment->cid"), NULL, "comment-$comment->cid"), '!user' => theme('username', $comment), '!date' => format_date($comment->created))) . theme('mark', node_mark($comment->nid, $comment->changed));
-      $output .= '</div>';
-    }
-    if ($summary) {
-      $output .= '<div class="summary">';
-      $output .= theme('table', array(), $summary);
-      $output .= '</div>';
-    }
-    if ($comment->body) {
-      $output .= '<div class="content">';
-      $output .= check_markup($comment->body);
-      $output .= '</div>';
-    }
-  }
-  return $output;
 }
 
-function project_comment_load($cid) {
-  $object = db_fetch_object(db_query('SELECT p.*, u.name FROM {project_comments} p INNER JOIN {users} u USING (uid) WHERE p.cid = %d ORDER BY p.created DESC', $cid));
-  $object->body = db_decode_blob($object->body);
-  $object->data = db_decode_blob($object->data);
-  return $object;
-}
-
-function project_comment_save($edit) {
-  global $user;
-
-  if (empty($edit->cid)) {
-    $edit->cid = db_next_id('{project}_cid');
-    if ($edit->file) {
-      $directory = file_create_path(variable_get('project_directory_issues', 'issues'));
-      $edit->file->filename = project_issue_munge_filename($edit->file->filename);
-      $file = file_save_upload($edit->file, $directory);
-      unset($edit->file);
-    }
-
-    if (empty($edit->uid)) {
-      $edit->uid = $user->uid;
-    }
-    $node = node_load(array('nid' => $edit->nid, 'type' => 'project_issue'));
-
-    // Check if comment changed any of the state values and update the node if necessary
-    foreach (array('pid', 'rid', 'category', 'component', 'priority', 'assigned', 'sid', 'title') as $var) {
-      if ($node->$var != $edit->$var) {
-        $data['old']->$var = $node->$var;
-        $data['new']->$var = $edit->$var;
-        $node->$var = $edit->$var;
-      }
-    }
-
-    // Add processed cck info into the node object for node_save
-    if (function_exists('_content_widget_invoke')) {
-      $type = content_types($node->type);
-      while (list($field, $val) = each($type['fields'])) {
-        $node->$field = $edit->$field;
-      }
-      _content_widget_invoke('process form values', $node);
+/**
+ * Create a project issue metadata table.
+ *
+ * @param $labels
+ *  An array, keys are field names, values are the displayed labels.
+ * @param $old
+ *  The previous comment (or the node).
+ * @param $followup
+ *  The current comment.
+ */
+function _project_issue_comment_table($labels, $old, $followup) {
+  $rows = array();
+  foreach ($labels as $field => $text) {
+    if ($old->$field != $followup->$field) {
+      $rows[] = array(
+        $labels[$field] .':',
+        project_mail_summary($field, $old->$field),
+        '&raquo; '. project_mail_summary($field, $followup->$field),
+      );
     }
-
-    watchdog('content', t('project_issue: added comment %title', array('%title' => $edit->title)), WATCHDOG_NOTICE, l('view', "node/$node->nid"));
-    $node->changed = time();
-    db_query("INSERT INTO {project_comments} (cid, nid, uid, created, changed, body, data, file_path, file_mime, file_size) VALUES (%d, %d, %d, %d, %d, %b, %b, '%s', '%s', %d)", $edit->cid, $edit->nid, $edit->uid, $node->changed, $node->changed, $edit->body, serialize($data), $file->filepath, $file->filemime, $file->filesize);
-
-    // Update node_comment_statistics so the tracker page lists the number of comments
-    $count = db_result(db_query('SELECT COUNT(cid) FROM {project_comments} WHERE nid = %d', $edit->nid));
-    db_query("UPDATE {node_comment_statistics} SET comment_count = %d, last_comment_timestamp = %d, last_comment_name = '%s', last_comment_uid = %d WHERE nid = %d", $count, time(), $user->name, $user->uid, $edit->nid);
-
-    node_save($node);
   }
-
-  return $edit->cid;
+  return theme('table', array(), $rows);
 }
 
 /**
- * Form API callback for previewing a project comment.
- *
- * @param $form
- *   The form to add the preview information to.
- * @param $edit
- *   The form values for the comment to preview.
+ * Returns the issue metadata table for a comment, adjusts node title.
  *
+ * @param $node
+ *  The corresponding node.
+ * @param $comment
+ *  The comment, if it's set then metadata will be returned. If it's not
+ *  set then node title will be adjusted (and metadata precalculated).
  * @return
- *   The modified form to render.
- *
+ *  A themed table of issue metadata.
  */
-function project_comment_form_add_preview($form, $edit) {
-  drupal_set_title(t('Preview comment'));
-  if (is_array($edit)) {
-    $comment = (object)$edit;
-  }
-  else {
-    $comment = $edit;
-  }
-  project_comment_validate($comment);
+function project_issue_comment_view(&$node, $comment = NULL) {
+  static $project_issue_tables;
 
-  // Preview the comment with security check.
-  if (!form_get_errors()) {
-    $output = _project_comment_view_single($comment, 0);
+  if (isset($comment)) {
+    return $project_issue_tables[$comment->cid];
   }
-
-  $form['comment_preview'] = array(
-    '#value' => $output,
-    '#weight' => -100,
-    '#prefix' => '<div class="preview"><div class="comment">',
-    '#suffix' => '</div></div>',
-  );
-
-  $output = '';
-  if (is_numeric(arg(3))) {
-    $node = node_load(array('nid' => arg(3), 'type' => 'project_issue'));
-    $output .= node_view($node, NULL, TRUE);
-    $form['comment_preview_below'] = array('#value' => $output, '#weight' => 100);
+  if ($node->comment_count) {
+    $old = $node;
+    $labels = _project_issue_comment_labels();
+    $result = db_query('SELECT cid, title, pid, rid, component, category, priority, assigned, sid FROM {project_issue_comments} WHERE nid = %d ORDER BY timestamp ASC', $node->nid);
+    while ($followup = db_fetch_object($result)) {
+      $project_issue_tables[$followup->cid] = _project_issue_comment_table($labels, $old, $followup);
+      $old = $followup;
+    }
+    $node->title = $old->title;
+    drupal_set_title(check_plain($node->title));
   }
-  unset($form['#sorted']);
-  return $form;
 }
Index: issue.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/issue.inc,v
retrieving revision 1.249
diff -u -F^f -r1.249 issue.inc
--- issue.inc	19 Aug 2007 23:23:37 -0000	1.249
+++ issue.inc	1 Sep 2007 20:50:52 -0000
@@ -1,6 +1,6 @@
 <?php
 // $Id: issue.inc,v 1.249 2007/08/19 23:23:37 dww Exp $
-// $Name:  $
+// $Name: HEAD $
 
 function project_issue_page() {
   global $user;
@@ -948,10 +948,6 @@ function project_issue_view($node, $teas
       '#value' => '<div class="header">'. t('Description') .'</div>',
       '#weight' => -3,
     );
-    $node->content['project_issue_comments'] = array(
-      '#value' => project_comment_view($node),
-      '#weight' => 2,
-    );
 
     // Breadcrumb navigation
     $breadcrumb[] = array('path' => 'project', 'title' => t('Projects'));
Index: mail.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/mail.inc,v
retrieving revision 1.73
diff -u -F^f -r1.73 mail.inc
--- mail.inc	19 Aug 2007 23:23:37 -0000	1.73
+++ mail.inc	1 Sep 2007 20:50:52 -0000
@@ -1,6 +1,6 @@
 <?php
 // $Id: mail.inc,v 1.73 2007/08/19 23:23:37 dww Exp $
-// $Name:  $
+// $Name: HEAD $
 
 function project_issue_mailhandler($node, $result, $i, $header, $mailbox) {
   if ($node->type == 'project') {
@@ -196,6 +196,7 @@ function project_mail_summary($field, $v
 }
 
 function project_mail_notify($node) {
+  return; //TODO: rewrite for ifac.
   if (defined('PROJECT_NOMAIL')) {
     return;
   }
Index: project_issue.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.install,v
retrieving revision 1.17
diff -u -F^f -r1.17 project_issue.install
--- project_issue.install	22 Aug 2007 16:19:51 -0000	1.17
+++ project_issue.install	1 Sep 2007 20:50:52 -0000
@@ -1,6 +1,6 @@
 <?php
 // $Id: project_issue.install,v 1.17 2007/08/22 16:19:51 thehunmonkgroup Exp $
-// $Name:  $
+// $Name: HEAD $
 
 function project_issue_install() {
   // We need to check this before we try to create the table, so that
@@ -38,21 +38,21 @@ function project_issue_install() {
           KEY project_issues_sid (sid),
           KEY project_issues_nid_assigned (nid, assigned)
         ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
-      db_query("CREATE TABLE IF NOT EXISTS {project_comments} (
-          cid int(10) unsigned NOT NULL default '0',
-          nid int(10) unsigned NOT NULL default '0',
-          uid int(10) unsigned NOT NULL default '0',
-          name varchar(255) NOT NULL default '',
-          created int(10) unsigned NOT NULL default '0',
-          changed int(10) unsigned NOT NULL default '0',
-          body blob,
-          data blob,
-          file_path varchar(255) NOT NULL default '',
-          file_mime varchar(255) NOT NULL default '',
-          file_size int NOT NULL default 0,
-          PRIMARY KEY (cid),
-          KEY project_comments_nid (nid)
-        ) /*!40100 DEFAULT CHARACTER SET utf8 */;");
+      db_query("CREATE TABLE IF NOT EXISTS {project_issue_comments} (
+          nid int(11) default NULL,
+          cid int(11) default NULL,
+          rid int(11) default NULL,
+          component varchar(255) default NULL,
+          category varchar(255) default NULL,
+          priority int(11) default NULL,
+          assigned int(11) default NULL,
+          sid int(11) default NULL,
+          pid int(10) unsigned NOT NULL,
+          title varchar(255) NOT NULL,
+          timestamp int(10) unsigned NOT NULL,
+          PRIMARY KEY(cid),
+          INDEX nid_timestamp (nid, timestamp)
+        ) /*!40100 DEFAULT CHARACTER SET utf8 */");
       db_query("CREATE TABLE IF NOT EXISTS {project_subscriptions} (
           nid int(10) unsigned NOT NULL default '0',
           uid int(10) unsigned NOT NULL default '0',
@@ -103,23 +103,22 @@ function project_issue_install() {
         db_query("CREATE INDEX {project_issues}_sid_idx ON {project_issues}(sid)");
         db_query('CREATE INDEX {project_issues}_nid_assigned_idx ON {project_issues}(nid, assigned)');
       }
-      if (!db_table_exists('project_comments')) {
-        db_query("CREATE TABLE {project_comments} (
-            cid int NOT NULL default '0',
-            nid int NOT NULL default '0',
-            uid int NOT NULL default '0',
-            name varchar(255) NOT NULL default '',
-            created int NOT NULL default '0',
-            changed int NOT NULL default '0',
-            body bytea,
-            data bytea,
-            file_path varchar(255) default '' NOT NULL,
-            file_mime varchar(255) default '' NOT NULL,
-            file_size int default 0 NOT NULL,
-            PRIMARY KEY (cid)
-          );");
-         db_query("CREATE SEQUENCE {project}_cid_seq INCREMENT 1 START 1");
-         db_query("CREATE INDEX {project_comments}_nid_idx ON {project_comments}(nid)");
+      if (!db_table_exists('project_issue_comments')) {
+        db_query("CREATE TABLE {project_issue_comments} (
+          nid int default NULL,
+          cid serial,
+          rid int default NULL,
+          component varchar(255) default NULL,
+          category varchar(255) default NULL,
+          priority int default NULL,
+          assigned int default NULL,
+          sid int default NULL,
+          pid int NOT NULL,
+          title varchar(255) NOT NULL,
+          timestamp int NOT NULL,
+          PRIMARY KEY(cid)
+        )");
+        db_query('CREATE INDEX {project_issue_comments}_nid_timestamp_idx ON {project_issue_comments} (nid, timestamp)');
       }
       if (!db_table_exists('project_subscriptions')) {
         db_query("CREATE TABLE {project_subscriptions} (
Index: project_issue.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.module,v
retrieving revision 1.37
diff -u -F^f -r1.37 project_issue.module
--- project_issue.module	22 Aug 2007 16:19:51 -0000	1.37
+++ project_issue.module	1 Sep 2007 20:50:53 -0000
@@ -1,6 +1,6 @@
 <?php
 // $Id: project_issue.module,v 1.37 2007/08/22 16:19:51 thehunmonkgroup Exp $
-// $Name:  $
+// $Name: HEAD $
 
 // issue nodes      -> project_issues
 // issue comments   -> project_comments
@@ -156,31 +156,6 @@ function project_issue_cron() {
   }
 }
 
-function project_issue_link($type, $node = 0, $main = 0) {
-  $links = array();
-  switch ($type) {
-    case 'node':
-      if ($node->type == 'project_issue' &&
-          !(arg(0) == 'project' && arg(1) == 'comments')) {
-          // Only add the link if we're not already on an issue follow-up.
-            if (node_access('create', 'project_issue')) {
-              $links['project_issue_follow_up'] = array(
-                'title' => t('Follow up'),
-                'href' => "project/comments/add/$node->nid",
-              );
-            }
-            else {
-              $links['project_issue_follow_up_forbidden'] = array(
-                'title' => theme('project_issue_follow_up_forbidden', $node->nid),
-                'html' => TRUE,
-              );
-            }
-      }
-      break;
-  }
-  return $links;
-}
-
 function project_issue_menu($may_cache) {
   $items = array();
   global $user;
@@ -510,6 +485,11 @@ function project_issue_issue_nodeapi(&$n
         form_set_error('sid', t('Invalid issue status %status: you do not have permission to set this status', array('%status' => $state)));
       }
       break;
+    case 'view':
+      $_GET['mode'] = COMMENT_MODE_FLAT_EXPANDED;
+      $_GET['sort'] = COMMENT_ORDER_OLDEST_FIRST;
+      project_issue_comment_view($node);
+      break;
   }
 }
 
