r73459 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r73458‎ | r73459 | r73460 >
Date:13:42, 21 September 2010
Author:catrope
Status:deferred
Tags:
Comment:
SimpleSurvey: Remove UsabilityInitiative.php dependency. Did not convert to ResourceLoader because this code will be deployed soon and this whole thing needs a rewrite anyway
Modified paths:
  • /trunk/extensions/SimpleSurvey/SimpleSurvey.php (modified) (history)
  • /trunk/extensions/SimpleSurvey/SpecialSimpleSurvey.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SimpleSurvey/SimpleSurvey.php
@@ -3,9 +3,12 @@
44 $dir = dirname( __FILE__ ) . '/';
55
66 // from prefswitch in usability initiative
7 -require_once( dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative/UsabilityInitiative.php" );
87 $prefswitchdir = dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative/PrefSwitch";
98
 9+// Use this to override the URL of ext.prefSwitch.{js,css} if needed
 10+$wgSimpleSurveyJSPath = null;
 11+$wgSimpleSurveyCSSPath = null;
 12+
1013 // Adds Autoload Classes
1114 $wgAutoloadClasses = array_merge(
1215 $wgAutoloadClasses,
Index: trunk/extensions/SimpleSurvey/SpecialSimpleSurvey.php
@@ -87,10 +87,14 @@
8888
8989 // Begin output
9090 $this->setHeaders();
91 - UsabilityInitiativeHooks::initialize();
92 - UsabilityInitiativeHooks::addScript( 'PrefSwitch/PrefSwitch.js', $wgPrefSwitchStyleVersion );
93 - UsabilityInitiativeHooks::addStyle( 'PrefSwitch/PrefSwitch.css', $wgPrefSwitchStyleVersion );
9491
 92+ global $wgExtensionAssetsPath, $wgSimpleSurveyJSPath, $wgSimpleSurveyCSSPath;
 93+ $script = Html::linkedScript( wfAppendQuery( $wgSimpleSurveyJSPath ? $wgSimpleSurveyJSPath :
 94+ "$wgExtensionAssetsPath/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.js", $wgPrefSwitchStyleVersion ) );
 95+ $wgOut->addScript( $script );
 96+ $wgOut->addExtensionStyle( wfAppendQuery( $wgSimpleSurveyCSSPath ? $wgSimpleSurveyCSSPath :
 97+ "$wgExtensionAssetsPath/UsabilityInitiative/PrefSwitch/modules/ext.prefSwitch.css", $wgPrefSwitchStyleVersion ) );
 98+
9599 // Handle various modes
96100 $renderedSurvey = $this->render( $wgRequest->getVal( "survey" ) );
97101
@@ -102,10 +106,7 @@
103107 // Only output the <form> and the <script>
104108 if ( $wgRequest->getBool( 'raw' ) ) {
105109 $wgOut->disable();
106 - echo $renderedSurvey;
107 -
108 - global $wgExtensionAssetsPath;
109 - echo Html::linkedScript( "$wgExtensionAssetsPath/UsabilityInitiative/PrefSwitch/PrefSwitch.js?$wgPrefSwitchStyleVersion" );
 110+ echo $renderedSurvey . $script;
110111 }
111112 }
112113

Status & tagging log