r109082 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109081‎ | r109082 | r109083 >
Date:00:03, 17 January 2012
Author:jeroendedauw
Status:deferred
Tags:
Comment:
work on message stuff, attempt to make 1.18 compatible
Modified paths:
  • /trunk/extensions/EducationProgram/resources/ep.api.js (modified) (history)
  • /trunk/extensions/EducationProgram/resources/ep.instructor.js (modified) (history)

Diff [purge]

Index: trunk/extensions/EducationProgram/resources/ep.api.js
@@ -8,6 +8,20 @@
99
1010 window.educationProgram = new( function() {
1111
 12+ // TODO: move to own file
 13+ this.msg = function () {
 14+ if ( typeof mw.language.gender === 'undefined' ) {
 15+ return gM.apply( this, arguments );
 16+ }
 17+ else {
 18+ return mw.msg.apply( this, arguments );
 19+ }
 20+ };
 21+
 22+ this.msge = function () {
 23+ return mw.html.escape( this.msg.apply( this, arguments ) );
 24+ };
 25+
1226 this.api = new( function() {
1327
1428 this.remove = function( data, callback ) {
Index: trunk/extensions/EducationProgram/resources/ep.instructor.js
@@ -7,7 +7,7 @@
88 */
99
1010 (function( $, mw, ep ) {
11 -
 11+
1212 $( document ).ready( function() {
1313
1414 $( '.ep-instructor-remove' ).click( function( event ) {
@@ -24,21 +24,21 @@
2525 var $cancel = $( '#ep-instructor-cancel-button' );
2626
2727 $remove.button( 'option', 'disabled', true );
28 - $remove.button( 'option', 'label', mw.msg( 'ep-instructor-removing' ) );
 28+ $remove.button( 'option', 'label', ep.msg( 'ep-instructor-removing' ) );
2929
3030 ep.api.removeInstructor( {
3131 'courseid': courseId,
3232 'userid': userId,
3333 'reason': summaryInput.val()
3434 } ).done( function() {
35 - $dialog.text( mw.msg( 'ep-instructor-removal-success' ) );
 35+ $dialog.text( ep.msg( 'ep-instructor-removal-success' ) );
3636 $remove.remove();
37 - $cancel.button( 'option', 'label', mw.msg( 'ep-instructor-close-button' ) );
 37+ $cancel.button( 'option', 'label', ep.msg( 'ep-instructor-close-button' ) );
3838 $cancel.focus();
3939 } ).fail( function() {
4040 $remove.button( 'option', 'disabled', false );
41 - $remove.button( 'option', 'label', mw.msg( 'ep-instructor-remove-retry' ) );
42 - alert( mw.msg( 'ep-instructor-remove-failed' ) );
 41+ $remove.button( 'option', 'label', ep.msg( 'ep-instructor-remove-retry' ) );
 42+ alert( ep.msg( 'ep-instructor-remove-failed' ) );
4343 } );
4444 };
4545
@@ -49,16 +49,16 @@
5050 } );
5151
5252 $dialog = $( '<div>' ).html( '' ).dialog( {
53 - 'title': mw.msg( 'ep-instructor-remove-title' ),
 53+ 'title': ep.msg( 'ep-instructor-remove-title' ),
5454 'minWidth': 550,
5555 'buttons': [
5656 {
57 - 'text': mw.msg( 'ep-instructor-remove-button' ),
 57+ 'text': ep.msg( 'ep-instructor-remove-button' ),
5858 'id': 'ep-instructor-remove-button',
5959 'click': doRemove
6060 },
6161 {
62 - 'text': mw.msg( 'ep-instructor-cancel-button' ),
 62+ 'text': ep.msg( 'ep-instructor-cancel-button' ),
6363 'id': 'ep-instructor-cancel-button',
6464 'click': function() {
6565 $dialog.dialog( 'close' );
@@ -111,21 +111,21 @@
112112 var $cancel = $( '#ep-instructor-add-cancel-button' );
113113
114114 $remove.button( 'option', 'disabled', true );
115 - $remove.button( 'option', 'label', mw.msg( 'ep-instructor-adding' ) );
 115+ $remove.button( 'option', 'label', ep.msg( 'ep-instructor-adding' ) );
116116
117117 ep.api.removeInstructor( {
118118 'courseid': this.courseId,
119119 'userid': this.userId,
120120 'reason': this.summaryInput.val()
121121 } ).done( function() {
122 - _this.$dialog.text( mw.msg( _this.selfMode ? 'ep-instructor-addittion-self-success' : 'ep-instructor-addittion-success' ) );
 122+ _this.$dialog.text( ep.msg( _this.selfMode ? 'ep-instructor-addittion-self-success' : 'ep-instructor-addittion-success', this.getName() ) );
123123 $add.remove();
124 - $cancel.button( 'option', 'label', mw.msg( 'ep-instructor-add-close-button' ) );
 124+ $cancel.button( 'option', 'label', ep.msg( 'ep-instructor-add-close-button' ) );
125125 $cancel.focus();
126126 } ).fail( function() {
127127 $add.button( 'option', 'disabled', false );
128 - $add.button( 'option', 'label', mw.msg( 'ep-instructor-add-retry' ) );
129 - alert( mw.msg( 'ep-instructor-addittion-failed' ) );
 128+ $add.button( 'option', 'label', ep.msg( 'ep-instructor-add-retry' ) );
 129+ alert( ep.msg( 'ep-instructor-addittion-failed' ) );
130130 } );
131131 };
132132
@@ -134,16 +134,16 @@
135135 };
136136
137137 this.$dialog = $( '<div>' ).html( '' ).dialog( {
138 - 'title': mw.msg( this.selfMode ? 'ep-instructor-add-self-title' : 'ep-instructor-add-title' ),
 138+ 'title': ep.msg( this.selfMode ? 'ep-instructor-add-self-title' : 'ep-instructor-add-title', this.getName() ),
139139 'minWidth': 550,
140140 'buttons': [
141141 {
142 - 'text': mw.msg( this.selfMode ? 'ep-instructor-add-self-button' : 'ep-instructor-add-button' ),
 142+ 'text': ep.msg( this.selfMode ? 'ep-instructor-add-self-button' : 'ep-instructor-add-button', this.getName() ),
143143 'id': 'ep-instructor-add-button',
144144 'click': this.doAdd
145145 },
146146 {
147 - 'text': mw.msg( 'ep-instructor-add-cancel-button' ),
 147+ 'text': ep.msg( 'ep-instructor-add-cancel-button' ),
148148 'id': 'ep-instructor-add-cancel-button',
149149 'click': function() {
150150 $dialog.dialog( 'close' );
@@ -152,7 +152,7 @@
153153 ]
154154 } );
155155
156 - this.$dialog.append( $( '<p>' ).text( gM(
 156+ this.$dialog.append( $( '<p>' ).text( gM(
157157 this.selfMode ? 'ep-instructor-add-self-text' : 'ep-instructor-add-text',
158158 this.courseName,
159159 this.getName()

Status & tagging log