Index: trunk/extensions/SimpleSurvey/Surveys.php |
— | — | @@ -6,6 +6,7 @@ |
7 | 7 | |
8 | 8 | $wgPrefSwitchSurveys['vitals-07-2010'] = array( |
9 | 9 | 'submit-msg' => 'vitals-07-2010-submit', |
| 10 | + 'intro-msg' => 'simple-survey-intro-vitals-07-2010', |
10 | 11 | 'updatable' => false, |
11 | 12 | 'questions' => array( |
12 | 13 | 'use' => array( |
Index: trunk/extensions/SimpleSurvey/SpecialSimpleSurvey.php |
— | — | @@ -90,12 +90,23 @@ |
91 | 91 | UsabilityInitiativeHooks::initialize(); |
92 | 92 | UsabilityInitiativeHooks::addScript( 'PrefSwitch/PrefSwitch.js', $wgPrefSwitchStyleVersion ); |
93 | 93 | UsabilityInitiativeHooks::addStyle( 'PrefSwitch/PrefSwitch.css', $wgPrefSwitchStyleVersion ); |
94 | | - $wgOut->addHtml( '<div class="plainlinks">' ); |
| 94 | + |
95 | 95 | // Handle various modes |
| 96 | + $renderedSurvey = $this->render( $wgRequest->getVal( "survey" ) ); |
96 | 97 | |
97 | | - $this->render( $wgRequest->getVal( "survey" ) ); |
98 | | - |
| 98 | + $wgOut->addHtml( '<div class="plainlinks">' ); |
| 99 | + $wgOut->addHtml( $renderedSurvey ); |
99 | 100 | $wgOut->addHtml( '</div>' ); |
| 101 | + |
| 102 | + // Handle raw mode |
| 103 | + // Only output the <form> and the <script> |
| 104 | + if ( $wgRequest->getBool( 'raw' ) ) { |
| 105 | + $wgOut->disable(); |
| 106 | + echo $renderedSurvey; |
| 107 | + |
| 108 | + global $wgExtensionAssetsPath; |
| 109 | + echo Html::linkedScript( "$wgExtensionAssetsPath/UsabilityInitiative/PrefSwitch/PrefSwitch.js?$wgPrefSwitchStyleVersion" ); |
| 110 | + } |
100 | 111 | } |
101 | 112 | |
102 | 113 | /* Private Functions */ |
— | — | @@ -113,7 +124,9 @@ |
114 | 125 | return; |
115 | 126 | } |
116 | 127 | |
117 | | - $wgOut->addWikiMsg( "simple-survey-intro-{$mode}" ); |
| 128 | + if ( isset( $wgPrefSwitchSurveys[$mode]['intro-msg'] ) ) { |
| 129 | + $wgOut->addWikiMsg( $wgPrefSwitchSurveys[$mode]['intro-msg'] ); |
| 130 | + } |
118 | 131 | |
119 | 132 | // Setup a form |
120 | 133 | $html = Xml::openElement( |
— | — | @@ -138,6 +151,6 @@ |
139 | 152 | ); |
140 | 153 | $html .= Xml::closeElement( 'dt' ); |
141 | 154 | $html .= Xml::closeElement( 'form' ); |
142 | | - $wgOut->addHtml( $html ); |
| 155 | + return $html; |
143 | 156 | } |
144 | 157 | } |