diff options
Diffstat (limited to 'modules')
-rw-r--r-- | modules/system/system.js | 36 | ||||
-rw-r--r-- | modules/system/system.module | 7 |
2 files changed, 26 insertions, 17 deletions
diff --git a/modules/system/system.js b/modules/system/system.js index 45741e76a..aa9db2c2c 100644 --- a/modules/system/system.js +++ b/modules/system/system.js @@ -14,21 +14,23 @@ Drupal.behaviors.cleanURLsSettingsCheck = function(context) { if ($("#clean-url.clean-url-processed, #clean-url.install").size()) { return; } - var url = location.pathname +"admin/settings/clean-urls"; + var url = location.pathname +"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, type: "GET", data: " ", complete: function(response) { - $("#testing").toggle(); - if (response.status == 200) { + $.ajax({ + url: location.protocol +"//"+ location.host + url, + dataType: 'json', + success: function () { // Check was successful. - $("#clean-url input.form-radio").attr("disabled", ""); + $("#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>"); - } - else { + $("#testing").toggle(); + }, + 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>"); } - }}); + }); $("#clean-url").addClass('clean-url-processed'); }; @@ -40,23 +42,23 @@ Drupal.behaviors.cleanURLsSettingsCheck = function(context) { * are currently enabled. */ Drupal.cleanURLsInstallCheck = function() { - var pathname = location.pathname +""; - var url = pathname.replace(/\/[^\/]*$/, "/") +"node"; + var url = location.protocol +"//"+ location.host + location.pathname.replace(/\/[^\/]*$/, "/") +"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"); - $.ajax({url: location.protocol +"//"+ location.host + url, type: "GET", data: " ", complete: function(response) { - $("#testing").toggle(); - if (response.status == 200) { + $.ajax({ + url: url, + dataType: 'json', + success: function () { // Check was successful. - $("#clean-url input.form-radio").attr("disabled", ""); + $("#clean-url input.form-radio").attr("disabled", false); $("#clean-url .description span").append('<div class="ok">'+ Drupal.settings.cleanURL.success +"</div>"); $("#clean-url input.form-radio").attr("checked", 1); - } - else { + }, + error: function() { // Check failed. $("#clean-url .description span").append('<div class="warning">'+ Drupal.settings.cleanURL.failure +"</div>"); } - }}); + }); $("#clean-url").addClass('clean-url-processed'); }; diff --git a/modules/system/system.module b/modules/system/system.module index 55d9bf5c4..13c9cfb6f 100644 --- a/modules/system/system.module +++ b/modules/system/system.module @@ -401,6 +401,13 @@ function system_menu() { 'page arguments' => array('system_clean_url_settings'), 'file' => 'system.admin.inc', ); + $items['admin/settings/clean-urls/check'] = array( + 'title' => 'Clean URL check', + 'page callback' => 'drupal_json', + 'page arguments' => array(array('status' => TRUE)), + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + ); // Reports: $items['admin/reports'] = array( |