r108347 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r108346‎ | r108347 | r108348 >
Date:04:56, 8 January 2012
Author:jeroendedauw
Status:ok
Tags:
Comment:
added special:ambassador
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.alias.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialAmbassador.php (added) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPPage.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialInstitution.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.i18n.alias.php
@@ -31,4 +31,5 @@
3232 'EditTerm' => array( 'EditTerm' ),
3333 'Enroll' => array( 'Enroll' ),
3434 'Ambassadors' => array( 'Ambassadors' ),
 35+ 'Ambassador' => array( 'Ambassador' ),
3536 );
Index: trunk/extensions/EducationProgram/specials/SpecialInstitution.php
@@ -87,7 +87,7 @@
8888 $stats['name'] = $org->getField( 'name' );
8989 $stats['city'] = $org->getField( 'city' );
9090
91 - $countries = CountryNames::getNames( $this->getLang()->getCode() );
 91+ $countries = CountryNames::getNames( $this->getLanguage()->getCode() );
9292 $stats['country'] = $countries[$org->getField( 'country' )];
9393
9494 foreach ( $stats as &$stat ) {
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php
@@ -183,7 +183,7 @@
184184 * @param boolean $collapsed
185185 * @param array $summaryData
186186 */
187 - protected function displaySummary( EPDBObject $item, $collapsed = true, array $summaryData = null ) {
 187+ protected function displaySummary( EPDBObject $item, $collapsed = false, array $summaryData = null ) {
188188 $out = $this->getOutput();
189189
190190 $class = 'wikitable ep-summary mw-collapsible';
Index: trunk/extensions/EducationProgram/specials/SpecialAmbassador.php
@@ -0,0 +1,82 @@
 2+<?php
 3+
 4+/**
 5+ * Shows the info for a single ambassador.
 6+ *
 7+ * @since 0.1
 8+ *
 9+ * @file SpecialAmbassador.php
 10+ * @ingroup EducationProgram
 11+ *
 12+ * @licence GNU GPL v3 or later
 13+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 14+ */
 15+class SpecialAmbassador extends SpecialEPPage {
 16+
 17+ /**
 18+ * Constructor.
 19+ *
 20+ * @since 0.1
 21+ */
 22+ public function __construct() {
 23+ parent::__construct( 'Ambassador' );
 24+ }
 25+
 26+ /**
 27+ * Main method.
 28+ *
 29+ * @since 0.1
 30+ *
 31+ * @param string $subPage
 32+ */
 33+ public function execute( $subPage ) {
 34+ parent::execute( $subPage );
 35+
 36+ $out = $this->getOutput();
 37+
 38+ if ( trim( $subPage ) === '' ) {
 39+ $this->getOutput()->redirect( SpecialPage::getTitleFor( 'Ambassadors' )->getLocalURL() );
 40+ }
 41+ else {
 42+ $out->setPageTitle( wfMsgExt( 'ep-ambassador-title', 'parsemag', $this->subPage ) );
 43+
 44+ $this->displayNavigation();
 45+
 46+ $mentor = false; //EPMentor::selectRow( null, array( 'id' => $this->subPage ) );
 47+
 48+ if ( $mentor === false ) {
 49+ $this->showWarning( wfMessage( 'ep-ambassador-does-not-exist', $this->subPage ) );
 50+ }
 51+ else {
 52+ $this->displaySummary( $mentor );
 53+ }
 54+ }
 55+ }
 56+
 57+ /**
 58+ * Gets the summary data.
 59+ *
 60+ * @since 0.1
 61+ *
 62+ * @param EPMentor $mentor
 63+ *
 64+ * @return array
 65+ */
 66+ protected function getSummaryData( EPDBObject $mentor ) {
 67+ $stats = array();
 68+
 69+ $orgs = array();
 70+
 71+ foreach ( $mentor->getOrgs( 'name' ) as /* EPOrg */ $org ) {
 72+ $orgs[] = Linker::linkKnown(
 73+ SpecialPage::getTitleFor( 'Institution', $org->getField( 'name' ) ),
 74+ htmlspecialchars( $org->getField( 'name' ) )
 75+ );
 76+ }
 77+
 78+ $stats['orgs'] = $this->getLanguage()->pipeList( $orgs );
 79+
 80+ return $stats;
 81+ }
 82+
 83+}
Property changes on: trunk/extensions/EducationProgram/specials/SpecialAmbassador.php
___________________________________________________________________
Added: svn:eol-style
184 + native
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -79,6 +79,7 @@
8080 'special-editcourse-edit' => 'Edit course',
8181 'special-enroll' => 'Enroll',
8282 'special-ambassadors' => 'Ambassadors',
 83+ 'special-ambassador' => 'Ambassador',
8384
8485 // Special:Institutions
8586 'ep-institutions-nosuchinstitution' => 'There is no institution with name "$1". Existing institutions are listed below.',
@@ -227,6 +228,10 @@
228229 'specialterm-summary-token' => 'Enrollment token',
229230 'ep-term-nav-edit' => 'Edit this term',
230231
 232+ // Special:Ambassador
 233+ 'ep-ambassador-does-not-exist' => 'There is no ambassador with name "$1". See [[Special:Ambassadors|here]] for a list of ambassadors.',
 234+ 'ep-ambassador-title' => 'Ambassador: $1',
 235+
231236 // Special:Enroll
232237 'ep-enroll-title' => 'Enroll for $1 at $2',
233238 'ep-enroll-login-first' => 'Before you can enroll in this course, you need to login.',
Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -89,6 +89,7 @@
9090 $wgAutoloadClasses['SpecialTerms'] = dirname( __FILE__ ) . '/specials/SpecialTerms.php';
9191 $wgAutoloadClasses['SpecialEnroll'] = dirname( __FILE__ ) . '/specials/SpecialEnroll.php';
9292 $wgAutoloadClasses['SpecialAmbassadors'] = dirname( __FILE__ ) . '/specials/SpecialAmbassadors.php';
 93+$wgAutoloadClasses['SpecialAmbassador'] = dirname( __FILE__ ) . '/specials/SpecialAmbassador.php';
9394
9495 // Special pages
9596 $wgSpecialPages['MyCourses'] = 'SpecialMyCourses';
@@ -106,6 +107,7 @@
107108 $wgSpecialPages['EditTerm'] = 'SpecialEditTerm';
108109 $wgSpecialPages['Enroll'] = 'SpecialEnroll';
109110 $wgSpecialPages['Ambassadors'] = 'SpecialAmbassadors';
 111+$wgSpecialPages['Ambassador'] = 'SpecialAmbassador';
110112
111113 $wgSpecialPageGroups['MyCourses'] = 'education';
112114 $wgSpecialPageGroups['Institution'] = 'education';
@@ -121,6 +123,7 @@
122124 $wgSpecialPageGroups['EditInstitution'] = 'education';
123125 $wgSpecialPageGroups['EditTerm'] = 'education';
124126 $wgSpecialPageGroups['Ambassadors'] = 'education';
 127+$wgSpecialPageGroups['Ambassador'] = 'education';
125128
126129 // DB object classes
127130 $egEPDBObjects = array();

Status & tagging log