http://www.mediawiki.org/wiki/Special:Code/MediaWiki/95700

Revision: 95700
Author:   jeroendedauw
Date:     2011-08-29 21:23:20 +0000 (Mon, 29 Aug 2011)
Log Message:
-----------
do not inc removed questions by default

Modified Paths:
--------------
    trunk/extensions/Survey/includes/SurveyQuestion.php
    trunk/extensions/Survey/resources/ext.survey.special.survey.js

Modified: trunk/extensions/Survey/includes/SurveyQuestion.php
===================================================================
--- trunk/extensions/Survey/includes/SurveyQuestion.php 2011-08-29 21:20:32 UTC 
(rev 95699)
+++ trunk/extensions/Survey/includes/SurveyQuestion.php 2011-08-29 21:23:20 UTC 
(rev 95700)
@@ -172,11 +172,18 @@
         * @since 0.1
         * 
         * @param integer $surveyId
+        * @param boolean $incRemoved
         * 
         * @return array of SurveyQuestion
         */
-       public static function getQuestionsForSurvey( $surveyId ) {
-               return self::getQuestionsFromDB( array( 'question_survey_id' => 
$surveyId ) );
+       public static function getQuestionsForSurvey( $surveyId, $incRemoved = 
false ) {
+               $conditions = array( 'question_survey_id' => $surveyId );
+               
+               if ( $incRemoved === false ) {
+                       $conditions['question_removed'] = 0;
+               }
+               
+               return self::getQuestionsFromDB( $conditions );
        }
        
        /**
@@ -290,4 +297,17 @@
                return $this->required;
        }
        
+       /**
+        * Gets if the question was removed.
+        * This means it should not be shown in the UI,
+        * and is only kept to make sense of old answers liked to it. 
+        * 
+        * @since 0.1
+        * 
+        * @return boolean
+        */
+       public function wasRemoved() {
+               return $this->removed;
+       }
+       
 }

Modified: trunk/extensions/Survey/resources/ext.survey.special.survey.js
===================================================================
--- trunk/extensions/Survey/resources/ext.survey.special.survey.js      
2011-08-29 21:20:32 UTC (rev 95699)
+++ trunk/extensions/Survey/resources/ext.survey.special.survey.js      
2011-08-29 21:23:20 UTC (rev 95700)
@@ -5,7 +5,7 @@
  * @licence GNU GPL v3 or later
  * @author Jeroen De Dauw <jeroendedauw at gmail dot com>
  */
-(function( $ ) { $( document ).ready( function() {
+(function( $, mw ) { $( document ).ready( function() {
 
        var _this = this;
 
@@ -22,10 +22,8 @@
                
                // TODO: defaulting
                
-               var id = 'foo';
-               
                $tr.append( $( '<td />' ).attr( { 'class': 'mw-label' } ).html(
-                       $( '<label />' ).attr( { 'for': id } ).text( 
survey.msg( 'survey-question-label-nr', ++questionNr ) )
+                       $( '<label />' ).text( mw.msg( 
'survey-question-label-nr', ++questionNr ) )
                ) );
                
                $tr.append( $( '<td />' ).attr( { 'class': 'mw-input' } ).html(
@@ -100,4 +98,4 @@
        
        setup();
        
-} ); })( jQuery );
\ No newline at end of file
+} ); })( jQuery, window.mediaWiki );
\ No newline at end of file


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to