Index: trunk/extensions/MoodBar/MoodBar.i18n.php |
— | — | @@ -15,10 +15,11 @@ |
16 | 16 | $messages['en'] = array( |
17 | 17 | 'moodbar-desc' => 'Allows specified users to send their "mood" back to the site operator', |
18 | 18 | // Portlet link |
19 | | - 'moodbar-trigger-using' => 'Using $1...', |
| 19 | + 'moodbar-trigger-using' => 'Editing $1...', |
| 20 | + 'moodbar-trigger-feedback' => 'Feedback about editing', |
| 21 | + 'moodbar-trigger-share' => 'Share your experience', |
20 | 22 | 'tooltip-p-moodbar-trigger-using' => '', |
21 | 23 | 'moodbar-intro-using' => 'Using $1 made me...', |
22 | | - 'moodbar-trigger-feedback' => 'Feedback', |
23 | 24 | 'tooltip-p-moodbar-trigger-feedback' => '', |
24 | 25 | // Overlay |
25 | 26 | 'moodbar-close' => '(close)', |
Index: trunk/extensions/MoodBar/modules/jquery.moodBar/jquery.moodBar.js |
— | — | @@ -28,7 +28,7 @@ |
29 | 29 | 'editmode' : (wgAction == 'edit') ? 1 : 0, |
30 | 30 | 'useragent' : clientData.name + '/' + clientData.versionBase, |
31 | 31 | 'system' : clientData.platform, |
32 | | - 'bucket' : mw.config.get('mbConfig').userBuckets.join(';'), |
| 32 | + 'bucket' : mb.conf.bucketKey, |
33 | 33 | 'type' : params.type, |
34 | 34 | 'token' : mw.user.tokens.get('editToken'), |
35 | 35 | 'format' : 'json' |
Index: trunk/extensions/MoodBar/modules/ext.moodBar/ext.moodBar.init.js |
— | — | @@ -17,10 +17,20 @@ |
18 | 18 | |
19 | 19 | init: function() { |
20 | 20 | var ui = mb.ui; |
| 21 | + |
| 22 | + mb.conf.bucketKey = mw.user.bucket( |
| 23 | + 'moodbar-trigger', |
| 24 | + { |
| 25 | + 'buckets' : { |
| 26 | + 'feedback' : 80, |
| 27 | + 'using' : 10, |
| 28 | + 'share' : 10 |
| 29 | + }, |
| 30 | + 'version' : 1, |
| 31 | + 'expires' : 30 |
| 32 | + } |
| 33 | + ); |
21 | 34 | |
22 | | - // Bucketing (@todo) |
23 | | - mb.conf.bucketKey = 'using'; |
24 | | - |
25 | 35 | // Create portlet |
26 | 36 | ui.pMoodbar = $( '<div id="p-moodbar"></div>' ); |
27 | 37 | |
Index: trunk/extensions/MoodBar/MoodBar.php |
— | — | @@ -49,11 +49,16 @@ |
50 | 50 | 'scripts' => 'ext.moodBar/ext.moodBar.init.js', |
51 | 51 | 'messages' => array( |
52 | 52 | 'moodbar-trigger-using', |
| 53 | + 'moodbar-trigger-feedback', |
| 54 | + 'moodbar-trigger-share', |
53 | 55 | 'tooltip-p-moodbar-trigger-using', |
54 | 56 | 'moodbar-trigger-feedback', |
55 | 57 | 'tooltip-p-moodbar-trigger-feedback', |
56 | 58 | ), |
57 | 59 | 'position' => 'top', |
| 60 | + 'dependencies' => array( |
| 61 | + 'mediawiki.user', |
| 62 | + ), |
58 | 63 | ); |
59 | 64 | |
60 | 65 | $wgResourceModules['ext.moodBar.core'] = $mbResourceTemplate + array( |
Index: trunk/extensions/MoodBar/MoodBar.hooks.php |
— | — | @@ -38,22 +38,8 @@ |
39 | 39 | return false; |
40 | 40 | } |
41 | 41 | |
42 | | - $buckets = self::getUserBuckets( $user ); |
| 42 | + return ((bool)EditPageTracking::getFirstEditPage($user)); |
43 | 43 | |
44 | | - if ( in_array( 'moodbar-always', $buckets ) ) { |
45 | | - return true; |
46 | | - } elseif( in_array( 'no-moodbar', $buckets ) ) { |
47 | | - return false; |
48 | | - } elseif ( in_array( 'moodbar-on-submit', $buckets ) ) { |
49 | | - // MoodBar is shown when a user has submitted an edit |
50 | | - return ( $user->getEditCount() > 0 ); |
51 | | - } elseif ( in_array( 'moodbar-on-edit', $buckets ) && |
52 | | - class_exists('EditPageTracking') ) |
53 | | - { |
54 | | - // MoodBar is shown when a user has previously loaded the edit form |
55 | | - return ((bool)EditPageTracking::getFirstEditPage($user)); |
56 | | - } |
57 | | - |
58 | 44 | return false; |
59 | 45 | } |
60 | 46 | |
— | — | @@ -90,20 +76,9 @@ |
91 | 77 | */ |
92 | 78 | public static function getUserBuckets( $user ) { |
93 | 79 | $id = $user->getID(); |
94 | | - |
95 | | - // 60 is divisible by 2, 3, 4, 5, 6 and 10 |
96 | | - $bucketId = $id % 60; |
97 | 80 | $buckets = array(); |
98 | 81 | |
99 | | - if ( $bucketId < 15 ) { |
100 | | - $buckets[] = 'no-moodbar'; |
101 | | - } elseif ( $bucketId < 30 ) { |
102 | | - $buckets[] = 'moodbar-on-edit'; |
103 | | - } elseif ( $bucketId < 45 ) { |
104 | | - $buckets[] = 'moodbar-on-submit'; |
105 | | - } elseif ( $bucektId < 60 ) { |
106 | | - $buckets[] = 'moodbar-always'; |
107 | | - } |
| 82 | + // No show-time bucketing yet. This method is a stub. |
108 | 83 | |
109 | 84 | sort($buckets); |
110 | 85 | return $buckets; |