r96456 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r96455‎ | r96456 | r96457 >
Date:17:19, 7 September 2011
Author:jeroendedauw
Status:deferred
Tags:
Comment:
added user type setting
Modified paths:
  • /trunk/extensions/Survey/Survey.i18n.php (modified) (history)
  • /trunk/extensions/Survey/includes/Survey.class.php (modified) (history)
  • /trunk/extensions/Survey/specials/SpecialSurvey.php (modified) (history)

Diff [purge]

Index: trunk/extensions/Survey/Survey.i18n.php
@@ -50,6 +50,12 @@
5151 'surveys-special-disabled' => 'Disabled',
5252 'surveys-special-confirm-delete' => 'Are you sure you want to delete this survey?',
5353 'surveys-special-delete-failed' => 'Failed to delete survey.',
 54+ 'survey-special-label-usertype' => 'Users that should get the survey',
 55+ 'survey-user-type-all' => 'Everyone',
 56+ 'survey-user-type-loggedin' => 'Logged in users',
 57+ 'survey-user-type-confirmed' => 'Confirmed users',
 58+ 'survey-user-type-editor' => 'Editors',
 59+ 'survey-user-type-anon' => 'Anonymouse users',
5460
5561 // Special:TakeSurvey
5662 'surveys-takesurvey-loading' => 'Loading survey.',
Index: trunk/extensions/Survey/specials/SpecialSurvey.php
@@ -80,6 +80,7 @@
8181 }
8282
8383 $survey->setField( 'enabled', $wgRequest->getCheck( 'survey-enabled' ) );
 84+ $survey->setField( 'user_type', $wgRequest->getInt( 'survey-user_type' ) );
8485
8586 $survey->setQuestions( $this->getSubmittedQuestions() );
8687
@@ -186,6 +187,21 @@
187188 );
188189
189190 $fields[] = array(
 191+ 'type' => 'radio',
 192+ 'default' => $survey->getField( 'user_type' ),
 193+ 'label-message' => 'survey-special-label-usertype',
 194+ 'id' => 'survey-user_type',
 195+ 'name' => 'survey-user_type',
 196+ 'options' => array(
 197+ wfMsg( 'survey-user-type-all' ) => Survey::$USER_ALL,
 198+ wfMsg( 'survey-user-type-loggedin' ) => Survey::$USER_LOGGEDIN,
 199+ wfMsg( 'survey-user-type-confirmed' ) => Survey::$USER_CONFIRMED,
 200+ wfMsg( 'survey-user-type-editor' ) => Survey::$USER_EDITOR,
 201+ wfMsg( 'survey-user-type-anon' ) => Survey::$USER_ANON,
 202+ ),
 203+ );
 204+
 205+ $fields[] = array(
190206 'type' => 'text',
191207 'default' => $survey->getField( 'header' ),
192208 'label-message' => 'survey-special-label-header',
Index: trunk/extensions/Survey/includes/Survey.class.php
@@ -13,6 +13,12 @@
1414 */
1515 class Survey extends SurveyDBClass {
1616
 17+ public static $USER_ALL = 0;
 18+ public static $USER_LOGGEDIN = 1;
 19+ public static $USER_CONFIRMED = 2;
 20+ public static $USER_EDITOR = 3;
 21+ public static $USER_ANON = 4;
 22+
1723 /**
1824 * @see SurveyDBClass::getDBTable()
1925 */
@@ -36,6 +42,8 @@
3743 'header' => 'str',
3844 'footer' => 'str',
3945 'thanks' => 'str',
 46+ 'user_type' => 'int',
 47+ 'namespaces' => 'array'
4048 );
4149 }
4250
@@ -54,6 +62,8 @@
5563 'header' => '',
5664 'footer' => '',
5765 'thanks' => '',
 66+ 'user_type' => self::$USER_ALL,
 67+ 'namespaces' => array(),
5868 );
5969 }
6070

Status & tagging log