Index: trunk/extensions/EducationProgram/resources/ep.api.js |
— | — | @@ -8,6 +8,20 @@ |
9 | 9 | |
10 | 10 | window.educationProgram = new( function() { |
11 | 11 | |
| 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 | + |
12 | 26 | this.api = new( function() { |
13 | 27 | |
14 | 28 | this.remove = function( data, callback ) { |
Index: trunk/extensions/EducationProgram/resources/ep.instructor.js |
— | — | @@ -7,7 +7,7 @@ |
8 | 8 | */ |
9 | 9 | |
10 | 10 | (function( $, mw, ep ) { |
11 | | - |
| 11 | + |
12 | 12 | $( document ).ready( function() { |
13 | 13 | |
14 | 14 | $( '.ep-instructor-remove' ).click( function( event ) { |
— | — | @@ -24,21 +24,21 @@ |
25 | 25 | var $cancel = $( '#ep-instructor-cancel-button' ); |
26 | 26 | |
27 | 27 | $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' ) ); |
29 | 29 | |
30 | 30 | ep.api.removeInstructor( { |
31 | 31 | 'courseid': courseId, |
32 | 32 | 'userid': userId, |
33 | 33 | 'reason': summaryInput.val() |
34 | 34 | } ).done( function() { |
35 | | - $dialog.text( mw.msg( 'ep-instructor-removal-success' ) ); |
| 35 | + $dialog.text( ep.msg( 'ep-instructor-removal-success' ) ); |
36 | 36 | $remove.remove(); |
37 | | - $cancel.button( 'option', 'label', mw.msg( 'ep-instructor-close-button' ) ); |
| 37 | + $cancel.button( 'option', 'label', ep.msg( 'ep-instructor-close-button' ) ); |
38 | 38 | $cancel.focus(); |
39 | 39 | } ).fail( function() { |
40 | 40 | $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' ) ); |
43 | 43 | } ); |
44 | 44 | }; |
45 | 45 | |
— | — | @@ -49,16 +49,16 @@ |
50 | 50 | } ); |
51 | 51 | |
52 | 52 | $dialog = $( '<div>' ).html( '' ).dialog( { |
53 | | - 'title': mw.msg( 'ep-instructor-remove-title' ), |
| 53 | + 'title': ep.msg( 'ep-instructor-remove-title' ), |
54 | 54 | 'minWidth': 550, |
55 | 55 | 'buttons': [ |
56 | 56 | { |
57 | | - 'text': mw.msg( 'ep-instructor-remove-button' ), |
| 57 | + 'text': ep.msg( 'ep-instructor-remove-button' ), |
58 | 58 | 'id': 'ep-instructor-remove-button', |
59 | 59 | 'click': doRemove |
60 | 60 | }, |
61 | 61 | { |
62 | | - 'text': mw.msg( 'ep-instructor-cancel-button' ), |
| 62 | + 'text': ep.msg( 'ep-instructor-cancel-button' ), |
63 | 63 | 'id': 'ep-instructor-cancel-button', |
64 | 64 | 'click': function() { |
65 | 65 | $dialog.dialog( 'close' ); |
— | — | @@ -111,21 +111,21 @@ |
112 | 112 | var $cancel = $( '#ep-instructor-add-cancel-button' ); |
113 | 113 | |
114 | 114 | $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' ) ); |
116 | 116 | |
117 | 117 | ep.api.removeInstructor( { |
118 | 118 | 'courseid': this.courseId, |
119 | 119 | 'userid': this.userId, |
120 | 120 | 'reason': this.summaryInput.val() |
121 | 121 | } ).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() ) ); |
123 | 123 | $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' ) ); |
125 | 125 | $cancel.focus(); |
126 | 126 | } ).fail( function() { |
127 | 127 | $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' ) ); |
130 | 130 | } ); |
131 | 131 | }; |
132 | 132 | |
— | — | @@ -134,16 +134,16 @@ |
135 | 135 | }; |
136 | 136 | |
137 | 137 | 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() ), |
139 | 139 | 'minWidth': 550, |
140 | 140 | 'buttons': [ |
141 | 141 | { |
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() ), |
143 | 143 | 'id': 'ep-instructor-add-button', |
144 | 144 | 'click': this.doAdd |
145 | 145 | }, |
146 | 146 | { |
147 | | - 'text': mw.msg( 'ep-instructor-add-cancel-button' ), |
| 147 | + 'text': ep.msg( 'ep-instructor-add-cancel-button' ), |
148 | 148 | 'id': 'ep-instructor-add-cancel-button', |
149 | 149 | 'click': function() { |
150 | 150 | $dialog.dialog( 'close' ); |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | ] |
154 | 154 | } ); |
155 | 155 | |
156 | | - this.$dialog.append( $( '<p>' ).text( gM( |
| 156 | + this.$dialog.append( $( '<p>' ).text( gM( |
157 | 157 | this.selfMode ? 'ep-instructor-add-self-text' : 'ep-instructor-add-text', |
158 | 158 | this.courseName, |
159 | 159 | this.getName() |