Index: trunk/extensions/Survey/includes/SurveyQuestion.php |
— | — | @@ -172,11 +172,18 @@ |
173 | 173 | * @since 0.1 |
174 | 174 | * |
175 | 175 | * @param integer $surveyId |
| 176 | + * @param boolean $incRemoved |
176 | 177 | * |
177 | 178 | * @return array of SurveyQuestion |
178 | 179 | */ |
179 | | - public static function getQuestionsForSurvey( $surveyId ) { |
180 | | - return self::getQuestionsFromDB( array( 'question_survey_id' => $surveyId ) ); |
| 180 | + public static function getQuestionsForSurvey( $surveyId, $incRemoved = false ) { |
| 181 | + $conditions = array( 'question_survey_id' => $surveyId ); |
| 182 | + |
| 183 | + if ( $incRemoved === false ) { |
| 184 | + $conditions['question_removed'] = 0; |
| 185 | + } |
| 186 | + |
| 187 | + return self::getQuestionsFromDB( $conditions ); |
181 | 188 | } |
182 | 189 | |
183 | 190 | /** |
— | — | @@ -290,4 +297,17 @@ |
291 | 298 | return $this->required; |
292 | 299 | } |
293 | 300 | |
| 301 | + /** |
| 302 | + * Gets if the question was removed. |
| 303 | + * This means it should not be shown in the UI, |
| 304 | + * and is only kept to make sense of old answers liked to it. |
| 305 | + * |
| 306 | + * @since 0.1 |
| 307 | + * |
| 308 | + * @return boolean |
| 309 | + */ |
| 310 | + public function wasRemoved() { |
| 311 | + return $this->removed; |
| 312 | + } |
| 313 | + |
294 | 314 | } |
Index: trunk/extensions/Survey/resources/ext.survey.special.survey.js |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * @licence GNU GPL v3 or later |
7 | 7 | * @author Jeroen De Dauw <jeroendedauw at gmail dot com> |
8 | 8 | */ |
9 | | -(function( $ ) { $( document ).ready( function() { |
| 9 | +(function( $, mw ) { $( document ).ready( function() { |
10 | 10 | |
11 | 11 | var _this = this; |
12 | 12 | |
— | — | @@ -22,10 +22,8 @@ |
23 | 23 | |
24 | 24 | // TODO: defaulting |
25 | 25 | |
26 | | - var id = 'foo'; |
27 | | - |
28 | 26 | $tr.append( $( '<td />' ).attr( { 'class': 'mw-label' } ).html( |
29 | | - $( '<label />' ).attr( { 'for': id } ).text( survey.msg( 'survey-question-label-nr', ++questionNr ) ) |
| 27 | + $( '<label />' ).text( mw.msg( 'survey-question-label-nr', ++questionNr ) ) |
30 | 28 | ) ); |
31 | 29 | |
32 | 30 | $tr.append( $( '<td />' ).attr( { 'class': 'mw-input' } ).html( |
— | — | @@ -100,4 +98,4 @@ |
101 | 99 | |
102 | 100 | setup(); |
103 | 101 | |
104 | | -} ); })( jQuery ); |
\ No newline at end of file |
| 102 | +} ); })( jQuery, window.mediaWiki ); |
\ No newline at end of file |