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.41
diff -u -r1.1.2.23.2.41 l10n_community.module
--- l10n_community/l10n_community.module	21 Aug 2009 06:40:26 -0000	1.1.2.23.2.41
+++ l10n_community/l10n_community.module	21 Aug 2009 10:30:05 -0000
@@ -249,6 +249,13 @@
     'type' => MENU_LOCAL_TASK,
     'weight' => 0,
   );
+  $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,
+  );
 
   // We have a valid project name from the web address.
   $items['translate/projects/%l10n_community_project'] = array(
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.12
diff -u -r1.1.2.15.2.12 export.inc
--- l10n_community/export.inc	16 Aug 2009 15:00:51 -0000	1.1.2.15.2.12
+++ l10n_community/export.inc	21 Aug 2009 10:30:05 -0000
@@ -37,7 +37,7 @@
  * Translation export form. This is multi-step with the project selection.
  */
 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);
@@ -46,7 +46,10 @@
     // When project was preset from URL, disable the selector.
     $hide_projects = TRUE;
   }
-
+  $form['js'] = array(
+    '#type' => 'value',
+    '#value' => FALSE,
+  );
   $projects = l10n_community_get_projects();
   $form['data'] = array(
     '#type' => 'fieldset',
@@ -84,7 +87,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'));
     foreach ($releases as $rid => $this_release) {
@@ -94,7 +101,9 @@
       '#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>',
       '#description' => t('Exporting with all releases is useful for translators, but is not optimal to use for end users because unused data would clutter up their database, when files get imported. Export for all releases if you would like to provide a complete translation, and you work with a desktop tool.'),
     );
   }
@@ -133,6 +142,29 @@
 }
 
 /**
+ * @see http://drupal.org/node/331941
+ * @return json data for the changed values
+ */
+function l10n_community_export_page_js() {
+  $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) {
@@ -150,7 +182,10 @@
  * all details available and return the output via HTTP.
  */
 function l10n_community_export_form_submit($form, &$form_state) {
-
+//if you choose 'All' and you change the project, you get the downloadfile as alert
+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;
   if (empty($uri)) {
@@ -166,6 +201,7 @@
   elseif ($form_state['values']['release'] != 'all') {
     $releases = l10n_community_get_releases($uri);
     if (!isset($releases[$form_state['values']['release']])) {
+      $form_state['redirect'] = array($_GET['q'], array('project' => $uri));
       form_set_error('release', t('Invalid release chosen.'));
       return;
     }
