http://www.mediawiki.org/wiki/Special:Code/MediaWiki/100202
Revision: 100202
Author: reedy
Date: 2011-10-19 01:57:03 +0000 (Wed, 19 Oct 2011)
Log Message:
-----------
Tweak message
Update some code bits
Modified Paths:
--------------
trunk/extensions/Contest/Contest.i18n.php
trunk/extensions/Contest/Contest.php
trunk/extensions/Contest/Contest.sql
trunk/extensions/Contest/includes/ContestDBObject.php
trunk/extensions/Contest/specials/SpecialEditContest.php
Modified: trunk/extensions/Contest/Contest.i18n.php
===================================================================
--- trunk/extensions/Contest/Contest.i18n.php 2011-10-19 01:35:26 UTC (rev
100201)
+++ trunk/extensions/Contest/Contest.i18n.php 2011-10-19 01:57:03 UTC (rev
100202)
@@ -145,7 +145,7 @@
'contest-contest-name' => 'Name',
'contest-contest-status' => 'Status',
'contest-contest-submissioncount' => 'Amount of participants',
- 'contest-contest-contestants' => 'Contest contestants',
+ 'contest-contest-contestants' => 'Contestants',
'contest-contest-contestants-text' => 'To judge an individual entry,
click on the entry ID in the left column.',
// Contestant pager
Modified: trunk/extensions/Contest/Contest.php
===================================================================
--- trunk/extensions/Contest/Contest.php 2011-10-19 01:35:26 UTC (rev
100201)
+++ trunk/extensions/Contest/Contest.php 2011-10-19 01:57:03 UTC (rev
100202)
@@ -110,7 +110,6 @@
$wgHooks['LinkEnd'][] =
'ContestHooks::onLinkEnd';
// Rights
-
$wgAvailableRights[] = 'contestadmin';
$wgAvailableRights[] = 'contestant';
$wgAvailableRights[] = 'contestjudge';
Modified: trunk/extensions/Contest/Contest.sql
===================================================================
--- trunk/extensions/Contest/Contest.sql 2011-10-19 01:35:26 UTC (rev
100201)
+++ trunk/extensions/Contest/Contest.sql 2011-10-19 01:57:03 UTC (rev
100202)
@@ -8,14 +8,14 @@
contest_name VARCHAR(255) NOT NULL, -- String
indentifier for the contest
contest_status TINYINT unsigned NOT NULL default '0', --
Status of the contest. One of 0 (DRAFT), 1 (ACTIVE), 2 (FINISHED)
contest_end varbinary(14) NOT NULL default '', -- End
time of the contest (MW timestamp)
-
+
contest_rules_page VARCHAR(255) NOT NULL, -- Name of the
page with rules
contest_opportunities VARCHAR(255) NOT NULL, -- Name of the
page with opportunities
contest_intro VARCHAR(255) NOT NULL, -- Name of the
page with the intro text
contest_help VARCHAR(255) NOT NULL, -- Name of the
page with contest help
contest_signup_email VARCHAR(255) NOT NULL, -- Name of the
page with the signup email text
contest_reminder_email VARCHAR(255) NOT NULL, -- Name of the
page with the reminder email text
-
+
contest_submission_count SMALLINT unsigned NOT NULL -- Number of
submissions made to the contest
) /*$wgDBTableOptions*/;
CREATE UNIQUE INDEX /*i*/contests_name ON /*_*/contests (contest_name);
@@ -27,20 +27,20 @@
contestant_contest_id SMALLINT unsigned NOT NULL, -- Foreign key on
contests.contest_id
contestant_user_id INT(10) unsigned NOT NULL, -- Foreign key on
user.user_id
contestant_challenge_id INT unsigned NOT NULL, -- Foreign key on
contest_challenges.challenge_id
-
+
-- These fields will be copied from the user table on contest lock
contestant_full_name VARCHAR(255) NOT NULL, -- Full name of
the contestant
contestant_user_name VARCHAR(255) NOT NULL, -- User name of
the contestant
contestant_email TINYBLOB NOT NULL, -- Email of the
contestant
-
+
-- Extra contestant info
contestant_country VARCHAR(255) NOT NULL, -- Country code
of the contestant
contestant_volunteer TINYINT unsigned NOT NULL, -- If the user is
interested in volunteer opportunities
contestant_wmf TINYINT unsigned NOT NULL, -- If the user is
interested in a WMF job
contestant_cv TINYBLOB NOT NULL, -- URL to the
users CV
-
+
contestant_submission TINYBLOB NOT NULL, -- URL to the
users submission
-
+
contestant_rating TINYINT unsigned NOT NULL, -- The average
rating of the contestant
contestant_rating_count SMALLINT unsigned NOT NULL, -- The number of
ratings
contestant_comments SMALLINT unsigned NOT NULL -- The number of
comments
@@ -65,7 +65,7 @@
CREATE TABLE IF NOT EXISTS /*_*/contest_challenges (
challenge_id INT unsigned NOT NULL auto_increment
PRIMARY KEY, -- Challenge id
challenge_contest_id INT unsigned NOT NULL, -- Foreign key on
contests.contest_id
-
+
challenge_text TEXT NOT NULL, -- Full challenge
description
challenge_title VARCHAR(255) NOT NULL, -- Title of the
challenge
challenge_oneline TEXT NOT NULL -- One line
description of the challenge
@@ -78,7 +78,7 @@
vote_id INT unsigned NOT NULL auto_increment
PRIMARY KEY,
vote_contestant_id INT unsigned NOT NULL, -- Foreign key on
contest_contestants.contestant_id
vote_user_id INT(10) unsigned NOT NULL, -- Judge user id
-
+
vote_value SMALLINT NOT NULL -- The value of
the vote
) /*$wgDBTableOptions*/;
CREATE UNIQUE INDEX /*i*/contest_votes_contestant_user ON /*_*/contest_votes
(vote_contestant_id, vote_user_id);
@@ -89,7 +89,7 @@
comment_id INT unsigned NOT NULL auto_increment
PRIMARY KEY,
comment_contestant_id INT unsigned NOT NULL, -- Foreign key on
contest_contestants.contestant_id
comment_user_id INT(10) unsigned NOT NULL, -- Judge user id
-
+
comment_text TEXT NOT NULL, -- The comment
text
comment_time varbinary(14) NOT NULL default '' -- The
time at which the comment was made
) /*$wgDBTableOptions*/;
Modified: trunk/extensions/Contest/includes/ContestDBObject.php
===================================================================
--- trunk/extensions/Contest/includes/ContestDBObject.php 2011-10-19
01:35:26 UTC (rev 100201)
+++ trunk/extensions/Contest/includes/ContestDBObject.php 2011-10-19
01:57:03 UTC (rev 100202)
@@ -43,7 +43,7 @@
$this->setFields( $fields );
}
-
+
/**
* Load the specified fields from the database.
*
@@ -51,29 +51,29 @@
*
* @param array|null $fields
* @param boolean $override
- *
+ *
* @return Success indicator
*/
public function loadFields( $fields = null, $override = true ) {
if ( is_null( $this->getId() ) ) {
return false;
}
-
+
if ( is_null( $fields ) ) {
$fields = array_keys( $this->getFieldTypes() );
}
-
+
$results = $this->rawSelect(
$this->getPrefixedFields( $fields ),
array( $this->getPrefixedField( 'id' ) =>
$this->getId() ),
array( 'LIMIT' => 1 )
);
-
+
foreach ( $results as $result ) {
$this->setFields( $this->getFieldsFromDBResult( $result
), $override );
return true;
}
-
+
return false;
}
@@ -219,7 +219,7 @@
*
* @since 0.1
*
- * @param null|array $props
+ * @param null|array $fields
* @param boolean $incNullId
*
* @return array
@@ -431,6 +431,20 @@
*/
public abstract function getDefaults();
+ /**
+ * Get a new instance of the class from an array.
+ * This method ought to be in the basic class and
+ * return a new static(), but this requires LSB/PHP>=5.3.
+ *
+ * @since 0.1
+ *
+ * @param array $data
+ * @param boolean $loadDefaults
+ *
+ * @return ContestDBObject
+ */
+ public abstract function newFromArray( array $data, $loadDefaults =
false );
+
//
//
// All below methods ought to be static, but can't be since this would
require LSB introduced in PHP 5.3.
@@ -523,10 +537,10 @@
foreach ( $result as $name => $value ) {
$data[substr( $name, $idFieldLength )] = $value;
}
-
+
return $data;
}
-
+
/**
* Get a new instance of the class from a database result.
*
Modified: trunk/extensions/Contest/specials/SpecialEditContest.php
===================================================================
--- trunk/extensions/Contest/specials/SpecialEditContest.php 2011-10-19
01:35:26 UTC (rev 100201)
+++ trunk/extensions/Contest/specials/SpecialEditContest.php 2011-10-19
01:57:03 UTC (rev 100202)
@@ -159,6 +159,10 @@
* @return array
*/
protected function getFormFields() {
+
+ /**
+ * @var $contest Contest
+ */
$contest = $this->contest;
$fields = array();
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs