Index: trunk/extensions/SecurePoll/includes/ballots/RadioRangeBallot.php |
— | — | @@ -49,16 +49,16 @@ |
50 | 50 | return $labels; |
51 | 51 | } |
52 | 52 | |
53 | | - function getMessageNames( $entity ) { |
54 | | - if ( $entity->getType() !== 'question' ) { |
| 53 | + function getMessageNames( $entity=null ) { |
| 54 | + if( $entity===null || $entity->getType() !== 'question' ) { |
55 | 55 | return array(); |
56 | 56 | } |
57 | | - if ( !$entity->getProperty( 'column-label-msgs' ) ) { |
| 57 | + if( !$entity->getProperty( 'column-label-msgs' ) ) { |
58 | 58 | return array(); |
59 | 59 | } |
60 | 60 | $msgs = array(); |
61 | 61 | list( $min, $max ) = $this->getMinMax( $entity ); |
62 | | - for ( $score = min; $score <= $max; $score++ ) { |
| 62 | + for ( $score = $min; $score <= $max; $score++ ) { |
63 | 63 | $signedScore = $this->addSign( $entity, $score ); |
64 | 64 | $msgs[] = "column$signedScore"; |
65 | 65 | } |
Index: trunk/extensions/SecurePoll/includes/ballots/Ballot.php |
— | — | @@ -21,6 +21,14 @@ |
22 | 22 | * @return string |
23 | 23 | */ |
24 | 24 | abstract function getQuestionForm( $question, $options ); |
| 25 | + |
| 26 | + /** |
| 27 | + * Get any extra messages that this ballot type uses to render questions. |
| 28 | + * Used to get the list of translatable messages for TranslatePage. |
| 29 | + * @return Array |
| 30 | + * @see SecurePoll_Election::getMessageNames() |
| 31 | + */ |
| 32 | + function getMessageNames(){ return array(); } |
25 | 33 | |
26 | 34 | /** |
27 | 35 | * Called when the form is submitted. This returns a Status object which, |
Index: trunk/extensions/SecurePoll/includes/entities/Entity.php |
— | — | @@ -40,6 +40,7 @@ |
41 | 41 | /** |
42 | 42 | * Get a list of localisable message names. This is used to provide the |
43 | 43 | * translate subpage with a list of messages to localise. |
| 44 | + * @return Array |
44 | 45 | */ |
45 | 46 | function getMessageNames() { |
46 | 47 | # STUB |
Index: trunk/extensions/SecurePoll/includes/entities/Election.php |
— | — | @@ -37,7 +37,7 @@ |
38 | 38 | * RemoteMWAuth |
39 | 39 | * remote-mw-script-path |
40 | 40 | * |
41 | | - * ChooseBallot |
| 41 | + * Ballot |
42 | 42 | * shuffle-questions |
43 | 43 | * shuffle-options |
44 | 44 | * |
Index: trunk/extensions/SecurePoll/includes/entities/Question.php |
— | — | @@ -5,7 +5,7 @@ |
6 | 6 | * more than one question in an election. |
7 | 7 | */ |
8 | 8 | class SecurePoll_Question extends SecurePoll_Entity { |
9 | | - var $options; |
| 9 | + var $options, $electionId; |
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Constructor |
— | — | @@ -18,13 +18,16 @@ |
19 | 19 | foreach ( $info['options'] as $optionInfo ) { |
20 | 20 | $this->options[] = new SecurePoll_Option( $context, $optionInfo ); |
21 | 21 | } |
| 22 | + $this->electionId = $info['election']; |
22 | 23 | } |
23 | 24 | |
24 | 25 | /** |
25 | 26 | * Get a list of localisable message names. |
26 | 27 | */ |
27 | 28 | function getMessageNames() { |
28 | | - return array( 'text' ); |
| 29 | + $ballot = $this->context->getElection( $this->electionId )->getBallot(); |
| 30 | + return array_merge( $ballot->getMessageNames( $this ), array( 'text' ) ); |
| 31 | + |
29 | 32 | } |
30 | 33 | |
31 | 34 | /** |
Index: trunk/extensions/SecurePoll/includes/main/Store.php |
— | — | @@ -193,17 +193,27 @@ |
194 | 194 | $questions = array(); |
195 | 195 | $options = array(); |
196 | 196 | $questionId = false; |
| 197 | + $electionId = false; |
197 | 198 | foreach ( $res as $row ) { |
198 | 199 | if ( $questionId === false ) { |
199 | 200 | } elseif ( $questionId !== $row->qu_entity ) { |
200 | | - $questions[] = array( 'id' => $questionId, 'options' => $options ); |
| 201 | + $questions[] = array( |
| 202 | + 'id' => $questionId, |
| 203 | + 'election' => $electionId, |
| 204 | + 'options' => $options |
| 205 | + ); |
201 | 206 | $options = array(); |
202 | 207 | } |
203 | 208 | $options[] = array( 'id' => $row->op_entity ); |
204 | 209 | $questionId = $row->qu_entity; |
| 210 | + $electionId = $row->qu_election; |
205 | 211 | } |
206 | 212 | if ( $questionId !== false ) { |
207 | | - $questions[] = array( 'id' => $questionId, 'options' => $options ); |
| 213 | + $questions[] = array( |
| 214 | + 'id' => $questionId, |
| 215 | + 'election' => $electionId, |
| 216 | + 'options' => $options |
| 217 | + ); |
208 | 218 | } |
209 | 219 | return $questions; |
210 | 220 | } |
— | — | @@ -337,7 +347,7 @@ |
338 | 348 | 'endDate', |
339 | 349 | 'auth' |
340 | 350 | ), |
341 | | - 'question' => array( 'id' ), |
| 351 | + 'question' => array( 'id', 'election' ), |
342 | 352 | 'option' => array( 'id' ), |
343 | 353 | ); |
344 | 354 | |