Index: trunk/extensions/Survey/Survey.sql |
— | — | @@ -14,7 +14,7 @@ |
15 | 15 | survey_user_type TINYINT NOT NULL default '0', -- Type of users that can participate in the survey |
16 | 16 | survey_namespaces BLOB NOT NULL, -- Namespaces on which the survey can be displayed |
17 | 17 | survey_ratio TINYINT unsigned NOT NULL, -- Percentage of users to show the survey to |
18 | | - survey_expiry INT unsigned NOT NULL -- Coockie expiry time for the survey |
| 18 | + survey_expiry INT unsigned NOT NULL, -- Coockie expiry time for the survey |
19 | 19 | ) /*$wgDBTableOptions*/; |
20 | 20 | |
21 | 21 | -- Questions |
Index: trunk/extensions/Survey/Survey.i18n.php |
— | — | @@ -102,6 +102,7 @@ |
103 | 103 | 'survey-special-label-name' => 'Survey ID', |
104 | 104 | 'survey-special-label-title' => 'Survey title', |
105 | 105 | 'survey-special-label-enabled' => 'Survey enabled', |
| 106 | + 'survey-special-label-ratio' => 'Percentage of people to show the survey to', |
106 | 107 | 'survey-special-label-add-first' => 'Add question', |
107 | 108 | 'survey-special-label-add-another' => 'Add another question', |
108 | 109 | 'survey-special-label-addquestion' => 'New question', |
Index: trunk/extensions/Survey/specials/SpecialSurvey.php |
— | — | @@ -79,7 +79,7 @@ |
80 | 80 | |
81 | 81 | $survey->setField( 'enabled', $wgRequest->getCheck( 'survey-enabled' ) ); |
82 | 82 | |
83 | | - foreach ( array( 'user_type' ) as $field ) { |
| 83 | + foreach ( array( 'user_type', 'ratio' ) as $field ) { |
84 | 84 | $survey->setField( $field, $wgRequest->getInt( 'survey-' . $field ) ); |
85 | 85 | } |
86 | 86 | |
— | — | @@ -224,7 +224,21 @@ |
225 | 225 | ), |
226 | 226 | ); |
227 | 227 | |
| 228 | + $nrs = array_merge( array( 0.01, 0.1 ), range( 1, 100 ) ); |
| 229 | + |
228 | 230 | $fields[] = array( |
| 231 | + 'type' => 'select', |
| 232 | + 'default' => $survey->getField( 'ratio' ), |
| 233 | + 'label-message' => 'survey-special-label-ratio', |
| 234 | + 'id' => 'survey-ratio', |
| 235 | + 'name' => 'survey-ratio', |
| 236 | + 'options' => array_flip( array_map( |
| 237 | + function( $n ) { return $GLOBALS['wgLang']->formatNum( $n ); }, |
| 238 | + array_combine( $nrs, $nrs ) |
| 239 | + ) ), |
| 240 | + ); |
| 241 | + |
| 242 | + $fields[] = array( |
229 | 243 | 'type' => 'text', |
230 | 244 | 'default' => $survey->getField( 'header' ), |
231 | 245 | 'label-message' => 'survey-special-label-header', |