r107186 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r107185‎ | r107186 | r107187 >
Date:22:07, 23 December 2011
Author:jeroendedauw
Status:deferred
Tags:educationprogram 
Comment:
work on special:term and some fixes
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPTerm.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialInstitution.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialTerm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialInstitution.php
@@ -41,11 +41,11 @@
4242
4343 if ( $org === false ) {
4444 if ( $this->getUser()->isAllowed( 'epadmin' ) ) {
45 - $out->addWikiMsg( 'ep-institution-create', 'parsemag', $this->subPage );
 45+ $out->addWikiMsg( 'ep-institution-create', $this->subPage );
4646 EPOrg::displayAddNewControl( $this->getContext(), array( 'name' => $this->subPage ) );
4747 }
4848 else {
49 - $out->addWikiMsg( 'ep-institution-none', 'parsemag', $this->subPage );
 49+ $out->addWikiMsg( 'ep-institution-none', $this->subPage );
5050 }
5151 }
5252 else {
Index: trunk/extensions/EducationProgram/specials/SpecialCourse.php
@@ -41,11 +41,11 @@
4242
4343 if ( $course === false ) {
4444 if ( $this->getUser()->isAllowed( 'epadmin' ) || $this->getUser()->isAllowed( 'epmentor' ) ) {
45 - $out->addWikiMsg( 'ep-course-create', 'parsemag', $this->subPage );
 45+ $out->addWikiMsg( 'ep-course-create', $this->subPage );
4646 EPCourse::displayAddNewRegion( $this->getContext(), array( 'name' => $this->subPage ) );
4747 }
4848 else {
49 - $out->addWikiMsg( 'ep-course-none', 'parsemag', $this->subPage );
 49+ $out->addWikiMsg( 'ep-course-none', $this->subPage );
5050 }
5151 }
5252 else {
@@ -58,7 +58,7 @@
5959 }
6060
6161 /**
62 - * Display the orgs info.
 62+ * Display the course info.
6363 *
6464 * @since 0.1
6565 *
Index: trunk/extensions/EducationProgram/specials/SpecialTerm.php
@@ -34,8 +34,40 @@
3535 parent::execute( $subPage );
3636
3737 $out = $this->getOutput();
38 -
39 - // TODO: AUTH
 38+
 39+ $out->setPageTitle( wfMsgExt( 'ep-term-title', 'parsemag', $this->subPage ) );
 40+
 41+ $term = EPTerm::selectRow( null, array( 'id' => $this->subPage ) );
 42+
 43+ if ( $term === false ) {
 44+ if ( $this->getUser()->isAllowed( 'epadmin' ) || $this->getUser()->isAllowed( 'epmentor' ) ) {
 45+ $out->addWikiMsg( 'ep-term-create', $this->subPage );
 46+ EPTerm::displayAddNewRegion( $this->getContext(), array( 'id' => $this->subPage ) );
 47+ }
 48+ else {
 49+ $out->addWikiMsg( 'ep-term-none', $this->subPage );
 50+ }
 51+ }
 52+ else {
 53+ $this->displayInfo( $term );
 54+
 55+ $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-term-students' ) ) );
 56+
 57+ // TODO
 58+ }
4059 }
 60+
 61+ /**
 62+ * Display the terms info.
 63+ *
 64+ * @since 0.1
 65+ *
 66+ * @param EPTerm $term
 67+ */
 68+ protected function displayInfo( EPTerm $term ) {
 69+ $out = $this->getOutput();
 70+
 71+
 72+ }
4173
4274 }
Index: trunk/extensions/EducationProgram/includes/EPTerm.php
@@ -94,7 +94,7 @@
9595 * @param IContextSource $context
9696 * @param array $args
9797 */
98 - public static function displayAddNewControl( IContextSource $context, array $courses ) {
 98+ public static function displayAddNewControl( IContextSource $context, array $args ) {
9999 $out = $context->getOutput();
100100
101101 $out->addHTML( Html::openElement(
@@ -113,8 +113,13 @@
114114
115115 $out->addHTML( Html::element( 'label', array( 'for' => 'newcourse' ), wfMsg( 'ep-terms-newcourse' ) ) );
116116
117 - $select = new XmlSelect( 'newcourse', 'newcourse' );
118 - $select->addOptions( EPCourse::getCourseOptions( $courses ) );
 117+ $select = new XmlSelect(
 118+ 'newcourse',
 119+ 'newcourse',
 120+ array_key_exists( 'course', $args ) ? $args['course'] : false
 121+ );
 122+
 123+ $select->addOptions( EPCourse::getCourseOptions( EPCourse::getEditableCourses( $context->getUser() ) ) );
119124 $out->addHTML( $select->getHTML() );
120125
121126 $out->addHTML( ' ' . Xml::inputLabel( wfMsg( 'ep-terms-newyear' ), 'newyear', 'newyear', 10 ) );
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -162,6 +162,12 @@
163163 'ep-course-terms' => 'Terms',
164164 'ep-course-none' => 'There is no course with name "$1". See [[Special:Course|here]] for a list of courses.',
165165 'ep-course-create' => 'There is no course with name "$1" yet, but you can create it.',
 166+
 167+ // Special:Term
 168+ 'ep-term-title' => 'Term: $1',
 169+ 'ep-term-students' => 'Students',
 170+ 'ep-term-none' => 'There is no term with name "$1". See [[Special:Terms|here]] for a list of terms.',
 171+ 'ep-term-create' => 'There is no term with name "$1" yet, but you can create it.',
166172 );
167173
168174 /** Message documentation (Message documentation)

Status & tagging log