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.64
diff -u -r1.1.2.23.2.64 l10n_community.module
--- l10n_community/l10n_community.module	13 Jan 2010 16:56:45 -0000	1.1.2.23.2.64
+++ l10n_community/l10n_community.module	24 Jan 2010 11:57:04 -0000
@@ -59,6 +59,14 @@
 function l10n_community_menu() {
   $items = array();
 
+  $items['l10n_community_export_page_js'] = array(
+    'title' => 'Export',
+    'page callback' => 'l10n_community_export_page_js',
+    'file' => 'export.inc',
+    'access arguments' => array('export gettext templates and translations'),
+    '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.22
diff -u -r1.1.2.15.2.22 export.inc
--- l10n_community/export.inc	18 Jan 2010 14:00:45 -0000	1.1.2.15.2.22
+++ l10n_community/export.inc	24 Jan 2010 11:57:04 -0000
@@ -38,16 +38,23 @@
  */
 function l10n_community_export_form(&$form_state, $uri = NULL, $langcode = NULL) {
 
+  $form = array();
   $hide_projects = FALSE;
+  $projects = l10n_community_get_projects();
+  $project = array_shift($projectsclone = $projects);
   if (!isset($uri)) {
-    $uri = !empty($form_state['values']['project']) ? $form_state['values']['project'] : (!empty($_GET['project']) ? $_GET['project'] : NULL);
+    $uri = !empty($form_state['values']['project']) ? $form_state['values']['project'] : (!empty($_GET['project']) ? $_GET['project'] : ($project->uri ? $project->uri : NULL));
   }
   else {
-    // When project was preset from URL, disable the selector.
+    // When project was preset from URL, disable the selector. pot-export
     $hide_projects = TRUE;
   }
 
-  $projects = l10n_community_get_projects();
+  $form['js'] = array(
+    '#type' => 'value',
+    '#value' => FALSE,
+  );
+
   $form['data'] = array(
     '#type' => 'fieldset',
     '#title' => t('Source data'),
@@ -85,7 +92,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_community_export_page_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 +106,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 +151,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 +192,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;
