r82749 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r82748‎ | r82749 | r82750 >
Date:22:20, 24 February 2011
Author:kaldari
Status:ok
Tags:
Comment:
automatically use localized alias for BannerListLoader to avoid 302 redirect
Modified paths:
  • /trunk/extensions/CentralNotice/SpecialBannerController.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CentralNotice/SpecialBannerController.php
@@ -43,7 +43,7 @@
4444 * In order to circumvent the normal squid cache override we add '/cn.js' to the bannerlist URL.
4545 */
4646 function getOutput() {
47 - global $wgCentralPagePath;
 47+ global $wgCentralPagePath, $wgContLang;
4848
4949 $js = $this->getScriptFunctions() . $this->getToggleScripts();
5050 $js .= <<<JAVASCRIPT
@@ -76,7 +76,11 @@
7777 var geoLocation = Geo.country; // pull the geo info
7878 }
7979 var bannerListQuery = $.param( { 'language': wgContentLanguage, 'project': wgNoticeProject, 'country': geoLocation } );
80 - var bannerListURL = wgScript + '?title=' + encodeURIComponent(wgFormattedNamespaces[-1]) + ':BannerListLoader&cache=/cn.js&' + bannerListQuery;
 80+JAVASCRIPT;
 81+ $js .= "\n\t\t\t\tvar bannerListURL = wgScript + '?title=' + encodeURIComponent('" .
 82+ $wgContLang->specialPage( 'BannerListLoader' ) .
 83+ "') + '&cache=/cn.js&' + bannerListQuery;\n";
 84+ $js .= <<<JAVASCRIPT
8185 var request = $.ajax( {
8286 url: bannerListURL,
8387 dataType: 'json',
@@ -177,5 +181,5 @@
178182 JAVASCRIPT;
179183 return $script;
180184 }
181 -
 185+
182186 }

Status & tagging log