https://www.mediawiki.org/wiki/Special:Code/MediaWiki/113427
Revision: 113427
Author: jeroendedauw
Date: 2012-03-08 23:39:19 +0000 (Thu, 08 Mar 2012)
Log Message:
-----------
added option to hide ambassador profile
Modified Paths:
--------------
trunk/extensions/EducationProgram/EducationProgram.hooks.php
trunk/extensions/EducationProgram/EducationProgram.i18n.php
trunk/extensions/EducationProgram/includes/EPCAs.php
trunk/extensions/EducationProgram/includes/EPOAPager.php
trunk/extensions/EducationProgram/includes/EPOAs.php
trunk/extensions/EducationProgram/specials/SpecialAmbassadorProfile.php
trunk/extensions/EducationProgram/sql/EducationProgram.sql
Added Paths:
-----------
trunk/extensions/EducationProgram/sql/AddAmbVisibleField.sql
Modified: trunk/extensions/EducationProgram/EducationProgram.hooks.php
===================================================================
--- trunk/extensions/EducationProgram/EducationProgram.hooks.php
2012-03-08 23:21:28 UTC (rev 113426)
+++ trunk/extensions/EducationProgram/EducationProgram.hooks.php
2012-03-08 23:39:19 UTC (rev 113427)
@@ -45,6 +45,14 @@
true
) );
+ $updater->addExtensionUpdate( array(
+ 'addField',
+ 'ep_oas',
+ 'oa_visible',
+ dirname( __FILE__ ) . '/sql/AddAmbVisibleField.sql',
+ true
+ ) );
+
return true;
}
Modified: trunk/extensions/EducationProgram/EducationProgram.i18n.php
===================================================================
--- trunk/extensions/EducationProgram/EducationProgram.i18n.php 2012-03-08
23:21:28 UTC (rev 113426)
+++ trunk/extensions/EducationProgram/EducationProgram.i18n.php 2012-03-08
23:39:19 UTC (rev 113427)
@@ -731,6 +731,7 @@
'epoa-profile-photo-help' => 'A picture of you that will be shown next
to your bio. Enter the name of an image on Wikimedia Commons and a preview will
appear. You can type the first few letters of the image name and then select
your image from the suggestion list. If you do not have a picture of you on
commons yet, [$1 go upload one]!',
'epoa-profile-saved' => 'Your profile has been saved',
'epoa-profile-invalid-bio' => 'Your bio needs to be at least contain $1
{{PLURAL:$1|character|characters}}.',
+ 'epoa-visible' => 'Publicly list me as Online Ambassador',
// Special:CampusAmbassadorProfile
'campusambassadorprofile' => 'Campus Ambassador profile',
@@ -742,6 +743,7 @@
'epca-profile-photo-help' => 'A picture of you that will be shown next
to your bio. Enter the name of an image on Wikimedia Commons and a preview will
appear. You can type the first few letters of the image name and then select
your image from the suggestion list. If you do not have a picture of you on
commons yet, [$1 go upload one]!',
'epca-profile-saved' => 'Your profile has been saved',
'epca-profile-invalid-bio' => 'Your bio needs to be at least contain $1
{{PLURAL:$1|character|characters}}.',
+ 'epca-visible' => 'Publicly list me as Campus Ambassador',
);
/** Message documentation (Message documentation)
Modified: trunk/extensions/EducationProgram/includes/EPCAs.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPCAs.php 2012-03-08
23:21:28 UTC (rev 113426)
+++ trunk/extensions/EducationProgram/includes/EPCAs.php 2012-03-08
23:39:19 UTC (rev 113427)
@@ -54,6 +54,8 @@
'id' => 'id',
'user_id' => 'int',
+
+ 'visible' => 'bool',
'bio' => 'str',
'photo' => 'str',
);
@@ -69,6 +71,7 @@
return array(
'bio' => '',
'photo' => '',
+ 'visible' => true,
);
}
Modified: trunk/extensions/EducationProgram/includes/EPOAPager.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPOAPager.php 2012-03-08
23:21:28 UTC (rev 113426)
+++ trunk/extensions/EducationProgram/includes/EPOAPager.php 2012-03-08
23:39:19 UTC (rev 113427)
@@ -23,6 +23,11 @@
public function __construct( IContextSource $context, array $conds =
array(), DBTable $table = null ) {
$this->mDefaultDirection = true;
+ $conds = array_merge(
+ array( 'visible' => true ),
+ $conds
+ );
+
parent::__construct(
$context,
$conds,
Modified: trunk/extensions/EducationProgram/includes/EPOAs.php
===================================================================
--- trunk/extensions/EducationProgram/includes/EPOAs.php 2012-03-08
23:21:28 UTC (rev 113426)
+++ trunk/extensions/EducationProgram/includes/EPOAs.php 2012-03-08
23:39:19 UTC (rev 113427)
@@ -54,6 +54,8 @@
'id' => 'id',
'user_id' => 'int',
+
+ 'visible' => 'bool',
'bio' => 'str',
'photo' => 'str',
);
@@ -69,6 +71,7 @@
return array(
'bio' => '',
'photo' => '',
+ 'visible' => true,
);
}
Modified:
trunk/extensions/EducationProgram/specials/SpecialAmbassadorProfile.php
===================================================================
--- trunk/extensions/EducationProgram/specials/SpecialAmbassadorProfile.php
2012-03-08 23:21:28 UTC (rev 113426)
+++ trunk/extensions/EducationProgram/specials/SpecialAmbassadorProfile.php
2012-03-08 23:39:19 UTC (rev 113427)
@@ -94,6 +94,14 @@
$msgPrefix = $this->getMsgPrefix();
+ $fields['visible'] = array(
+ 'type' => 'check',
+ 'label-message' => $this->getMsgPrefix() . 'visible',
+ 'required' => true,
+ 'rows' => 10,
+ 'default' => $ambassador->getField( 'visible' ),
+ );
+
$fields['bio'] = array(
'type' => 'textarea',
'label-message' => $this->getMsgPrefix() .
'profile-bio',
Copied: trunk/extensions/EducationProgram/sql/AddAmbVisibleField.sql (from rev
113409, trunk/extensions/EducationProgram/sql/AddArticleTitleField.sql)
===================================================================
--- trunk/extensions/EducationProgram/sql/AddAmbVisibleField.sql
(rev 0)
+++ trunk/extensions/EducationProgram/sql/AddAmbVisibleField.sql
2012-03-08 23:39:19 UTC (rev 113427)
@@ -0,0 +1,9 @@
+-- MySQL patch for the Education Program extension.
+-- Licence: GNU GPL v3+
+-- Author: Jeroen De Dauw < [email protected] >
+
+ALTER TABLE /*_*/ep_cas ADD COLUMN ca_visible TINYINT unsigned NOT NULL;
+ALTER TABLE /*_*/ep_oas ADD COLUMN oa_visible TINYINT unsigned NOT NULL;
+
+CREATE INDEX /*i*/ep_cas_visible ON /*_*/ep_cas (ca_visible);
+CREATE INDEX /*i*/ep_oas_visible ON /*_*/ep_oas (oa_visible);
\ No newline at end of file
Modified: trunk/extensions/EducationProgram/sql/EducationProgram.sql
===================================================================
--- trunk/extensions/EducationProgram/sql/EducationProgram.sql 2012-03-08
23:21:28 UTC (rev 113426)
+++ trunk/extensions/EducationProgram/sql/EducationProgram.sql 2012-03-08
23:39:19 UTC (rev 113427)
@@ -142,11 +142,13 @@
ca_id INT unsigned NOT NULL auto_increment
PRIMARY KEY,
ca_user_id INT unsigned NOT NULL, -- Foreign key on
user.user_id
+ ca_visible TINYINT unsigned NOT NULL, -- If the profile
should be public
ca_bio TEXT NOT NULL, -- Bio of the
ambassador
ca_photo VARCHAR(255) NOT NULL -- Name of a photo
of the ambassador on commons
) /*$wgDBTableOptions*/;
CREATE UNIQUE INDEX /*i*/ep_cas_user_id ON /*_*/ep_cas (ca_user_id);
+CREATE INDEX /*i*/ep_cas_visible ON /*_*/ep_cas (ca_visible);
@@ -155,11 +157,13 @@
oa_id INT unsigned NOT NULL auto_increment
PRIMARY KEY,
oa_user_id INT unsigned NOT NULL, -- Foreign key on
user.user_id
+ oa_visible TINYINT unsigned NOT NULL, -- If the profile
should be public
oa_bio TEXT NOT NULL, -- Bio of the
ambassador
oa_photo VARCHAR(255) NOT NULL -- Name of a photo
of the ambassador on commons
) /*$wgDBTableOptions*/;
CREATE UNIQUE INDEX /*i*/ep_oas_user_id ON /*_*/ep_oas (oa_user_id);
+CREATE INDEX /*i*/ep_oas_visible ON /*_*/ep_oas (oa_visible);
_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs