r96791 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96790‎ | r96791 | r96792 >
Date:15:55, 11 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
use title instead of name/id in actual survey
Modified paths:
  • /trunk/extensions/Survey/includes/SurveyTag.php (modified) (history)
  • /trunk/extensions/Survey/resources/jquery.survey.js (modified) (history)
  • /trunk/extensions/Survey/specials/SpecialTakeSurvey.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/specials/SpecialTakeSurvey.php
@@ -33,7 +33,7 @@
3434 parent::execute( $subPage );
3535
3636 $survey = Survey::selectRow(
37 - array( 'enabled' ),
 37+ array( 'name', 'title', 'enabled' ),
3838 array( 'name' => $subPage )
3939 );
4040
@@ -41,12 +41,12 @@
4242 $this->showError( 'surveys-takesurvey-nosuchsurvey' );
4343 }
4444 else if ( $survey->getField( 'enabled' ) ) {
45 - $this->displaySurvey( $subPage );
 45+ $this->displaySurvey( $survey );
4646 }
4747 else if ( $GLOBALS['wgUser']->isAllowed( 'surveyadmin' ) ) {
4848 $this->showWarning( 'surveys-takesurvey-warn-notenabled' );
4949 $this->getOutput()->addHTML( '<br /><br /><br /><br />' );
50 - $this->displaySurvey( $subPage );
 50+ $this->displaySurvey( $survey );
5151 }
5252 else {
5353 $this->showError( 'surveys-takesurvey-surveynotenabled' );
@@ -59,13 +59,14 @@
6060 *
6161 * @since 0.1
6262 *
63 - * @param string $surveyName
 63+ * @param Survey $surveyName
6464 */
65 - protected function displaySurvey( $surveyName ) {
 65+ protected function displaySurvey( $survey ) {
6666 $this->getOutput()->addWikiText( Xml::element(
6767 'survey',
6868 array(
69 - 'name' => $surveyName,
 69+ 'name' => $survey->getField( 'name' ),
 70+ 'title' => $survey->getField( 'title' ),
7071 'require-enabled' => $GLOBALS['wgUser']->isAllowed( 'surveyadmin' ) ? '0' : '1'
7172 ),
7273 wfMsg( 'surveys-takesurvey-loading' )
Index: trunk/extensions/Survey/includes/SurveyTag.php
@@ -91,6 +91,7 @@
9292 return array(
9393 'id' => array( 'filter' => FILTER_VALIDATE_INT, 'options' => array( 'min_range' => 1 ) ),
9494 'name' => array(),
 95+ 'title' => array(),
9596 'require-enabled' => array( 'filter' => FILTER_VALIDATE_INT, 'options' => array( 'min_range' => 0, 'max_range' => 1 ) ),
9697 );
9798 }
Index: trunk/extensions/Survey/resources/jquery.survey.js
@@ -204,7 +204,7 @@
205205 this.getSurveyBody = function( surveyData ) {
206206 $survey = $( '<div />' );
207207
208 - $survey.append( $( '<h1 />' ).text( surveyData.name ) );
 208+ $survey.append( $( '<h1 />' ).text( surveyData.title ) );
209209
210210 $survey.append( $( '<p />' ).text( surveyData.header ) );
211211

Follow-up revisions

RevisionCommit summaryAuthorDate
r96794partially revert r96791; changes not neededjeroendedauw16:04, 11 September 2011

Status & tagging log