Index: l10n_community/l10n_community.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/l10n_server/l10n_community/Attic/l10n_community.module,v
retrieving revision 1.1.2.23.2.60
diff -u -r1.1.2.23.2.60 l10n_community.module
--- l10n_community/l10n_community.module	11 Nov 2009 18:21:01 -0000	1.1.2.23.2.60
+++ l10n_community/l10n_community.module	22 Nov 2009 13:16:44 -0000
@@ -74,6 +74,14 @@
 function l10n_community_menu() {
   $items = array();
 
+  $items['l10n_server/js'] = array(
+    'title' => 'Export',
+    'page callback' => 'l10n_community_export_page_js',
+    'file' => 'export.inc',
+    'access callback' => 'l10n_community_export_access',
+    'type' => MENU_CALLBACK,
+  );
+
   // Settings menu items.
   $items['admin/l10n_server'] = array(
     'title' => 'Localization server',
Index: l10n_community/export.inc
===================================================================
RCS file: /cvs/drupal/contributions/modules/l10n_server/l10n_community/Attic/export.inc,v
retrieving revision 1.1.2.15.2.19
diff -u -r1.1.2.15.2.19 export.inc
--- l10n_community/export.inc	20 Nov 2009 14:44:05 -0000	1.1.2.15.2.19
+++ l10n_community/export.inc	22 Nov 2009 13:16:44 -0000
@@ -38,6 +38,7 @@
  */
 function l10n_community_export_form(&$form_state, $uri = NULL, $langcode = NULL) {
 
+  $form = array();
   $hide_projects = FALSE;
   if (!isset($uri)) {
     $uri = !empty($form_state['values']['project']) ? $form_state['values']['project'] : (!empty($_GET['project']) ? $_GET['project'] : NULL);
@@ -47,6 +48,11 @@
     $hide_projects = TRUE;
   }
 
+  $form['js'] = array(
+    '#type' => 'value',
+    '#value' => FALSE,
+  );
+
   $projects = l10n_community_get_projects();
   $form['data'] = array(
     '#type' => 'fieldset',
@@ -85,7 +91,11 @@
   if (isset($projects[$uri])) {
     // Set this project as default value if identified.
     $form['data']['project']['#default_value'] = $projects[$uri]->title;
-
+    $form['data']['project']['#ahah'] = array(
+      'event' => 'change',
+      'path' => 'l10n_server/js',
+      'wrapper' => 'l10n_server_releases',
+    );
     $releases = l10n_community_get_releases($uri);
     $release_options = array('all' => t('All releases merged'));
     foreach ($releases as $rid => $this_release) {
@@ -95,7 +105,10 @@
       '#title' => t('Release'),
       '#type' => count($release_options) <= 3 ? 'radios' : 'select',
       '#options' => $release_options,
-      '#default_value' => isset($release) ? $release : 'all',
+      '#default_value' => 'all',
+      '#prefix' => '<div id="l10n_server_releases">',
+      '#suffix' => '</div>',
+
     );
   }
   if (isset($langcode) && isset($form['data']['release'])) {
@@ -137,6 +150,33 @@
 }
 
 /**
+ * @see http://drupal.org/node/331941
+ * @return json data for the changed values
+ */
+function l10n_community_export_page_js() {
+  if (empty($_POST)) {
+    drupal_goto();
+  }
+  $form_state = array('storage' => NULL, 'submitted' => FALSE);
+  $form_build_id = $_POST['form_build_id'];
+  $form = form_get_cache($form_build_id, $form_state);
+  $args = $form['#parameters'];
+  $form_id = array_shift($args);
+  $form_state['post'] = $form['#post'] = $_POST;
+  $form['#programmed'] = $form['#redirect'] = FALSE;
+  // set to TRUE, so we can check that in l10n_community_export_form_submit()
+  $form['js'] = array('#type' => 'value', '#value' => TRUE);
+  drupal_process_form($form_id, $form, $form_state);
+  $form = drupal_rebuild_form($form_id, $form_state, $args, $form_build_id);
+  $release_form = $form['data']['release'];
+  unset($release_form['#prefix'], $release_form['#suffix']);
+  $output = theme('status_messages') . drupal_render($release_form);
+  // Final rendering callback.
+drupal_json(array('status' => TRUE, 'data' => $output));
+}
+
+
+/**
  * Release field is mandatory.
  */
 function l10n_community_export_form_validate($form, &$form_state) {
@@ -151,6 +191,10 @@
  * all details available and return the output via HTTP.
  */
 function l10n_community_export_form_submit($form, &$form_state) {
+// we want only change the form, not submit
+  if ($form_state['values']['js']) {
+    return;
+  }
 
   // This was validated to work in the validation code.
   $uri = !empty($form_state['values']['project']) ? l10n_community_project_uri_by_title($form_state['values']['project']) : NULL;
