r109700 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109699‎ | r109700 | r109701 >
Date:22:50, 21 January 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r109656 - renaming
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/includes/EPMC.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEditCourse.php (deleted) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEditMasterCourse.php (added) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.i18n.alias.php
@@ -28,7 +28,7 @@
2929 'EducationProgram' => array( 'EducationProgram' ),
3030 'EditCourse' => array( 'EditCourse' ),
3131 'EditInstitution' => array( 'EditInstitution' ),
32 - 'EditMC' => array( 'EditMC' ),
 32+ 'EditMasterCourse' => array( 'EditMasterCourse' ),
3333 'Enroll' => array( 'Enroll' ),
3434 'CampusAmbassadors' => array( 'CampusAmbassadors' ),
3535 'OnlineAmbassadors' => array( 'OnlineAmbassadors' ),
Index: trunk/extensions/EducationProgram/specials/SpecialEditCourse.php
@@ -1,80 +0,0 @@
2 -<?php
3 -
4 -/**
5 - * Addition and modification interface for master courses.
6 - *
7 - * @since 0.1
8 - *
9 - * @file SpecialEditMasterCourse.php
10 - * @ingroup EducationProgram
11 - *
12 - * @licence GNU GPL v3 or later
13 - * @author Jeroen De Dauw < jeroendedauw@gmail.com >
14 - */
15 -class SpecialEditMasterCourse extends SpecialEPFormPage {
16 -
17 - /**
18 - * Constructor.
19 - *
20 - * @since 0.1
21 - */
22 - public function __construct() {
23 - parent::__construct( 'EditMasterCourse', 'ep-mc', 'EPMC', 'MasterCourses' );
24 - }
25 -
26 - /**
27 - * (non-PHPdoc)
28 - * @see SpecialEPFormPage::getFormFields()
29 - * @return array
30 - */
31 - protected function getFormFields() {
32 - $fields = parent::getFormFields();
33 -
34 - $fields['name'] = array (
35 - 'type' => 'text',
36 - 'label-message' => 'ep-mc-edit-name',
37 - 'maxlength' => 255,
38 - 'required' => true,
39 - 'validation-callback' => function ( $value, array $alldata = null ) {
40 - return strlen( $value ) < 5 ? wfMsgExt( 'ep-mc-invalid-name', 'parsemag', 5 ) : true;
41 - } ,
42 - );
43 -
44 - $orgOptions = EPOrg::getOrgOptions();
45 -
46 - $fields['org_id'] = array (
47 - 'type' => 'select',
48 - 'label-message' => 'ep-mc-edit-org',
49 - 'required' => true,
50 - 'options' => $orgOptions,
51 - 'validation-callback' => function ( $value, array $alldata = null ) use ( $orgOptions ) {
52 - return in_array( (int)$value, array_values( $orgOptions ) ) ? true : wfMsg( 'ep-mc-invalid-org' );
53 - } ,
54 - );
55 -
56 - $fields['description'] = array (
57 - 'type' => 'textarea',
58 - 'label-message' => 'ep-mc-edit-description',
59 - 'required' => true,
60 - 'validation-callback' => function ( $value, array $alldata = null ) {
61 - return strlen( $value ) < 10 ? wfMsgExt( 'ep-mc-invalid-description', 'parsemag', 10 ) : true;
62 - } ,
63 - 'rows' => 10,
64 - 'id' => 'wpTextbox1',
65 - );
66 -
67 - return $this->processFormFields( $fields );
68 - }
69 -
70 - /**
71 - * (non-PHPdoc)
72 - * @see SpecialEPFormPage::getNewData()
73 - */
74 - protected function getNewData() {
75 - return array(
76 - 'org_id' => $this->getRequest()->getVal( 'neworg' ),
77 - 'name' => $this->getRequest()->getVal( 'newname' ),
78 - );
79 - }
80 -
81 -}
Index: trunk/extensions/EducationProgram/specials/SpecialEditMasterCourse.php
@@ -0,0 +1,80 @@
 2+<?php
 3+
 4+/**
 5+ * Addition and modification interface for master courses.
 6+ *
 7+ * @since 0.1
 8+ *
 9+ * @file SpecialEditMasterCourse.php
 10+ * @ingroup EducationProgram
 11+ *
 12+ * @licence GNU GPL v3 or later
 13+ * @author Jeroen De Dauw < jeroendedauw@gmail.com >
 14+ */
 15+class SpecialEditMasterCourse extends SpecialEPFormPage {
 16+
 17+ /**
 18+ * Constructor.
 19+ *
 20+ * @since 0.1
 21+ */
 22+ public function __construct() {
 23+ parent::__construct( 'EditMasterCourse', 'ep-mc', 'EPMC', 'MasterCourses' );
 24+ }
 25+
 26+ /**
 27+ * (non-PHPdoc)
 28+ * @see SpecialEPFormPage::getFormFields()
 29+ * @return array
 30+ */
 31+ protected function getFormFields() {
 32+ $fields = parent::getFormFields();
 33+
 34+ $fields['name'] = array (
 35+ 'type' => 'text',
 36+ 'label-message' => 'ep-mc-edit-name',
 37+ 'maxlength' => 255,
 38+ 'required' => true,
 39+ 'validation-callback' => function ( $value, array $alldata = null ) {
 40+ return strlen( $value ) < 5 ? wfMsgExt( 'ep-mc-invalid-name', 'parsemag', 5 ) : true;
 41+ } ,
 42+ );
 43+
 44+ $orgOptions = EPOrg::getOrgOptions();
 45+
 46+ $fields['org_id'] = array (
 47+ 'type' => 'select',
 48+ 'label-message' => 'ep-mc-edit-org',
 49+ 'required' => true,
 50+ 'options' => $orgOptions,
 51+ 'validation-callback' => function ( $value, array $alldata = null ) use ( $orgOptions ) {
 52+ return in_array( (int)$value, array_values( $orgOptions ) ) ? true : wfMsg( 'ep-mc-invalid-org' );
 53+ } ,
 54+ );
 55+
 56+ $fields['description'] = array (
 57+ 'type' => 'textarea',
 58+ 'label-message' => 'ep-mc-edit-description',
 59+ 'required' => true,
 60+ 'validation-callback' => function ( $value, array $alldata = null ) {
 61+ return strlen( $value ) < 10 ? wfMsgExt( 'ep-mc-invalid-description', 'parsemag', 10 ) : true;
 62+ } ,
 63+ 'rows' => 10,
 64+ 'id' => 'wpTextbox1',
 65+ );
 66+
 67+ return $this->processFormFields( $fields );
 68+ }
 69+
 70+ /**
 71+ * (non-PHPdoc)
 72+ * @see SpecialEPFormPage::getNewData()
 73+ */
 74+ protected function getNewData() {
 75+ return array(
 76+ 'org_id' => $this->getRequest()->getVal( 'neworg' ),
 77+ 'name' => $this->getRequest()->getVal( 'newname' ),
 78+ );
 79+ }
 80+
 81+}
Property changes on: trunk/extensions/EducationProgram/specials/SpecialEditMasterCourse.php
___________________________________________________________________
Added: svn:eol-style
182 + native
Index: trunk/extensions/EducationProgram/includes/EPMC.php
@@ -222,7 +222,7 @@
223223 * @return boolean
224224 */
225225 public static function displayAddNewControl( IContextSource $context, array $args = array() ) {
226 - if ( !$context->getUser()->isAllowed( 'ep-course' ) ) {
 226+ if ( !$context->getUser()->isAllowed( 'ep-mc' ) ) {
227227 return false;
228228 }
229229
@@ -232,17 +232,17 @@
233233 'form',
234234 array(
235235 'method' => 'post',
236 - 'action' => SpecialPage::getTitleFor( 'EditCourse' )->getLocalURL(),
 236+ 'action' => SpecialPage::getTitleFor( 'EditMasterCourse' )->getLocalURL(),
237237 )
238238 ) );
239239
240240 $out->addHTML( '<fieldset>' );
241241
242 - $out->addHTML( '<legend>' . wfMsgHtml( 'ep-courses-addnew' ) . '</legend>' );
 242+ $out->addHTML( '<legend>' . wfMsgHtml( 'ep-mcs-addnew' ) . '</legend>' );
243243
244 - $out->addHTML( Html::element( 'p', array(), wfMsg( 'ep-courses-namedoc' ) ) );
 244+ $out->addHTML( Html::element( 'p', array(), wfMsg( 'ep-mcs-namedoc' ) ) );
245245
246 - $out->addHTML( Html::element( 'label', array( 'for' => 'neworg' ), wfMsg( 'ep-courses-neworg' ) ) );
 246+ $out->addHTML( Html::element( 'label', array( 'for' => 'neworg' ), wfMsg( 'ep-mcs-neworg' ) ) );
247247
248248 $out->addHTML( '&#160;' );
249249
@@ -258,7 +258,7 @@
259259 $out->addHTML( '&#160;' );
260260
261261 $out->addHTML( Xml::inputLabel(
262 - wfMsg( 'ep-courses-newname' ),
 262+ wfMsg( 'ep-mcs-newname' ),
263263 'newname',
264264 'newname',
265265 false,
@@ -307,7 +307,7 @@
308308 * @param array $conditions
309309 */
310310 public static function displayPager( IContextSource $context, array $conditions = array() ) {
311 - $pager = new EPCoursePager( $context, $conditions );
 311+ $pager = new EPMCPager( $context, $conditions );
312312
313313 if ( $pager->getNumRows() ) {
314314 $context->getOutput()->addHTML(
@@ -320,7 +320,7 @@
321321 }
322322 else {
323323 $context->getOutput()->addHTML( $pager->getFilterControl( true ) );
324 - $context->getOutput()->addWikiMsg( 'ep-mc-noresults' );
 324+ $context->getOutput()->addWikiMsg( 'ep-mcs-noresults' );
325325 }
326326 }
327327
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -166,16 +166,16 @@
167167 'ep-institutions-newname' => 'Institution name:',
168168 'ep-institutions-add' => 'Add institution',
169169
170 - // Special:Courses
171 - 'ep-courses-nosuchcourse' => 'There is no course with name "$1". Existing courses are listed below.',
172 - 'ep-courses-noresults' => 'There are no courses to list.',
173 - 'ep-courses-addnew' => 'Add a new course',
174 - 'ep-courses-namedoc' => 'Enter the name for the new course (which should be unique) and hit the button.',
175 - 'ep-courses-newname' => 'Course name:',
176 - 'ep-courses-add' => 'Add course',
177 - 'ep-courses-addorgfirst' => 'You need to [[Special:Institutions|add an institution]] before you can create any courses.',
178 - 'ep-courses-noorgs' => 'You are not a mentor of any institutions yet, so cannot add any courses.',
179 - 'ep-courses-neworg' => 'Institution',
 170+ // Special:MasterCourses
 171+ 'ep-mcs-nosuchcourse' => 'There is no master course with name "$1". Existing master courses are listed below.',
 172+ 'ep-mcs-noresults' => 'There are no master courses to list.',
 173+ 'ep-mcs-addnew' => 'Add a new master course',
 174+ 'ep-mcs-namedoc' => 'Enter the name for the new course (which should be unique) and hit the button.',
 175+ 'ep-mcs-newname' => 'Master course name:',
 176+ 'ep-mcs-add' => 'Add master course',
 177+ 'ep-mcs-addorgfirst' => 'You need to [[Special:Institutions|add an institution]] before you can create any master courses.',
 178+ 'ep-mcs-noorgs' => 'You are not a mentor of any institutions yet, so cannot add any master courses.',
 179+ 'ep-mcs-neworg' => 'Institution',
180180
181181 // Special:Courses
182182 'ep-courses-nosuchcourse' => 'There is no course with id "$1". Existing courses are listed below.',
Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -85,7 +85,7 @@
8686 $wgAutoloadClasses['SpecialCourses'] = dirname( __FILE__ ) . '/specials/SpecialCourses.php';
8787 $wgAutoloadClasses['SpecialEditCourse'] = dirname( __FILE__ ) . '/specials/SpecialEditCourse.php';
8888 $wgAutoloadClasses['SpecialEditInstitution'] = dirname( __FILE__ ) . '/specials/SpecialEditInstitution.php';
89 -$wgAutoloadClasses['SpecialEditMC'] = dirname( __FILE__ ) . '/specials/SpecialEditMC.php';
 89+$wgAutoloadClasses['SpecialEditMasterCourse'] = dirname( __FILE__ ) . '/specials/SpecialEditMasterCourse.php';
9090 $wgAutoloadClasses['SpecialEducationProgram'] = dirname( __FILE__ ) . '/specials/SpecialEducationProgram.php';
9191 $wgAutoloadClasses['SpecialEPFormPage'] = dirname( __FILE__ ) . '/specials/SpecialEPFormPage.php';
9292 $wgAutoloadClasses['SpecialEPPage'] = dirname( __FILE__ ) . '/specials/SpecialEPPage.php';
@@ -94,8 +94,8 @@
9595 $wgAutoloadClasses['SpecialMyCourses'] = dirname( __FILE__ ) . '/specials/SpecialMyCourses.php';
9696 $wgAutoloadClasses['SpecialStudent'] = dirname( __FILE__ ) . '/specials/SpecialStudent.php';
9797 $wgAutoloadClasses['SpecialStudents'] = dirname( __FILE__ ) . '/specials/SpecialStudents.php';
98 -$wgAutoloadClasses['SpecialMC'] = dirname( __FILE__ ) . '/specials/SpecialMC.php';
99 -$wgAutoloadClasses['SpecialMCs'] = dirname( __FILE__ ) . '/specials/SpecialMCs.php';
 98+$wgAutoloadClasses['SpecialMasterCourse'] = dirname( __FILE__ ) . '/specials/SpecialMasterCourse.php';
 99+$wgAutoloadClasses['SpecialMasterCourses'] = dirname( __FILE__ ) . '/specials/SpecialMasterCourses.php';
100100 $wgAutoloadClasses['SpecialEnroll'] = dirname( __FILE__ ) . '/specials/SpecialEnroll.php';
101101 $wgAutoloadClasses['SpecialCAs'] = dirname( __FILE__ ) . '/specials/SpecialCAs.php';
102102 $wgAutoloadClasses['SpecialOAs'] = dirname( __FILE__ ) . '/specials/SpecialOAs.php';
@@ -110,12 +110,12 @@
111111 $wgSpecialPages['Students'] = 'SpecialStudents';
112112 $wgSpecialPages['Course'] = 'SpecialCourse';
113113 $wgSpecialPages['Courses'] = 'SpecialCourses';
114 -$wgSpecialPages['MasterCourse'] = 'SpecialMC';
115 -$wgSpecialPages['MasterCourses'] = 'SpecialMCs';
 114+$wgSpecialPages['MasterCourse'] = 'SpecialMasterCourse';
 115+$wgSpecialPages['MasterCourses'] = 'SpecialMasterCourses';
116116 $wgSpecialPages['EducationProgram'] = 'SpecialEducationProgram';
117117 $wgSpecialPages['EditCourse'] = 'SpecialEditCourse';
118118 $wgSpecialPages['EditInstitution'] = 'SpecialEditInstitution';
119 -$wgSpecialPages['EditMasterCourse'] = 'SpecialEditMC';
 119+$wgSpecialPages['EditMasterCourse'] = 'SpecialEditMasterCourse';
120120 $wgSpecialPages['Enroll'] = 'SpecialEnroll';
121121 $wgSpecialPages['CampusAmbassadors'] = 'SpecialCAs';
122122 $wgSpecialPages['OnlineAmbassadors'] = 'SpecialOAs';
@@ -134,7 +134,7 @@
135135 $wgSpecialPageGroups['EducationProgram'] = 'education';
136136 $wgSpecialPageGroups['EditCourse'] = 'education';
137137 $wgSpecialPageGroups['EditInstitution'] = 'education';
138 -$wgSpecialPageGroups['EditMC'] = 'education';
 138+$wgSpecialPageGroups['EditMasterCourse'] = 'education';
139139 $wgSpecialPageGroups['CampusAmbassadors'] = 'education';
140140 $wgSpecialPageGroups['OnlineAmbassadors'] = 'education';
141141 $wgSpecialPageGroups['CampusAmbassador'] = 'education';

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109656schema changes currently completely breaking the extension and added hook to ...jeroendedauw22:24, 20 January 2012

Status & tagging log