r109576 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109575‎ | r109576 | r109577 >
Date:22:30, 19 January 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
fixed some bugs and some minor work on instructor management
Modified paths:
  • /trunk/extensions/EducationProgram/includes/EPDBObject.php (modified) (history)
  • /trunk/extensions/EducationProgram/includes/EPTerm.php (modified) (history)
  • /trunk/extensions/EducationProgram/resources/ep.instructor.js (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialCourse.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialEnroll.php (modified) (history)
  • /trunk/extensions/EducationProgram/specials/SpecialTerm.php (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/specials/SpecialEnroll.php
@@ -55,14 +55,14 @@
5656 $tokenIsValid = $term->getField( 'token' ) === '';
5757
5858 if ( !$tokenIsValid ) {
59 - $tokenIsValid = $term->getField( 'token' ) === $token;
60 -
6159 if ( count( $args ) === 2 ) {
6260 $token = $args[1];
6361 }
6462 elseif ( $this->getRequest()->wasPosted() && $this->getRequest()->getCheck( 'wptoken' ) ) {
6563 $token = $this->getRequest()->getText( 'wptoken' );
6664 }
 65+
 66+ $tokenIsValid = $term->getField( 'token' ) === $token;
6767 }
6868
6969 if ( $tokenIsValid ) {
Index: trunk/extensions/EducationProgram/specials/SpecialCourse.php
@@ -146,11 +146,11 @@
147147 $instList[] = $instructor->getUserLink() . $instructor->getToolLinks( $this->getContext(), $course );
148148 }
149149
150 - if ( count( $instructors ) == 1 ) {
 150+ if ( false ) { // count( $instructors ) == 1
151151 return $instList[0];
152152 }
153153 else {
154 - return '<ul><li>' . implode( '</li><li>', $instList ) . '</li></ul>';
 154+ return '<ul id="ep-course-instructors"><li>' . implode( '</li><li>', $instList ) . '</li></ul>';
155155 }
156156 }
157157 else {
Index: trunk/extensions/EducationProgram/specials/SpecialTerm.php
@@ -75,7 +75,7 @@
7676 },
7777 $term->getStudents( 'id' )
7878 );
79 -
 79+
8080 if ( count( $studentIds ) > 0 ) {
8181 $out->addHTML( Html::element( 'h2', array(), wfMsg( 'ep-term-students' ) ) );
8282 EPStudent::displayPager( $this->getContext(), array( 'id' => $studentIds ) );
Index: trunk/extensions/EducationProgram/includes/EPTerm.php
@@ -134,7 +134,7 @@
135135 $conditions,
136136 array(),
137137 array(
138 - 'ep_students_per_term' => array( 'INNER JOIN', array( array( array( 'ep_students_per_term', 'term_id' ), array( 'ep_terms', 'id' ) ) ) ),
 138+ 'ep_students_per_term' => array( 'INNER JOIN', array( array( array( 'ep_students_per_term', 'student_id' ), array( 'ep_students', 'id' ) ) ) ),
139139 'ep_terms' => array( 'INNER JOIN', array( array( array( 'ep_students_per_term', 'term_id' ), array( 'ep_terms', 'id' ) ) ) )
140140 )
141141 );
Index: trunk/extensions/EducationProgram/includes/EPDBObject.php
@@ -939,7 +939,7 @@
940940 $cond[1][] = implode( '=', $parts );
941941 }
942942
943 - $conds[] = $cond;
 943+ $conds[$table] = $cond;
944944 }
945945
946946 return $conds;
Index: trunk/extensions/EducationProgram/resources/ep.instructor.js
@@ -37,9 +37,7 @@
3838 $remove.remove();
3939 $cancel.button( 'option', 'label', ep.msg( 'ep-instructor-close-button' ) );
4040 $cancel.focus();
41 -
42 - // TODO: update UI to reflect the addition
43 - location.reload();
 41+ $this.closest( 'li' ).remove();
4442 } ).fail( function() {
4543 $remove.button( 'option', 'disabled', false );
4644 $remove.button( 'option', 'label', ep.msg( 'ep-instructor-remove-retry' ) );
@@ -134,14 +132,15 @@
135133 _this.getName(),
136134 _this.courseName
137135 ) );
 136+
138137 $add.remove();
139138 $cancel.button( 'option', 'label', ep.msg( 'ep-instructor-add-close-button' ) );
140139 $cancel.focus();
141140
142 - // TODO: update UI to reflect the addition
143 - location.reload();
 141+ // TODO: link name to user page and show control links
 142+ $( '#ep-course-instructors' ).append( $( '<li>' ).text( _this.getName() ) )
144143 } ).fail( function() {
145 - // TODO: implement handling for fails caused by invalid user name
 144+ // TODO: implement nicer handling for fails caused by invalid user name
146145
147146 $add.button( 'option', 'disabled', false );
148147 $add.button( 'option', 'label', ep.msg( 'ep-instructor-add-retry' ) );

Status & tagging log