http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100251
Revision: 100251
Author: jeroendedauw
Date: 2011-10-19 18:38:25 +0000 (Wed, 19 Oct 2011)
Log Message:
-----------
added days left field and initial work on reminder email UI
Modified Paths:
--------------
trunk/extensions/Contest/Contest.i18n.php
trunk/extensions/Contest/Contest.php
trunk/extensions/Contest/includes/Contest.class.php
trunk/extensions/Contest/specials/SpecialContest.php
Modified: trunk/extensions/Contest/Contest.i18n.php
===================================================================
--- trunk/extensions/Contest/Contest.i18n.php 2011-10-19 18:37:03 UTC (rev
100250)
+++ trunk/extensions/Contest/Contest.i18n.php 2011-10-19 18:38:25 UTC (rev
100251)
@@ -145,8 +145,19 @@
'contest-contest-name' => 'Name',
'contest-contest-status' => 'Status',
'contest-contest-submissioncount' => 'Amount of participants',
+ 'contest-contest-end' => 'Contest end',
+ 'contest-contest-days-ago' => '$1, $2 {{PLURAL:$2|day|days}} ago',
+ 'contest-contest-days-left' => '$1, in $2 {{PLURAL:$2|day|days}}',
'contest-contest-contestants' => 'Contestants',
'contest-contest-contestants-text' => 'To judge an individual entry,
click on the entry ID in the left column.',
+ 'contest-contest-reminder-mail' => 'Reminder email',
+ 'contest-contest-reminder-page' => 'The content for the reminder email
is pulled from [[$1|this page]].',
+ 'contest-contest-send-reminder' => 'Send reminder',
+
+ 'contest-contest-reminder-preview' => 'Preview of the reminder email:',
+ 'contest-contest-reminder-title' => 'Reminder email',
+ 'contest-contest-reminder-send' => 'Send reminder',
+ 'contest-contest-reminder-cancel' => 'Cancel',
// Contestant pager
'contest-contestant-id' => 'ID',
Modified: trunk/extensions/Contest/Contest.php
===================================================================
--- trunk/extensions/Contest/Contest.php 2011-10-19 18:37:03 UTC (rev
100250)
+++ trunk/extensions/Contest/Contest.php 2011-10-19 18:38:25 UTC (rev
100251)
@@ -155,6 +155,21 @@
)
);
+$wgResourceModules['contest.special.contest'] = $moduleTemplate + array(
+ 'scripts' => array(
+ 'contest.special.contest.js'
+ ),
+ 'messages' => array(
+ 'contest-contest-reminder-title',
+ 'contest-contest-reminder-cancel',
+ 'contest-contest-reminder-send',
+ 'contest-contest-reminder-preview'
+ ),
+ 'dependencies' => array(
+ 'jquery.ui.button', 'jquery.ui.dialog',
+ )
+);
+
$wgResourceModules['jquery.ui.timepicker'] = $moduleTemplate + array(
'scripts' => array(
'jquery.ui.timepicker.js',
Modified: trunk/extensions/Contest/includes/Contest.class.php
===================================================================
--- trunk/extensions/Contest/includes/Contest.class.php 2011-10-19 18:37:03 UTC
(rev 100250)
+++ trunk/extensions/Contest/includes/Contest.class.php 2011-10-19 18:38:25 UTC
(rev 100251)
@@ -16,8 +16,8 @@
// Constants representing the states a contest can have.
const STATUS_DRAFT = 0;
const STATUS_ACTIVE = 1;
- const STATUS_FINISHED = 2; // manually stopped by contest manager
- const STATUS_EXPIRED = 3; // past configured contest end date
+ const STATUS_FINISHED = 2; // Manually stopped by contest manager.
+ const STATUS_EXPIRED = 3; // Past configured contest end date.
/**
* List of challenges for this contest.
@@ -138,6 +138,7 @@
*/
public function getDefaults() {
$defaultPage = 'MediaWiki:Contests/';
+
return array(
'name' => '',
'status' => self::STATUS_DRAFT,
@@ -188,14 +189,18 @@
wfMsg( 'contest-status-draft' ) =>
self::STATUS_DRAFT,
wfMsg( 'contest-status-active' ) =>
self::STATUS_ACTIVE,
wfMsg( 'contest-status-finished' ) =>
self::STATUS_FINISHED,
+ wfMsg( 'contest-status-expired' ) =>
self::STATUS_EXPIRED,
);
}
- if ( !$onlySettable ) {
- $map[wfMsg( 'contest-status-expired')] =
self::STATUS_EXPIRED;
+ if ( $onlySettable ) {
+ $messages = $map;
+ unset( $messages[wfMsg( 'contest-status-expired' )] );
+ return $messages;
}
-
- return $map;
+ else {
+ return $map;
+ }
}
/**
Modified: trunk/extensions/Contest/specials/SpecialContest.php
===================================================================
--- trunk/extensions/Contest/specials/SpecialContest.php 2011-10-19
18:37:03 UTC (rev 100250)
+++ trunk/extensions/Contest/specials/SpecialContest.php 2011-10-19
18:38:25 UTC (rev 100251)
@@ -53,9 +53,13 @@
}
else {
$out->setPageTitle( wfMsgExt( 'contest-contest-title',
'parseinline', $contest->getField( 'name' ) ) );
+
$this->displayNavigation();
$this->showGeneralInfo( $contest );
+ // TODO $this->showMailFunctionality( $contest );
$this->showContestants( $contest, $challengeTitle );
+
+ $out->addModules( 'contest.special.contest' );
}
}
@@ -107,11 +111,50 @@
$stats['name'] = $contest->getField( 'name' );
$stats['status'] = Contest::getStatusMessage(
$contest->getStatus() );
$stats['submissioncount'] = $this->getLang()->formatNum(
$contest->getField( 'submission_count' ) );
-
+
+ $stats['end'] = wfMsgExt(
+ $contest->getDaysLeft() < 0 ?
'contest-contest-days-ago' : 'contest-contest-days-left',
+ 'parsemag',
+ $this->getLang()->timeanddate( $contest->getField(
'end' ), true ),
+ $this->getLang()->formatNum( abs(
$contest->getDaysLeft() ) )
+ );
+
return $stats;
}
/**
+ *
+ *
+ * @since 0.1
+ *
+ * @param Contest $contest
+ */
+ protected function showMailFunctionality( Contest $contest ) {
+ $out = $this->getOutput();
+
+ $out->addHTML( Html::element( 'h3', array(), wfMsg(
'contest-contest-reminder-mail' ) ) );
+
+ $out->addWikiMsg( 'contest-contest-reminder-page',
$contest->getField( 'reminder_email' ) );
+
+ $out->addHTML( Html::element(
+ 'button',
+ array(
+ 'id' => 'send-reminder',
+ ),
+ wfMsg( 'contest-contest-send-reminder' )
+ ) );
+
+ $out->addHTML( Html::rawElement(
+ 'div',
+ array(
+ 'id' => 'reminder-content',
+ 'style' => 'display:none'
+ ),
+ ContestUtils::getParsedArticleContent(
$contest->getField( 'reminder_email' ) )
+ ) );
+ }
+
+ /**
* Show a paged list of the contestants foe this contest.
*
* @since 0.1
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs