Index: branches/wmf/1.18wmf1/extensions/Contest/Contest.i18n.php |
— | — | @@ -177,6 +177,7 @@ |
178 | 178 | 'contest-contestant-commentcount' => 'Comments', |
179 | 179 | 'contest-contestant-overallrating' => 'Rating', |
180 | 180 | 'contest-contestant-rating' => '$1 ($2 {{PLURAL:$2|vote|votes}})', |
| 181 | + 'contest-contestant-submission' => 'Submission', |
181 | 182 | |
182 | 183 | // Special:Contestant |
183 | 184 | 'contest-contestant-title' => 'Contestant $1 ($2)', |
— | — | @@ -277,6 +278,7 @@ |
278 | 279 | 'contest-contestant-yes' => 'Table cell value', |
279 | 280 | 'contest-contestant-commentcount' => 'Table column header', |
280 | 281 | 'contest-contestant-overallrating' => 'Table column header', |
| 282 | + 'contest-contestant-submission' => 'Table column header', |
281 | 283 | 'contest-contestant-rating' => '$1 is the avarage rating, $2 is the amount of votes', |
282 | 284 | 'contest-contestant-title' => 'Page title with contestant id $1 and contest name $2', |
283 | 285 | 'contest-contestant-header-id' => 'Table row header', |
Index: branches/wmf/1.18wmf1/extensions/Contest/specials/SpecialContestant.php |
— | — | @@ -46,6 +46,10 @@ |
47 | 47 | $this->handleSubmission( $contestant->getId() ); |
48 | 48 | } |
49 | 49 | |
| 50 | + if ( $this->getRequest()->wasPosted() ) { |
| 51 | + $contestant->setReadDb( DB_MASTER ); |
| 52 | + } |
| 53 | + |
50 | 54 | $contestant->loadFields(); |
51 | 55 | $this->showPage( $contestant ); |
52 | 56 | } |
— | — | @@ -190,11 +194,11 @@ |
191 | 195 | $stats['submission'] = htmlspecialchars( wfMsg( 'contest-contestant-notsubmitted' ) ); |
192 | 196 | } |
193 | 197 | else { |
194 | | - $stats['submission'] = '<b>' . Html::element( |
| 198 | + $stats['submission'] = Html::element( |
195 | 199 | 'a', |
196 | | - array( 'href' => $contestant->getField( 'submission' ) ), |
197 | | - wfMsg( 'contest-contestant-submission-url' ) |
198 | | - ) . '</b>'; |
| 200 | + array( 'href' => $contestant->getField( 'submission' ) ), |
| 201 | + $contestant->getField( 'submission' ) |
| 202 | + ); |
199 | 203 | } |
200 | 204 | |
201 | 205 | $countries = ContestContestant::getCountries(); |
Index: branches/wmf/1.18wmf1/extensions/Contest/Contest.php |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | die( '<b>Error:</b> Contest requires MediaWiki 1.18 or above.' ); |
30 | 30 | } |
31 | 31 | |
32 | | -define( 'CONTEST_VERSION', '0.1' ); |
| 32 | +define( 'CONTEST_VERSION', '0.2 alpha' ); |
33 | 33 | |
34 | 34 | $wgExtensionCredits['other'][] = array( |
35 | 35 | 'path' => __FILE__, |
Index: branches/wmf/1.18wmf1/extensions/Contest/includes/ContestDBObject.php |
— | — | @@ -23,6 +23,14 @@ |
24 | 24 | * @var array |
25 | 25 | */ |
26 | 26 | protected $fields = array( 'id' => null ); |
| 27 | + |
| 28 | + /** |
| 29 | + * The database connection to use for read operations. |
| 30 | + * |
| 31 | + * @since 0.2 |
| 32 | + * @var integer DB_ enum |
| 33 | + */ |
| 34 | + protected $readDb = DB_SLAVE; |
27 | 35 | |
28 | 36 | /** |
29 | 37 | * Constructor. |
— | — | @@ -273,8 +281,29 @@ |
274 | 282 | return $this->insertIntoDB(); |
275 | 283 | } |
276 | 284 | } |
277 | | - |
| 285 | + |
278 | 286 | /** |
| 287 | + * Get the database type used for read operations. |
| 288 | + * |
| 289 | + * @since 0.2 |
| 290 | + * @return integer DB_ enum |
| 291 | + */ |
| 292 | + public function getReadDb() { |
| 293 | + return $this->readDb; |
| 294 | + } |
| 295 | + |
| 296 | + /** |
| 297 | + * Set the database type to use for read operations. |
| 298 | + * |
| 299 | + * @param integer $db |
| 300 | + * |
| 301 | + * @since 0.2 |
| 302 | + */ |
| 303 | + public function setReadDb( $db ) { |
| 304 | + $this->readDb = $db; |
| 305 | + } |
| 306 | + |
| 307 | + /** |
279 | 308 | * Updates the object in the database. |
280 | 309 | * |
281 | 310 | * @since 0.1 |
— | — | @@ -710,7 +739,7 @@ |
711 | 740 | * @return ResultWrapper |
712 | 741 | */ |
713 | 742 | public function rawSelect( $fields = null, array $conditions = array(), array $options = array() ) { |
714 | | - $dbr = wfGetDB( DB_SLAVE ); |
| 743 | + $dbr = wfGetDB( $this->getReadDb() ); |
715 | 744 | |
716 | 745 | return $dbr->select( |
717 | 746 | $this->getDBTable(), |
Index: branches/wmf/1.18wmf1/extensions/Contest/includes/ContestantPager.php |
— | — | @@ -131,6 +131,7 @@ |
132 | 132 | 'contestant_wmf' => 'contest-contestant-wmf', |
133 | 133 | 'contestant_comments' => 'contest-contestant-commentcount', |
134 | 134 | 'contestant_rating' => 'contest-contestant-overallrating', |
| 135 | + 'contestant_submission' => 'contest-contestant-submission', |
135 | 136 | ); |
136 | 137 | |
137 | 138 | $headers = array_map( 'wfMsg', $headers ); |
— | — | @@ -217,13 +218,22 @@ |
218 | 219 | $value = htmlspecialchars( $this->getLang()->formatNum( $value ) ); |
219 | 220 | break; |
220 | 221 | case 'contestant_rating': |
221 | | - $value = htmlspecialchars( wfMsgExt( |
| 222 | + $value = '<div style="white-space:nowrap;">' . htmlspecialchars( wfMsgExt( |
222 | 223 | 'contest-contestant-rating', |
223 | 224 | 'parsemag', |
224 | 225 | $this->getLang()->formatNum( $value / 100 ), |
225 | 226 | $this->getLang()->formatNum( $this->mCurrentRow->contestant_rating_count ) |
226 | | - ) ); |
| 227 | + ) ) . '</div>'; |
227 | 228 | break; |
| 229 | + case 'contestant_submission': |
| 230 | + $value = Html::element( |
| 231 | + 'a', |
| 232 | + array( |
| 233 | + 'href' => $value |
| 234 | + ), |
| 235 | + $value |
| 236 | + ); |
| 237 | + break; |
228 | 238 | } |
229 | 239 | |
230 | 240 | return $value; |
— | — | @@ -240,6 +250,7 @@ |
241 | 251 | 'contestant_comments', |
242 | 252 | 'contestant_rating', |
243 | 253 | 'contestant_rating_count', |
| 254 | + 'contestant_submission', |
244 | 255 | ), |
245 | 256 | 'conds' => $this->conds, |
246 | 257 | ); |
Property changes on: branches/wmf/1.18wmf1/extensions/Contest |
___________________________________________________________________ |
Modified: svn:mergeinfo |
247 | 258 | Merged /trunk/extensions/Contest:r100399,100402 |