summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGábor Hojtsy <gabor@hojtsy.hu>2007-12-17 23:43:43 +0000
committerGábor Hojtsy <gabor@hojtsy.hu>2007-12-17 23:43:43 +0000
commit83bde0f54754ba68351f00ce512333f78a999f4f (patch)
tree90608c593b9348e571be4ff7b0cee3b04b6fcd24
parentcf790b5a096a154cee6f22688b4c9d2dbc14d76f (diff)
downloadbrdo-83bde0f54754ba68351f00ce512333f78a999f4f.tar.gz
brdo-83bde0f54754ba68351f00ce512333f78a999f4f.tar.bz2
#193804 by starbow, Rob Loach, Wim Leers: add often used basePath setting by defualt to JS settings, also providing an elegant bugfix to #201248
-rw-r--r--includes/common.inc10
-rw-r--r--modules/system/system.js6
2 files changed, 11 insertions, 5 deletions
diff --git a/includes/common.inc b/includes/common.inc
index c2b1d5914..00f497d4e 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1934,14 +1934,20 @@ function drupal_add_js($data = NULL, $type = 'module', $scope = 'header', $defer
if (isset($data)) {
- // Add jquery.js and drupal.js the first time a Javascript file is added.
+ // Add jquery.js and drupal.js, as well as the basePath setting, the
+ // first time a Javascript file is added.
if (empty($javascript)) {
$javascript['header'] = array(
'core' => array(
'misc/jquery.js' => array('cache' => TRUE, 'defer' => FALSE, 'preprocess' => TRUE),
'misc/drupal.js' => array('cache' => TRUE, 'defer' => FALSE, 'preprocess' => TRUE),
),
- 'module' => array(), 'theme' => array(), 'setting' => array(), 'inline' => array(),
+ 'module' => array(),
+ 'theme' => array(),
+ 'setting' => array(
+ array('basePath' => base_path()),
+ ),
+ 'inline' => array(),
);
}
diff --git a/modules/system/system.js b/modules/system/system.js
index aa9db2c2c..a53fefc77 100644
--- a/modules/system/system.js
+++ b/modules/system/system.js
@@ -14,7 +14,7 @@ Drupal.behaviors.cleanURLsSettingsCheck = function(context) {
if ($("#clean-url.clean-url-processed, #clean-url.install").size()) {
return;
}
- var url = location.pathname +"admin/settings/clean-urls/check";
+ var url = Drupal.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({
@@ -42,7 +42,7 @@ Drupal.behaviors.cleanURLsSettingsCheck = function(context) {
* are currently enabled.
*/
Drupal.cleanURLsInstallCheck = function() {
- var url = location.protocol +"//"+ location.host + location.pathname.replace(/\/[^\/]*$/, "/") +"admin/settings/clean-urls/check";
+ 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");
$.ajax({
@@ -85,7 +85,7 @@ Drupal.behaviors.copyFieldValue = function (context) {
sourceField.addClass('copy-field-values-processed');
}
}
-}
+};
/**
* Show/hide custom format sections on the date-time settings page.