=== added file 'project_issue.js'
--- project_issue.js	1970-01-01 00:00:00 +0000
+++ project_issue.js	2006-12-27 16:27:03 +0000
@@ -0,0 +1,33 @@
+/* $Id: $ */
+
+function mod_project(base, pid) {
+  if (Drupal.jsEnabled) {
+    // Temporarily disable the dynamic selects while we retrieve the new info.
+    // The newly loaded selects will be enabled by default.
+    $('#edit-rid, #edit-component').attr('disabled', 'disabled');
+
+    // Get existing component setting.
+    var cid = $('#edit-component').val();
+    cid = Drupal.encodeURIComponent(cid);
+
+    // Get existing version label.
+    var nid = $('#edit-rid').val();
+    var rid = $('#edit-rid option[@value=' + nid + ']').text();
+    rid = Drupal.encodeURIComponent(rid);
+
+    // Ajax GET request.
+    $.ajax({
+      type: 'GET',
+      url: base + pid + '/' + cid + '/' + rid,
+      success: function (data) {
+        // Parse back result
+        var result = Drupal.parseJson(data);
+  	    $('#edit-rid, #edit-component').parent().remove();
+  	    $('#edit-pid').parent().after(result['component']).after(result['rid']);
+      },
+      error: function (xmlhttp) {
+        alert('An HTTP error '+ xmlhttp.status +' occured.\n'+ url);
+      }
+    });
+  }
+}

=== modified file 'issue.inc'
--- issue.inc	2006-12-27 15:57:52 +0000
+++ issue.inc	2006-12-27 16:22:08 +0000
@@ -63,6 +63,68 @@ function project_issue_page() {
   }
 }
 
+function project_issue_update_project($pid, $cid = NULL, $rid = NULL) {
+
+  // Rids.
+  $return['rid'] = '';
+
+  // Only generate release stuff if the project_release module is enabled.
+  if (module_exists('project_release')) {
+    $project->nid = $pid;
+    if ($releases = project_release_get_releases($project, 0)) {
+      $releases = array(t('<none>')) + $releases;
+      // Since the value of releases is by nid, try to match release
+      // based on the label instead.
+      $default = 0;
+      foreach ($releases as $key => $label) {
+      	if ($rid == $label) {
+      	  $default = $key;
+      	}
+      }
+      $form = array();
+      $form['rid'] = array(
+        '#type' => 'select',
+        '#title' => t('Version'),
+        '#default_value' => $default,
+        '#options' => $releases,
+        '#required' => TRUE,
+      );
+
+      // Build the HTML output for the rid select.
+      $form = form_builder('rid', $form);
+      $return['rid'] .= drupal_render($form);
+    }
+  }
+
+  // Components.
+  $return['component'] = '';
+  $project = db_fetch_object(db_query('SELECT * FROM {project_issue_projects} WHERE nid = %d', $pid));
+  $components = array();
+  if ($project->components) {
+    $components = array(t('<none>'));
+    foreach (unserialize($project->components) as $component) {
+      $components[$component] = $component;
+    }
+  }
+
+  $form = array();
+  $form['component'] = array(
+    '#type' => 'select',
+    '#title' => t('Component'),
+    '#default_value' => $cid,
+    '#options' => $components,
+    '#required' => TRUE,
+  );
+
+  // Build the HTML output for the component select.
+  $form = form_builder('component', $form);
+  $return['component'] .= drupal_render($form);
+
+  // Translate to js before output, so the calling js can work with the data.
+  print drupal_to_js($return);
+  exit();
+}
+
 /**
  * Decides what to do with search page request.
  *
@@ -418,6 +480,8 @@ function theme_project_issue_subscribe($
 function project_issue_form($node, $param) {
   global $user;
 
+  drupal_add_js(drupal_get_path('module', 'project_issue') .'/project_issue.js');
+
   $default_state = variable_get('project_issue_default_state', 1);
   // Set form parameters so we can accept file uploads.
   $form['#attributes'] = array('enctype' => 'multipart/form-data');
@@ -490,6 +554,7 @@ function project_issue_form($node, $para
       '#default_value' => $node->pid,
       '#options' => $projects,
       '#required' => TRUE,
+      '#attributes' => array('onchange' => 'mod_project("'. base_path() .'project/issues/update_project/", this.value);'),
     );
     if ($releases) {
       $form['project_info']['rid'] = array(

=== modified file 'project_issue.module'
--- project_issue.module	2006-12-27 15:57:52 +0000
+++ project_issue.module	2006-12-27 15:59:31 +0000
@@ -165,6 +165,12 @@ function project_issue_menu($may_cache) 
       'type' => MENU_NORMAL_ITEM,
     );
     $items[] = array(
+      'path' => 'project/issues/update_project',
+      'callback' => 'project_issue_update_project',
+      'access' => $access,
+      'type' => MENU_CALLBACK,
+    );
+    $items[] = array(
       'path' => 'project/issues/statistics',
       'title' => t('Statistics'),
       'callback' => 'project_issue_page',

