r90567 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r90566‎ | r90567 | r90568 >
Date:00:55, 22 June 2011
Author:kaldari
Status:resolved (Comments)
Tags:
Comment:
making message field configurable in preparation for welcome templates, disabling email for barnstars for now (per Howie and Alolita), making label verbiage consistant
Modified paths:
  • /trunk/extensions/WikiLove/WikiLove.i18n.php (modified) (history)
  • /trunk/extensions/WikiLove/WikiLove.php (modified) (history)
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js (modified) (history)
  • /trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js (modified) (history)

Diff [purge]

Index: trunk/extensions/WikiLove/WikiLove.php
@@ -98,6 +98,7 @@
9999 'wikilove-get-started-list-3',
100100 'wikilove-add-details',
101101 'wikilove-image',
 102+ 'wikilove-select-image',
102103 'wikilove-header',
103104 'wikilove-title',
104105 'wikilove-enter-message',
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.defaultOptions.js
@@ -20,7 +20,7 @@
2121 // note that when not using subtypes you should use these subtype options
2222 // for the top-level type
2323 'original': {
24 - fields: [ 'notify' ], // fields to ask for in form
 24+ fields: [ 'message' ], // fields to ask for in form
2525 option: 'Original Barnstar', // option listed in the select list
2626 descr: 'This barnstar is given to recognize particularly fine contributions to Wikipedia, to let people know that their hard work is seen and appreciated.', // description
2727 header: 'A barnstar for you!', // header that appears at the top of the talk page post (optional)
@@ -29,7 +29,7 @@
3030 email: 'Hello $7!\n\nI just awarded you a barnstar.' // message to use in email notification; $7 is replaced by the recipient's username
3131 },
3232 'admins': {
33 - fields: [ 'notify' ],
 33+ fields: [ 'message' ],
3434 option: 'Admin\'s Barnstar',
3535 descr: 'The Admin\'s Barnstar may be awarded to an administrator who made a particularly difficult decision or performed a tedious but needed admin task.',
3636 header: 'A barnstar for you!',
@@ -38,7 +38,7 @@
3939 email: 'Hello $7!\n\nI just awarded you a barnstar.'
4040 },
4141 'antivandalism': {
42 - fields: [ 'notify' ],
 42+ fields: [ 'message' ],
4343 option: 'Anti-Vandalism Barnstar',
4444 descr: 'The Anti-Vandalism Barnstar may be awarded to those who show great contributions to protecting and reverting attacks of vandalism on Wikipedia.',
4545 header: 'A barnstar for you!',
@@ -47,7 +47,7 @@
4848 email: 'Hello $7!\n\nI just awarded you a barnstar.'
4949 },
5050 'diligence': {
51 - fields: [ 'notify' ],
 51+ fields: [ 'message' ],
5252 option: 'Barnstar of Diligence',
5353 descr: 'The Barnstar of Diligence may be awarded in recognition of a combination of extraordinary scrutiny, precision and community service.',
5454 header: 'A barnstar for you!',
@@ -56,7 +56,7 @@
5757 email: 'Hello $7!\n\nI just awarded you a barnstar.'
5858 },
5959 'diplomacy': {
60 - fields: [ 'notify' ],
 60+ fields: [ 'message' ],
6161 option: 'Barnstar of Diplomacy',
6262 descr: 'The Barnstar of Diplomacy is awarded to users who have helped to resolve, peacefully, conflicts on Wikipedia.',
6363 header: 'A barnstar for you!',
@@ -65,7 +65,7 @@
6666 email: 'Hello $7!\n\nI just awarded you a barnstar.'
6767 },
6868 'goodhumor': {
69 - fields: [ 'notify' ],
 69+ fields: [ 'message' ],
7070 option: 'Barnstar of Good Humor',
7171 descr: 'The Barnstar of Good Humor may be awarded to Wikipedians who consistently lighten the mood, defuse conflicts, and make Wikipedia a better place to be.',
7272 header: 'A barnstar for you!',
@@ -74,7 +74,7 @@
7575 email: 'Hello $7!\n\nI just awarded you a barnstar.'
7676 },
7777 'brilliant': {
78 - fields: [ 'notify' ],
 78+ fields: [ 'message' ],
7979 option: 'Brilliant Idea Barnstar',
8080 descr: 'The Brilliant Idea Barnstar may be awarded to a user who figures out an elegant solution to a particularly difficult problem.',
8181 header: 'A barnstar for you!',
@@ -83,7 +83,7 @@
8484 email: 'Hello $7!\n\nI just awarded you a barnstar.'
8585 },
8686 'citation': {
87 - fields: [ 'notify' ],
 87+ fields: [ 'message' ],
8888 option: 'Citation Barnstar',
8989 descr: 'The Citation Barnstar is awarded to users who provide references and in-line citations to previously unsourced articles.',
9090 header: 'A barnstar for you!',
@@ -92,7 +92,7 @@
9393 email: 'Hello $7!\n\nI just awarded you a barnstar.'
9494 },
9595 'civility': {
96 - fields: [ 'notify' ],
 96+ fields: [ 'message' ],
9797 option: 'Civility Barnstar',
9898 descr: 'The Civility Barnstar may be awarded to any user who excels at maintaining civility in the midst of contentious situations.',
9999 header: 'A barnstar for you!',
@@ -101,7 +101,7 @@
102102 email: 'Hello $7!\n\nI just awarded you a barnstar.'
103103 },
104104 'copyeditor': {
105 - fields: [ 'notify' ],
 105+ fields: [ 'message' ],
106106 option: 'Copyeditor\'s Barnstar',
107107 descr: 'The Copyeditor\'s Barnstar is awarded for excellence in correcting spelling, grammar, punctuation, and style issues.',
108108 header: 'A barnstar for you!',
@@ -110,7 +110,7 @@
111111 email: 'Hello $7!\n\nI just awarded you a barnstar.'
112112 },
113113 'defender': {
114 - fields: [ 'notify' ],
 114+ fields: [ 'message' ],
115115 option: 'Defender of the Wiki Barnstar',
116116 descr: 'The Defender of the Wiki may be awarded to those who have gone above and beyond to prevent Wikipedia from being used for fraudulent purposes.',
117117 header: 'A barnstar for you!',
@@ -119,7 +119,7 @@
120120 email: 'Hello $7!\n\nI just awarded you a barnstar.'
121121 },
122122 'editors': {
123 - fields: [ 'notify' ],
 123+ fields: [ 'message' ],
124124 option: 'Editor\'s Barnstar',
125125 descr: 'The Editor\'s Barnstar is awarded to individuals who display particularly fine decisions in general editing.',
126126 header: 'A barnstar for you!',
@@ -128,7 +128,7 @@
129129 email: 'Hello $7!\n\nI just awarded you a barnstar.'
130130 },
131131 'designers': {
132 - fields: [ 'notify' ],
 132+ fields: [ 'message' ],
133133 option: 'Graphic Designer\'s Barnstar',
134134 descr: 'The Graphic Designer\'s Barnstar may be awarded to those who work tirelessly to provide Wikipedia with free, high-quality graphics.',
135135 header: 'A barnstar for you!',
@@ -137,7 +137,7 @@
138138 email: 'Hello $7!\n\nI just awarded you a barnstar.'
139139 },
140140 'half': {
141 - fields: [ 'notify' ],
 141+ fields: [ 'message' ],
142142 option: 'Half Barnstar',
143143 descr: 'The Half Barnstar is awarded for excellence in cooperation, especially for productive editing with someone who holds an opposing viewpoint.',
144144 header: 'A barnstar for you!',
@@ -146,7 +146,7 @@
147147 email: 'Hello $7!\n\nI just awarded you a barnstar.'
148148 },
149149 'minor': {
150 - fields: [ 'notify' ],
 150+ fields: [ 'message' ],
151151 option: 'Minor Barnstar',
152152 descr: 'Minor edits are often overlooked, but are essential contributions to Wikipedia. The Minor Barnstar is awarded for making minor edits of the utmost quality.',
153153 header: 'A barnstar for you!',
@@ -155,7 +155,7 @@
156156 email: 'Hello $7!\n\nI just awarded you a barnstar.'
157157 },
158158 'antispam': {
159 - fields: [ 'notify' ],
 159+ fields: [ 'message' ],
160160 option: 'No Spam Barnstar',
161161 descr: 'The Anti-Spam Barnstar is awarded to users who do an exceptional job fighting against spam on Wikipedia.',
162162 header: 'A barnstar for you!',
@@ -164,7 +164,7 @@
165165 email: 'Hello $7!\n\nI just awarded you a barnstar.'
166166 },
167167 'photographers': {
168 - fields: [ 'notify' ],
 168+ fields: [ 'message' ],
169169 option: 'Photographer\'s Barnstar',
170170 descr: 'The Photographer\'s Barnstar is awarded to those individuals who tirelessly improve the Wikipedia with their photographic skills and contributions.',
171171 header: 'A barnstar for you!',
@@ -173,7 +173,7 @@
174174 email: 'Hello $7!\n\nI just awarded you a barnstar.'
175175 },
176176 'kindness': {
177 - fields: [ 'notify' ],
 177+ fields: [ 'message' ],
178178 option: 'Random Acts of Kindness Barnstar',
179179 descr: 'The Random Acts of Kindness Barnstar may be awarded to those that show a pattern of going the extra mile to be nice, without being asked.',
180180 header: 'A barnstar for you!',
@@ -182,7 +182,7 @@
183183 email: 'Hello $7!\n\nI just awarded you a barnstar.'
184184 },
185185 'reallife': {
186 - fields: [ 'notify' ],
 186+ fields: [ 'message' ],
187187 option: 'Real Life Barnstar',
188188 descr: 'The Real Life Barnstar is awarded to editors who make contributions both online and offline, by organizing wiki-related real-life events.',
189189 header: 'A barnstar for you!',
@@ -191,7 +191,7 @@
192192 email: 'Hello $7!\n\nI just awarded you a barnstar.'
193193 },
194194 'resilient': {
195 - fields: [ 'notify' ],
 195+ fields: [ 'message' ],
196196 option: 'Resilient Barnstar',
197197 descr: 'The Resilient Barnstar may be given to any editor who learns and improves from criticisms, never letting mistakes impede their growth as a Wikipedian.',
198198 header: 'A barnstar for you!',
@@ -200,7 +200,7 @@
201201 email: 'Hello $7!\n\nI just awarded you a barnstar.'
202202 },
203203 'rosetta': {
204 - fields: [ 'notify' ],
 204+ fields: [ 'message' ],
205205 option: 'Rosetta Barnstar',
206206 descr: 'The Rosetta Barnstar may be given to any editor who exhibits outstanding translation efforts on Wikipedia.',
207207 header: 'A barnstar for you!',
@@ -209,7 +209,7 @@
210210 email: 'Hello $7!\n\nI just awarded you a barnstar.'
211211 },
212212 'special': {
213 - fields: [ 'notify' ],
 213+ fields: [ 'message' ],
214214 option: 'Special Barnstar',
215215 descr: 'The Special Barnstar may be awarded to a user as a gesture of appreciation when there is no other barnstar which would be appropriate.',
216216 header: 'A barnstar for you!',
@@ -218,7 +218,7 @@
219219 email: 'Hello $7!\n\nI just awarded you a barnstar.'
220220 },
221221 'surreal': {
222 - fields: [ 'notify' ],
 222+ fields: [ 'message' ],
223223 option: 'Surreal Barnstar',
224224 descr: 'The Surreal Barnstar may be awarded to any Wikipedian who adds "special flavor" to the community by acting as a sort of wildcard.',
225225 header: 'A barnstar for you!',
@@ -227,7 +227,7 @@
228228 email: 'Hello $7!\n\nI just awarded you a barnstar.'
229229 },
230230 'teamwork': {
231 - fields: [ 'notify' ],
 231+ fields: [ 'message' ],
232232 option: 'Teamwork Barnstar',
233233 descr: 'The Teamwork Barnstar may be awarded when several editors work together to improve an article.',
234234 header: 'A barnstar for you!',
@@ -236,7 +236,7 @@
237237 email: 'Hello $7!\n\nI just awarded you a barnstar.'
238238 },
239239 'technical': {
240 - fields: [ 'notify' ],
 240+ fields: [ 'message' ],
241241 option: 'Technical Barnstar',
242242 descr: 'The Technical Barnstar may be awarded to anyone who has enhanced Wikipedia through their technical work (programming, bot building, link repair, etc.).',
243243 header: 'A barnstar for you!',
@@ -245,7 +245,7 @@
246246 email: 'Hello $7!\n\nI just awarded you a barnstar.'
247247 },
248248 'tireless': {
249 - fields: [ 'notify' ],
 249+ fields: [ 'message' ],
250250 option: 'Tireless Contributor Barnstar',
251251 descr: 'The Tireless Contributor Barnstar is awarded to especially tireless Wikipedians who contribute an especially large body of work without sacrificing quality.',
252252 header: 'A barnstar for you!',
@@ -254,7 +254,7 @@
255255 email: 'Hello $7!\n\nI just awarded you a barnstar.'
256256 },
257257 'writers': {
258 - fields: [ 'notify' ],
 258+ fields: [ 'message' ],
259259 option: 'Writer\'s Barnstar',
260260 descr: 'The Writer\'s Barnstar may be awarded to any user who has written a large number of articles or has contributed a large number of edits.',
261261 header: 'A barnstar for you!',
@@ -267,7 +267,7 @@
268268 },
269269 'beer': {
270270 name: 'Beer',
271 - fields: [ 'header' ],
 271+ fields: [ 'header', 'message' ],
272272 header: 'A beer for you!',
273273 text: '[[$3|left|150px]]\n$1\n\n~~~~\n<br style="clear: both"/>', // custom text
274274 gallery: {
@@ -277,9 +277,28 @@
278278 },
279279 icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-beer.png' // icon for left-side menu
280280 },
 281+ 'food': {
 282+ name: 'Food', // name of the type (appears in the types menu)
 283+ select: 'Select food:', // subtype select label
 284+ subtypes: { // some different subtypes
 285+ // note that when not using subtypes you should use these subtype options
 286+ // for the top-level type
 287+ 'cookie': {
 288+ text: '{| style="background-color: $5; border: 1px solid $6;"\n\
 289+|style="vertical-align: middle; padding: 5px;" | [[$3|$4]]\n\
 290+|style="vertical-align: middle; padding: 3px;" | $1 ~~~~\n\
 291+|}',
 292+ fields: [ 'header', 'message' ], // fields to ask for in form
 293+ option: 'Cookie', // option listed in the select list
 294+ header: 'A cookie for you!', // header that appears at the top of the talk page post (optional)
 295+ image: 'Choco_chip_cookie.png' // image for the award
 296+ }
 297+ },
 298+ icon: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-cookie.png' // icon for left-side menu
 299+ },
281300 'kitten': {
282301 name: 'Kitten',
283 - fields: [ 'header' ],
 302+ fields: [ 'header', 'message' ],
284303 header: 'A kitten for you!',
285304 text: '[[$3|left|150px]]\n$1\n\n~~~~\n<br style="clear: both"/>', // $3 is the image filename
286305 gallery: {
@@ -292,7 +311,7 @@
293312 // default type, nice to leave this one in place when adding other types
294313 'makeyourown': {
295314 name: mw.msg( 'wikilove-type-makeyourown' ),
296 - fields: [ 'header', 'title', 'image', 'notify' ],
 315+ fields: [ 'header', 'title', 'image', 'message' ],
297316 imageSize: '150px',
298317 icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-create.png' // icon for left-side menu
299318 }
Index: trunk/extensions/WikiLove/modules/ext.wikiLove/ext.wikiLove.core.js
@@ -66,7 +66,7 @@
6767 <label for="mw-wikilove-subtype" id="mw-wikilove-subtype-label"></label>\
6868 <select id="mw-wikilove-subtype"></select>\
6969 <div id="mw-wikilove-subtype-description"></div>\
70 - <label id="mw-wikilove-gallery-label"><html:msg key="wikilove-image"/></label>\
 70+ <label id="mw-wikilove-gallery-label"><html:msg key="wikilove-select-image"/></label>\
7171 <div id="mw-wikilove-gallery">\
7272 <div id="mw-wikilove-gallery-error">\
7373 <html:msg key="wikilove-err-gallery"/>\
@@ -82,7 +82,7 @@
8383 <label for="mw-wikilove-image" id="mw-wikilove-image-label"><html:msg key="wikilove-image"/></label>\
8484 <input type="text" class="text" id="mw-wikilove-image"/>\
8585 <label for="mw-wikilove-message" id="mw-wikilove-message-label"><html:msg key="wikilove-enter-message"/></label>\
86 - <span class="mw-wikilove-note"><html:msg key="wikilove-omit-sig"/></span>\
 86+ <span class="mw-wikilove-note" id="mw-wikilove-message-note"><html:msg key="wikilove-omit-sig"/></span>\
8787 <textarea id="mw-wikilove-message"></textarea>\
8888 <div id="mw-wikilove-notify">\
8989 <input type="checkbox" id="mw-wikilove-notify-checkbox" name="notify"/>\
@@ -210,21 +210,21 @@
211211 $( '#mw-wikilove-subtype-description').hide();
212212 }
213213
214 - // show or hide header label and textbox depending on whether a predefined header exists
 214+ // show or hide header label and textbox depending on fields configuration
215215 $( '#mw-wikilove-header, #mw-wikilove-header-label' )
216216 .toggle( $.inArray( 'header', currentTypeOrSubtype.fields ) >= 0 );
217217
218218 // set the new text for the header textbox
219219 $( '#mw-wikilove-header' ).val( currentTypeOrSubtype.header || '' );
220220
221 - // show or hide title label and textbox depending on whether a predefined title exists
 221+ // show or hide title label and textbox depending on fields configuration
222222 $( '#mw-wikilove-title, #mw-wikilove-title-label')
223223 .toggle( $.inArray( 'title', currentTypeOrSubtype.fields ) >= 0 );
224224
225225 // set the new text for the title textbox
226226 $( '#mw-wikilove-title' ).val( currentTypeOrSubtype.title || '' );
227227
228 - // show or hide image label and textbox depending on whether a predefined image exists
 228+ // show or hide image label and textbox depending on fields configuration
229229 $( '#mw-wikilove-image, #mw-wikilove-image-label')
230230 .toggle( $.inArray( 'image', currentTypeOrSubtype.fields ) >= 0 );
231231
@@ -241,6 +241,13 @@
242242 $( '#mw-wikilove-gallery, #mw-wikilove-gallery-label' ).hide();
243243 }
244244
 245+ // show or hide message label and textbox depending on fields configuration
 246+ $( '#mw-wikilove-message, #mw-wikilove-message-label, #mw-wikilove-message-note' )
 247+ .toggle( $.inArray( 'message', currentTypeOrSubtype.fields ) >= 0 );
 248+
 249+ // set the new text for the message textbox
 250+ $( '#mw-wikilove-message' ).val( currentTypeOrSubtype.message || '' );
 251+
245252 if( $.inArray( 'notify', currentTypeOrSubtype.fields ) >= 0 && emailable ) {
246253 $( '#mw-wikilove-notify' ).show();
247254 } else {
Index: trunk/extensions/WikiLove/WikiLove.i18n.php
@@ -24,9 +24,10 @@
2525 'wikilove-get-started-list-2' => 'Add details to your WikiLove',
2626 'wikilove-get-started-list-3' => 'Send your WikiLove!',
2727 'wikilove-add-details' => 'Add details',
28 - 'wikilove-image' => 'Image:',
29 - 'wikilove-header' => 'Header:',
30 - 'wikilove-title' => 'Title:',
 28+ 'wikilove-image' => 'Enter an image:',
 29+ 'wikilove-select-image' => 'Select an image:',
 30+ 'wikilove-header' => 'Enter a header:',
 31+ 'wikilove-title' => 'Enter a title:',
3132 'wikilove-enter-message' => 'Enter a message:',
3233 'wikilove-omit-sig' => '(without a signature)',
3334 'wikilove-button-preview' => 'Preview',

Follow-up revisions

RevisionCommit summaryAuthorDate
r90621fixing bad path in r90567kaldari22:40, 22 June 2011
r90879In r90567 the message box was made shown/hidden based on configuration option...janpaul12315:01, 27 June 2011

Comments

#Comment by Krinkle (talk | contribs)   17:42, 22 June 2011
+			icon: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-cookie.png' // icon for left-side menu

Same gotcha as fixed earlier, the above returns a broken/404 images on installations like Wikimedia's and others running off-trunk with extensions in a custom location. Use instead:

 			icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/WikiLove/modules/ext.wikiLove/images/...
#Comment by Krinkle (talk | contribs)   17:42, 22 June 2011
+	icon: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/icons/wikilove-icon-cookie.png' // icon for left-side menu
Same gotcha as fixed earlier, the above returns a broken/404 images on installations like Wikimedia's and others running from SVN with extensions in a custom location. Use instead:
<pre>		icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/WikiLove/modules/ext.wikiLove/images/...
#Comment by Krinkle (talk | contribs)   17:43, 22 June 2011
+	icon: mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + '/extensions/WikiLove/modules/ext.wikiLove/images/...

Same gotcha as fixed earlier, the above returns a broken/404 images on installations like Wikimedia's and others running from SVN with extensions in a custom location. Use instead:

	icon: mw.config.get( 'wgExtensionAssetsPath' ) + '/WikiLove/modules/ext.wikiLove/images/...
#Comment by Kaldari (talk | contribs)   22:41, 22 June 2011

Oops, dumb mistake. Fixed in r90621.

#Comment by JanPaul123 (talk | contribs)   15:02, 27 June 2011

I see that you made the message box shown/hidden based on configuration options, but when shown it is still not required to enter a message. I guess we can put that back in now, did so in r90879.

Status & tagging log