Index: trunk/extensions/MoodBar/modules/jquery.moodBar/jquery.moodBar.js |
— | — | @@ -48,6 +48,42 @@ |
49 | 49 | success: fb.callback, |
50 | 50 | dataType: 'json' |
51 | 51 | } ); |
| 52 | + }, |
| 53 | + |
| 54 | + /* ajax method to set user email. |
| 55 | + * called when user email address is not sent. |
| 56 | + */ |
| 57 | + 'setEmail': function( mbProps ) { |
| 58 | + var apiRequest = { |
| 59 | + 'action': 'moodbarsetuseremail', |
| 60 | + 'mbaction': 'setemail', |
| 61 | + 'email': mbProps.email, |
| 62 | + 'token': mw.config.get('mbEditToken'), |
| 63 | + 'format':'json' |
| 64 | + }; |
| 65 | + return $.ajax( { |
| 66 | + type: 'post', |
| 67 | + url: mw.util.wikiScript( 'api' ), |
| 68 | + data: apiRequest, |
| 69 | + success: mbProps.callback, |
| 70 | + dataType: 'json' |
| 71 | + } ); |
| 72 | + }, |
| 73 | + |
| 74 | + 'resendVerification': function (mbProps) { |
| 75 | + var apiRequest = { |
| 76 | + 'action': 'moodbarsetuseremail', |
| 77 | + 'mbaction': 'resendverification', |
| 78 | + 'token': mw.config.get('mbEditToken'), |
| 79 | + 'format':'json' |
| 80 | + }; |
| 81 | + return $.ajax( { |
| 82 | + type: 'post', |
| 83 | + url: mw.util.wikiScript( 'api' ), |
| 84 | + data: apiRequest, |
| 85 | + success: mbProps.callback, |
| 86 | + dataType: 'json' |
| 87 | + } ); |
52 | 88 | } |
53 | 89 | }; |
54 | 90 | } ) ( jQuery ); |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.init.js |
— | — | @@ -2,12 +2,14 @@ |
3 | 3 | * Initialization script for the MoodBar MediaWiki extension |
4 | 4 | * |
5 | 5 | * @author Timo Tijhof, 2011 |
| 6 | + * @author Rob Moen, 2011 |
6 | 7 | */ |
7 | 8 | ( function( $ ) { |
8 | 9 | |
9 | 10 | var mb = mw.moodBar = { |
10 | 11 | |
11 | | - conf: mw.config.get( 'mbConfig' ), |
| 12 | + conf: mw.config.get( 'mbConfig' ), |
| 13 | + userData: {}, //set by getUserInfo |
12 | 14 | |
13 | 15 | cookiePrefix: function() { |
14 | 16 | return 'ext.moodBar@' + mb.conf.bucketConfig.version + '-'; |
— | — | @@ -54,13 +56,40 @@ |
55 | 57 | .wrap( '<p>' ) |
56 | 58 | .parent() |
57 | 59 | .appendTo( ui.pMoodbar ); |
58 | | - |
| 60 | + |
59 | 61 | // Inject portlet into document, when document is ready |
60 | 62 | $( mb.inject ); |
| 63 | + |
| 64 | + // Assign user props to mb.userData object. |
| 65 | + mb.getUserInfo(); |
61 | 66 | }, |
62 | 67 | |
63 | 68 | inject: function() { |
64 | 69 | $( '#mw-head' ).append( mb.ui.pMoodbar ); |
| 70 | + }, |
| 71 | + |
| 72 | + getUserInfo: function() { |
| 73 | + var query = { |
| 74 | + action: 'query', |
| 75 | + meta: 'userinfo', |
| 76 | + uiprop: 'email', |
| 77 | + format: 'json' |
| 78 | + }; |
| 79 | + $(document).ready( function() { |
| 80 | + $.ajax( { |
| 81 | + 'type': 'POST', |
| 82 | + 'url': mw.util.wikiScript( 'api' ), |
| 83 | + 'data': query, |
| 84 | + 'success': function (data) { |
| 85 | + mb.userData = data.query.userinfo; |
| 86 | + }, |
| 87 | + 'error': function( jqXHR, textStatus, errorThrown ) { |
| 88 | + mb.userData = null; |
| 89 | + }, |
| 90 | + 'dataType': 'json' |
| 91 | + } ); |
| 92 | + }); |
| 93 | + |
65 | 94 | } |
66 | 95 | |
67 | 96 | }; |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.css |
— | — | @@ -96,7 +96,7 @@ |
97 | 97 | } |
98 | 98 | |
99 | 99 | .mw-moodBar-feedback-invalid { |
100 | | - border:2px solid #CC0000; |
| 100 | + border: 2px solid #CC0000; |
101 | 101 | } |
102 | 102 | |
103 | 103 | .mw-moodBar-privacy, |
— | — | @@ -123,6 +123,20 @@ |
124 | 124 | height: 77px; |
125 | 125 | } |
126 | 126 | |
| 127 | +.mw-moodBar-state-success { |
| 128 | + /* @embed */ |
| 129 | + background: url(images/response-success.png) left center no-repeat; |
| 130 | + padding: 20px 0 0 90px; |
| 131 | + height: 77px; |
| 132 | +} |
| 133 | + |
| 134 | +.mw-moodBar-state-error { |
| 135 | + /* @embed */ |
| 136 | + background: url(images/response-error.png) left center no-repeat; |
| 137 | + padding: 20px 0 0 90px; |
| 138 | + height: 77px; |
| 139 | +} |
| 140 | + |
127 | 141 | .mw-moodBar-state-title { |
128 | 142 | font-weight: bold; |
129 | 143 | font-size: 25px; |
— | — | @@ -133,11 +147,18 @@ |
134 | 148 | color: #7e7e7e; |
135 | 149 | } |
136 | 150 | |
| 151 | +.mw-moodBar-desc { |
| 152 | + font-size: .8em; |
| 153 | + padding: 1em; |
| 154 | +} |
| 155 | + |
137 | 156 | .red-bold { |
138 | | - font-weight:bold; |
139 | | - color:#CC0000; |
| 157 | + font-weight: bold; |
| 158 | + color: #CC0000; |
140 | 159 | } |
141 | 160 | |
| 161 | + |
| 162 | + |
142 | 163 | /** |
143 | 164 | * Types |
144 | 165 | */ |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.tooltip.css |
— | — | @@ -0,0 +1,35 @@ |
| 2 | +#moodbar-tooltip-overlay-wrap { |
| 3 | + width: 285px; |
| 4 | + position: absolute; |
| 5 | + left: 12.5em; |
| 6 | + top: 2.5em; |
| 7 | + background: #ff9933; |
| 8 | + padding: 2px; |
| 9 | +} |
| 10 | + |
| 11 | +#moodbar-tooltip-pointy { |
| 12 | + position: absolute; |
| 13 | + top: -15px; |
| 14 | + left: 15px; |
| 15 | + /* @embed */ |
| 16 | + background: url(images/tooltip-pokey.png); |
| 17 | + background-repeat: no-repeat; |
| 18 | + background-position: left; |
| 19 | + height: 17px; |
| 20 | + width: 15px; |
| 21 | +} |
| 22 | + |
| 23 | +#moodbar-tooltip-overlay { |
| 24 | + background: #fefac6; |
| 25 | + padding: 10px; |
| 26 | +} |
| 27 | + |
| 28 | +#moodbar-tooltip-overlay #moodbar-tooltip-title { |
| 29 | + font-weight: bold; |
| 30 | + font-size: 0.75em; |
| 31 | + margin-bottom: 10px; |
| 32 | +} |
| 33 | + |
| 34 | +#moodbar-tooltip-overlay #moodbar-tooltip-subtitle { |
| 35 | + font-size: 0.7em; |
| 36 | +} |
\ No newline at end of file |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.core.js |
— | — | @@ -2,13 +2,15 @@ |
3 | 3 | * Front-end scripting core for the MoodBar MediaWiki extension |
4 | 4 | * |
5 | 5 | * @author Timo Tijhof, 2011 |
| 6 | + * @author Rob Moen, 2011 |
6 | 7 | */ |
| 8 | + |
7 | 9 | ( function( $ ) { |
8 | 10 | |
9 | 11 | var mb = mw.moodBar; |
10 | 12 | $.extend( mb, { |
11 | 13 | |
12 | | - tpl: { |
| 14 | + tpl: { |
13 | 15 | overlayBase: '\ |
14 | 16 | <div id="mw-moodBar-overlayWrap"><div id="mw-moodBar-overlay">\ |
15 | 17 | <div id="mw-moodBar-pokey"></div>\ |
— | — | @@ -38,6 +40,30 @@ |
39 | 41 | </a>\ |
40 | 42 | <div class="mw-moodBar-overlayWhatContent"></div>\ |
41 | 43 | </span>', |
| 44 | + emailinput: '\ |
| 45 | + <div class="mw-moodBar-overlayTitle"><span><html:msg key="moodbar-email-title" /></span></div>\ |
| 46 | + <div class="mw-moodBar-form">\ |
| 47 | + <div class="mw-moodBar-desc">\ |
| 48 | + <html:msg key="moodbar-email-desc" />\ |
| 49 | + </div>\ |
| 50 | + <div class="mw-moodBar-formInputs">\ |
| 51 | + <html:msg key="moodbar-email-input" />\ |
| 52 | + <input type="text" id="mw-moodBar-emailInput" class="mw-moodBar-emailInput" />\ |
| 53 | + <input type="button" class="mw-moodBar-emailSubmit" disabled="disabled" />\ |
| 54 | + <input type="button" class="mw-moodBar-emailOptOut" />\ |
| 55 | + </div>\ |
| 56 | + </div>', |
| 57 | + emailconfirmation: '\ |
| 58 | + <div class="mw-moodBar-overlayTitle"><span><html:msg key="moodbar-email-confirm-title" /></span></div>\ |
| 59 | + <div class="mw-moodBar-form">\ |
| 60 | + <div class="mw-moodBar-desc">\ |
| 61 | + <html:msg key="moodbar-email-confirm-desc" />\ |
| 62 | + </div>\ |
| 63 | + <div class="mw-moodBar-formInputs">\ |
| 64 | + <input type="button" class="mw-moodBar-emailConfirm" />\ |
| 65 | + <input type="button" class="mw-moodBar-emailOptOut" />\ |
| 66 | + </div>\ |
| 67 | + </div>', |
42 | 68 | type: '\ |
43 | 69 | <span class="mw-moodBar-type mw-moodBar-type-$1" rel="$1">\ |
44 | 70 | <span class="mw-moodBar-typeTitle"><html:msg key="moodbar-type-$1-title" /></span>\ |
— | — | @@ -47,6 +73,11 @@ |
48 | 74 | <div class="mw-moodBar-state-title"><html:msg key="moodbar-loading-title" /></div>\ |
49 | 75 | <div class="mw-moodBar-state-subtitle"><html:msg key="moodbar-loading-subtitle" /></div>\ |
50 | 76 | </div>', |
| 77 | + updatingEmail: '\ |
| 78 | + <div class="mw-moodBar-state mw-moodBar-state-loading">\ |
| 79 | + <div class="mw-moodBar-state-title"><html:msg key="moodbar-updating-title" /></div>\ |
| 80 | + <div class="mw-moodBar-state-subtitle"><html:msg key="moodbar-updating-subtitle" /></div>\ |
| 81 | + </div>', |
51 | 82 | success: '\ |
52 | 83 | <div class="mw-moodBar-state mw-moodBar-state-success">\ |
53 | 84 | <div class="mw-moodBar-state-title"><html:msg key="moodbar-success-title" /></div>\ |
— | — | @@ -70,6 +101,7 @@ |
71 | 102 | if ( mb.ui.overlay.is( ':hidden' ) ) { |
72 | 103 | mb.swapContent( mb.tpl.userinput ); |
73 | 104 | mb.ui.overlay.show(); |
| 105 | + mb.ui.tooltip.hide(); |
74 | 106 | } else { |
75 | 107 | mb.ui.overlay.hide(); |
76 | 108 | } |
— | — | @@ -84,6 +116,14 @@ |
85 | 117 | ); |
86 | 118 | mb.ui.overlay.fadeOut( 'fast' ); |
87 | 119 | mb.ui.trigger.fadeOut( 'fast' ); |
| 120 | + }, |
| 121 | + |
| 122 | + emailOptOut: function( e ) { |
| 123 | + $.cookie( |
| 124 | + mb.cookiePrefix() + 'emailOptOut', |
| 125 | + '1', |
| 126 | + { 'path': '/', 'expires': Number( mb.conf.disableExpiration ) } |
| 127 | + ); |
88 | 128 | } |
89 | 129 | }, |
90 | 130 | |
— | — | @@ -93,10 +133,24 @@ |
94 | 134 | type: 'unknown', |
95 | 135 | callback: function( data ) { |
96 | 136 | if ( data && data.moodbar && data.moodbar.result === 'success' ) { |
97 | | - mb.swapContent( mb.tpl.success ); |
98 | | - setTimeout( function() { |
99 | | - mb.ui.overlay.fadeOut(); |
100 | | - }, 3000 ); |
| 137 | + |
| 138 | + var userData = mb.userData, |
| 139 | + emailOptOut = ($.cookie( mb.cookiePrefix() + 'emailOptOut' ) == '1'); |
| 140 | + |
| 141 | + if( emailOptOut === false) { |
| 142 | + if(userData.email !== "") { //check for email address |
| 143 | + if('emailauthenticated' in userData) { //they have confirmed |
| 144 | + mb.showSuccess(); |
| 145 | + } else { //show email confirmation form |
| 146 | + mb.swapContent ( mb.tpl.emailconfirmation ); |
| 147 | + } |
| 148 | + } else { //no email, show email input form |
| 149 | + mb.swapContent( mb.tpl.emailinput ); |
| 150 | + } |
| 151 | + } else { //user has email opt-out cookie set |
| 152 | + mb.showSuccess(); |
| 153 | + } |
| 154 | + |
101 | 155 | } else if (data && data.error && data.error.code === 'blocked') { |
102 | 156 | mb.swapContent( mb.tpl.blocked ); |
103 | 157 | setTimeout( function() { |
— | — | @@ -108,6 +162,27 @@ |
109 | 163 | } |
110 | 164 | }, |
111 | 165 | |
| 166 | + showSuccess: function() { |
| 167 | + mb.swapContent( mb.tpl.success ); |
| 168 | + setTimeout( function() { |
| 169 | + mb.ui.overlay.fadeOut(); |
| 170 | + }, 3000 ); |
| 171 | + }, |
| 172 | + |
| 173 | + emailInput: { |
| 174 | + email: '', |
| 175 | + callback: function( data ) { |
| 176 | + mb.showSuccess(); |
| 177 | + } |
| 178 | + }, |
| 179 | + |
| 180 | + emailVerify: { |
| 181 | + callback: function ( data ) { |
| 182 | + mb.showSuccess(); |
| 183 | + } |
| 184 | + |
| 185 | + }, |
| 186 | + |
112 | 187 | prepareUserinputContent: function( overlay ) { |
113 | 188 | overlay |
114 | 189 | // Populate type selector |
— | — | @@ -125,7 +200,7 @@ |
126 | 201 | $mwMoodBarTypes.addClass( 'mw-moodBar-types-select' ); |
127 | 202 | mb.feedbackItem.type = $el.attr( 'rel' ); |
128 | 203 | $el.addClass( 'mw-moodBar-selected' ) |
129 | | - .addClass( 'mw-moodBar-' + mb.feedbackItem.type + '-selected' ); |
| 204 | + .addClass( 'mw-moodBar-' + mb.feedbackItem.type + '-selected' ); |
130 | 205 | $el.parent() |
131 | 206 | .find( '.mw-moodBar-selected' ) |
132 | 207 | .not( $el ) |
— | — | @@ -133,7 +208,7 @@ |
134 | 209 | .removeClass( 'mw-moodBar-happy-selected' ) |
135 | 210 | .removeClass( 'mw-moodBar-sad-selected' ) |
136 | 211 | .removeClass( 'mw-moodBar-confused-selected' ); |
137 | | - mb.validate(); |
| 212 | + mb.validateFeedback(); |
138 | 213 | } ) |
139 | 214 | .get( 0 ) |
140 | 215 | ); |
— | — | @@ -252,7 +327,7 @@ |
253 | 328 | // Keypress |
254 | 329 | .find( '#mw-moodBar-feedbackInput' ) |
255 | 330 | .keyup( function(event) { |
256 | | - mb.validate(); |
| 331 | + mb.validateFeedback(); |
257 | 332 | }) |
258 | 333 | .end(); |
259 | 334 | |
— | — | @@ -278,6 +353,51 @@ |
279 | 354 | }); |
280 | 355 | }, |
281 | 356 | |
| 357 | + prepareEmailInput: function ( overlay ) { |
| 358 | + overlay |
| 359 | + .find('#mw-moodBar-emailInput') |
| 360 | + .keyup(function(event){ |
| 361 | + mb.validateEmail(); |
| 362 | + }) |
| 363 | + .end() |
| 364 | + .find('.mw-moodBar-emailOptOut') |
| 365 | + .val ( mw.msg ( 'moodbar-email-optout' ) ) |
| 366 | + .click (function(event) { |
| 367 | + //set cookie to prevent this from coming back |
| 368 | + mb.event.emailOptOut(); |
| 369 | + mb.showSuccess(); |
| 370 | + }) |
| 371 | + .end() |
| 372 | + .find('.mw-moodBar-emailSubmit') |
| 373 | + .val( mw.msg( 'moodbar-email-submit' ) ) |
| 374 | + .click( function( event ) { |
| 375 | + //set the email address in the userdata to prevent email form on same page view |
| 376 | + mb.userData.email = mb.emailInput.email = overlay.find('#mw-moodBar-emailInput').val(); |
| 377 | + mb.swapContent( mb.tpl.updatingEmail ); |
| 378 | + $.moodBar.setEmail (mb.emailInput); |
| 379 | + }); |
| 380 | + |
| 381 | + }, |
| 382 | + |
| 383 | + prepareEmailVerification: function ( overlay ) { |
| 384 | + overlay |
| 385 | + .find( '.mw-moodBar-emailConfirm' ) |
| 386 | + .val( mw.msg ( 'moodbar-email-resend-confirmation' ) ) |
| 387 | + .click ( function() { |
| 388 | + mb.swapContent( mb.tpl.updatingEmail ); |
| 389 | + $.moodBar.resendVerification( mb.emailVerify ); |
| 390 | + }) |
| 391 | + .end() |
| 392 | + .find( '.mw-moodBar-emailOptOut' ) |
| 393 | + .val( mw.msg ( 'moodbar-email-optout' ) ) |
| 394 | + .click( function ( event ) { |
| 395 | + //set cookie to prevent this from coming back |
| 396 | + mb.event.emailOptOut(); |
| 397 | + mb.showSuccess(); |
| 398 | + }); |
| 399 | + |
| 400 | + }, |
| 401 | + |
282 | 402 | core: function() { |
283 | 403 | |
284 | 404 | // Create overlay |
— | — | @@ -336,17 +456,33 @@ |
337 | 457 | if ( tpl == mb.tpl.userinput ) { |
338 | 458 | mb.prepareUserinputContent( mb.ui.overlay ); |
339 | 459 | } |
| 460 | + if ( tpl == mb.tpl.emailinput ) { |
| 461 | + mb.prepareEmailInput ( mb.ui.overlay ); |
| 462 | + } |
| 463 | + if (tpl == mb.tpl.emailconfirmation) { |
| 464 | + mb.prepareEmailVerification ( mb.ui.overlay ); |
| 465 | + } |
340 | 466 | return true; |
341 | 467 | }, |
342 | 468 | |
343 | | - validate: function() { |
| 469 | + validateFeedback: function() { |
344 | 470 | var comment = $( '#mw-moodBar-feedbackInput' ).val(); |
345 | 471 | if( $.trim( comment ).length > 0 && comment.length <= 140 && $( '.mw-moodBar-selected').length ) { |
346 | 472 | mb.ui.overlay.find( '.mw-moodBar-formSubmit').removeAttr('disabled'); |
347 | 473 | } else { |
348 | 474 | mb.ui.overlay.find( '.mw-moodBar-formSubmit').attr({'disabled':'true'}); |
349 | 475 | } |
| 476 | + }, |
| 477 | + |
| 478 | + validateEmail: function() { |
| 479 | + var email = $( '#mw-moodBar-emailInput' ).val(); |
| 480 | + if( $.trim( email ).length > 0) { //find validate email method |
| 481 | + mb.ui.overlay.find( '.mw-moodBar-emailSubmit').removeAttr('disabled'); |
| 482 | + } else { |
| 483 | + mb.ui.overlay.find( '.mw-moodBar-emailSubmit').attr({'disabled':'true'}); |
| 484 | + } |
350 | 485 | } |
| 486 | + |
351 | 487 | } ); |
352 | 488 | |
353 | 489 | if ( !mb.isDisabled() ) { |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/images/tooltip-pokey.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar/images/tooltip-pokey.png |
___________________________________________________________________ |
Added: svn:mime-type |
354 | 490 | + application/octet-stream |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/images/response-error.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar/images/response-error.png |
___________________________________________________________________ |
Added: svn:mime-type |
355 | 491 | + application/octet-stream |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/images/response-success.png |
Cannot display: file marked as a binary type. |
svn:mime-type = application/octet-stream |
Property changes on: trunk/extensions/MoodBar/modules/ext.moodBar/images/response-success.png |
___________________________________________________________________ |
Added: svn:mime-type |
356 | 492 | + application/octet-stream |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.tooltip.js |
— | — | @@ -0,0 +1,52 @@ |
| 2 | +/** |
| 3 | + * Script for the MoodBar ToolTip |
| 4 | + * |
| 5 | + * @author Rob Moen, 2011 |
| 6 | + */ |
| 7 | +jQuery( document ).ready( function( $ ) { |
| 8 | + |
| 9 | + var mb = mw.moodBar; |
| 10 | + |
| 11 | + $.extend( mb.ui, { |
| 12 | + tooltip: null, |
| 13 | + |
| 14 | + // returns true if cookie is not set, otherwise returns false |
| 15 | + shouldShow: function() { |
| 16 | + |
| 17 | + shown = ( $.cookie( mb.cookiePrefix() + 'tooltip' ) == '1' ); // has this been shown ? |
| 18 | + if ( !shown ) { |
| 19 | + return true; |
| 20 | + } |
| 21 | + return false; |
| 22 | + |
| 23 | + }, |
| 24 | + |
| 25 | + showTooltip: function () { |
| 26 | + //set tooltip cookie |
| 27 | + $.cookie( mb.cookiePrefix() + 'tooltip', '1', { 'path': '/', 'expires': Number( mb.conf.disableExpiration ) } ); |
| 28 | + $( '#mw-head' ).append( mb.ui.tooltip ); // attach tooltip |
| 29 | + setTimeout( function() { |
| 30 | + mb.ui.tooltip.fadeOut(); |
| 31 | + }, 4000 ); |
| 32 | + } |
| 33 | + |
| 34 | + } ); |
| 35 | + |
| 36 | + // Build Tooltip |
| 37 | + mb.ui.tooltip = $('<div>').attr('id', 'moodbar-tooltip-overlay-wrap') |
| 38 | + .append( |
| 39 | + $('<div>').attr('id', 'moodbar-tooltip-overlay') |
| 40 | + .append( |
| 41 | + $('<div>').attr('id', 'moodbar-tooltip-pointy') |
| 42 | + ).append( |
| 43 | + $('<div>').attr('id', 'moodbar-tooltip-title').text( mw.msg( 'moodbar-tooltip-title' ) ) |
| 44 | + ).append( |
| 45 | + $('<div>').attr('id', 'moodbar-tooltip-subtitle').text( mw.msg( 'moodbar-tooltip-subtitle' ) ) |
| 46 | + ) |
| 47 | + ); |
| 48 | + |
| 49 | + if ( !mb.isDisabled() && mb.ui.shouldShow()) { |
| 50 | + mb.ui.showTooltip(); |
| 51 | + } |
| 52 | + |
| 53 | +} ); |
\ No newline at end of file |
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.css |
— | — | @@ -343,6 +343,6 @@ |
344 | 344 | text-align:center; |
345 | 345 | } |
346 | 346 | .red-bold { |
347 | | - font-weight:bold; |
348 | | - color:#CC0000; |
| 347 | + font-weight: bold; |
| 348 | + color: #CC0000; |
349 | 349 | } |
\ No newline at end of file |
Index: trunk/extensions/MoodBar/modules/ext.moodBar.dashboard/ext.moodBar.dashboard.js |
— | — | @@ -30,6 +30,14 @@ |
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
| 34 | + * Select all comment type filters. |
| 35 | + */ |
| 36 | + function selectAllTypes() { |
| 37 | + $( '#fbd-filters-type-praise, #fbd-filters-type-confusion, #fbd-filters-type-issues' ).each( function() { |
| 38 | + $(this).prop( 'checked', true); |
| 39 | + }); |
| 40 | + } |
| 41 | + /** |
34 | 42 | * Set the moodbar-feedback-types and moodbar-feedback-username cookies based on formState. |
35 | 43 | * This function uses the form state saved in formState, so you may want to call saveFormState() first. |
36 | 44 | */ |
— | — | @@ -57,6 +65,8 @@ |
58 | 66 | changed = true; |
59 | 67 | } |
60 | 68 | } ); |
| 69 | + } else { |
| 70 | + selectAllTypes(); |
61 | 71 | } |
62 | 72 | return changed; |
63 | 73 | } |
— | — | @@ -262,7 +272,7 @@ |
263 | 273 | .append( $('<button>').attr('class', 'fbd-action-cancel').text( mw.msg('moodbar-feedback-action-cancel')) ) |
264 | 274 | .append( $('<span>').attr('class', 'fbd-item-reason-msg') ) |
265 | 275 | .append( $('<div>').attr('class', 'fbd-item-reason-msg') ); |
266 | | - |
| 276 | + |
267 | 277 | var storedParams = params; |
268 | 278 | var $storedItem = $item; |
269 | 279 | |
— | — | @@ -388,7 +398,7 @@ |
389 | 399 | 'target': '_new' |
390 | 400 | }, mw.msg( 'moodbar-response-link' ) ); |
391 | 401 | |
392 | | - //ULA |
| 402 | + //ULA |
393 | 403 | var ula = mw.msg( 'moodbar-response-terms' ) |
394 | 404 | .replace ( /\$1/g, termsLink ); |
395 | 405 | |
— | — | @@ -643,6 +653,13 @@ |
644 | 654 | loadComments( 'more' ); |
645 | 655 | } ); |
646 | 656 | |
| 657 | + $( '#fbd-filters-types input[type=checkbox]' ).click( function() { |
| 658 | + var types = getSelectedTypes(); |
| 659 | + if(types.length === 0) { //check for 0 because onclick it will already have unchecked itself. |
| 660 | + $(this).prop('checked', true); |
| 661 | + } |
| 662 | + }); |
| 663 | + |
647 | 664 | saveFormState(); |
648 | 665 | var filterType = $( '#fbd-filters' ).children( 'form' ).data( 'filtertype' ); |
649 | 666 | // If filtering already happened on the PHP side, don't load the form state from cookies |
Index: trunk/extensions/MoodBar/MoodBar.php |
— | — | @@ -91,6 +91,21 @@ |
92 | 92 | ), |
93 | 93 | ); |
94 | 94 | |
| 95 | +$wgResourceModules['ext.moodBar.tooltip'] = $mbResourceTemplate + array( |
| 96 | + 'styles' => 'ext.moodBar/ext.moodBar.tooltip.css', |
| 97 | + 'scripts' => 'ext.moodBar/ext.moodBar.tooltip.js', |
| 98 | + 'messages' => array( |
| 99 | + 'moodbar-tooltip-title', |
| 100 | + 'moodbar-tooltip-subtitle', |
| 101 | + ), |
| 102 | + 'position' => 'top', |
| 103 | + 'dependencies' => array( |
| 104 | + 'jquery.cookie', |
| 105 | + 'jquery.client', |
| 106 | + 'ext.moodBar.init', |
| 107 | + ), |
| 108 | +); |
| 109 | + |
95 | 110 | $oldVersion = version_compare( $wgVersion, '1.17', '<=' ); |
96 | 111 | |
97 | 112 | if ( !$oldVersion ) { |
— | — | @@ -137,6 +152,16 @@ |
138 | 153 | 'moodbar-success-subtitle', |
139 | 154 | 'moodbar-blocked-title', |
140 | 155 | 'moodbar-blocked-subtitle', |
| 156 | + 'moodbar-email-title', |
| 157 | + 'moodbar-email-input', |
| 158 | + 'moodbar-email-desc', |
| 159 | + 'moodbar-email-submit', |
| 160 | + 'moodbar-updating-title', |
| 161 | + 'moodbar-updating-subtitle', |
| 162 | + 'moodbar-email-confirm-title', |
| 163 | + 'moodbar-email-confirm-desc', |
| 164 | + 'moodbar-email-resend-confirmation', |
| 165 | + 'moodbar-email-optout', |
141 | 166 | ), |
142 | 167 | 'dependencies' => array( |
143 | 168 | 'mediawiki.util', |
— | — | @@ -222,4 +247,4 @@ |
223 | 248 | 'infoUrl' => 'http://www.mediawiki.org/wiki/MoodBar', |
224 | 249 | 'privacyUrl' => 'about:blank', |
225 | 250 | 'disableExpiration' => 365, |
226 | | -); |
| 251 | +); |
\ No newline at end of file |
Index: trunk/extensions/MoodBar/MoodBar.i18n.php |
— | — | @@ -59,6 +59,19 @@ |
60 | 60 | 'moodbar-error-subtitle' => 'Something went wrong! Please try sharing your feedback again later.', |
61 | 61 | 'moodbar-blocked-title' => 'Blocked!', |
62 | 62 | 'moodbar-blocked-subtitle' => 'You have been blocked from editing.', |
| 63 | + 'moodbar-email-title' => 'Receive Notifications?', |
| 64 | + 'moodbar-email-input' => 'Your email address', |
| 65 | + 'moodbar-email-desc' => 'Please enter your email address to receive notifications regarding responses to your feedback.', |
| 66 | + 'moodbar-email-submit' => 'Update', |
| 67 | + 'moodbar-updating-title' => 'Updating...', |
| 68 | + 'moodbar-updating-subtitle' => 'We are updating your email settings.', |
| 69 | + 'moodbar-email-confirm-title' => 'Email Confirmation?', |
| 70 | + 'moodbar-email-confirm-desc' => 'In order to receive notifications regarding responses to your feedback, you must confirm your email address. To resend the confirmation email, click the "Resend Confirmation" button.', |
| 71 | + 'moodbar-email-resend-confirmation' => 'Resend Confirmation', |
| 72 | + 'moodbar-email-optout' => 'No Thanks', |
| 73 | + // MoodBar Tooltip |
| 74 | + 'moodbar-tooltip-title' => 'Are you sad, happy, or confused about editing Wikipedia?', |
| 75 | + 'moodbar-tooltip-subtitle' => 'Your feedback about editing Wikipedia helps us make the site better.', |
63 | 76 | // Special:MoodBar |
64 | 77 | 'right-moodbar-view' => 'View and export MoodBar feedback', |
65 | 78 | 'right-moodbar-admin' => 'Alter visibility on the feedback dashboard', |
— | — | @@ -214,6 +227,19 @@ |
215 | 228 | 'moodbar-error-subtitle' => 'Subtitle of screen when an error occurred. $1 is the SITENAME', |
216 | 229 | 'moodbar-blocked-title' => 'Title of the screen after blocked user attempts to post feedback.', |
217 | 230 | 'moodbar-blocked-subtitle' => 'Subtitle of screen after blocked user attempts to post feedback.', |
| 231 | + 'moodbar-email-title' => 'Title of MoodBar when user has no email addresss', |
| 232 | + 'moodbar-email-input' => 'Field label for Email address', |
| 233 | + 'moodbar-email-desc' => 'Message prompting user to enter their email address.', |
| 234 | + 'moodbar-email-submit' => 'Button text for updating email address', |
| 235 | + 'moodbar-updating-title' => 'Title for MoodBar when updating email address and requesting confirmation', |
| 236 | + 'moodbar-updating-subtitle' => 'Subtitle for MoodBar when updating email address and requesting confirmation', |
| 237 | + 'moodbar-email-confirm-title' => 'Title of moodbar when email address has not been confirmed', |
| 238 | + 'moodbar-email-confirm-desc' => 'Subtitle of moodBar when email address has not been confirmed.', |
| 239 | + 'moodbar-email-resend-confirmation' => 'Button text for resnding confirmation email', |
| 240 | + 'moodbar-email-optout' => 'Button text for email opt-out', |
| 241 | + //MoodBar Tooltip |
| 242 | + 'moodbar-tooltip-title' => 'Text for title of moodbar tooltip', |
| 243 | + 'moodbar-tooltip-subtitle' => 'Text for subtitle of moodbar tooltip', |
218 | 244 | 'right-moodbar-view' => '{{doc-right|moodbar-view}}', |
219 | 245 | 'right-moodbar-admin' => '{{doc-right|moodbar-admin}}', |
220 | 246 | 'moodbar-header-timestamp' => '{{Identical|Timestamp}}', |
Index: trunk/extensions/MoodBar/MoodBar.hooks.php |
— | — | @@ -7,9 +7,10 @@ |
8 | 8 | * @param $output OutputPage |
9 | 9 | * @param $skin Skin |
10 | 10 | */ |
| 11 | + |
11 | 12 | public static function onPageDisplay( &$output, &$skin ) { |
12 | 13 | if ( self::shouldShowMoodbar( $output, $skin ) ) { |
13 | | - $output->addModules( array( 'ext.moodBar.init', 'ext.moodBar.core' ) ); |
| 14 | + $output->addModules( array( 'ext.moodBar.init', 'ext.moodBar.tooltip', 'ext.moodBar.core' ) ); |
14 | 15 | } |
15 | 16 | |
16 | 17 | return true; |