Index: trunk/extensions/SimpleSurvey/SimpleSurvey.php |
— | — | @@ -3,9 +3,12 @@ |
4 | 4 | $dir = dirname( __FILE__ ) . '/'; |
5 | 5 | |
6 | 6 | // from prefswitch in usability initiative |
7 | | -require_once( dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative/UsabilityInitiative.php" ); |
8 | 7 | $prefswitchdir = dirname( dirname( __FILE__ ) ) . "/UsabilityInitiative/PrefSwitch"; |
9 | 8 | |
| 9 | +// Use this to override the URL of ext.prefSwitch.{js,css} if needed |
| 10 | +$wgSimpleSurveyJSPath = null; |
| 11 | +$wgSimpleSurveyCSSPath = null; |
| 12 | + |
10 | 13 | // Adds Autoload Classes |
11 | 14 | $wgAutoloadClasses = array_merge( |
12 | 15 | $wgAutoloadClasses, |
Index: trunk/extensions/SimpleSurvey/SpecialSimpleSurvey.php |
— | — | @@ -87,10 +87,14 @@ |
88 | 88 | |
89 | 89 | // Begin output |
90 | 90 | $this->setHeaders(); |
91 | | - UsabilityInitiativeHooks::initialize(); |
92 | | - UsabilityInitiativeHooks::addScript( 'PrefSwitch/PrefSwitch.js', $wgPrefSwitchStyleVersion ); |
93 | | - UsabilityInitiativeHooks::addStyle( 'PrefSwitch/PrefSwitch.css', $wgPrefSwitchStyleVersion ); |
94 | 91 | |
| 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 | + |
95 | 99 | // Handle various modes |
96 | 100 | $renderedSurvey = $this->render( $wgRequest->getVal( "survey" ) ); |
97 | 101 | |
— | — | @@ -102,10 +106,7 @@ |
103 | 107 | // Only output the <form> and the <script> |
104 | 108 | if ( $wgRequest->getBool( 'raw' ) ) { |
105 | 109 | $wgOut->disable(); |
106 | | - echo $renderedSurvey; |
107 | | - |
108 | | - global $wgExtensionAssetsPath; |
109 | | - echo Html::linkedScript( "$wgExtensionAssetsPath/UsabilityInitiative/PrefSwitch/PrefSwitch.js?$wgPrefSwitchStyleVersion" ); |
| 110 | + echo $renderedSurvey . $script; |
110 | 111 | } |
111 | 112 | } |
112 | 113 | |