r109989 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109988‎ | r109989 | r109990 >
Date:02:47, 25 January 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
follow up to r109985; fixed stuff I missed initially and replaced year field with term field
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPCoursePager.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrg.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPOrgPager.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEPPage.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEditCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialInstitution.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialInstitution.php
@@ -59,7 +59,7 @@
6060
6161 $this->displaySummary( $org );
6262
63 - $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-institution-mcs' ) ) );
 63+ $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-institution-courses' ) ) );
6464
6565 EPCourse::displayPager( $this->getContext(), array( 'org_id' => $org->getId() ) );
6666
@@ -92,7 +92,6 @@
9393
9494 $stats['status'] = wfMsgHtml( $org->getField( 'active' ) ? 'ep-institution-active' : 'ep-institution-inactive' );
9595
96 - $stats['mcs'] = $this->getLanguage()->formatNum( $org->getField( 'mcs' ) );
9796 $stats['courses'] = $this->getLanguage()->formatNum( $org->getField( 'courses' ) );
9897 $stats['students'] = $this->getLanguage()->formatNum( $org->getField( 'students' ) );
9998
@@ -109,15 +108,6 @@
110109 );
111110 }
112111
113 - if ( $org->getField( 'mcs' ) > 0 ) {
114 - $stats['mcs'] = Linker::linkKnown(
115 - SpecialPage::getTitleFor( 'MasterCourses' ),
116 - $stats['mcs'],
117 - array(),
118 - array( 'org_id' => $org->getId() )
119 - );
120 - }
121 -
122112 return $stats;
123113 }
124114
Index: trunk/extensions/EducationProgram/specials/SpecialCourse.php
@@ -102,7 +102,7 @@
103103
104104 $lang = $this->getLanguage();
105105
106 - $stats['year'] = htmlspecialchars( $lang->formatNum( $course->getField( 'year' ), true ) );
 106+ $stats['term'] = htmlspecialchars( $course->getField( 'term' ) );
107107 $stats['start'] = htmlspecialchars( $lang->timeanddate( $course->getField( 'start' ), true ) );
108108 $stats['end'] = htmlspecialchars( $lang->timeanddate( $course->getField( 'end' ), true ) );
109109
Index: trunk/extensions/EducationProgram/specials/SpecialEPPage.php
@@ -168,7 +168,6 @@
169169 protected function getDefaultNavigationItems() {
170170 $items = array(
171171 wfMsg( 'ep-nav-orgs' ) => SpecialPage::getTitleFor( 'Institutions' ),
172 - wfMsg( 'ep-nav-mcs' ) => SpecialPage::getTitleFor( 'MasterCourses' ),
173172 wfMsg( 'ep-nav-courses' ) => SpecialPage::getTitleFor( 'Courses' ),
174173 );
175174
Index: trunk/extensions/EducationProgram/specials/SpecialEditCourse.php
@@ -56,13 +56,10 @@
5757 } ,
5858 );
5959
60 - $fields['year'] = array (
61 - 'type' => 'int',
62 - 'label-message' => 'ep-course-edit-year',
 60+ $fields['term'] = array (
 61+ 'type' => 'text',
 62+ 'label-message' => 'ep-course-edit-term',
6363 'required' => true,
64 - 'min' => 2000,
65 - 'max' => 9001,
66 - 'size' => 15,
6764 );
6865
6966 $fields['start'] = array (
@@ -105,8 +102,8 @@
106103 */
107104 protected function getNewData() {
108105 return array(
109 - 'mc_id' => $this->getRequest()->getVal( 'newmc' ),
110 - 'year' => $this->getRequest()->getVal( 'newyear' ),
 106+ 'org_id' => $this->getRequest()->getVal( 'neworg' ),
 107+ 'term' => $this->getRequest()->getVal( 'newterm' ),
111108 );
112109 }
113110
Index: trunk/extensions/EducationProgram/includes/EPOrgPager.php
@@ -32,7 +32,6 @@
3333 'name',
3434 'city',
3535 'country',
36 - 'mcs',
3736 'courses',
3837 'students',
3938 'active',
@@ -71,15 +70,11 @@
7271 $countries = array_flip( EPUtils::getCountryOptions( $this->getLanguage()->getCode() ) );
7372 $value = htmlspecialchars( $countries[$value] );
7473 break;
75 - case 'courses': case 'students': case 'mcs':
 74+ case 'courses': case 'students':
7675 $rawValue = $value;
7776 $value = htmlspecialchars( $this->getLanguage()->formatNum( $value ) );
7877
79 - if ( $rawValue > 0 && in_array( $name, array( 'mcs', 'courses' ) ) ) {
80 - if ( $name == 'mcs' ) {
81 - $name = 'MasterCourses';
82 - }
83 -
 78+ if ( $rawValue > 0 && $name === 'courses' ) {
8479 $value = Linker::linkKnown(
8580 SpecialPage::getTitleFor( $this->getLanguage()->ucfirst( $name ) ),
8681 $value,
@@ -108,7 +103,6 @@
109104 'country',
110105 'courses',
111106 'students',
112 - 'mcs',
113107 'active',
114108 );
115109 }
Index: trunk/extensions/EducationProgram/includes/EPCoursePager.php
@@ -31,7 +31,7 @@
3232 return array(
3333 'id',
3434 'org_id',
35 - 'year',
 35+ 'term',
3636 'start',
3737 'end',
3838 'students',
@@ -74,8 +74,8 @@
7575 htmlspecialchars( $value )
7676 );
7777 break;
78 - case 'year':
79 - $value = htmlspecialchars( $this->getLanguage()->formatNum( $value, true ) );
 78+ case 'term':
 79+ $value = htmlspecialchars( $value ); // TODO
8080 break;
8181 case 'start': case 'end':
8282 $value = htmlspecialchars( $this->getLanguage()->date( $value ) );
@@ -97,7 +97,7 @@
9898 protected function getSortableFields() {
9999 return array(
100100 'id',
101 - 'year',
 101+ 'term',
102102 'start',
103103 'end',
104104 'students',
@@ -137,14 +137,14 @@
138138 'datatype' => 'int',
139139 );
140140
141 - $years = EPCourse::selectFields( 'year', array(), array( 'DISTINCT' ), array(), true );
142 - asort( $years, SORT_NUMERIC );
143 - $years = array_merge( array( '' ), $years );
144 - $years = array_combine( $years, $years );
 141+ $terms = EPCourse::selectFields( 'term', array(), array( 'DISTINCT' ), array(), true );
 142+ natcasesort( $terms );
 143+ $terms = array_merge( array( '' ), $terms );
 144+ $years = array_combine( $terms, $terms );
145145
146 - $options['year'] = array(
 146+ $options['term'] = array(
147147 'type' => 'select',
148 - 'options' => $years,
 148+ 'options' => $terms,
149149 'value' => '',
150150 );
151151
Index: trunk/extensions/EducationProgram/includes/EPOrg.php
@@ -81,7 +81,7 @@
8282 */
8383 public function loadSummaryFields( $summaryFields = null ) {
8484 if ( is_null( $summaryFields ) ) {
85 - $summaryFields = array( 'courses', 'mcs', 'students', 'active' );
 85+ $summaryFields = array( 'courses', 'students', 'active' );
8686 }
8787 else {
8888 $summaryFields = (array)$summaryFields;
Index: trunk/extensions/EducationProgram/includes/EPCourse.php
@@ -349,7 +349,7 @@
350350
351351 $out->addHTML( Html::element( 'p', array(), wfMsg( 'ep-courses-namedoc' ) ) );
352352
353 - $out->addHTML( Html::element( 'label', array( 'for' => 'newmc' ), wfMsg( 'ep-courses-newmastercourse' ) ) );
 353+ $out->addHTML( Html::element( 'label', array( 'for' => 'newmc' ), wfMsg( 'ep-courses-neworg' ) ) );
354354
355355 $select = new XmlSelect(
356356 'neworg',
@@ -360,7 +360,7 @@
361361 $select->addOptions( EPOrg::getOrgOptions() );
362362 $out->addHTML( $select->getHTML() );
363363
364 - $out->addHTML( ' ' . Xml::inputLabel( wfMsg( 'ep-courses-newyear' ), 'newyear', 'newyear', 10 ) );
 364+ $out->addHTML( ' ' . Xml::inputLabel( wfMsg( 'ep-courses-newterm' ), 'newterm', 'newterm', 10 ) );
365365
366366 $out->addHTML( ' ' . Html::input(
367367 'addnewcourse',
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -34,18 +34,15 @@
3535 'tooltip-ep-form-save' => 'Save',
3636 'tooltip-ep-edit-institution' => 'Edit this institution',
3737 'tooltip-ep-edit-course' => 'Edit this course',
38 - 'tooltip-ep-edit-mc' => 'Edit this master course',
3938
4039 // Access keys
4140 'accesskey-ep-form-save' => 's', # do not translate or duplicate this message to other languages
4241 'accesskey-ep-edit-institution' => 'e', # do not translate or duplicate this message to other languages
4342 'accesskey-ep-edit-course' => 'e', # do not translate or duplicate this message to other languages
44 - 'accesskey-ep-edit-mc' => 'e', # do not translate or duplicate this message to other languages
4543
4644 // Navigation links
4745 'ep-nav-orgs' => 'Institution list',
4846 'ep-nav-courses' => 'Courses list',
49 - 'ep-nav-mcs' => 'Master courses list',
5047 'ep-nav-mycourses' => 'My courses',
5148 'ep-nav-students' => 'Student list',
5249 'ep-nav-mentors' => 'Ambassador list',
@@ -53,21 +50,18 @@
5451 // Logging
5552 'log-name-institution' => 'Institution log',
5653 'log-name-course' => 'Course log',
57 - 'log-name-mc' => 'Master course log',
5854 'log-name-student' => 'Student log',
5955 'log-name-ambassador' => 'Ambassador log',
6056 'log-name-instructor' => 'Instructor log',
6157
6258 'log-header-institution' => 'These events track the changes that are made to institutions.',
6359 'log-header-course' => 'These events track the changes that are made to courses.',
64 - 'log-header-mc' => 'These events track the changes that are made to master courses.',
6560 'log-header-instructor' => 'These events track the changes that are made to instructors.',
6661 'log-header-ambassador' => 'These events track the changes that are made to ambassadors.',
6762 'log-header-student' => 'These events track the changes that are made to students.',
6863
6964 'log-description-institution' => 'Log of all changes to [[Special:Institutions|institutions]].',
7065 'log-description-course' => 'Log of all changes to [[Special:Courses|courses]].',
71 - 'log-description-mc' => 'Log of all changes to [[Special:MasterCourses|master courses]].',
7266 'log-description-instructor' => 'Log of all changes to instructors.',
7367 'log-description-ambassador' => 'Log of all changes to [[Special:OnlineAmbassadors|online]] and [[Special:CampusAmbassadors|campus ambassadors]].',
7468 'log-description-student' => 'Log of all changes to [[Special:Students|students]].',
@@ -105,7 +99,6 @@
106100 // Rights
107101 'right-ep-org' => 'Manage Education Program institutions',
108102 'right-ep-course' => 'Manage Education Program courses',
109 - 'right-ep-mcs' => 'Manage Education Program master courses',
110103 'right-ep-token' => 'See Education Program enrollment tokens',
111104 'right-ep-remstudent' => 'Remove students from courses',
112105 'right-ep-enroll' => 'Enroll in Education Program courses',
@@ -116,7 +109,6 @@
117110 // Actions
118111 'action-ep-org' => 'manage institutions',
119112 'action-ep-course' => 'manage courses',
120 - 'action-ep-mc' => 'manage master courses',
121113 'action-ep-token' => 'see enrollment tokens',
122114 'action-ep-remstudent' => 'remove students from courses',
123115 'action-ep-enroll' => 'enroll in courses',
@@ -157,10 +149,6 @@
158150 'special-educationprogram' => 'Education Program',
159151 'special-editinstitution-add' => 'Add institution',
160152 'special-editinstitution-edit' => 'Edit institution',
161 - 'special-mastercourses' => 'Master courses',
162 - 'special-mastercourse' => 'Master course',
163 - 'special-editmastercourse-add' => 'Add master course',
164 - 'special-editmastercourse-edit' => 'Edit master course',
165153 'special-editcourse-add' => 'Add course',
166154 'special-editcourse-edit' => 'Edit course',
167155 'special-enroll' => 'Enroll',
@@ -169,7 +157,6 @@
170158 'special-onlineambassador' => 'Online ambassador',
171159 'special-campusambassador' => 'Campus ambassador',
172160 'special-coursehistory' => 'Revision history of "$1"',
173 - 'special-mastercoursehistory' => 'Revision history of "$1"',
174161 'special-institutionhistory' => 'Revision history of "$1"',
175162
176163 // Course statuses
@@ -185,27 +172,16 @@
186173 'ep-institutions-newname' => 'Institution name:',
187174 'ep-institutions-add' => 'Add institution',
188175
189 - // Special:MasterCourses
190 - 'ep-mcs-nosuchcourse' => 'There is no master course with name "$1". Existing master courses are listed below.',
191 - 'ep-mcs-noresults' => 'There are no master courses to list.',
192 - 'ep-mcs-addnew' => 'Add a new master course',
193 - 'ep-mcs-namedoc' => 'Enter the name for the new course (which should be unique) and hit the button.',
194 - 'ep-mcs-newname' => 'Master course name:',
195 - 'ep-mcs-add' => 'Add master course',
196 - 'ep-mcs-addorgfirst' => 'You need to [[Special:Institutions|add an institution]] before you can create any master courses.',
197 - 'ep-mcs-noorgs' => 'You are not a mentor of any institutions yet, so cannot add any master courses.',
198 - 'ep-mcs-neworg' => 'Institution',
199 -
200176 // Special:Courses
201 - 'ep-courses-nosuchcourse' => 'There is no course with id "$1". Existing courses are listed below.',
 177+ 'ep-courses-nosuchcourse' => 'There is no course with name "$1". Existing courses are listed below.',
202178 'ep-courses-noresults' => 'There are no courses to list.',
203179 'ep-courses-addnew' => 'Add a new course',
204 - 'ep-courses-namedoc' => 'Enter the master course the course belongs to and the year in which it is active.',
205 - 'ep-courses-newyear' => 'Course year:',
206 - 'ep-courses-newmastercourse' => 'Course master course:',
 180+ 'ep-courses-namedoc' => 'Enter the institution the course belongs to and the year in which it is active.',
 181+ 'ep-courses-newterm' => 'Course term:',
 182+ 'ep-courses-neworg' => 'Course institution:',
207183 'ep-courses-add' => 'Add course',
208 - 'ep-courses-nocourses' => 'There are no master courses yet. You need to [[Special:MasterCourses|add a master course]] before you can create any courses.',
209 - 'ep-courses-addmastercoursefirst' => 'There are no master courses yet. You need to [[Special:MasterCourses|add a master course]] before you can create any courses.',
 184+ 'ep-courses-noorgs' => 'There are no institutions yet. You need to [[Special:Institutions|add an institution]] before you can create any courses.',
 185+ 'ep-courses-addorgfirst' => 'There are no institutions yet. You need to [[Special:Institutions|add an institution]] before you can create any courses.',
210186
211187 // Special:Students
212188 'ep-students-noresults' => 'There are no students to list.',
@@ -227,7 +203,6 @@
228204 'eporgpager-filter-country' => 'Country',
229205 'eporgpager-header-courses' => 'Courses',
230206 'eporgpager-header-students' => 'Students',
231 - 'eporgpager-header-mcs' => 'Master courses',
232207 'eporgpager-header-active' => 'Active',
233208 'eporgpager-filter-active' => 'Active courses',
234209 'eporgpager-yes' => 'Yes',
@@ -236,11 +211,11 @@
237212 // Course pager
238213 'epcoursepager-header-id' => 'Id',
239214 'epcoursepager-header-mc-id' => 'Master course',
240 - 'epcoursepager-header-year' => 'Year',
 215+ 'epcoursepager-header-term' => 'Term',
241216 'epcoursepager-header-start' => 'Start',
242217 'epcoursepager-header-end' => 'End',
243218 'epcoursepager-filter-mc-id' => 'Master course',
244 - 'epcoursepager-filter-year' => 'Year',
 219+ 'epcoursepager-filter-term' => 'Term',
245220 'epcoursepager-filter-org-id' => 'Institution',
246221 'epcoursepager-header-status' => 'Status',
247222 'epcoursepager-filter-status' => 'Status',
@@ -272,22 +247,10 @@
273248 'educationprogram-org-edit-country' => 'Country',
274249 'educationprogram-org-submit' => 'Submit',
275250
276 - // Special:EditMasterCourse
277 - 'editmastercourse-add-legend' => 'Add master course',
278 - 'editmastercourse-edit-legend' => 'Edit master course',
279 - 'ep-mc-edit-name' => 'Name',
280 - 'ep-mc-edit-org' => 'Institution',
281 - 'ep-mc-edit-description' => 'Description',
282 - 'ep-mc-edit-timeline' => 'Timeline',
283 -
284 - 'ep-mc-invalid-name' => 'This name is to short. It needs to be at least contain $1 {{PLURAL:$1|character|characters}}.',
285 - 'ep-mc-invalid-description' => 'This description is to short. It needs to be at least contain $1 {{PLURAL:$1|character|characters}}.',
286 - 'ep-mc-invalid-org' => 'This institution does not exist',
287 -
288251 // Special:EditCourse
289252 'editcourse-add-legend' => 'Add course',
290253 'editcourse-edit-legend' => 'Edit course',
291 - 'ep-course-edit-year' => 'Year',
 254+ 'ep-course-edit-term' => 'Term',
292255 'ep-course-edit-mastercourse' => 'Master course',
293256 'ep-course-edit-start' => 'Start date',
294257 'ep-course-edit-end' => 'End date',
@@ -308,39 +271,17 @@
309272 'ep-institution-none' => 'There is no institution with name "$1". See [[Special:Institution|here]] for a list of institutions.',
310273 'ep-institution-create' => 'There is no institution with name "$1" yet, but you can create it.',
311274 'ep-institution-title' => 'Institution: $1',
312 - 'ep-institution-mcs' => 'Master courses',
313275 'specialinstitution-summary-name' => 'Name',
314276 'specialinstitution-summary-city' => 'City',
315277 'specialinstitution-summary-country' => 'Country',
316278 'specialinstitution-summary-status' => 'Status',
317279 'specialinstitution-summary-courses' => 'Course count',
318 - 'specialinstitution-summary-mcs' => 'Master course count',
319280 'specialinstitution-summary-students' => 'Student count',
320281 'ep-institution-nav-edit' => 'Edit this institution',
321282 'ep-institution-add-mc' => 'Add a master course',
322283 'ep-institution-inactive' => 'Inactive',
323284 'ep-institution-active' => 'Active',
324285
325 - // Special:MasterCourse
326 - 'ep-mc-title' => 'Master course: $1',
327 - 'ep-mc-courses' => 'Courses',
328 - 'ep-mc-none' => 'There is no master course with name "$1". See [[Special:MasterCourses|here]] for a list of master courses.',
329 - 'ep-mc-create' => 'There is no master course with name "$1" yet, but you can create it.',
330 - 'specialmastercourse-summary-name' => 'Name',
331 - 'specialmastercourse-summary-org' => 'Institution',
332 - 'specialmastercourse-summary-students' => 'Student count',
333 - 'specialmastercourse-summary-status' => 'Status',
334 - 'ep-mc-description' => 'Description',
335 - 'ep-mc-nav-edit' => 'Edit this master course',
336 - 'ep-mc-add-course' => 'Add a course',
337 - 'ep-mc-inactive' => 'Inactive',
338 - 'ep-mc-active' => 'Active',
339 - 'specialmastercourse-summary-courses' => 'Course count',
340 - 'specialmastercourse-summary-instructors' => 'Instructors',
341 - 'ep-mc-no-instructors' => 'There are no instructors for this master course.',
342 - 'ep-mc-become-instructor' => 'Become instructor',
343 - 'ep-mc-add-instructor' => 'Add an instructor',
344 -
345286 // Special:Course
346287 'ep-course-title' => 'Course: $1',
347288 'ep-course-students' => 'Students',
@@ -348,7 +289,7 @@
349290 'ep-course-create' => 'There is no course with id "$1", but you can create a new one.',
350291 'specialcourse-summary-org' => 'Institution',
351292 'specialcourse-summary-mastercourse' => 'Master course',
352 - 'specialcourse-summary-year' => 'Year',
 293+ 'specialcourse-summary-term' => 'Term',
353294 'specialcourse-summary-start' => 'Start',
354295 'specialcourse-summary-end' => 'End',
355296 'specialcourse-summary-students' => 'Student count',
@@ -409,7 +350,6 @@
410351 'ep-mycourses-not-a-student' => 'You are not enrolled in any [[Special:Courses|courses]].',
411352
412353 // ep.instructor
413 - // <script>alert("XSS");</script>
414354 'ep-instructor-remove-title' => 'Remove instructor from master course',
415355 'ep-instructor-remove-button' => 'Remove instructor',
416356 'ep-instructor-removing' => 'Removing...',

Follow-up revisions

RevisionCommit summaryAuthorDate
r109991follow up r109985 r109989; updated messages and field namesjeroendedauw03:05, 25 January 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r109985merge master courses with coursesjeroendedauw02:22, 25 January 2012

Status & tagging log