r112965 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r112964‎ | r112965 | r112966 >
Date:21:54, 3 March 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Follow up to r112963; fix var definition and improved error handling
Modified paths:
  • /trunk/extensions/EducationProgram/EducationProgram.i18n.php (modified) (history)
  • /trunk/extensions/EducationProgram/EducationProgram.php (modified) (history)
  • /trunk/extensions/EducationProgram/resources/ep.enlist.js (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/EducationProgram.php
@@ -555,6 +555,9 @@
556556 'ep-instructor-addittion-null',
557557 'ep-online-addittion-null',
558558 'ep-campus-addittion-null',
 559+ 'ep-instructor-addittion-invalid-user',
 560+ 'ep-online-addittion-invalid-user',
 561+ 'ep-campus-addittion-invalid-user',
559562 'ep-instructor-add-close-button',
560563 'ep-online-add-close-button',
561564 'ep-campus-add-close-button',
Index: trunk/extensions/EducationProgram/EducationProgram.i18n.php
@@ -627,6 +627,7 @@
628628 'ep-instructor-addittion-success' => '$1 has been successfully added as {{GENDER:$1|instructor}} for course $2!',
629629 'ep-instructor-addittion-self-success' => 'You have been successfully added as {{GENDER:$1|instructor}} for course $2!',
630630 'ep-instructor-addittion-null' => '$1 has already been added as {{GENDER:$1|instructor}} to course $2',
 631+ 'ep-instructor-addittion-invalid-user' => 'There is no user with name $1, so no one has been added to course $2',
631632 'ep-instructor-add-close-button' => 'Close',
632633 'ep-instructor-add-retry' => 'Retry',
633634 'ep-instructor-addittion-failed' => 'Something went wrong - could not add the instructor to the course.',
@@ -654,6 +655,7 @@
655656 'ep-online-addittion-success' => '$1 has been successfully added as {{GENDER:$1|Online Ambassador}} for course $2!',
656657 'ep-online-addittion-self-success' => 'You have been successfully added as {{GENDER:$1|Online Ambassador}} for course $2!',
657658 'ep-online-addittion-null' => '$1 has already been added as {{GENDER:$1|Online Ambassador}} to course $2',
 659+ 'ep-online-addittion-invalid-user' => 'There is no user with name $1, so no one has been added to course $2',
658660 'ep-online-add-close-button' => 'Close',
659661 'ep-online-add-retry' => 'Retry',
660662 'ep-online-addittion-failed' => 'Something went wrong - could not add the Online Ambassador to the course.',
@@ -681,6 +683,7 @@
682684 'ep-campus-addittion-success' => '$1 has been successfully added as {{GENDER:$1|Campus Ambassador}} for course $2!',
683685 'ep-campus-addittion-self-success' => 'You have been successfully added as {{GENDER:$1|Campus Ambassador}} for course $2!',
684686 'ep-campus-addittion-null' => '$1 has already been added as {{GENDER:$1|Campus Ambassador}} to course $2',
 687+ 'ep-campus-addittion-invalid-user' => 'There is no user with name $1, so no one has been added to course $2',
685688 'ep-campus-add-close-button' => 'Close',
686689 'ep-campus-add-retry' => 'Retry',
687690 'ep-campus-addittion-failed' => 'Something went wrong - could not add the Campus Ambassador to the course.',
Index: trunk/extensions/EducationProgram/resources/ep.enlist.js
@@ -108,7 +108,8 @@
109109 $( '.ep-add-role' ).click( function( event ) {
110110 var $this = $( this ),
111111 _this = this,
112 - role = $this.attr( 'data-role' );
 112+ role = $this.attr( 'data-role' ),
 113+ isCompletionEnter = false;
113114
114115 this.courseId = $this.attr( 'data-courseid' );
115116 this.courseName = $this.attr( 'data-coursename' );
@@ -137,8 +138,7 @@
138139
139140 this.doAdd = function() {
140141 var $add = $( '#ep-' + role + '-add-button' ),
141 - $cancel = $( '#ep-' + role + '-add-cancel-button' ),
142 - isCompletionEnter = false;
 142+ $cancel = $( '#ep-' + role + '-add-cancel-button' );
143143
144144 $add.button( 'option', 'disabled', true );
145145 $add.button( 'option', 'label', ep.msg( 'ep-' + role + '-adding' ) );
@@ -180,11 +180,16 @@
181181 $ul.append( $( '<li>' ).text( _this.getName() ) );
182182 }
183183 } ).fail( function( data ) {
184 - // TODO: implement nicer handling for fails caused by invalid user name
185 -
186184 $add.button( 'option', 'disabled', false );
187185 $add.button( 'option', 'label', ep.msg( 'ep-' + role + '-add-retry' ) );
188 - alert( ep.msg( 'ep-' + role + '-addittion-failed' ) );
 186+
 187+ var msgKey = data.error ? 'ep-' + role + '-addittion-' + data.error.code : 'ep-' + role + '-addittion-failed';
 188+
 189+ alert( ep.msg(
 190+ msgKey,
 191+ _this.getName(),
 192+ _this.courseName
 193+ ) );
189194 } );
190195 };
191196

Sign-offs

UserFlagDate
Rob Schnautz (WMF)tested19:30, 7 March 2012

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r112963Follow up to r112961; selecting an item with return should not submit dialogjeroendedauw21:32, 3 March 2012

Status & tagging log