? 97145_pi_version_2.patch
? 97145_pi_version_4.patch
? pi_generate_version.patch
? project_issue-advanced_search-words.patch
Index: /Applications/MAMP/htdocs/rg/drupal/sites/all/modules/project_issue/comment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/comment.inc,v
retrieving revision 1.131
diff -u -p -r1.131 comment.inc
--- comment.inc	14 Apr 2008 00:28:43 -0000	1.131
+++ comment.inc	4 May 2008 01:45:39 -0000
@@ -174,6 +174,14 @@ function project_issue_comment(&$arg, $o
           $component = 0;
         }
         empty($component) && form_set_error('project_info][component', t('You have to specify a valid component.'));
+
+        // Validate assigned.
+        $assigned = $arg['issue_info']['assigned'];
+        $assigned_choices = project_issue_assigned_choices($node);
+        if ($assigned && !isset($assigned_choices)) {
+          $assigned = 0;
+          form_set_error('issue_info][assigned', t('You have to specify a valid user for the assigned field.'));
+        }
       }
       else {
         form_set_error('project_info][pid', t('You have to specify a valid project.'));
Index: /Applications/MAMP/htdocs/rg/drupal/sites/all/modules/project_issue/issue.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/issue.inc,v
retrieving revision 1.310
diff -u -p -r1.310 issue.inc
--- issue.inc	14 Apr 2008 00:29:17 -0000	1.310
+++ issue.inc	4 May 2008 01:45:41 -0000
@@ -79,7 +79,7 @@ function project_issue_page() {
  * JS callback method to return updated elements on the issue form
  * when someone changes the "Project" selector. See project_issue.js.
  */
-function project_issue_update_project($pid, $cid = NULL, $rid = NULL) {
+function project_issue_update_project($pid, $cid = NULL, $rid = NULL, $assigned_uid = NULL, $issue_nid = NULL) {
 
   // Prevent a malicious user from snooping this callback directly.
   $error = array('error' => t('Malicious attempt to access unauthorized information detected.'));
@@ -128,6 +128,32 @@ function project_issue_update_project($p
     }
   }
 
+  // Assigned.
+  if (is_numeric($issue_nid)) {
+    $issue = node_load($issue_nid);
+  }
+  else {
+    $issue = new stdClass;
+  }
+  $issue->pid = $pid;
+  $return['assigned'] = '';
+  $assigned_choices = project_issue_assigned_choices($issue);
+
+  $form = array();
+  // Element is tree'd here to match the original form layout.
+  $form['issue_info']['#tree'] = FALSE;
+  $form['issue_info']['assigned'] = array(
+    '#type' => 'select',
+    '#title' => t('Assigned'),
+    '#default_value' => $assigned_uid,
+    '#options' => $assigned_choices,
+    '#required' => TRUE,
+  );
+
+  // Build the HTML output for the rid select.
+  $form = form_builder('assigned', $form);
+  $return['assigned'] .= drupal_render($form);
+
   // Components.
   $return['component'] = '';
   $project = db_fetch_object(db_query('SELECT * FROM {project_issue_projects} WHERE nid = %d', $pid));
@@ -713,15 +739,7 @@ function project_issue_form($node, $incl
     $categories = array_merge(array(t('<none>')), project_issue_category(0, 0));
     $priorities = project_issue_priority();
     $states = project_issue_state(0, true, $node->nid && ($node->uid == $user->uid), $node->sid);
-
-    // Setup the array of choices for who the issue is assigned to.
-    $assigned = array();
-    foreach (module_implements('project_issue_assignees') as $module) {
-      $function = "{$module}_project_issue_assignees";
-      $function($assigned, $node);
-    }
-    natcasesort($assigned);
-    $assigned = array(0 => empty($node->assigned) ? t('Unassigned') : t('Unassign')) + $assigned;
+    $assigned = project_issue_assigned_choices($node);
   }
 
   // Display the site-wide and/or per-project help text.
@@ -797,6 +815,10 @@ function project_issue_form($node, $incl
       '#default_value' => $node->assigned,
       '#options' => $assigned,
     );
+    $form['issue_info']['issue_nid'] = array(
+      '#type' => 'hidden',
+      '#value' => isset($node->nid) ? $node->nid : 0,
+    );
     if (count($states) > 1) {
       $form['issue_info']['sid'] = array(
         '#type' => 'select',
@@ -859,6 +881,27 @@ function project_issue_form($node, $incl
 }
 
 /**
+ * Build an array of users to whom an issue may be assigned.
+ *
+ * @param $issue
+ *   The issue object.
+ * @return
+ *   A keyed array in the form uid => name containing users
+ *   to whom an issue may be assigned.
+ */
+function project_issue_assigned_choices($issue) {
+  // Setup the array of choices for who the issue is assigned to.
+  $assigned = array();
+  foreach (module_implements('project_issue_assignees') as $module) {
+    $function = "{$module}_project_issue_assignees";
+    $function($assigned, $issue);
+  }
+  natcasesort($assigned);
+  $assigned = array(0 => empty($issue->assigned) ? t('Unassigned') : t('Unassign')) + $assigned;
+  return $assigned;
+}
+
+/**
  * Implmentation of hook_validate().
  *
  * Ensures that the issue node form has valid values for all required fields.
Index: /Applications/MAMP/htdocs/rg/drupal/sites/all/modules/project_issue/project_issue.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.js,v
retrieving revision 1.4
diff -u -p -r1.4 project_issue.js
--- project_issue.js	25 Oct 2007 04:44:04 -0000	1.4
+++ project_issue.js	4 May 2008 01:45:41 -0000
@@ -6,7 +6,7 @@ Drupal.projectSwitchAutoAttach = functio
 
     // Temporarily disable the dynamic selects while we retrieve the new info.
     // The newly loaded selects will be enabled by default.
-    $('#edit-project-info-rid, #edit-project-info-component').attr('disabled', 'disabled');
+    $('#edit-project-info-rid, #edit-project-info-component, #edit-assigned').attr('disabled', 'disabled', 'disabled');
 
     // Get existing component setting.
     var cid = $('#edit-project-info-component').val();
@@ -17,8 +17,16 @@ Drupal.projectSwitchAutoAttach = functio
     var rid = $('#edit-project-info-rid option[@value=' + nid + ']').text();
     rid = Drupal.encodeURIComponent(rid);
 
+    // Get existing assigned uid.
+    var assigned_uid = $('#edit-assigned').val();
+    assigned_uid = Drupal.encodeURIComponent(assigned_uid);
+    
+    // Get the issue node's nid.
+    var issue_nid = $('#edit-issue-nid').val();
+    issue_nid = Drupal.encodeURIComponent(issue_nid);
+
     // Pass new project ID, existing version, existing component.
-    var url = Drupal.settings.projectUrl + '/' + pid + '/' + cid + '/' + rid;
+    var url = Drupal.settings.projectUrl + '/' + pid + '/' + cid + '/' + rid + '/' + assigned_uid + '/' + issue_nid;
 
     // Ajax GET request.
     $.ajax({
@@ -33,6 +41,8 @@ Drupal.projectSwitchAutoAttach = functio
         else {
           $('#edit-project-info-rid, #edit-project-info-component').parent().remove();
           $('#edit-project-info-pid').parent().after(result.component).after(result.rid);
+          $('#edit-assigned').parent().remove();
+          $('#edit-priority').parent().after(result.assigned);
         }
       },
       error: function (xmlhttp) {
