? .DS_Store
? .htaccess.swp
? 392362-clean-url-install-cleanup.patch
? clean_url_form_04.patch
? clean_url_form_05.patch
? clean_url_settings_00.patch
? clean_url_settings_01.patch
? clean_url_settings_02.patch
? clean_url_settings_03.patch
? clean_url_settings_04.patch
? clean_url_settings_05.patch
? clean_url_settings_06.patch
? clean_url_settings_07.patch
? clean_url_settings_08.patch
? clean_url_settings_09.patch
? clean_url_settings_10.patch
? clean_url_settings_11.patch
? modules/.DS_Store
? sites/.DS_Store
? sites/default/.DS_Store
? sites/default/files
? sites/default/settings.php
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	4 Apr 2009 21:28:04 -0000
@@ -1760,36 +1760,53 @@ function system_site_maintenance_setting
 }
 
 /**
- * Form builder; Configure Clean URL settings.
+ * Form builder; Configure clean URL settings.
  *
  * @ingroup forms
  * @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).'),
-  );
+function system_clean_url_settings($form_state) {
+  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>';
+  // When accessing this form using a non-clean URL, allow a re-check to make
+  // sure clean URLs can be disabled at all times.
+  $available = FALSE;
+  if (strpos(request_uri(), '?q=') === FALSE || drupal_get_session('clean_url')) {
+    $available = TRUE;
+  }
+  else {
+    $request = drupal_http_request($base_url . '/admin/settings/clean-urls/check');
+    if (isset($request->code) && $request->code == 200) {
+      $available = TRUE;
     }
   }
 
-  return system_settings_form($form, TRUE);
+  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>.'),
+    );
+    $form = system_settings_form($form);
+  }
+  else {
+    drupal_add_js(drupal_get_path('module', 'system') . '/system.js');
+
+    $form['#redirect'] = $base_url . '/admin/settings/clean-urls';
+    $form['clean_url_description'] = array(
+      '#type' => 'markup',
+      '#markup' => '<p>' . t('Use URLs like <code>example.com/user</code> instead of <code>example.com/?q=user</code>.') . ' ' . t('If you are directed to a <em>Page not found (404)</em> error after testing for clean URLs, see the <a href="@handbook">online handbook</a>.', array('@handbook' => 'http://drupal.org/node/15365')) . '</p>',
+    );
+    $form['clean_url_test'] = array(
+      '#type' => 'submit',
+      '#value' => t('Run the clean URL test'),
+    );
+  }
+
+  return $form;
 }
 
 /**
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	4 Apr 2009 21:28:04 -0000
@@ -13,26 +13,16 @@ 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, #edit-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();
+        location = 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").addClass('clean-url-processed');
   }
@@ -47,8 +37,6 @@ Drupal.behaviors.cleanURLsSettingsCheck 
  */
 Drupal.cleanURLsInstallCheck = function() {
   var url = location.protocol +"//"+ location.host + Drupal.settings.basePath +"admin/settings/clean-urls/check";
-  $("#clean-url .description").append('<span><div id="testing">'+ Drupal.settings.cleanURL.testing +"</div></span>");
-  $("#clean-url.install").css("display", "block");
   // Submit a synchronous request to avoid database errors associated with
   // concurrent requests during install.
   $.ajax({
@@ -57,18 +45,10 @@ Drupal.cleanURLsInstallCheck = function(
     dataType: 'json',
     success: function () {
       // Check was successful.
-      $("#clean-url input.form-radio").attr("disabled", false);
-      $("#clean-url input.form-radio").attr("checked", 1);
-      $("#clean-url .description span").append('<div class="ok">'+ Drupal.settings.cleanURL.success +"</div>");
-      $("#testing").hide();
+      $("#edit-clean-url").attr("value", 1);
     },
-    error: function() {
-      // Check failed.
-      $("#clean-url .description span").append('<div class="warning">'+ Drupal.settings.cleanURL.failure +"</div>");
-      $("#testing").hide();
-    }
   });
-  $("#clean-url").addClass('clean-url-processed');
+  $("#edit-clean-url").addClass('clean-url-processed');
 };
 
 /**
@@ -134,4 +114,4 @@ Drupal.behaviors.poweredByPreview = {
   }
 };
 
-})(jQuery);
\ No newline at end of file
+})(jQuery);
