? pi_assigned_update_5.patch
? pi_assigned_update_6.patch
Index: issue.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/issue.inc,v
retrieving revision 1.315
diff -r1.315 issue.inc
79,80c79,92
<  * JS callback method to return updated elements on the issue form
<  * when someone changes the "Project" selector. See project_issue.js.
---
>  * JS callback method to return updated elements on the issue form.
>  * This function is called when someone changes the "Project" selector.
>  * See project_issue.js.
>  *
>  * @param $pid
>  *   The nid of the project we're updating to.
>  * @param $issue_nid
>  *   The issue nid.
>  * @param $cid
>  *   The component from the previously selected project.
>  * @param $rid
>  *   The version from the previously selected project.
>  * @param $assigned_uid
>  *   The uid of the assigned user from the previously selected project.
82,83c94
< function project_issue_update_project($pid, $cid = NULL, $rid = NULL) {
< 
---
> function project_issue_update_project($pid, $issue_nid, $cid = NULL, $rid = NULL, $assigned_uid = NULL) {
86c97
<   $node = node_load($pid);
---
>   $node = node_load(array('nid' => $pid, 'type' => 'project_project'));
130a142,166
>   // Assigned.
>   if (is_numeric($issue_nid)) {
>     $issue = node_load(array('nid' => $issue_nid, 'type' => 'project_issue'));
>   }
>   else {
>     // @TODO:  This case should not ever be hit until
>     // http://drupal.org/node/197281 lands.
>     $issue = new stdClass;
>   }
>   $issue->pid = $pid;
>   $return['assigned'] = '';
>   $assigned_choices = project_issue_assigned_choices($issue);
> 
>   $form = array();
>   $form['issue_info']['assigned'] = array(
>     '#type' => 'select',
>     '#title' => t('Assigned'),
>     '#default_value' => $assigned_uid,
>     '#options' => $assigned_choices,
>   );
> 
>   // Build the HTML output for the assigned select.
>   $form = form_builder('assigned', $form);
>   $return['assigned'] .= drupal_render($form);
> 
690c726,730
<     drupal_add_js(array('projectUrl' => url('project/issues/update_project')), 'setting');
---
>     drupal_add_js(
>       array(
>         'projectUrl' => url('project/issues/update_project'),
>         'issueNid' => $node->nid,
>       ), 'setting');
716,724c756
< 
<     // 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);
861a894,914
>  * 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;
> }
> 
> /**
Index: project_issue.js
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/project_issue/project_issue.js,v
retrieving revision 1.4
diff -r1.4 project_issue.js
9c9
<     $('#edit-project-info-rid, #edit-project-info-component').attr('disabled', 'disabled');
---
>     $('#edit-project-info-rid, #edit-project-info-component, #edit-assigned').attr('disabled', 'disabled');
19a20,26
>     // 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 = Drupal.encodeURIComponent(Drupal.settings.issueNid);
> 
21c28
<     var url = Drupal.settings.projectUrl + '/' + pid + '/' + cid + '/' + rid;
---
>     var url = Drupal.settings.projectUrl + '/' + pid + '/' + issue_nid + '/' + cid + '/' + rid + '/' + assigned_uid;
35a43,44
>           $('#edit-assigned').parent().remove();
>           $('#edit-priority').parent().after(result.assigned);
