Index: trunk/extensions/Survey/Survey.i18n.php |
— | — | @@ -50,6 +50,12 @@ |
51 | 51 | 'surveys-special-disabled' => 'Disabled', |
52 | 52 | 'surveys-special-confirm-delete' => 'Are you sure you want to delete this survey?', |
53 | 53 | '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', |
54 | 60 | |
55 | 61 | // Special:TakeSurvey |
56 | 62 | 'surveys-takesurvey-loading' => 'Loading survey.', |
Index: trunk/extensions/Survey/specials/SpecialSurvey.php |
— | — | @@ -80,6 +80,7 @@ |
81 | 81 | } |
82 | 82 | |
83 | 83 | $survey->setField( 'enabled', $wgRequest->getCheck( 'survey-enabled' ) ); |
| 84 | + $survey->setField( 'user_type', $wgRequest->getInt( 'survey-user_type' ) ); |
84 | 85 | |
85 | 86 | $survey->setQuestions( $this->getSubmittedQuestions() ); |
86 | 87 | |
— | — | @@ -186,6 +187,21 @@ |
187 | 188 | ); |
188 | 189 | |
189 | 190 | $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( |
190 | 206 | 'type' => 'text', |
191 | 207 | 'default' => $survey->getField( 'header' ), |
192 | 208 | 'label-message' => 'survey-special-label-header', |
Index: trunk/extensions/Survey/includes/Survey.class.php |
— | — | @@ -13,6 +13,12 @@ |
14 | 14 | */ |
15 | 15 | class Survey extends SurveyDBClass { |
16 | 16 | |
| 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 | + |
17 | 23 | /** |
18 | 24 | * @see SurveyDBClass::getDBTable() |
19 | 25 | */ |
— | — | @@ -36,6 +42,8 @@ |
37 | 43 | 'header' => 'str', |
38 | 44 | 'footer' => 'str', |
39 | 45 | 'thanks' => 'str', |
| 46 | + 'user_type' => 'int', |
| 47 | + 'namespaces' => 'array' |
40 | 48 | ); |
41 | 49 | } |
42 | 50 | |
— | — | @@ -54,6 +62,8 @@ |
55 | 63 | 'header' => '', |
56 | 64 | 'footer' => '', |
57 | 65 | 'thanks' => '', |
| 66 | + 'user_type' => self::$USER_ALL, |
| 67 | + 'namespaces' => array(), |
58 | 68 | ); |
59 | 69 | } |
60 | 70 | |