? docs
? tmp
? modules/syndication
? sites/all/modules/admin_menu
? sites/all/modules/cck
? sites/all/modules/coder
? sites/all/modules/cvs_deploy
? sites/all/modules/demo
? sites/all/modules/devel
? sites/all/modules/drush
? sites/all/modules/google_analytics
? sites/all/modules/mollom
? sites/all/modules/path_redirect
? sites/all/modules/pbs
? sites/all/modules/plugin_manager
? sites/all/modules/robotstxt
? sites/all/modules/sandbox
Index: modules/system/system.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v
retrieving revision 1.131
diff -u -p -r1.131 system.admin.inc
--- modules/system/system.admin.inc	17 Mar 2009 15:26:29 -0000	1.131
+++ modules/system/system.admin.inc	3 Apr 2009 23:16:41 -0000
@@ -1766,30 +1766,49 @@ function system_site_maintenance_setting
  * @see system_settings_form()
  */
 function system_clean_url_settings() {
-  $form['clean_url'] = array(
-    '#type' => 'radios',
-    '#title' => t('Clean URLs'),
-    '#default_value' => 0,
-    '#options' => array(t('Disabled'), t('Enabled')),
-    '#description' => t('This option makes Drupal emit "clean" URLs (i.e. without <code>?q=</code> in the URL).'),
-  );
+  global $base_url;
 
-  if (!variable_get('clean_url', 0)) {
-    if (strpos(request_uri(), '?q=') !== FALSE) {
-      drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
-
-      $form['clean_url']['#description'] .= ' <span>' . t('Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="@handbook">handbook page on Clean URLs</a> has additional troubleshooting information.', array('@handbook' => 'http://drupal.org/node/15365')) . '</span>';
-
-      $form['clean_url']['#disabled'] = TRUE;
-      $form['clean_url']['#prefix'] = '<div id="clean-url">';
-      $form['clean_url']['#suffix'] = '<p>' . t('<a href="@clean_url">Run the clean url test</a>.', array('@clean_url' => base_path() . 'admin/settings/clean-urls')) . '</p></div>';
-    }
-    else {
-      $form['clean_url']['#description'] .= ' <div class="ok">' . t('Your server has been successfully tested to support this feature.') . '</div>';
-    }
+  // Show the clean URL checkbox if clean URLS are currently enabled, we are on
+  // a clean URL path, or we have been on the clean URL path before this session.
+  $available = (variable_get('clean_url', 0) || strpos(request_uri(), '?q=') === FALSE) || drupal_get_session('clean_url');
+  if (!$available) {
+    // If none of the above checks worked, try to request the clean URL test page.
+    $test = drupal_http_request($base_url . '/' . '/admin/settings/clean-urls/check');
+    $available = ($test && $test->code == 200);
+  }
+  
+  if ($available) {
+    drupal_set_session('clean_url', TRUE);
+    $form['clean_url'] = array(
+      '#type' => 'checkbox',
+      '#title' => t('Enable clean URLs'),
+      '#default_value' => 0,
+      '#description' => t('Use URLs like <code>example.com/user</code> instead of <code>example.com/?q=user</code>.'),
+      '#attributes' => array('class' => 'clean-url-processed'),
+    );
+    $form = system_settings_form($form);
   }
+  else {
+    drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
+    $form['clean_url_description'] = array(
+      '#markup' => '<div id="clean-url-description">' . t('Before enabling clean URLs, you must perform a test to determine if your server is properly configured. If you are able to see this page again after clicking the "Run the clean URL test" link, the test has succeeded and the radio buttons above will be available. If instead you are directed to a "Page not found" error, you will need to change the configuration of your server. The <a href="@handbook">handbook page on Clean URLs</a> has additional troubleshooting information.', array('@handbook' => 'http://drupal.org/node/15365')) . '</div>',
+    );
+    $form['clean_url_test'] = array(
+      '#type' => 'submit',
+      '#value' => t('Run the clean url test'),
+      '#submit' => array('system_clean_url_settings_submit_test'),
+    );
+  }
+
+  return $form;
+}
 
-  return system_settings_form($form, TRUE);
+/**
+ * Submit handler; Redirect to the clean URL test.
+ */
+function system_clean_url_settings_submit_test($form, &$form_state) {
+  global $base_url;
+  $form_state['redirect'] = $base_url . '/admin/settings/clean-urls';
 }
 
 /**
Index: modules/system/system.css
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.css,v
retrieving revision 1.53
diff -u -p -r1.53 system.css
--- modules/system/system.css	5 Dec 2008 12:50:28 -0000	1.53
+++ modules/system/system.css	3 Apr 2009 23:16:41 -0000
@@ -485,13 +485,6 @@ table.sticky-header {
 }
 
 /*
-** Installation clean URLs
-*/
-#clean-url.install {
-  display: none;
-}
-
-/*
 ** For anything you want to hide on page load when JS is enabled, so
 ** that you can use the JS to control visibility and avoid flicker.
 */
Index: modules/system/system.js
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.js,v
retrieving revision 1.21
diff -u -p -r1.21 system.js
--- modules/system/system.js	17 Mar 2009 15:26:29 -0000	1.21
+++ modules/system/system.js	3 Apr 2009 23:16:43 -0000
@@ -13,25 +13,23 @@ Drupal.behaviors.cleanURLsSettingsCheck 
     // This behavior attaches by ID, so is only valid once on a page.
     // Also skip if we are on an install page, as Drupal.cleanURLsInstallCheck will handle
     // the processing.
-    if ($("#clean-url.clean-url-processed, #clean-url.install").size()) {
+    if ($(".clean-url-processed, #clean-url.install").size()) {
       return;
     }
     var url = settings.basePath +"admin/settings/clean-urls/check";
-    $("#clean-url .description span").html('<div id="testing">'+ Drupal.t('Testing clean URLs...') +"</div>");
-    $("#clean-url p").hide();
     $.ajax({
       url: location.protocol +"//"+ location.host + url,
       dataType: 'json',
       success: function () {
         // Check was successful.
-        $("#clean-url input.form-radio").attr("disabled", false);
-        $("#clean-url .description span").append('<div class="ok">'+ Drupal.t('Your server has been successfully tested to support this feature.') +"</div>");
-        $("#testing").hide();
+        $("#clean-url-description").before('<div class="messages ok">'+ Drupal.t('Your server has been successfully tested to support this feature.') +"</div>");
+        // Redirect to the clean URL settings form.
+        // This will only happen if drupal_http_request() failed.
+        window.location = location.protocol +"//"+ location.host + settings.basePath + 'admin/settings/clean-urls';
       },
       error: function() {
         // Check failed.
-        $("#clean-url .description span").append('<div class="warning">'+ Drupal.t('Your system configuration does not currently support this feature. The <a href="http://drupal.org/node/15365">handbook page on Clean URLs</a> has additional troubleshooting information.') +"</div>");
-        $("#testing").hide();
+        $("#clean-url-description").before('<div class="messages warning">'+ Drupal.t('Your system configuration does not currently support this feature. The <a href="http://drupal.org/node/15365">handbook page on Clean URLs</a> has additional troubleshooting information.') +"</div>");
       }
     });
     $("#clean-url").addClass('clean-url-processed');
@@ -134,4 +132,4 @@ Drupal.behaviors.poweredByPreview = {
   }
 };
 
-})(jQuery);
\ No newline at end of file
+})(jQuery);
