Index: trunk/extensions/WikiLove/WikiLove.api.php |
— | — | @@ -16,7 +16,7 @@ |
17 | 17 | } |
18 | 18 | |
19 | 19 | if ( $wgWikiLoveLogging ) { |
20 | | - $this->saveInDb( $talk, $params['subject'], $params['text'], $params['type'], isset( $params['email'] ) ? 1 : 0 ); |
| 20 | + $this->saveInDb( $talk, $params['subject'], $params['message'], $params['type'], isset( $params['email'] ) ? 1 : 0 ); |
21 | 21 | } |
22 | 22 | |
23 | 23 | $api = new ApiMain( new FauxRequest( array( |
— | — | @@ -30,7 +30,7 @@ |
31 | 31 | ), false, array( 'wsEditToken' => $wgRequest->getSessionData( 'wsEditToken' ) ) ), true ); |
32 | 32 | |
33 | 33 | if ( isset( $params['email'] ) ) { |
34 | | - $this->emailUser( $talk, $params['subject'], $params['email'] ); |
| 34 | + $this->emailUser( $talk, $params['subject'], $params['email'], $params['token'] ); |
35 | 35 | } |
36 | 36 | |
37 | 37 | $api->execute(); |
— | — | @@ -46,11 +46,12 @@ |
47 | 47 | /** |
48 | 48 | * @param $talk Title |
49 | 49 | * @param $subject |
50 | | - * @param $text |
| 50 | + * @param $message |
51 | 51 | * @param $type |
| 52 | + * @param $email |
52 | 53 | * @return void |
53 | 54 | */ |
54 | | - private function saveInDb( $talk, $subject, $text, $type, $email ) { |
| 55 | + private function saveInDb( $talk, $subject, $message, $type, $email ) { |
55 | 56 | global $wgUser; |
56 | 57 | $dbw = wfGetDB( DB_MASTER ); |
57 | 58 | $values = array( |
— | — | @@ -59,7 +60,7 @@ |
60 | 61 | 'wll_receiver' => User::newFromName( $talk->getSubjectPage()->getBaseText() )->getId(), |
61 | 62 | 'wll_type' => $type, |
62 | 63 | 'wll_subject' => $subject, |
63 | | - 'wll_message' => $text, |
| 64 | + 'wll_message' => $message, |
64 | 65 | 'wll_email' => $email, |
65 | 66 | ); |
66 | 67 | try{ |
— | — | @@ -69,12 +70,14 @@ |
70 | 71 | } |
71 | 72 | } |
72 | 73 | |
73 | | - private function emailUser( $talk, $subject, $text ) { |
| 74 | + private function emailUser( $talk, $subject, $text, $token ) { |
| 75 | + global $wgRequest; |
74 | 76 | $api = new ApiMain( new FauxRequest( array( |
75 | 77 | 'action' => 'emailuser', |
76 | 78 | 'target' => User::newFromName( $talk->getSubjectPage()->getBaseText() )->getName(), |
77 | 79 | 'subject' => $subject, |
78 | 80 | 'text' => $text, |
| 81 | + 'token' => $token, |
79 | 82 | ), false, array( 'wsEditToken' => $wgRequest->getSessionData( 'wsEditToken' ) ) ), true ); |
80 | 83 | try{ |
81 | 84 | $api->execute(); |
— | — | @@ -93,6 +96,10 @@ |
94 | 97 | ApiBase::PARAM_TYPE => 'string', |
95 | 98 | ApiBase::PARAM_REQUIRED => true, |
96 | 99 | ), |
| 100 | + 'message' => array( |
| 101 | + ApiBase::PARAM_TYPE => 'string', |
| 102 | + ApiBase::PARAM_REQUIRED => true, |
| 103 | + ), |
97 | 104 | 'token' => array( |
98 | 105 | ApiBase::PARAM_TYPE => 'string', |
99 | 106 | ApiBase::PARAM_REQUIRED => true, |
— | — | @@ -114,6 +121,7 @@ |
115 | 122 | return array( |
116 | 123 | 'title' => 'Title of the user or user talk page to send WikiLove to', |
117 | 124 | 'text' => 'Raw wikitext to add in the new section', |
| 125 | + 'message' => 'Actual message the user has entered, for logging purposes', |
118 | 126 | 'token' => 'Edit token. You can get one of these through prop=info', |
119 | 127 | 'subject' => 'Subject header of the new section', |
120 | 128 | 'type' => array( 'Type of WikiLove (for statistics); this corresponds with a type', |
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js |
— | — | @@ -26,7 +26,7 @@ |
27 | 27 | header: 'A barnstar for you!', // header that appears at the top of the talk page post (optional) |
28 | 28 | title: 'The Original Barnstar', // title that appears inside the award box (optional) |
29 | 29 | image: 'Original Barnstar Hires.png', // image for the award |
30 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' // message to use in email notification; $7 is replaced by the recipient's username |
| 30 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' // message to use in eemail notification; $7 is replaced by the recipient's username |
31 | 31 | }, |
32 | 32 | 'admins': { |
33 | 33 | fields: [ 'notify' ], |
— | — | @@ -35,7 +35,7 @@ |
36 | 36 | header: 'A barnstar for you!', |
37 | 37 | title: 'The Admin\'s Barnstar', |
38 | 38 | image: 'Administrator Barnstar Hires.png', |
39 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 39 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
40 | 40 | }, |
41 | 41 | 'antivandalism': { |
42 | 42 | fields: [ 'notify' ], |
— | — | @@ -44,7 +44,7 @@ |
45 | 45 | header: 'A barnstar for you!', |
46 | 46 | title: 'The Anti-Vandalism Barnstar', |
47 | 47 | image: 'Barnstar of Reversion Hires.png', |
48 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 48 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
49 | 49 | }, |
50 | 50 | 'diligence': { |
51 | 51 | fields: [ 'notify' ], |
— | — | @@ -53,7 +53,7 @@ |
54 | 54 | header: 'A barnstar for you!', |
55 | 55 | title: 'The Barnstar of Diligence', |
56 | 56 | image: 'Barnstar of Diligence Hires.png', |
57 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 57 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
58 | 58 | }, |
59 | 59 | 'diplomacy': { |
60 | 60 | fields: [ 'notify' ], |
— | — | @@ -62,7 +62,7 @@ |
63 | 63 | header: 'A barnstar for you!', |
64 | 64 | title: 'The Barnstar of Diplomacy', |
65 | 65 | image: 'Peace Barnstar Hires.png', |
66 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 66 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
67 | 67 | }, |
68 | 68 | 'goodhumor': { |
69 | 69 | fields: [ 'notify' ], |
— | — | @@ -71,7 +71,7 @@ |
72 | 72 | header: 'A barnstar for you!', |
73 | 73 | title: 'The Barnstar of Good Humor', |
74 | 74 | image: 'Barnstar of Reversion Hires.png', |
75 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 75 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
76 | 76 | }, |
77 | 77 | 'brilliant': { |
78 | 78 | fields: [ 'notify' ], |
— | — | @@ -80,7 +80,7 @@ |
81 | 81 | header: 'A barnstar for you!', |
82 | 82 | title: 'The Brilliant Idea Barnstar', |
83 | 83 | image: 'Brilliant Idea Barnstar Hires.png', |
84 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 84 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
85 | 85 | }, |
86 | 86 | 'citation': { |
87 | 87 | fields: [ 'notify' ], |
— | — | @@ -89,7 +89,7 @@ |
90 | 90 | header: 'A barnstar for you!', |
91 | 91 | title: 'The Citation Barnstar', |
92 | 92 | image: 'Citation Barnstar Hires.png', |
93 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 93 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
94 | 94 | }, |
95 | 95 | 'civility': { |
96 | 96 | fields: [ 'notify' ], |
— | — | @@ -98,7 +98,7 @@ |
99 | 99 | header: 'A barnstar for you!', |
100 | 100 | title: 'The Civility Barnstar', |
101 | 101 | image: 'Civility Barnstar Hires.png', |
102 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 102 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
103 | 103 | }, |
104 | 104 | 'copyeditor': { |
105 | 105 | fields: [ 'notify' ], |
— | — | @@ -107,7 +107,7 @@ |
108 | 108 | header: 'A barnstar for you!', |
109 | 109 | title: 'The Copyeditor\'s Barnstar', |
110 | 110 | image: 'Copyeditor Barnstar Hires.png', |
111 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 111 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
112 | 112 | }, |
113 | 113 | 'defender': { |
114 | 114 | fields: [ 'notify' ], |
— | — | @@ -116,7 +116,7 @@ |
117 | 117 | header: 'A barnstar for you!', |
118 | 118 | title: 'The Defender of the Wiki Barnstar', |
119 | 119 | image: 'WikiDefender Barnstar Hires.png', |
120 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 120 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
121 | 121 | }, |
122 | 122 | 'editors': { |
123 | 123 | fields: [ 'notify' ], |
— | — | @@ -125,7 +125,7 @@ |
126 | 126 | header: 'A barnstar for you!', |
127 | 127 | title: 'The Editor\'s Barnstar', |
128 | 128 | image: 'Editors Barnstar Hires.png', |
129 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 129 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
130 | 130 | }, |
131 | 131 | 'designers': { |
132 | 132 | fields: [ 'notify' ], |
— | — | @@ -134,7 +134,7 @@ |
135 | 135 | header: 'A barnstar for you!', |
136 | 136 | title: 'The Graphic Designer\'s Barnstar', |
137 | 137 | image: 'Rosetta Barnstar Hires.png', |
138 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 138 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
139 | 139 | }, |
140 | 140 | 'half': { |
141 | 141 | fields: [ 'notify' ], |
— | — | @@ -143,7 +143,7 @@ |
144 | 144 | header: 'A barnstar for you!', |
145 | 145 | title: 'The Half Barnstar', |
146 | 146 | image: 'Halfstar Hires.png', |
147 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 147 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
148 | 148 | }, |
149 | 149 | 'minor': { |
150 | 150 | fields: [ 'notify' ], |
— | — | @@ -152,7 +152,7 @@ |
153 | 153 | header: 'A barnstar for you!', |
154 | 154 | title: 'The Minor barnstar', |
155 | 155 | image: 'Minor Barnstar Hires.png', |
156 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 156 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
157 | 157 | }, |
158 | 158 | 'antispam': { |
159 | 159 | fields: [ 'notify' ], |
— | — | @@ -161,7 +161,7 @@ |
162 | 162 | header: 'A barnstar for you!', |
163 | 163 | title: 'The No Spam Barnstar', |
164 | 164 | image: 'No Spam Barnstar Hires.png', |
165 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 165 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
166 | 166 | }, |
167 | 167 | 'photographers': { |
168 | 168 | fields: [ 'notify' ], |
— | — | @@ -170,7 +170,7 @@ |
171 | 171 | header: 'A barnstar for you!', |
172 | 172 | title: 'The Photographer\'s Barnstar', |
173 | 173 | image: 'Camera Barnstar Hires.png', |
174 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 174 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
175 | 175 | }, |
176 | 176 | 'kindness': { |
177 | 177 | fields: [ 'notify' ], |
— | — | @@ -179,7 +179,7 @@ |
180 | 180 | header: 'A barnstar for you!', |
181 | 181 | title: 'The Random Acts of Kindness barnstar', |
182 | 182 | image: 'Kindness Barnstar Hires.png', |
183 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 183 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
184 | 184 | }, |
185 | 185 | 'reallife': { |
186 | 186 | fields: [ 'notify' ], |
— | — | @@ -188,7 +188,7 @@ |
189 | 189 | header: 'A barnstar for you!', |
190 | 190 | title: 'The Real Life Barnstar', |
191 | 191 | image: 'Real Life Barnstar.jpg', |
192 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 192 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
193 | 193 | }, |
194 | 194 | 'resilient': { |
195 | 195 | fields: [ 'notify' ], |
— | — | @@ -197,7 +197,7 @@ |
198 | 198 | header: 'A barnstar for you!', |
199 | 199 | title: 'The Resilient Barnstar', |
200 | 200 | image: 'Resilient Barnstar Hires.png', |
201 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 201 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
202 | 202 | }, |
203 | 203 | 'rosetta': { |
204 | 204 | fields: [ 'notify' ], |
— | — | @@ -206,7 +206,7 @@ |
207 | 207 | header: 'A barnstar for you!', |
208 | 208 | title: 'The Rosetta Barnstar', |
209 | 209 | image: 'Rosetta Barnstar Hires.png', |
210 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 210 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
211 | 211 | }, |
212 | 212 | 'special': { |
213 | 213 | fields: [ 'notify' ], |
— | — | @@ -215,7 +215,7 @@ |
216 | 216 | header: 'A barnstar for you!', |
217 | 217 | title: 'The Special Barnstar', |
218 | 218 | image: 'Special Barnstar Hires.png', |
219 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 219 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
220 | 220 | }, |
221 | 221 | 'surreal': { |
222 | 222 | fields: [ 'notify' ], |
— | — | @@ -224,7 +224,7 @@ |
225 | 225 | header: 'A barnstar for you!', |
226 | 226 | title: 'The Surreal Barnstar', |
227 | 227 | image: 'Surreal Barnstar Hires.png', |
228 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 228 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
229 | 229 | }, |
230 | 230 | 'teamwork': { |
231 | 231 | fields: [ 'notify' ], |
— | — | @@ -233,7 +233,7 @@ |
234 | 234 | header: 'A barnstar for you!', |
235 | 235 | title: 'The Teamwork Barnstar', |
236 | 236 | image: 'Team Barnstar Hires.png', |
237 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 237 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
238 | 238 | }, |
239 | 239 | 'technical': { |
240 | 240 | fields: [ 'notify' ], |
— | — | @@ -242,7 +242,7 @@ |
243 | 243 | header: 'A barnstar for you!', |
244 | 244 | title: 'The Technical Barnstar', |
245 | 245 | image: 'Vitruvian Barnstar Hires.png', |
246 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 246 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
247 | 247 | }, |
248 | 248 | 'tireless': { |
249 | 249 | fields: [ 'notify' ], |
— | — | @@ -251,7 +251,7 @@ |
252 | 252 | header: 'A barnstar for you!', |
253 | 253 | title: 'The Tireless Contributor Barnstar', |
254 | 254 | image: 'Tireless Contributor Barnstar Hires.gif', |
255 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 255 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
256 | 256 | }, |
257 | 257 | 'writers': { |
258 | 258 | fields: [ 'notify' ], |
— | — | @@ -260,7 +260,7 @@ |
261 | 261 | header: 'A barnstar for you!', |
262 | 262 | title: 'The Writer\'s Barnstar', |
263 | 263 | image: 'Writers Barnstar Hires.png', |
264 | | - mail: 'Hello $7!\n\nI just awarded you a barnstar.' |
| 264 | + email: 'Hello $7!\n\nI just awarded you a barnstar.' |
265 | 265 | } |
266 | 266 | }, |
267 | 267 | icon: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-barnstar.png' // icon for left-side menu |
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js |
— | — | @@ -240,9 +240,10 @@ |
241 | 241 | $.wikiLove.showGallery(); // build gallery from array of images |
242 | 242 | } else { |
243 | 243 | // gallery is a category |
244 | | - $( '#mw-wikilove-gallery-label' ).show(); |
245 | | - $( '#mw-wikilove-gallery' ).show(); |
246 | | - $.wikiLove.makeGallery(); // build gallery from category |
| 244 | + // not supported right now |
| 245 | + $( '#mw-wikilove-gallery-label' ).hide(); |
| 246 | + $( '#mw-wikilove-gallery' ).hide(); |
| 247 | + //$.wikiLove.makeGallery(); // build gallery from category |
247 | 248 | } |
248 | 249 | } |
249 | 250 | else { |
— | — | @@ -294,23 +295,24 @@ |
295 | 296 | $.wikiLove.showError( 'wikilove-err-sig' ); return false; |
296 | 297 | } |
297 | 298 | |
298 | | - var msg = $.wikiLove.prepareMsg( |
| 299 | + var text = $.wikiLove.prepareMsg( |
299 | 300 | $.wikiLove.currentTypeOrSubtype.text || $.wikiLove.options.defaultText, |
300 | 301 | $.wikiLove.currentTypeOrSubtype.imageSize, |
301 | 302 | $.wikiLove.currentTypeOrSubtype.backgroundColor, |
302 | 303 | $.wikiLove.currentTypeOrSubtype.borderColor |
303 | 304 | ); |
304 | 305 | |
305 | | - $.wikiLove.doPreview( '==' + $( '#mw-wikilove-header' ).val() + "==\n" + msg ); |
| 306 | + $.wikiLove.doPreview( '==' + $( '#mw-wikilove-header' ).val() + "==\n" + text ); |
306 | 307 | $.wikiLove.previewData = { |
307 | 308 | 'header': $( '#mw-wikilove-header' ).val(), |
308 | | - 'msg': msg, |
| 309 | + 'text': text, |
| 310 | + 'message': $( '#mw-wikilove-message' ).val(), |
309 | 311 | 'type': $.wikiLove.currentTypeId |
310 | 312 | + ($.wikiLove.currentSubtypeId !== null ? '-' + $.wikiLove.currentSubtypeId : '') |
311 | 313 | }; |
312 | 314 | |
313 | 315 | if ( $( '#mw-wikilove-notify-checkbox:checked' ).val() && $.wikiLove.emailable ) { |
314 | | - $.wikiLove.previewData.mail = $.wikiLove.prepareMsg( $.wikiLove.currentTypeOrSubtype.mail ); |
| 316 | + $.wikiLove.previewData.email = $.wikiLove.prepareMsg( $.wikiLove.currentTypeOrSubtype.email ); |
315 | 317 | } |
316 | 318 | }, |
317 | 319 | |
— | — | @@ -385,14 +387,14 @@ |
386 | 388 | */ |
387 | 389 | submitSend: function( e ) { |
388 | 390 | e.preventDefault(); |
389 | | - $.wikiLove.doSend( $.wikiLove.previewData.header, $.wikiLove.previewData.msg, |
390 | | - $.wikiLove.previewData.type, $.wikiLove.previewData.notify ); |
| 391 | + $.wikiLove.doSend( $.wikiLove.previewData.header, $.wikiLove.previewData.text, |
| 392 | + $.wikiLove.previewData.message, $.wikiLove.previewData.type, $.wikiLove.previewData.email ); |
391 | 393 | }, |
392 | 394 | |
393 | 395 | /* |
394 | 396 | * Fires the final AJAX request and then redirects to the talk page where the content is added. |
395 | 397 | */ |
396 | | - doSend: function( subject, wikitext, type, mail ) { |
| 398 | + doSend: function( subject, wikitext, message, type, email ) { |
397 | 399 | $( '#mw-wikilove-send-spinner' ).fadeIn( 200 ); |
398 | 400 | |
399 | 401 | var sendData = { |
— | — | @@ -401,12 +403,13 @@ |
402 | 404 | 'title': mw.config.get( 'wgPageName' ), |
403 | 405 | 'type': type, |
404 | 406 | 'text': wikitext, |
| 407 | + 'message': message, |
405 | 408 | 'subject': subject, |
406 | 409 | 'token': mw.user.tokens.get( 'editToken' ) |
407 | 410 | }; |
408 | 411 | |
409 | | - if ( mail ) { |
410 | | - sendData.email = mail; |
| 412 | + if ( email ) { |
| 413 | + sendData.email = email; |
411 | 414 | } |
412 | 415 | |
413 | 416 | $.ajax({ |
— | — | @@ -418,7 +421,7 @@ |
419 | 422 | $( '#mw-wikilove-send-spinner' ).fadeOut( 200 ); |
420 | 423 | |
421 | 424 | if ( typeof data.error !== 'undefined' ) { |
422 | | - $( '#mw-wikilove-preview' ).append( '<div class="wlError">' + mw.html.escape( data.error.info ) + '<div>' ); |
| 425 | + $( '#mw-wikilove-preview' ).append( '<div class="mw-wikilove-error">' + mw.html.escape( data.error.info ) + '<div>' ); |
423 | 426 | return; |
424 | 427 | } |
425 | 428 | |