Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -320,7 +320,6 @@ |
321 | 321 | |
322 | 322 | # Database schema changes |
323 | 323 | $wgHooks['LoadExtensionSchemaUpdates'][] = 'FlaggedRevsUpdaterHooks::addSchemaUpdates'; |
324 | | - |
325 | 324 | # ######## |
326 | 325 | |
327 | 326 | function efSetFlaggedRevsConditionalHooks() { |
Index: trunk/extensions/FlaggedRevs/presentation/FlaggedRevsUI.hooks.php |
— | — | @@ -45,12 +45,12 @@ |
46 | 46 | $localModulePath = dirname( __FILE__ ) . '/modules/'; |
47 | 47 | $remoteModulePath = 'FlaggedRevs/presentation/modules'; |
48 | 48 | $modules['ext.flaggedRevs.basic'] = array( |
49 | | - 'styles' => array( 'flaggedrevs.css' ), |
| 49 | + 'styles' => array( 'ext.flaggedRevs.basic.css' ), |
50 | 50 | 'localBasePath' => $localModulePath, |
51 | 51 | 'remoteExtPath' => $remoteModulePath, |
52 | 52 | ); |
53 | 53 | $modules['ext.flaggedRevs.advanced'] = array( |
54 | | - 'scripts' => array( 'flaggedrevs.js' ), |
| 54 | + 'scripts' => array( 'ext.flaggedRevs.advanced.js' ), |
55 | 55 | 'messages' => array( |
56 | 56 | 'revreview-toggle-show', 'revreview-toggle-hide', |
57 | 57 | 'revreview-diff-toggle-show', 'revreview-diff-toggle-hide', |
— | — | @@ -62,8 +62,8 @@ |
63 | 63 | 'remoteExtPath' => $remoteModulePath, |
64 | 64 | ); |
65 | 65 | $modules['ext.flaggedRevs.review'] = array( |
66 | | - 'scripts' => array( 'review.js' ), |
67 | | - 'styles' => array( 'review.css' ), |
| 66 | + 'scripts' => array( 'ext.flaggedRevs.review.js' ), |
| 67 | + 'styles' => array( 'ext.flaggedRevs.review.css' ), |
68 | 68 | 'messages' => array( |
69 | 69 | 'savearticle', 'tooltip-save', 'accesskey-save', |
70 | 70 | 'revreview-submitedit', 'revreview-submitedit-title', |
Index: trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.css |
— | — | @@ -1,311 +0,0 @@ |
2 | | -/** |
3 | | - * FlaggedRevs Stylesheet |
4 | | - * @author Aaron Schulz |
5 | | - */ |
6 | | - |
7 | | -/* Standard User Interface */ |
8 | | -div.flaggedrevs_basic, |
9 | | -div.flaggedrevs_quality, |
10 | | -div.flaggedrevs_pristine, |
11 | | -div.flaggedrevs_notice { |
12 | | - border: 1px solid #aaa; |
13 | | - padding: 5px; |
14 | | - font-weight: normal; |
15 | | - line-height: 1.5em; |
16 | | - margin: .5em 1em 0em 0em; |
17 | | - text-align: center; |
18 | | - clear: both; |
19 | | -} |
20 | | -div.flaggedrevs_short_basic img { |
21 | | - vertical-align: text-bottom; |
22 | | -} |
23 | | -div.flaggedrevs_basic { |
24 | | - background-color: #f0f8ff; |
25 | | -} |
26 | | -div.flaggedrevs_quality { |
27 | | - background-color: #e1ffe1; |
28 | | -} |
29 | | -div.flaggedrevs_pristine { |
30 | | - background-color: #ffffe3; |
31 | | -} |
32 | | -div.flaggedrevs_notice { |
33 | | - background-color: #f9f9f9; |
34 | | -} |
35 | | - |
36 | | -table.flaggedrevs_editnotice, |
37 | | -table.flaggedrevs_viewnotice { |
38 | | - padding: 3px; |
39 | | - border: 2px solid #6cc8f3; |
40 | | - background-color: #f9f9f9; |
41 | | - text-align: left; |
42 | | - width: 100%; |
43 | | - clear: both; |
44 | | -} |
45 | | - |
46 | | -div.flaggedrevs_diffnotice, |
47 | | -div.flaggedrevs_preview { |
48 | | - border: 1px solid #a7d7f9; |
49 | | - padding: 5px; |
50 | | - text-align: center; |
51 | | - clear: both; |
52 | | -} |
53 | | -div.flaggedrevs_diffnotice { |
54 | | - font-size: 85%; |
55 | | - background-color: #f9f9f9; |
56 | | -} |
57 | | -div.flaggedrevs_preview { |
58 | | - background-color: #eaf2fd; |
59 | | - color: black; |
60 | | -} |
61 | | - |
62 | | -span.flaggedrevs_important { |
63 | | - font-size: 115%; |
64 | | - font-weight: bold; |
65 | | -} |
66 | | - |
67 | | -div.flaggedrevs_notes { |
68 | | - border: 1px solid #aaa; |
69 | | - background-color: #f9f9f9; |
70 | | - padding: 5px; |
71 | | - font-size: 85%; |
72 | | - margin-left: 50px; |
73 | | - margin-right: 50px; |
74 | | - text-align: center; |
75 | | -} |
76 | | - |
77 | | -.fr-text-value { |
78 | | - width: 100px; |
79 | | -} |
80 | | - |
81 | | -.fr-marker-20, |
82 | | -.fr-marker-40, |
83 | | -.fr-marker-60, |
84 | | -.fr-marker-80, |
85 | | -.fr-marker-100 { |
86 | | - background-position: bottom left; |
87 | | - background-repeat: no-repeat; |
88 | | - padding-bottom: 3px; |
89 | | -} |
90 | | - |
91 | | -.fr-marker-20 { |
92 | | - /* @embed */ |
93 | | - background-image: url('img/bar_20.png'); |
94 | | -} |
95 | | -.fr-marker-40 { |
96 | | - /* @embed */ |
97 | | - background-image: url('img/bar_40.png'); |
98 | | -} |
99 | | -.fr-marker-60 { |
100 | | - /* @embed */ |
101 | | - background-image: url('img/bar_60.png'); |
102 | | -} |
103 | | -.fr-marker-80 { |
104 | | - /* @embed */ |
105 | | - background-image: url('img/bar_80.png'); |
106 | | -} |
107 | | -.fr-marker-100 { |
108 | | - /* @embed */ |
109 | | - background-image: url('img/bar_100.png'); |
110 | | -} |
111 | | - |
112 | | -/* Short User Interface */ |
113 | | -div.flaggedrevs_short { |
114 | | - border: 1px solid #ccc; |
115 | | - background-color: #ffffff; |
116 | | - font-size: 95%; |
117 | | - font-weight: normal; |
118 | | - margin: 0 0 0 1em; |
119 | | - line-height: 16px; |
120 | | - padding: 2px; |
121 | | - float: right; |
122 | | -} |
123 | | - |
124 | | -/* @noflip */ |
125 | | -.sitedir-ltr div.flaggedrevs_short { |
126 | | - float: right; |
127 | | - margin: 0 0 0 1em; |
128 | | -} |
129 | | - |
130 | | -/* @noflip */ |
131 | | -.sitedir-rtl div.flaggedrevs_short { |
132 | | - float: left; |
133 | | - margin: 0 1em 0 0; |
134 | | -} |
135 | | - |
136 | | -div.flaggedrevs_short_basic { |
137 | | - white-space: nowrap; |
138 | | -} |
139 | | - |
140 | | -div.flaggedrevs_short_details { |
141 | | - border: 1px solid #aaa; |
142 | | - background-color: #ffffff; |
143 | | - padding: 5px; |
144 | | - position: absolute; |
145 | | - top: 0; |
146 | | - right: -2px; |
147 | | - width: 25em; |
148 | | -} |
149 | | - |
150 | | -/* @noflip */ |
151 | | -.sitedir-ltr div.flaggedrevs_short_details { |
152 | | - right: -2px; |
153 | | - left: auto; |
154 | | -} |
155 | | - |
156 | | -/* @noflip */ |
157 | | -.sitedir-rtl div.flaggedrevs_short_details { |
158 | | - left: -2px; |
159 | | - right: auto; |
160 | | -} |
161 | | - |
162 | | -.fr-text { |
163 | | - height: 1em; |
164 | | - line-height: 1em; |
165 | | - margin: 0px 7px 0px 0px; |
166 | | - padding: 0px; |
167 | | - font-weight: bold; |
168 | | - width: 80px; |
169 | | -} |
170 | | - |
171 | | -.fr-value20, |
172 | | -.fr-value40, |
173 | | -.fr-value60, |
174 | | -.fr-value80, |
175 | | -.fr-value100 { |
176 | | - height: 1em; |
177 | | - line-height: 1em; |
178 | | - width: 95px; |
179 | | - float: left; |
180 | | - background-repeat: no-repeat; |
181 | | - background-position: 50% 50%; |
182 | | - text-align: center; |
183 | | -} |
184 | | - |
185 | | -.fr-value20 { |
186 | | - /* @embed */ |
187 | | - background-image: url('img/fr-marker-20.png'); |
188 | | -} |
189 | | -.fr-value40 { |
190 | | - /* @embed */ |
191 | | - background-image: url('img/fr-marker-40.png'); |
192 | | -} |
193 | | -.fr-value60 { |
194 | | - /* @embed */ |
195 | | - background-image: url('img/fr-marker-60.png'); |
196 | | -} |
197 | | -.fr-value80 { |
198 | | - /* @embed */ |
199 | | - background-image: url('img/fr-marker-80.png'); |
200 | | -} |
201 | | -.fr-value100 { |
202 | | - /* @embed */ |
203 | | - background-image: url('img/fr-marker-100.png'); |
204 | | -} |
205 | | - |
206 | | -/* Both User Interfaces */ |
207 | | -.flaggedrevs-color-0 { |
208 | | - background-color: #f9f9f9; |
209 | | -} |
210 | | -.flaggedrevs-color-1 { |
211 | | - background-color: #f0f8ff; |
212 | | -} |
213 | | -.flaggedrevs-color-2 { |
214 | | - background-color: #e1ffe1; |
215 | | -} |
216 | | -.flaggedrevs-color-3 { |
217 | | - background-color: #ffffe3; |
218 | | -} |
219 | | - |
220 | | -.flaggedrevs-pending { |
221 | | - background-color: #ffeeaa; |
222 | | -} |
223 | | -.flaggedrevs-unreviewed { |
224 | | - background-color: #faebd7; |
225 | | -} |
226 | | - |
227 | | -a.fr-toggle-symbol { |
228 | | - color: blue; |
229 | | - white-space: nowrap; |
230 | | - font-family: monospace; |
231 | | - font-weight: bold; |
232 | | - cursor: pointer; |
233 | | - margin: 0 .3em 0 .3em; |
234 | | -} |
235 | | - |
236 | | -a.fr-toggle-text { |
237 | | - color: blue; |
238 | | - font-weight: bold; |
239 | | - cursor: pointer; |
240 | | -} |
241 | | - |
242 | | -img.fr-toggle-arrow { |
243 | | - cursor: pointer; |
244 | | -} |
245 | | - |
246 | | -li.fr-hist-stable-margin { |
247 | | - margin-top: 2em; |
248 | | -} |
249 | | - |
250 | | -img.flaggedrevs-icon { |
251 | | - margin-right: .2em; |
252 | | - margin-left: .2em; |
253 | | -} |
254 | | - |
255 | | -.fr-diff-ratings { |
256 | | - font-size: 90%; |
257 | | - font-weight: bold; |
258 | | - line-height: 1em; |
259 | | - width: 100%; |
260 | | -} |
261 | | - |
262 | | -.fr-diff-to-stable { |
263 | | - line-height: 1em; |
264 | | -} |
265 | | - |
266 | | -.fr-hist-basic-user, |
267 | | -.fr-hist-quality-user, |
268 | | -.fr-hist-basic-auto, |
269 | | -.fr-hist-quality-auto { |
270 | | - font-weight: bold; |
271 | | -} |
272 | | - |
273 | | -/* RC pending changes notice */ |
274 | | -.fr-watchlist-pending-notice { |
275 | | - padding: 3px; |
276 | | - margin: 5px; |
277 | | - border: 1px solid #990000; |
278 | | - background-color: #FEECD7; |
279 | | -} |
280 | | - |
281 | | -/* Special pages */ |
282 | | -.fr-pending-long { |
283 | | - background-color: #f5ecec; |
284 | | -} |
285 | | -.fr-pending-long2 { |
286 | | - background-color: #f5dddd; |
287 | | -} |
288 | | -.fr-pending-long3 { |
289 | | - background-color: #e2caca; |
290 | | -} |
291 | | - |
292 | | -.fr-unreviewed-unwatched { |
293 | | - background-color: #faebd7; |
294 | | -} |
295 | | - |
296 | | -span.fr-under-review { |
297 | | - background-color: yellow; |
298 | | - font-weight: bold; |
299 | | -} |
300 | | - |
301 | | -.mw-fr-reviewlink { |
302 | | - font-weight: bold; |
303 | | -} |
304 | | - |
305 | | -/* Diff items */ |
306 | | -#mw-fr-diff-headeritems { |
307 | | - direction: ltr; |
308 | | -} |
309 | | - |
310 | | -#mw-fr-stablediff { |
311 | | - background-color: white; |
312 | | -} |
Index: trunk/extensions/FlaggedRevs/presentation/modules/flaggedrevs.js |
— | — | @@ -1,212 +0,0 @@ |
2 | | -/** |
3 | | - * FlaggedRevs Stylesheet |
4 | | - * @author Aaron Schulz |
5 | | - * @author Krinkle <krinklemail@gmail.com> 2011 |
6 | | - */ |
7 | | -( function( $ ) { |
8 | | - |
9 | | -var fr = { |
10 | | - /* Dropdown collapse timer */ |
11 | | - 'boxCollapseTimer': null, |
12 | | - |
13 | | - /* Startup function */ |
14 | | - 'init': function() { |
15 | | - // Enables rating detail box |
16 | | - var toggle = $( '#mw-fr-revisiontoggle' ); |
17 | | - |
18 | | - if ( toggle.length ) { |
19 | | - toggle.css( 'display', 'inline' ); // show toggle control |
20 | | - fr.hideBoxDetails(); // hide the initially displayed ratings |
21 | | - } |
22 | | - |
23 | | - // Bar UI: Toggle the box when the toggle is clicked |
24 | | - $( '.fr-toggle-symbol#mw-fr-revisiontoggle' ).click( fr.toggleBoxDetails ); |
25 | | - |
26 | | - // Simple UI: Show the box on mouseOver |
27 | | - $( '.fr-toggle-arrow#mw-fr-revisiontoggle' ).mouseover( fr.onBoxMouseOver ); |
28 | | - $( '.flaggedrevs_short#mw-fr-revisiontag' ).mouseout( fr.onBoxMouseOut ); |
29 | | - |
30 | | - // Enables diff detail box and toggle |
31 | | - toggle = $( '#mw-fr-difftoggle' ); |
32 | | - if ( toggle.length ) { |
33 | | - toggle.css( 'display', 'inline' ); // show toggle control |
34 | | - $( '#mw-fr-stablediff' ).hide(); |
35 | | - } |
36 | | - toggle.children( 'a' ).click( fr.toggleDiff ); |
37 | | - |
38 | | - // Enables log detail box and toggle |
39 | | - toggle = $( '#mw-fr-logtoggle' ); |
40 | | - if ( toggle.length ) { |
41 | | - toggle.css( 'display', 'inline' ); // show toggle control |
42 | | - $( '#mw-fr-logexcerpt' ).hide(); |
43 | | - } |
44 | | - toggle.children( 'a' ).click( fr.toggleLog ); |
45 | | - |
46 | | - // Enables changing of save button when "review this" checkbox changes |
47 | | - $( '#wpReviewEdit' ).click( fr.updateSaveButton ); |
48 | | - }, |
49 | | - |
50 | | - /* Expands flag info box details */ |
51 | | - 'showBoxDetails': function() { |
52 | | - $( '#mw-fr-revisiondetails' ).css( 'display', 'block' ); |
53 | | - }, |
54 | | - |
55 | | - /* Collapses flag info box details */ |
56 | | - 'hideBoxDetails': function() { |
57 | | - $( '#mw-fr-revisiondetails' ).css( 'display', 'none' ); |
58 | | - }, |
59 | | - |
60 | | - /** |
61 | | - * Toggles flag info box details for (+/-) control |
62 | | - * @context {jQuery} |
63 | | - * @param e {jQuery.Event} |
64 | | - */ |
65 | | - 'toggleBoxDetails': function( e ) { |
66 | | - var toggle = $( '#mw-fr-revisiontoggle' ), |
67 | | - ratings = $( '#mw-fr-revisiondetails' ); |
68 | | - |
69 | | - if ( toggle.length && ratings.length ) { |
70 | | - // Collapsed -> expand |
71 | | - if ( ratings.css( 'display' ) === 'none' ) { |
72 | | - fr.showBoxDetails(); |
73 | | - toggle.text( mw.msg( 'revreview-toggle-hide' ) ); |
74 | | - // Expanded -> collapse |
75 | | - } else { |
76 | | - fr.hideBoxDetails(); |
77 | | - toggle.text( mw.msg( 'revreview-toggle-show' ) ); |
78 | | - } |
79 | | - } |
80 | | - }, |
81 | | - |
82 | | - /** |
83 | | - * Expands flag info box details on mouseOver |
84 | | - * @context {jQuery} |
85 | | - * @param e {jQuery.Event} |
86 | | - */ |
87 | | - 'onBoxMouseOver': function( e ) { |
88 | | - window.clearTimeout( fr.boxCollapseTimer ); |
89 | | - fr.boxCollapseTimer = null; |
90 | | - fr.showBoxDetails(); |
91 | | - }, |
92 | | - |
93 | | - /** |
94 | | - * Hides flag info box details on mouseOut *except* for event bubbling |
95 | | - * @context {jQuery} |
96 | | - * @param e {jQuery.Event} |
97 | | - */ |
98 | | - 'onBoxMouseOut': function( e ) { |
99 | | - if ( !fr.isMouseOutBubble( e, 'mw-fr-revisiontag' ) ) { |
100 | | - fr.boxCollapseTimer = window.setTimeout( fr.hideBoxDetails, 150 ); |
101 | | - } |
102 | | - }, |
103 | | - |
104 | | - /** |
105 | | - * Checks if mouseOut event is for a child of parentId |
106 | | - * @param e {jQuery.Event} |
107 | | - * @param parentId {String} |
108 | | - * @return {Boolean} True if given event object originated from a (direct or indirect) |
109 | | - * child element of an element with an id of parentId. |
110 | | - */ |
111 | | - 'isMouseOutBubble': function( e, parentId ) { |
112 | | - var toNode = e.relatedTarget; |
113 | | - |
114 | | - if ( toNode ) { |
115 | | - var nextParent = toNode.parentNode; |
116 | | - while ( nextParent ) { |
117 | | - if ( nextParent.id === parentId ) { |
118 | | - return true; |
119 | | - } |
120 | | - // next up |
121 | | - nextParent = nextParent.parentNode; |
122 | | - } |
123 | | - } |
124 | | - return false; |
125 | | - }, |
126 | | - |
127 | | - /** |
128 | | - * Toggles diffs |
129 | | - * @context {jQuery} |
130 | | - * @param e {jQuery.Event} |
131 | | - */ |
132 | | - 'toggleDiff': function( e ) { |
133 | | - var diff = $( '#mw-fr-stablediff' ), |
134 | | - toggle = $( '#mw-fr-difftoggle' ); |
135 | | - |
136 | | - if ( diff.length && toggle.length ) { |
137 | | - if ( diff.css( 'display' ) === 'none' ) { |
138 | | - diff.show( 'slow' ); |
139 | | - toggle.children( 'a' ).text( mw.msg( 'revreview-diff-toggle-hide' ) ); |
140 | | - } else { |
141 | | - diff.hide( 'slow' ); |
142 | | - toggle.children( 'a' ).text( mw.msg( 'revreview-diff-toggle-show' ) ); |
143 | | - } |
144 | | - } |
145 | | - }, |
146 | | - |
147 | | - /** |
148 | | - * Toggles log excerpts |
149 | | - * @context {jQuery} |
150 | | - * @param e {jQuery.Event} |
151 | | - */ |
152 | | - 'toggleLog': function( e ) { |
153 | | - var hideMsg, showMsg, |
154 | | - log = $( '#mw-fr-logexcerpt' ), |
155 | | - toggle = $( '#mw-fr-logtoggle' ); |
156 | | - |
157 | | - if ( log.length && toggle.length ) { |
158 | | - // Two different message sets used here... |
159 | | - if ( toggle.hasClass( 'fr-logtoggle-details' ) ) { |
160 | | - hideMsg = mw.msg( 'revreview-log-details-hide' ); |
161 | | - showMsg = mw.msg( 'revreview-log-details-show' ); |
162 | | - } else { |
163 | | - hideMsg = mw.msg( 'revreview-log-toggle-hide' ); |
164 | | - showMsg = mw.msg( 'revreview-log-toggle-show' ); |
165 | | - } |
166 | | - |
167 | | - if ( log.css( 'display' ) === 'none' ) { |
168 | | - log.show(); |
169 | | - toggle.children( 'a' ).text( hideMsg ); |
170 | | - } else { |
171 | | - log.hide(); |
172 | | - toggle.children( 'a' ).text( showMsg ); |
173 | | - } |
174 | | - } |
175 | | - }, |
176 | | - |
177 | | - /** |
178 | | - * Update save button when "review this" checkbox changes |
179 | | - * @context {jQuery} |
180 | | - * @param e {jQuery.Event} |
181 | | - */ |
182 | | - 'updateSaveButton': function() { |
183 | | - var $save = $( '#wpSave' ), |
184 | | - $checkbox = $( '#wpReviewEdit' ); |
185 | | - |
186 | | - if ( $save.length && $checkbox.length ) { |
187 | | - // Review pending changes |
188 | | - if ( $checkbox.prop( 'checked' ) ) { |
189 | | - $save |
190 | | - .val( mw.msg( 'savearticle' ) ) |
191 | | - .attr( 'title', |
192 | | - mw.msg( 'tooltip-save' ) + ' [' + mw.msg( 'accesskey-save' ) + ']' |
193 | | - ); |
194 | | - // Submit for review |
195 | | - } else { |
196 | | - $save |
197 | | - .val( mw.msg( 'revreview-submitedit' ) ) |
198 | | - .attr( 'title', |
199 | | - mw.msg( 'revreview-submitedit-title' ) + ' [' + mw.msg( 'accesskey-save' ) + ']' |
200 | | - ); |
201 | | - } |
202 | | - } |
203 | | - mw.util.updateTooltipAccessKeys( [ $save ] ); // update accesskey in save.title |
204 | | - } |
205 | | -}; |
206 | | - |
207 | | -// Perform some onload (which is when this script is included) events: |
208 | | -fr.init(); |
209 | | - |
210 | | -// Expose globally |
211 | | -window.FlaggedRevs = fr; |
212 | | - |
213 | | -})( jQuery ); |
Index: trunk/extensions/FlaggedRevs/presentation/modules/review.css |
— | — | @@ -1,48 +0,0 @@ |
2 | | -/** |
3 | | - * FlaggedRevs Stylesheet |
4 | | - * @author Aaron Schulz |
5 | | - */ |
6 | | - |
7 | | -/* Review form */ |
8 | | -.flaggedrevs_reviewform { |
9 | | - background-color: #f9f9f9; |
10 | | - font-size: 90%; |
11 | | - clear: both; |
12 | | -} |
13 | | - |
14 | | -.fr-rating-controls, |
15 | | -.fr-rating-controls-disabled { |
16 | | - vertical-align: middle; |
17 | | -} |
18 | | - |
19 | | -.fr-rating-controls-disabled { |
20 | | - color: GrayText; |
21 | | -} |
22 | | - |
23 | | -#mw-fr-confirmreview { |
24 | | - white-space: nowrap; |
25 | | -} |
26 | | -.fr-rating-options { |
27 | | - margin-right: 1.5em; |
28 | | - white-space: nowrap; |
29 | | -} |
30 | | - |
31 | | -.fr-rating-option-0 { |
32 | | - background-color: #f5ecec; |
33 | | -} |
34 | | -.fr-rating-option-1 { |
35 | | - background-color: #f0f8ff; |
36 | | -} |
37 | | -.fr-rating-option-2 { |
38 | | - background-color: #e1ffe1; |
39 | | -} |
40 | | -.fr-rating-option-3 { |
41 | | - background-color: #fef0db; |
42 | | -} |
43 | | -.fr-rating-option-4 { |
44 | | - background-color: #ffffe3; |
45 | | -} |
46 | | - |
47 | | -#mw-fr-commentbox { |
48 | | - margin-right: 1.5em; |
49 | | -} |
Index: trunk/extensions/FlaggedRevs/presentation/modules/review.js |
— | — | @@ -1,442 +0,0 @@ |
2 | | -/** |
3 | | - * FlaggedRevs Stylesheet |
4 | | - * @author Aaron Schulz |
5 | | - * @author Daniel Arnold 2008 |
6 | | - */ |
7 | | - |
8 | | -window.FlaggedRevsReview = { |
9 | | - 'isUserReviewing': 0, // user reviewing this page? |
10 | | - /* |
11 | | - * Updates for radios/checkboxes on patch by Daniel Arnold (bug 13744). |
12 | | - * Visually update the revision rating form on change. |
13 | | - * - Disable submit in case of invalid input. |
14 | | - * - Update colors when <select> changes. |
15 | | - * - Also remove comment box clutter in case of invalid input. |
16 | | - * NOTE: all buttons should exist (perhaps hidden though) |
17 | | - */ |
18 | | - 'updateRatingForm': function() { |
19 | | - var ratingform = document.getElementById('mw-fr-ratingselects'); |
20 | | - if( !ratingform ) return; |
21 | | - var disabled = document.getElementById('fr-rating-controls-disabled'); |
22 | | - if( disabled ) return; |
23 | | - |
24 | | - var quality = true; |
25 | | - var somezero = false; |
26 | | - |
27 | | - // Determine if this is a "quality" or "incomplete" review |
28 | | - for( var tag in wgFlaggedRevsParams.tags ) { |
29 | | - var controlName = "wp" + tag; |
30 | | - var levels = document.getElementsByName(controlName); |
31 | | - if( !levels.length ) continue; |
32 | | - |
33 | | - var selectedlevel = 0; // default |
34 | | - if( levels[0].nodeName == 'SELECT' ) { |
35 | | - selectedlevel = levels[0].selectedIndex; |
36 | | - } else if( levels[0].type == 'radio' ) { |
37 | | - for( var i = 0; i < levels.length; i++ ) { |
38 | | - if( levels[i].checked ) { |
39 | | - selectedlevel = i; |
40 | | - break; |
41 | | - } |
42 | | - } |
43 | | - } else if( levels[0].type == 'checkbox' ) { |
44 | | - selectedlevel = (levels[0].checked) ? 1: 0; |
45 | | - } else { |
46 | | - return; // error: should not happen |
47 | | - } |
48 | | - |
49 | | - // Get quality level for this tag |
50 | | - var qualityLevel = wgFlaggedRevsParams.tags[tag]['quality']; |
51 | | - |
52 | | - if( selectedlevel < qualityLevel ) { |
53 | | - quality = false; // not a quality review |
54 | | - } |
55 | | - if( selectedlevel <= 0 ) { |
56 | | - somezero = true; |
57 | | - } |
58 | | - } |
59 | | - |
60 | | - // (a) If only a few levels are zero ("incomplete") then disable submission. |
61 | | - // (b) Re-enable submission for already accepted revs when ratings change. |
62 | | - var asubmit = document.getElementById('mw-fr-submit-accept'); |
63 | | - if( asubmit ) { |
64 | | - asubmit.disabled = somezero ? 'disabled' : ''; |
65 | | - asubmit.value = mediaWiki.msg('revreview-submit-review'); // reset to "Accept" |
66 | | - } |
67 | | - |
68 | | - // Update colors of <select> |
69 | | - FlaggedRevsReview.updateRatingFormColors( ratingform ); |
70 | | - }, |
71 | | - |
72 | | - /* |
73 | | - * Update <select> color for the selected item |
74 | | - */ |
75 | | - 'updateRatingFormColors': function() { |
76 | | - for( var tag in wgFlaggedRevsParams.tags ) { |
77 | | - var controlName = "wp" + tag; |
78 | | - var levels = document.getElementsByName(controlName); |
79 | | - if( levels.length && levels[0].nodeName == 'SELECT' ) { |
80 | | - var selectedlevel = levels[0].selectedIndex; |
81 | | - var value = levels[0].getElementsByTagName('option')[selectedlevel].value; |
82 | | - levels[0].className = 'fr-rating-option-' + value; |
83 | | - // Fix FF one-time jitter bug of changing an <option> |
84 | | - levels[0].selectedIndex = null; |
85 | | - levels[0].selectedIndex = selectedlevel; |
86 | | - } |
87 | | - } |
88 | | - }, |
89 | | - |
90 | | - /* |
91 | | - * Disable 'accept' button if the revision was already reviewed |
92 | | - * NOTE: this is used so that they can be re-enabled if a rating changes |
93 | | - */ |
94 | | - 'maybeDisableAcceptButton': function() { |
95 | | - if( typeof(jsReviewNeedsChange) != 'undefined' && jsReviewNeedsChange == 1 ) { |
96 | | - var asubmit = document.getElementById('mw-fr-submit-accept'); |
97 | | - if( asubmit ) { |
98 | | - asubmit.disabled = 'disabled'; |
99 | | - } |
100 | | - } |
101 | | - }, |
102 | | - |
103 | | - /* |
104 | | - * Enable AJAX-based submit functionality to the review form on this page |
105 | | - */ |
106 | | - 'enableAjaxReview': function() { |
107 | | - var asubmit = document.getElementById("mw-fr-submit-accept"); |
108 | | - if( asubmit ) { |
109 | | - asubmit.onclick = FlaggedRevsReview.submitRevisionReview; |
110 | | - } |
111 | | - var usubmit = document.getElementById("mw-fr-submit-unaccept"); |
112 | | - if( usubmit ) { |
113 | | - usubmit.onclick = FlaggedRevsReview.submitRevisionReview; |
114 | | - } |
115 | | - }, |
116 | | - |
117 | | - /* |
118 | | - * Lock review form from submissions (using during AJAX requests) |
119 | | - */ |
120 | | - 'lockReviewForm': function( form ) { |
121 | | - var inputs = form.getElementsByTagName("input"); |
122 | | - for( var i=0; i < inputs.length; i++) { |
123 | | - inputs[i].disabled = "disabled"; |
124 | | - } |
125 | | - var textareas = document.getElementsByTagName("textarea"); |
126 | | - for( var i=0; i < textareas.length; i++) { |
127 | | - textareas[i].disabled = "disabled"; |
128 | | - } |
129 | | - var selects = form.getElementsByTagName("select"); |
130 | | - for( var i=0; i < selects.length; i++) { |
131 | | - selects[i].disabled = "disabled"; |
132 | | - } |
133 | | - }, |
134 | | - |
135 | | - /* |
136 | | - * Unlock review form from submissions (using after AJAX requests) |
137 | | - */ |
138 | | - 'unlockReviewForm': function( form ) { |
139 | | - var inputs = form.getElementsByTagName("input"); |
140 | | - for( var i=0; i < inputs.length; i++) { |
141 | | - if( inputs[i].type != 'submit' ) { // not all buttons can be enabled |
142 | | - inputs[i].disabled = ""; |
143 | | - } else { |
144 | | - inputs[i].blur(); // focus off element (bug 24013) |
145 | | - } |
146 | | - } |
147 | | - var textareas = document.getElementsByTagName("textarea"); |
148 | | - for( var i=0; i < textareas.length; i++) { |
149 | | - textareas[i].disabled = ""; |
150 | | - } |
151 | | - var selects = form.getElementsByTagName("select"); |
152 | | - for( var i=0; i < selects.length; i++) { |
153 | | - selects[i].disabled = ""; |
154 | | - } |
155 | | - }, |
156 | | - |
157 | | - /* |
158 | | - * Submit a revision review via AJAX and update form elements. |
159 | | - * |
160 | | - * Note: requestArgs build-up from radios/checkboxes |
161 | | - * based on patch by Daniel Arnold (bug 13744) |
162 | | - */ |
163 | | - 'submitRevisionReview': function() { |
164 | | - var form = document.getElementById("mw-fr-reviewform"); |
165 | | - if( !form ) { |
166 | | - return true; // do normal behavoir (shouldn't happen) |
167 | | - } |
168 | | - FlaggedRevsReview.lockReviewForm( form ); // disallow submissions |
169 | | - |
170 | | - var notes = document.getElementById("wpNotes"); |
171 | | - // Build up arguments array and update submit button text... |
172 | | - var requestArgs = []; // array of strings of the format <"pname|pval">. |
173 | | - var inputs = form.getElementsByTagName("input"); |
174 | | - for( var i=0; i < inputs.length; i++) { |
175 | | - // Different input types may occur depending on tags... |
176 | | - if( inputs[i].name == "title" || inputs[i].name == "action" ) { |
177 | | - continue; // No need to send these... |
178 | | - } else if( inputs[i].type == "submit" ) { |
179 | | - if( inputs[i].id == this.id ) { |
180 | | - requestArgs.push( inputs[i].name + "|1" ); |
181 | | - // Show that we are submitting via this button |
182 | | - inputs[i].value = mediaWiki.msg('revreview-submitting'); |
183 | | - } |
184 | | - } else if( inputs[i].type == "checkbox" ) { |
185 | | - requestArgs.push( inputs[i].name + "|" + |
186 | | - (inputs[i].checked ? inputs[i].value : 0) ); |
187 | | - } else if( inputs[i].type == "radio" ) { |
188 | | - if( inputs[i].checked ) { // must be checked |
189 | | - requestArgs.push( inputs[i].name + "|" + inputs[i].value ); |
190 | | - } |
191 | | - } else { |
192 | | - requestArgs.push( inputs[i].name + "|" + inputs[i].value ); // text/hiddens... |
193 | | - } |
194 | | - } |
195 | | - if( notes ) { |
196 | | - requestArgs.push( notes.name + "|" + notes.value ); |
197 | | - } |
198 | | - var selects = form.getElementsByTagName("select"); |
199 | | - for( var i=0; i < selects.length; i++) { |
200 | | - // Get the selected tag level... |
201 | | - if( selects[i].selectedIndex >= 0 ) { |
202 | | - var soption = selects[i].getElementsByTagName("option")[selects[i].selectedIndex]; |
203 | | - requestArgs.push( selects[i].name + "|" + soption.value ); |
204 | | - } |
205 | | - } |
206 | | - // Send encoded function plus all arguments... |
207 | | - var post_data = 'action=ajax&rs=RevisionReview::AjaxReview'; |
208 | | - for( var i=0; i<requestArgs.length; i++ ) { |
209 | | - post_data += '&rsargs[]=' + encodeURIComponent( requestArgs[i] ); |
210 | | - } |
211 | | - // Send POST request via AJAX! |
212 | | - var call = jQuery.ajax({ |
213 | | - url : wgScriptPath + '/index.php', |
214 | | - type : "POST", |
215 | | - data : post_data, |
216 | | - dataType: "html", // response type |
217 | | - success : function( response ) { |
218 | | - FlaggedRevsReview.updateReviewForm( form, response ); }, |
219 | | - error : function( response ) { |
220 | | - FlaggedRevsReview.unlockReviewForm( form ); } |
221 | | - }); |
222 | | - return false; // don't do normal non-AJAX submit |
223 | | - }, |
224 | | - |
225 | | - /* |
226 | | - * Update form elements after AJAX review. |
227 | | - */ |
228 | | - 'updateReviewForm': function( form, response ) { |
229 | | - var msg = response.substr(6); // remove <err#> or <suc#> |
230 | | - // Read new "last change time" timestamp for conflict handling |
231 | | - // @TODO: pass last-chage-time data using JSON or something not retarded |
232 | | - var m = msg.match(/^<lct#(\d*)>(.*)/m); |
233 | | - if( m ) msg = m[2]; // remove tag from msg |
234 | | - var changeTime = m ? m[1] : null; // MW TS |
235 | | - // Some form elements... |
236 | | - var asubmit = document.getElementById('mw-fr-submit-accept'); |
237 | | - var usubmit = document.getElementById('mw-fr-submit-unaccept'); |
238 | | - var legend = document.getElementById('mw-fr-reviewformlegend'); |
239 | | - var diffNotice = document.getElementById('mw-fr-difftostable'); |
240 | | - var tagBox = document.getElementById('mw-fr-revisiontag'); |
241 | | - // On success... |
242 | | - if( response.indexOf('<suc#>') == 0 ) { |
243 | | - // (a) Update document title and form buttons... |
244 | | - document.title = mediaWiki.msg('actioncomplete'); |
245 | | - if( asubmit && usubmit ) { |
246 | | - // Revision was flagged |
247 | | - if( asubmit.value == mediaWiki.msg('revreview-submitting') ) { |
248 | | - asubmit.value = mediaWiki.msg('revreview-submit-reviewed'); // done! |
249 | | - asubmit.style.fontWeight = 'bold'; |
250 | | - // Unlock and reset *unflag* button |
251 | | - usubmit.value = mediaWiki.msg('revreview-submit-unreview'); |
252 | | - usubmit.removeAttribute( 'style' ); // back to normal |
253 | | - usubmit.disabled = ''; |
254 | | - // Revision was unflagged |
255 | | - } else if( usubmit.value == mediaWiki.msg('revreview-submitting') ) { |
256 | | - usubmit.value = mediaWiki.msg('revreview-submit-unreviewed'); // done! |
257 | | - usubmit.style.fontWeight = 'bold'; |
258 | | - // Unlock and reset *flag* button |
259 | | - asubmit.value = mediaWiki.msg('revreview-submit-review'); |
260 | | - asubmit.removeAttribute( 'style' ); // back to normal |
261 | | - asubmit.disabled = ''; |
262 | | - } |
263 | | - } |
264 | | - // (b) Remove review tag from drafts |
265 | | - if( tagBox ) tagBox.style.display = 'none'; |
266 | | - // (c) Update diff-related items... |
267 | | - var diffUIParams = document.getElementById('mw-fr-diff-dataform'); |
268 | | - if( diffUIParams ) { |
269 | | - // Hide "review this" box on diffs |
270 | | - if( diffNotice ) diffNotice.style.display = 'none'; |
271 | | - // Update the contents of the mw-fr-diff-headeritems div |
272 | | - var requestArgs = []; // <oldid, newid> |
273 | | - requestArgs.push( diffUIParams.getElementsByTagName('input')[0].value ); |
274 | | - requestArgs.push( diffUIParams.getElementsByTagName('input')[1].value ); |
275 | | - // Send encoded function plus all arguments... |
276 | | - var url_pars = '?action=ajax&rs=FlaggablePageView::AjaxBuildDiffHeaderItems'; |
277 | | - for( var i=0; i<requestArgs.length; i++ ) { |
278 | | - url_pars += '&rsargs[]=' + encodeURIComponent(requestArgs[i]); |
279 | | - } |
280 | | - // Send GET request via AJAX! |
281 | | - var call = jQuery.ajax({ |
282 | | - url : wgScriptPath + '/index.php' + url_pars, |
283 | | - type : "GET", |
284 | | - dataType: "html", // response type |
285 | | - success : FlaggedRevsReview.processDiffHeaderItemsResult |
286 | | - }); |
287 | | - } |
288 | | - // On failure... |
289 | | - } else { |
290 | | - // (a) Update document title and form buttons... |
291 | | - document.title = mediaWiki.msg('actionfailed'); |
292 | | - if( asubmit && usubmit ) { |
293 | | - // Revision was flagged |
294 | | - if( asubmit.value == mediaWiki.msg('revreview-submitting') ) { |
295 | | - asubmit.value = mediaWiki.msg('revreview-submit-review'); // back to normal |
296 | | - asubmit.disabled = ''; // unlock flag button |
297 | | - // Revision was unflagged |
298 | | - } else if( usubmit.value == mediaWiki.msg('revreview-submitting') ) { |
299 | | - usubmit.value = mediaWiki.msg('revreview-submit-unreview'); // back to normal |
300 | | - usubmit.disabled = ''; // unlock |
301 | | - } |
302 | | - } |
303 | | - // (b) Output any error response message |
304 | | - if( response.indexOf('<err#>') == 0 ) { |
305 | | - mediaWiki.util.jsMessage( msg, 'review' ); // failure notice |
306 | | - } else { |
307 | | - mediaWiki.util.jsMessage( response, 'review' ); // fatal notice |
308 | | - } |
309 | | - window.scroll(0,0); // scroll up to notice |
310 | | - } |
311 | | - // Update changetime for conflict handling |
312 | | - if( changeTime != null ) { |
313 | | - document.getElementById('mw-fr-input-changetime').value = changeTime; |
314 | | - } |
315 | | - FlaggedRevsReview.unlockReviewForm( form ); |
316 | | - }, |
317 | | - |
318 | | - // update the contents of the mw-fr-diff-headeritems div |
319 | | - 'processDiffHeaderItemsResult': function( response ) { |
320 | | - var diffHeaderItems = document.getElementById("mw-fr-diff-headeritems"); |
321 | | - if( diffHeaderItems && response != '' ) { |
322 | | - diffHeaderItems.innerHTML = response; |
323 | | - } |
324 | | - }, |
325 | | - |
326 | | - /* |
327 | | - * Enable AJAX-based functionality to set that a user is reviewing a page/diff |
328 | | - */ |
329 | | - 'enableAjaxReviewActivity': function() { |
330 | | - // User is already reviewing in another tab... |
331 | | - if ( $('#mw-fr-user-reviewing').val() == 1 ) { |
332 | | - FlaggedRevsReview.isUserReviewing = 1; |
333 | | - FlaggedRevsReview.advertiseReviewing( null, true ); |
334 | | - // User is not already reviewing this.... |
335 | | - } else { |
336 | | - FlaggedRevsReview.deadvertiseReviewing( null, true ); |
337 | | - } |
338 | | - $('#mw-fr-reviewing-status').show(); |
339 | | - }, |
340 | | - |
341 | | - /* |
342 | | - * Flag users as "now reviewing" |
343 | | - */ |
344 | | - 'advertiseReviewing': function( e, isInitial ) { |
345 | | - if ( isInitial !== true ) { // don't send if just setting up form |
346 | | - if ( !FlaggedRevsReview.setReviewingStatus( 1 ) ) { |
347 | | - return; // failed |
348 | | - } |
349 | | - } |
350 | | - // Build notice to say that user is advertising... |
351 | | - var msgkey = $('#mw-fr-input-refid').length |
352 | | - ? 'revreview-adv-reviewing-c' // diff |
353 | | - : 'revreview-adv-reviewing-p'; // page |
354 | | - var $underReview = $( |
355 | | - '<span class="fr-under-review">' + mw.message( msgkey ).escaped() + '</span>' ); |
356 | | - // Update notice to say that user is advertising... |
357 | | - $('#mw-fr-reviewing-status') |
358 | | - .empty() |
359 | | - .append( $underReview ) |
360 | | - .append( ' (' + mw.html.element( 'a', |
361 | | - { id: 'mw-fr-reviewing-stop' }, mw.msg( 'revreview-adv-stop-link' ) ) + ')' ) |
362 | | - .find( '#mw-fr-reviewing-stop') |
363 | | - .css( 'cursor', 'pointer' ) |
364 | | - .click( FlaggedRevsReview.deadvertiseReviewing ); |
365 | | - }, |
366 | | - |
367 | | - /* |
368 | | - * Flag users as "no longer reviewing" |
369 | | - */ |
370 | | - 'deadvertiseReviewing': function( e, isInitial ) { |
371 | | - if ( isInitial !== true ) { // don't send if just setting up form |
372 | | - if ( !FlaggedRevsReview.setReviewingStatus( 0 ) ) { |
373 | | - return; // failed |
374 | | - } |
375 | | - } |
376 | | - // Build notice to say that user is not advertising... |
377 | | - var msgkey = $('#mw-fr-input-refid').length |
378 | | - ? 'revreview-sadv-reviewing-c' // diff |
379 | | - : 'revreview-sadv-reviewing-p'; // page |
380 | | - var $underReview = $( |
381 | | - '<span class="fr-make-under-review">' + |
382 | | - mw.message( msgkey ) |
383 | | - .escaped() |
384 | | - .replace( /\$1/, mw.html.element( 'a', |
385 | | - { id: 'mw-fr-reviewing-start' }, mw.msg( 'revreview-adv-start-link' ) ) ) + |
386 | | - '</span>' |
387 | | - ); |
388 | | - $underReview.find( '#mw-fr-reviewing-start') |
389 | | - .css( 'cursor', 'pointer' ) |
390 | | - .click( FlaggedRevsReview.advertiseReviewing ); |
391 | | - // Update notice to say that user is not advertising... |
392 | | - $('#mw-fr-reviewing-status').empty().append( $underReview ); |
393 | | - }, |
394 | | - |
395 | | - /* |
396 | | - * Set reviewing status for this page/diff |
397 | | - */ |
398 | | - 'setReviewingStatus': function( value ) { |
399 | | - // Get {previd,oldid} array for this page view. |
400 | | - // The previd value will be 0 if this is not a diff view. |
401 | | - var oRevId = $('#mw-fr-input-refid') ? $('#mw-fr-input-refid').val() : 0; |
402 | | - var nRevId = $('#mw-fr-input-oldid') ? $('#mw-fr-input-oldid').val() : 0; |
403 | | - if ( nRevId > 0 ) { |
404 | | - // Send GET request via AJAX! |
405 | | - var call = jQuery.ajax({ |
406 | | - url : wgScriptPath + '/api.php', |
407 | | - data : { |
408 | | - action : 'reviewactivity', |
409 | | - previd : oRevId, |
410 | | - oldid : nRevId, |
411 | | - reviewing : value, |
412 | | - token : mw.user.tokens.get('editToken'), |
413 | | - format : 'json' |
414 | | - }, |
415 | | - type : "POST", |
416 | | - dataType: "html", // response type |
417 | | - timeout : 1700, // don't delay user exiting |
418 | | - async : false |
419 | | - }); |
420 | | - } |
421 | | - if ( call.status == 200 ) { |
422 | | - var s = jQuery.parseJSON( call.responseText ); |
423 | | - if ( s && s.reviewactivity && s.reviewactivity.result == "Success" ) { |
424 | | - FlaggedRevsReview.isUserReviewing = value; |
425 | | - return true; |
426 | | - } |
427 | | - } |
428 | | - return false; |
429 | | - } |
430 | | -}; |
431 | | - |
432 | | -// Perform some onload (which is when this script is included) events: |
433 | | -FlaggedRevsReview.maybeDisableAcceptButton(); |
434 | | -FlaggedRevsReview.updateRatingFormColors(); |
435 | | -FlaggedRevsReview.enableAjaxReview(); |
436 | | -FlaggedRevsReview.enableAjaxReviewActivity(); |
437 | | - |
438 | | -// Flag users as "no longer reviewing" on navigate-away |
439 | | -$( window ).bind( 'beforeunload', function( e ) { |
440 | | - if ( FlaggedRevsReview.isUserReviewing == 1 ) { |
441 | | - FlaggedRevsReview.deadvertiseReviewing(); |
442 | | - } |
443 | | -} ); |
Index: trunk/extensions/FlaggedRevs/presentation/modules/ext.flaggedRevs.basic.css |
— | — | @@ -0,0 +1,311 @@ |
| 2 | +/** |
| 3 | + * FlaggedRevs Stylesheet |
| 4 | + * @author Aaron Schulz |
| 5 | + */ |
| 6 | + |
| 7 | +/* Standard User Interface */ |
| 8 | +div.flaggedrevs_basic, |
| 9 | +div.flaggedrevs_quality, |
| 10 | +div.flaggedrevs_pristine, |
| 11 | +div.flaggedrevs_notice { |
| 12 | + border: 1px solid #aaa; |
| 13 | + padding: 5px; |
| 14 | + font-weight: normal; |
| 15 | + line-height: 1.5em; |
| 16 | + margin: .5em 1em 0em 0em; |
| 17 | + text-align: center; |
| 18 | + clear: both; |
| 19 | +} |
| 20 | +div.flaggedrevs_short_basic img { |
| 21 | + vertical-align: text-bottom; |
| 22 | +} |
| 23 | +div.flaggedrevs_basic { |
| 24 | + background-color: #f0f8ff; |
| 25 | +} |
| 26 | +div.flaggedrevs_quality { |
| 27 | + background-color: #e1ffe1; |
| 28 | +} |
| 29 | +div.flaggedrevs_pristine { |
| 30 | + background-color: #ffffe3; |
| 31 | +} |
| 32 | +div.flaggedrevs_notice { |
| 33 | + background-color: #f9f9f9; |
| 34 | +} |
| 35 | + |
| 36 | +table.flaggedrevs_editnotice, |
| 37 | +table.flaggedrevs_viewnotice { |
| 38 | + padding: 3px; |
| 39 | + border: 2px solid #6cc8f3; |
| 40 | + background-color: #f9f9f9; |
| 41 | + text-align: left; |
| 42 | + width: 100%; |
| 43 | + clear: both; |
| 44 | +} |
| 45 | + |
| 46 | +div.flaggedrevs_diffnotice, |
| 47 | +div.flaggedrevs_preview { |
| 48 | + border: 1px solid #a7d7f9; |
| 49 | + padding: 5px; |
| 50 | + text-align: center; |
| 51 | + clear: both; |
| 52 | +} |
| 53 | +div.flaggedrevs_diffnotice { |
| 54 | + font-size: 85%; |
| 55 | + background-color: #f9f9f9; |
| 56 | +} |
| 57 | +div.flaggedrevs_preview { |
| 58 | + background-color: #eaf2fd; |
| 59 | + color: black; |
| 60 | +} |
| 61 | + |
| 62 | +span.flaggedrevs_important { |
| 63 | + font-size: 115%; |
| 64 | + font-weight: bold; |
| 65 | +} |
| 66 | + |
| 67 | +div.flaggedrevs_notes { |
| 68 | + border: 1px solid #aaa; |
| 69 | + background-color: #f9f9f9; |
| 70 | + padding: 5px; |
| 71 | + font-size: 85%; |
| 72 | + margin-left: 50px; |
| 73 | + margin-right: 50px; |
| 74 | + text-align: center; |
| 75 | +} |
| 76 | + |
| 77 | +.fr-text-value { |
| 78 | + width: 100px; |
| 79 | +} |
| 80 | + |
| 81 | +.fr-marker-20, |
| 82 | +.fr-marker-40, |
| 83 | +.fr-marker-60, |
| 84 | +.fr-marker-80, |
| 85 | +.fr-marker-100 { |
| 86 | + background-position: bottom left; |
| 87 | + background-repeat: no-repeat; |
| 88 | + padding-bottom: 3px; |
| 89 | +} |
| 90 | + |
| 91 | +.fr-marker-20 { |
| 92 | + /* @embed */ |
| 93 | + background-image: url('img/bar_20.png'); |
| 94 | +} |
| 95 | +.fr-marker-40 { |
| 96 | + /* @embed */ |
| 97 | + background-image: url('img/bar_40.png'); |
| 98 | +} |
| 99 | +.fr-marker-60 { |
| 100 | + /* @embed */ |
| 101 | + background-image: url('img/bar_60.png'); |
| 102 | +} |
| 103 | +.fr-marker-80 { |
| 104 | + /* @embed */ |
| 105 | + background-image: url('img/bar_80.png'); |
| 106 | +} |
| 107 | +.fr-marker-100 { |
| 108 | + /* @embed */ |
| 109 | + background-image: url('img/bar_100.png'); |
| 110 | +} |
| 111 | + |
| 112 | +/* Short User Interface */ |
| 113 | +div.flaggedrevs_short { |
| 114 | + border: 1px solid #ccc; |
| 115 | + background-color: #ffffff; |
| 116 | + font-size: 95%; |
| 117 | + font-weight: normal; |
| 118 | + margin: 0 0 0 1em; |
| 119 | + line-height: 16px; |
| 120 | + padding: 2px; |
| 121 | + float: right; |
| 122 | +} |
| 123 | + |
| 124 | +/* @noflip */ |
| 125 | +.sitedir-ltr div.flaggedrevs_short { |
| 126 | + float: right; |
| 127 | + margin: 0 0 0 1em; |
| 128 | +} |
| 129 | + |
| 130 | +/* @noflip */ |
| 131 | +.sitedir-rtl div.flaggedrevs_short { |
| 132 | + float: left; |
| 133 | + margin: 0 1em 0 0; |
| 134 | +} |
| 135 | + |
| 136 | +div.flaggedrevs_short_basic { |
| 137 | + white-space: nowrap; |
| 138 | +} |
| 139 | + |
| 140 | +div.flaggedrevs_short_details { |
| 141 | + border: 1px solid #aaa; |
| 142 | + background-color: #ffffff; |
| 143 | + padding: 5px; |
| 144 | + position: absolute; |
| 145 | + top: 0; |
| 146 | + right: -2px; |
| 147 | + width: 25em; |
| 148 | +} |
| 149 | + |
| 150 | +/* @noflip */ |
| 151 | +.sitedir-ltr div.flaggedrevs_short_details { |
| 152 | + right: -2px; |
| 153 | + left: auto; |
| 154 | +} |
| 155 | + |
| 156 | +/* @noflip */ |
| 157 | +.sitedir-rtl div.flaggedrevs_short_details { |
| 158 | + left: -2px; |
| 159 | + right: auto; |
| 160 | +} |
| 161 | + |
| 162 | +.fr-text { |
| 163 | + height: 1em; |
| 164 | + line-height: 1em; |
| 165 | + margin: 0px 7px 0px 0px; |
| 166 | + padding: 0px; |
| 167 | + font-weight: bold; |
| 168 | + width: 80px; |
| 169 | +} |
| 170 | + |
| 171 | +.fr-value20, |
| 172 | +.fr-value40, |
| 173 | +.fr-value60, |
| 174 | +.fr-value80, |
| 175 | +.fr-value100 { |
| 176 | + height: 1em; |
| 177 | + line-height: 1em; |
| 178 | + width: 95px; |
| 179 | + float: left; |
| 180 | + background-repeat: no-repeat; |
| 181 | + background-position: 50% 50%; |
| 182 | + text-align: center; |
| 183 | +} |
| 184 | + |
| 185 | +.fr-value20 { |
| 186 | + /* @embed */ |
| 187 | + background-image: url('img/fr-marker-20.png'); |
| 188 | +} |
| 189 | +.fr-value40 { |
| 190 | + /* @embed */ |
| 191 | + background-image: url('img/fr-marker-40.png'); |
| 192 | +} |
| 193 | +.fr-value60 { |
| 194 | + /* @embed */ |
| 195 | + background-image: url('img/fr-marker-60.png'); |
| 196 | +} |
| 197 | +.fr-value80 { |
| 198 | + /* @embed */ |
| 199 | + background-image: url('img/fr-marker-80.png'); |
| 200 | +} |
| 201 | +.fr-value100 { |
| 202 | + /* @embed */ |
| 203 | + background-image: url('img/fr-marker-100.png'); |
| 204 | +} |
| 205 | + |
| 206 | +/* Both User Interfaces */ |
| 207 | +.flaggedrevs-color-0 { |
| 208 | + background-color: #f9f9f9; |
| 209 | +} |
| 210 | +.flaggedrevs-color-1 { |
| 211 | + background-color: #f0f8ff; |
| 212 | +} |
| 213 | +.flaggedrevs-color-2 { |
| 214 | + background-color: #e1ffe1; |
| 215 | +} |
| 216 | +.flaggedrevs-color-3 { |
| 217 | + background-color: #ffffe3; |
| 218 | +} |
| 219 | + |
| 220 | +.flaggedrevs-pending { |
| 221 | + background-color: #ffeeaa; |
| 222 | +} |
| 223 | +.flaggedrevs-unreviewed { |
| 224 | + background-color: #faebd7; |
| 225 | +} |
| 226 | + |
| 227 | +a.fr-toggle-symbol { |
| 228 | + color: blue; |
| 229 | + white-space: nowrap; |
| 230 | + font-family: monospace; |
| 231 | + font-weight: bold; |
| 232 | + cursor: pointer; |
| 233 | + margin: 0 .3em 0 .3em; |
| 234 | +} |
| 235 | + |
| 236 | +a.fr-toggle-text { |
| 237 | + color: blue; |
| 238 | + font-weight: bold; |
| 239 | + cursor: pointer; |
| 240 | +} |
| 241 | + |
| 242 | +img.fr-toggle-arrow { |
| 243 | + cursor: pointer; |
| 244 | +} |
| 245 | + |
| 246 | +li.fr-hist-stable-margin { |
| 247 | + margin-top: 2em; |
| 248 | +} |
| 249 | + |
| 250 | +img.flaggedrevs-icon { |
| 251 | + margin-right: .2em; |
| 252 | + margin-left: .2em; |
| 253 | +} |
| 254 | + |
| 255 | +.fr-diff-ratings { |
| 256 | + font-size: 90%; |
| 257 | + font-weight: bold; |
| 258 | + line-height: 1em; |
| 259 | + width: 100%; |
| 260 | +} |
| 261 | + |
| 262 | +.fr-diff-to-stable { |
| 263 | + line-height: 1em; |
| 264 | +} |
| 265 | + |
| 266 | +.fr-hist-basic-user, |
| 267 | +.fr-hist-quality-user, |
| 268 | +.fr-hist-basic-auto, |
| 269 | +.fr-hist-quality-auto { |
| 270 | + font-weight: bold; |
| 271 | +} |
| 272 | + |
| 273 | +/* RC pending changes notice */ |
| 274 | +.fr-watchlist-pending-notice { |
| 275 | + padding: 3px; |
| 276 | + margin: 5px; |
| 277 | + border: 1px solid #990000; |
| 278 | + background-color: #FEECD7; |
| 279 | +} |
| 280 | + |
| 281 | +/* Special pages */ |
| 282 | +.fr-pending-long { |
| 283 | + background-color: #f5ecec; |
| 284 | +} |
| 285 | +.fr-pending-long2 { |
| 286 | + background-color: #f5dddd; |
| 287 | +} |
| 288 | +.fr-pending-long3 { |
| 289 | + background-color: #e2caca; |
| 290 | +} |
| 291 | + |
| 292 | +.fr-unreviewed-unwatched { |
| 293 | + background-color: #faebd7; |
| 294 | +} |
| 295 | + |
| 296 | +span.fr-under-review { |
| 297 | + background-color: yellow; |
| 298 | + font-weight: bold; |
| 299 | +} |
| 300 | + |
| 301 | +.mw-fr-reviewlink { |
| 302 | + font-weight: bold; |
| 303 | +} |
| 304 | + |
| 305 | +/* Diff items */ |
| 306 | +#mw-fr-diff-headeritems { |
| 307 | + direction: ltr; |
| 308 | +} |
| 309 | + |
| 310 | +#mw-fr-stablediff { |
| 311 | + background-color: white; |
| 312 | +} |
Property changes on: trunk/extensions/FlaggedRevs/presentation/modules/ext.flaggedRevs.basic.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 313 | + native |
Index: trunk/extensions/FlaggedRevs/presentation/modules/ext.flaggedRevs.review.css |
— | — | @@ -0,0 +1,48 @@ |
| 2 | +/** |
| 3 | + * FlaggedRevs Stylesheet |
| 4 | + * @author Aaron Schulz |
| 5 | + */ |
| 6 | + |
| 7 | +/* Review form */ |
| 8 | +.flaggedrevs_reviewform { |
| 9 | + background-color: #f9f9f9; |
| 10 | + font-size: 90%; |
| 11 | + clear: both; |
| 12 | +} |
| 13 | + |
| 14 | +.fr-rating-controls, |
| 15 | +.fr-rating-controls-disabled { |
| 16 | + vertical-align: middle; |
| 17 | +} |
| 18 | + |
| 19 | +.fr-rating-controls-disabled { |
| 20 | + color: GrayText; |
| 21 | +} |
| 22 | + |
| 23 | +#mw-fr-confirmreview { |
| 24 | + white-space: nowrap; |
| 25 | +} |
| 26 | +.fr-rating-options { |
| 27 | + margin-right: 1.5em; |
| 28 | + white-space: nowrap; |
| 29 | +} |
| 30 | + |
| 31 | +.fr-rating-option-0 { |
| 32 | + background-color: #f5ecec; |
| 33 | +} |
| 34 | +.fr-rating-option-1 { |
| 35 | + background-color: #f0f8ff; |
| 36 | +} |
| 37 | +.fr-rating-option-2 { |
| 38 | + background-color: #e1ffe1; |
| 39 | +} |
| 40 | +.fr-rating-option-3 { |
| 41 | + background-color: #fef0db; |
| 42 | +} |
| 43 | +.fr-rating-option-4 { |
| 44 | + background-color: #ffffe3; |
| 45 | +} |
| 46 | + |
| 47 | +#mw-fr-commentbox { |
| 48 | + margin-right: 1.5em; |
| 49 | +} |
Property changes on: trunk/extensions/FlaggedRevs/presentation/modules/ext.flaggedRevs.review.css |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 50 | + native |
Index: trunk/extensions/FlaggedRevs/presentation/modules/ext.flaggedRevs.review.js |
— | — | @@ -0,0 +1,442 @@ |
| 2 | +/** |
| 3 | + * FlaggedRevs Stylesheet |
| 4 | + * @author Aaron Schulz |
| 5 | + * @author Daniel Arnold 2008 |
| 6 | + */ |
| 7 | + |
| 8 | +window.FlaggedRevsReview = { |
| 9 | + 'isUserReviewing': 0, // user reviewing this page? |
| 10 | + /* |
| 11 | + * Updates for radios/checkboxes on patch by Daniel Arnold (bug 13744). |
| 12 | + * Visually update the revision rating form on change. |
| 13 | + * - Disable submit in case of invalid input. |
| 14 | + * - Update colors when <select> changes. |
| 15 | + * - Also remove comment box clutter in case of invalid input. |
| 16 | + * NOTE: all buttons should exist (perhaps hidden though) |
| 17 | + */ |
| 18 | + 'updateRatingForm': function() { |
| 19 | + var ratingform = document.getElementById('mw-fr-ratingselects'); |
| 20 | + if( !ratingform ) return; |
| 21 | + var disabled = document.getElementById('fr-rating-controls-disabled'); |
| 22 | + if( disabled ) return; |
| 23 | + |
| 24 | + var quality = true; |
| 25 | + var somezero = false; |
| 26 | + |
| 27 | + // Determine if this is a "quality" or "incomplete" review |
| 28 | + for( var tag in wgFlaggedRevsParams.tags ) { |
| 29 | + var controlName = "wp" + tag; |
| 30 | + var levels = document.getElementsByName(controlName); |
| 31 | + if( !levels.length ) continue; |
| 32 | + |
| 33 | + var selectedlevel = 0; // default |
| 34 | + if( levels[0].nodeName == 'SELECT' ) { |
| 35 | + selectedlevel = levels[0].selectedIndex; |
| 36 | + } else if( levels[0].type == 'radio' ) { |
| 37 | + for( var i = 0; i < levels.length; i++ ) { |
| 38 | + if( levels[i].checked ) { |
| 39 | + selectedlevel = i; |
| 40 | + break; |
| 41 | + } |
| 42 | + } |
| 43 | + } else if( levels[0].type == 'checkbox' ) { |
| 44 | + selectedlevel = (levels[0].checked) ? 1: 0; |
| 45 | + } else { |
| 46 | + return; // error: should not happen |
| 47 | + } |
| 48 | + |
| 49 | + // Get quality level for this tag |
| 50 | + var qualityLevel = wgFlaggedRevsParams.tags[tag]['quality']; |
| 51 | + |
| 52 | + if( selectedlevel < qualityLevel ) { |
| 53 | + quality = false; // not a quality review |
| 54 | + } |
| 55 | + if( selectedlevel <= 0 ) { |
| 56 | + somezero = true; |
| 57 | + } |
| 58 | + } |
| 59 | + |
| 60 | + // (a) If only a few levels are zero ("incomplete") then disable submission. |
| 61 | + // (b) Re-enable submission for already accepted revs when ratings change. |
| 62 | + var asubmit = document.getElementById('mw-fr-submit-accept'); |
| 63 | + if( asubmit ) { |
| 64 | + asubmit.disabled = somezero ? 'disabled' : ''; |
| 65 | + asubmit.value = mediaWiki.msg('revreview-submit-review'); // reset to "Accept" |
| 66 | + } |
| 67 | + |
| 68 | + // Update colors of <select> |
| 69 | + FlaggedRevsReview.updateRatingFormColors( ratingform ); |
| 70 | + }, |
| 71 | + |
| 72 | + /* |
| 73 | + * Update <select> color for the selected item |
| 74 | + */ |
| 75 | + 'updateRatingFormColors': function() { |
| 76 | + for( var tag in wgFlaggedRevsParams.tags ) { |
| 77 | + var controlName = "wp" + tag; |
| 78 | + var levels = document.getElementsByName(controlName); |
| 79 | + if( levels.length && levels[0].nodeName == 'SELECT' ) { |
| 80 | + var selectedlevel = levels[0].selectedIndex; |
| 81 | + var value = levels[0].getElementsByTagName('option')[selectedlevel].value; |
| 82 | + levels[0].className = 'fr-rating-option-' + value; |
| 83 | + // Fix FF one-time jitter bug of changing an <option> |
| 84 | + levels[0].selectedIndex = null; |
| 85 | + levels[0].selectedIndex = selectedlevel; |
| 86 | + } |
| 87 | + } |
| 88 | + }, |
| 89 | + |
| 90 | + /* |
| 91 | + * Disable 'accept' button if the revision was already reviewed |
| 92 | + * NOTE: this is used so that they can be re-enabled if a rating changes |
| 93 | + */ |
| 94 | + 'maybeDisableAcceptButton': function() { |
| 95 | + if( typeof(jsReviewNeedsChange) != 'undefined' && jsReviewNeedsChange == 1 ) { |
| 96 | + var asubmit = document.getElementById('mw-fr-submit-accept'); |
| 97 | + if( asubmit ) { |
| 98 | + asubmit.disabled = 'disabled'; |
| 99 | + } |
| 100 | + } |
| 101 | + }, |
| 102 | + |
| 103 | + /* |
| 104 | + * Enable AJAX-based submit functionality to the review form on this page |
| 105 | + */ |
| 106 | + 'enableAjaxReview': function() { |
| 107 | + var asubmit = document.getElementById("mw-fr-submit-accept"); |
| 108 | + if( asubmit ) { |
| 109 | + asubmit.onclick = FlaggedRevsReview.submitRevisionReview; |
| 110 | + } |
| 111 | + var usubmit = document.getElementById("mw-fr-submit-unaccept"); |
| 112 | + if( usubmit ) { |
| 113 | + usubmit.onclick = FlaggedRevsReview.submitRevisionReview; |
| 114 | + } |
| 115 | + }, |
| 116 | + |
| 117 | + /* |
| 118 | + * Lock review form from submissions (using during AJAX requests) |
| 119 | + */ |
| 120 | + 'lockReviewForm': function( form ) { |
| 121 | + var inputs = form.getElementsByTagName("input"); |
| 122 | + for( var i=0; i < inputs.length; i++) { |
| 123 | + inputs[i].disabled = "disabled"; |
| 124 | + } |
| 125 | + var textareas = document.getElementsByTagName("textarea"); |
| 126 | + for( var i=0; i < textareas.length; i++) { |
| 127 | + textareas[i].disabled = "disabled"; |
| 128 | + } |
| 129 | + var selects = form.getElementsByTagName("select"); |
| 130 | + for( var i=0; i < selects.length; i++) { |
| 131 | + selects[i].disabled = "disabled"; |
| 132 | + } |
| 133 | + }, |
| 134 | + |
| 135 | + /* |
| 136 | + * Unlock review form from submissions (using after AJAX requests) |
| 137 | + */ |
| 138 | + 'unlockReviewForm': function( form ) { |
| 139 | + var inputs = form.getElementsByTagName("input"); |
| 140 | + for( var i=0; i < inputs.length; i++) { |
| 141 | + if( inputs[i].type != 'submit' ) { // not all buttons can be enabled |
| 142 | + inputs[i].disabled = ""; |
| 143 | + } else { |
| 144 | + inputs[i].blur(); // focus off element (bug 24013) |
| 145 | + } |
| 146 | + } |
| 147 | + var textareas = document.getElementsByTagName("textarea"); |
| 148 | + for( var i=0; i < textareas.length; i++) { |
| 149 | + textareas[i].disabled = ""; |
| 150 | + } |
| 151 | + var selects = form.getElementsByTagName("select"); |
| 152 | + for( var i=0; i < selects.length; i++) { |
| 153 | + selects[i].disabled = ""; |
| 154 | + } |
| 155 | + }, |
| 156 | + |
| 157 | + /* |
| 158 | + * Submit a revision review via AJAX and update form elements. |
| 159 | + * |
| 160 | + * Note: requestArgs build-up from radios/checkboxes |
| 161 | + * based on patch by Daniel Arnold (bug 13744) |
| 162 | + */ |
| 163 | + 'submitRevisionReview': function() { |
| 164 | + var form = document.getElementById("mw-fr-reviewform"); |
| 165 | + if( !form ) { |
| 166 | + return true; // do normal behavoir (shouldn't happen) |
| 167 | + } |
| 168 | + FlaggedRevsReview.lockReviewForm( form ); // disallow submissions |
| 169 | + |
| 170 | + var notes = document.getElementById("wpNotes"); |
| 171 | + // Build up arguments array and update submit button text... |
| 172 | + var requestArgs = []; // array of strings of the format <"pname|pval">. |
| 173 | + var inputs = form.getElementsByTagName("input"); |
| 174 | + for( var i=0; i < inputs.length; i++) { |
| 175 | + // Different input types may occur depending on tags... |
| 176 | + if( inputs[i].name == "title" || inputs[i].name == "action" ) { |
| 177 | + continue; // No need to send these... |
| 178 | + } else if( inputs[i].type == "submit" ) { |
| 179 | + if( inputs[i].id == this.id ) { |
| 180 | + requestArgs.push( inputs[i].name + "|1" ); |
| 181 | + // Show that we are submitting via this button |
| 182 | + inputs[i].value = mediaWiki.msg('revreview-submitting'); |
| 183 | + } |
| 184 | + } else if( inputs[i].type == "checkbox" ) { |
| 185 | + requestArgs.push( inputs[i].name + "|" + |
| 186 | + (inputs[i].checked ? inputs[i].value : 0) ); |
| 187 | + } else if( inputs[i].type == "radio" ) { |
| 188 | + if( inputs[i].checked ) { // must be checked |
| 189 | + requestArgs.push( inputs[i].name + "|" + inputs[i].value ); |
| 190 | + } |
| 191 | + } else { |
| 192 | + requestArgs.push( inputs[i].name + "|" + inputs[i].value ); // text/hiddens... |
| 193 | + } |
| 194 | + } |
| 195 | + if( notes ) { |
| 196 | + requestArgs.push( notes.name + "|" + notes.value ); |
| 197 | + } |
| 198 | + var selects = form.getElementsByTagName("select"); |
| 199 | + for( var i=0; i < selects.length; i++) { |
| 200 | + // Get the selected tag level... |
| 201 | + if( selects[i].selectedIndex >= 0 ) { |
| 202 | + var soption = selects[i].getElementsByTagName("option")[selects[i].selectedIndex]; |
| 203 | + requestArgs.push( selects[i].name + "|" + soption.value ); |
| 204 | + } |
| 205 | + } |
| 206 | + // Send encoded function plus all arguments... |
| 207 | + var post_data = 'action=ajax&rs=RevisionReview::AjaxReview'; |
| 208 | + for( var i=0; i<requestArgs.length; i++ ) { |
| 209 | + post_data += '&rsargs[]=' + encodeURIComponent( requestArgs[i] ); |
| 210 | + } |
| 211 | + // Send POST request via AJAX! |
| 212 | + var call = jQuery.ajax({ |
| 213 | + url : wgScriptPath + '/index.php', |
| 214 | + type : "POST", |
| 215 | + data : post_data, |
| 216 | + dataType: "html", // response type |
| 217 | + success : function( response ) { |
| 218 | + FlaggedRevsReview.updateReviewForm( form, response ); }, |
| 219 | + error : function( response ) { |
| 220 | + FlaggedRevsReview.unlockReviewForm( form ); } |
| 221 | + }); |
| 222 | + return false; // don't do normal non-AJAX submit |
| 223 | + }, |
| 224 | + |
| 225 | + /* |
| 226 | + * Update form elements after AJAX review. |
| 227 | + */ |
| 228 | + 'updateReviewForm': function( form, response ) { |
| 229 | + var msg = response.substr(6); // remove <err#> or <suc#> |
| 230 | + // Read new "last change time" timestamp for conflict handling |
| 231 | + // @TODO: pass last-chage-time data using JSON or something not retarded |
| 232 | + var m = msg.match(/^<lct#(\d*)>(.*)/m); |
| 233 | + if( m ) msg = m[2]; // remove tag from msg |
| 234 | + var changeTime = m ? m[1] : null; // MW TS |
| 235 | + // Some form elements... |
| 236 | + var asubmit = document.getElementById('mw-fr-submit-accept'); |
| 237 | + var usubmit = document.getElementById('mw-fr-submit-unaccept'); |
| 238 | + var legend = document.getElementById('mw-fr-reviewformlegend'); |
| 239 | + var diffNotice = document.getElementById('mw-fr-difftostable'); |
| 240 | + var tagBox = document.getElementById('mw-fr-revisiontag'); |
| 241 | + // On success... |
| 242 | + if( response.indexOf('<suc#>') == 0 ) { |
| 243 | + // (a) Update document title and form buttons... |
| 244 | + document.title = mediaWiki.msg('actioncomplete'); |
| 245 | + if( asubmit && usubmit ) { |
| 246 | + // Revision was flagged |
| 247 | + if( asubmit.value == mediaWiki.msg('revreview-submitting') ) { |
| 248 | + asubmit.value = mediaWiki.msg('revreview-submit-reviewed'); // done! |
| 249 | + asubmit.style.fontWeight = 'bold'; |
| 250 | + // Unlock and reset *unflag* button |
| 251 | + usubmit.value = mediaWiki.msg('revreview-submit-unreview'); |
| 252 | + usubmit.removeAttribute( 'style' ); // back to normal |
| 253 | + usubmit.disabled = ''; |
| 254 | + // Revision was unflagged |
| 255 | + } else if( usubmit.value == mediaWiki.msg('revreview-submitting') ) { |
| 256 | + usubmit.value = mediaWiki.msg('revreview-submit-unreviewed'); // done! |
| 257 | + usubmit.style.fontWeight = 'bold'; |
| 258 | + // Unlock and reset *flag* button |
| 259 | + asubmit.value = mediaWiki.msg('revreview-submit-review'); |
| 260 | + asubmit.removeAttribute( 'style' ); // back to normal |
| 261 | + asubmit.disabled = ''; |
| 262 | + } |
| 263 | + } |
| 264 | + // (b) Remove review tag from drafts |
| 265 | + if( tagBox ) tagBox.style.display = 'none'; |
| 266 | + // (c) Update diff-related items... |
| 267 | + var diffUIParams = document.getElementById('mw-fr-diff-dataform'); |
| 268 | + if( diffUIParams ) { |
| 269 | + // Hide "review this" box on diffs |
| 270 | + if( diffNotice ) diffNotice.style.display = 'none'; |
| 271 | + // Update the contents of the mw-fr-diff-headeritems div |
| 272 | + var requestArgs = []; // <oldid, newid> |
| 273 | + requestArgs.push( diffUIParams.getElementsByTagName('input')[0].value ); |
| 274 | + requestArgs.push( diffUIParams.getElementsByTagName('input')[1].value ); |
| 275 | + // Send encoded function plus all arguments... |
| 276 | + var url_pars = '?action=ajax&rs=FlaggablePageView::AjaxBuildDiffHeaderItems'; |
| 277 | + for( var i=0; i<requestArgs.length; i++ ) { |
| 278 | + url_pars += '&rsargs[]=' + encodeURIComponent(requestArgs[i]); |
| 279 | + } |
| 280 | + // Send GET request via AJAX! |
| 281 | + var call = jQuery.ajax({ |
| 282 | + url : wgScriptPath + '/index.php' + url_pars, |
| 283 | + type : "GET", |
| 284 | + dataType: "html", // response type |
| 285 | + success : FlaggedRevsReview.processDiffHeaderItemsResult |
| 286 | + }); |
| 287 | + } |
| 288 | + // On failure... |
| 289 | + } else { |
| 290 | + // (a) Update document title and form buttons... |
| 291 | + document.title = mediaWiki.msg('actionfailed'); |
| 292 | + if( asubmit && usubmit ) { |
| 293 | + // Revision was flagged |
| 294 | + if( asubmit.value == mediaWiki.msg('revreview-submitting') ) { |
| 295 | + asubmit.value = mediaWiki.msg('revreview-submit-review'); // back to normal |
| 296 | + asubmit.disabled = ''; // unlock flag button |
| 297 | + // Revision was unflagged |
| 298 | + } else if( usubmit.value == mediaWiki.msg('revreview-submitting') ) { |
| 299 | + usubmit.value = mediaWiki.msg('revreview-submit-unreview'); // back to normal |
| 300 | + usubmit.disabled = ''; // unlock |
| 301 | + } |
| 302 | + } |
| 303 | + // (b) Output any error response message |
| 304 | + if( response.indexOf('<err#>') == 0 ) { |
| 305 | + mediaWiki.util.jsMessage( msg, 'review' ); // failure notice |
| 306 | + } else { |
| 307 | + mediaWiki.util.jsMessage( response, 'review' ); // fatal notice |
| 308 | + } |
| 309 | + window.scroll(0,0); // scroll up to notice |
| 310 | + } |
| 311 | + // Update changetime for conflict handling |
| 312 | + if( changeTime != null ) { |
| 313 | + document.getElementById('mw-fr-input-changetime').value = changeTime; |
| 314 | + } |
| 315 | + FlaggedRevsReview.unlockReviewForm( form ); |
| 316 | + }, |
| 317 | + |
| 318 | + // update the contents of the mw-fr-diff-headeritems div |
| 319 | + 'processDiffHeaderItemsResult': function( response ) { |
| 320 | + var diffHeaderItems = document.getElementById("mw-fr-diff-headeritems"); |
| 321 | + if( diffHeaderItems && response != '' ) { |
| 322 | + diffHeaderItems.innerHTML = response; |
| 323 | + } |
| 324 | + }, |
| 325 | + |
| 326 | + /* |
| 327 | + * Enable AJAX-based functionality to set that a user is reviewing a page/diff |
| 328 | + */ |
| 329 | + 'enableAjaxReviewActivity': function() { |
| 330 | + // User is already reviewing in another tab... |
| 331 | + if ( $('#mw-fr-user-reviewing').val() == 1 ) { |
| 332 | + FlaggedRevsReview.isUserReviewing = 1; |
| 333 | + FlaggedRevsReview.advertiseReviewing( null, true ); |
| 334 | + // User is not already reviewing this.... |
| 335 | + } else { |
| 336 | + FlaggedRevsReview.deadvertiseReviewing( null, true ); |
| 337 | + } |
| 338 | + $('#mw-fr-reviewing-status').show(); |
| 339 | + }, |
| 340 | + |
| 341 | + /* |
| 342 | + * Flag users as "now reviewing" |
| 343 | + */ |
| 344 | + 'advertiseReviewing': function( e, isInitial ) { |
| 345 | + if ( isInitial !== true ) { // don't send if just setting up form |
| 346 | + if ( !FlaggedRevsReview.setReviewingStatus( 1 ) ) { |
| 347 | + return; // failed |
| 348 | + } |
| 349 | + } |
| 350 | + // Build notice to say that user is advertising... |
| 351 | + var msgkey = $('#mw-fr-input-refid').length |
| 352 | + ? 'revreview-adv-reviewing-c' // diff |
| 353 | + : 'revreview-adv-reviewing-p'; // page |
| 354 | + var $underReview = $( |
| 355 | + '<span class="fr-under-review">' + mw.message( msgkey ).escaped() + '</span>' ); |
| 356 | + // Update notice to say that user is advertising... |
| 357 | + $('#mw-fr-reviewing-status') |
| 358 | + .empty() |
| 359 | + .append( $underReview ) |
| 360 | + .append( ' (' + mw.html.element( 'a', |
| 361 | + { id: 'mw-fr-reviewing-stop' }, mw.msg( 'revreview-adv-stop-link' ) ) + ')' ) |
| 362 | + .find( '#mw-fr-reviewing-stop') |
| 363 | + .css( 'cursor', 'pointer' ) |
| 364 | + .click( FlaggedRevsReview.deadvertiseReviewing ); |
| 365 | + }, |
| 366 | + |
| 367 | + /* |
| 368 | + * Flag users as "no longer reviewing" |
| 369 | + */ |
| 370 | + 'deadvertiseReviewing': function( e, isInitial ) { |
| 371 | + if ( isInitial !== true ) { // don't send if just setting up form |
| 372 | + if ( !FlaggedRevsReview.setReviewingStatus( 0 ) ) { |
| 373 | + return; // failed |
| 374 | + } |
| 375 | + } |
| 376 | + // Build notice to say that user is not advertising... |
| 377 | + var msgkey = $('#mw-fr-input-refid').length |
| 378 | + ? 'revreview-sadv-reviewing-c' // diff |
| 379 | + : 'revreview-sadv-reviewing-p'; // page |
| 380 | + var $underReview = $( |
| 381 | + '<span class="fr-make-under-review">' + |
| 382 | + mw.message( msgkey ) |
| 383 | + .escaped() |
| 384 | + .replace( /\$1/, mw.html.element( 'a', |
| 385 | + { id: 'mw-fr-reviewing-start' }, mw.msg( 'revreview-adv-start-link' ) ) ) + |
| 386 | + '</span>' |
| 387 | + ); |
| 388 | + $underReview.find( '#mw-fr-reviewing-start') |
| 389 | + .css( 'cursor', 'pointer' ) |
| 390 | + .click( FlaggedRevsReview.advertiseReviewing ); |
| 391 | + // Update notice to say that user is not advertising... |
| 392 | + $('#mw-fr-reviewing-status').empty().append( $underReview ); |
| 393 | + }, |
| 394 | + |
| 395 | + /* |
| 396 | + * Set reviewing status for this page/diff |
| 397 | + */ |
| 398 | + 'setReviewingStatus': function( value ) { |
| 399 | + // Get {previd,oldid} array for this page view. |
| 400 | + // The previd value will be 0 if this is not a diff view. |
| 401 | + var oRevId = $('#mw-fr-input-refid') ? $('#mw-fr-input-refid').val() : 0; |
| 402 | + var nRevId = $('#mw-fr-input-oldid') ? $('#mw-fr-input-oldid').val() : 0; |
| 403 | + if ( nRevId > 0 ) { |
| 404 | + // Send GET request via AJAX! |
| 405 | + var call = jQuery.ajax({ |
| 406 | + url : wgScriptPath + '/api.php', |
| 407 | + data : { |
| 408 | + action : 'reviewactivity', |
| 409 | + previd : oRevId, |
| 410 | + oldid : nRevId, |
| 411 | + reviewing : value, |
| 412 | + token : mw.user.tokens.get('editToken'), |
| 413 | + format : 'json' |
| 414 | + }, |
| 415 | + type : "POST", |
| 416 | + dataType: "html", // response type |
| 417 | + timeout : 1700, // don't delay user exiting |
| 418 | + async : false |
| 419 | + }); |
| 420 | + } |
| 421 | + if ( call.status == 200 ) { |
| 422 | + var s = jQuery.parseJSON( call.responseText ); |
| 423 | + if ( s && s.reviewactivity && s.reviewactivity.result == "Success" ) { |
| 424 | + FlaggedRevsReview.isUserReviewing = value; |
| 425 | + return true; |
| 426 | + } |
| 427 | + } |
| 428 | + return false; |
| 429 | + } |
| 430 | +}; |
| 431 | + |
| 432 | +// Perform some onload (which is when this script is included) events: |
| 433 | +FlaggedRevsReview.maybeDisableAcceptButton(); |
| 434 | +FlaggedRevsReview.updateRatingFormColors(); |
| 435 | +FlaggedRevsReview.enableAjaxReview(); |
| 436 | +FlaggedRevsReview.enableAjaxReviewActivity(); |
| 437 | + |
| 438 | +// Flag users as "no longer reviewing" on navigate-away |
| 439 | +$( window ).bind( 'beforeunload', function( e ) { |
| 440 | + if ( FlaggedRevsReview.isUserReviewing == 1 ) { |
| 441 | + FlaggedRevsReview.deadvertiseReviewing(); |
| 442 | + } |
| 443 | +} ); |
Property changes on: trunk/extensions/FlaggedRevs/presentation/modules/ext.flaggedRevs.review.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 444 | + native |
Index: trunk/extensions/FlaggedRevs/presentation/modules/ext.flaggedRevs.advanced.js |
— | — | @@ -0,0 +1,212 @@ |
| 2 | +/** |
| 3 | + * FlaggedRevs Stylesheet |
| 4 | + * @author Aaron Schulz |
| 5 | + * @author Krinkle <krinklemail@gmail.com> 2011 |
| 6 | + */ |
| 7 | +( function( $ ) { |
| 8 | + |
| 9 | +var fr = { |
| 10 | + /* Dropdown collapse timer */ |
| 11 | + 'boxCollapseTimer': null, |
| 12 | + |
| 13 | + /* Startup function */ |
| 14 | + 'init': function() { |
| 15 | + // Enables rating detail box |
| 16 | + var toggle = $( '#mw-fr-revisiontoggle' ); |
| 17 | + |
| 18 | + if ( toggle.length ) { |
| 19 | + toggle.css( 'display', 'inline' ); // show toggle control |
| 20 | + fr.hideBoxDetails(); // hide the initially displayed ratings |
| 21 | + } |
| 22 | + |
| 23 | + // Bar UI: Toggle the box when the toggle is clicked |
| 24 | + $( '.fr-toggle-symbol#mw-fr-revisiontoggle' ).click( fr.toggleBoxDetails ); |
| 25 | + |
| 26 | + // Simple UI: Show the box on mouseOver |
| 27 | + $( '.fr-toggle-arrow#mw-fr-revisiontoggle' ).mouseover( fr.onBoxMouseOver ); |
| 28 | + $( '.flaggedrevs_short#mw-fr-revisiontag' ).mouseout( fr.onBoxMouseOut ); |
| 29 | + |
| 30 | + // Enables diff detail box and toggle |
| 31 | + toggle = $( '#mw-fr-difftoggle' ); |
| 32 | + if ( toggle.length ) { |
| 33 | + toggle.css( 'display', 'inline' ); // show toggle control |
| 34 | + $( '#mw-fr-stablediff' ).hide(); |
| 35 | + } |
| 36 | + toggle.children( 'a' ).click( fr.toggleDiff ); |
| 37 | + |
| 38 | + // Enables log detail box and toggle |
| 39 | + toggle = $( '#mw-fr-logtoggle' ); |
| 40 | + if ( toggle.length ) { |
| 41 | + toggle.css( 'display', 'inline' ); // show toggle control |
| 42 | + $( '#mw-fr-logexcerpt' ).hide(); |
| 43 | + } |
| 44 | + toggle.children( 'a' ).click( fr.toggleLog ); |
| 45 | + |
| 46 | + // Enables changing of save button when "review this" checkbox changes |
| 47 | + $( '#wpReviewEdit' ).click( fr.updateSaveButton ); |
| 48 | + }, |
| 49 | + |
| 50 | + /* Expands flag info box details */ |
| 51 | + 'showBoxDetails': function() { |
| 52 | + $( '#mw-fr-revisiondetails' ).css( 'display', 'block' ); |
| 53 | + }, |
| 54 | + |
| 55 | + /* Collapses flag info box details */ |
| 56 | + 'hideBoxDetails': function() { |
| 57 | + $( '#mw-fr-revisiondetails' ).css( 'display', 'none' ); |
| 58 | + }, |
| 59 | + |
| 60 | + /** |
| 61 | + * Toggles flag info box details for (+/-) control |
| 62 | + * @context {jQuery} |
| 63 | + * @param e {jQuery.Event} |
| 64 | + */ |
| 65 | + 'toggleBoxDetails': function( e ) { |
| 66 | + var toggle = $( '#mw-fr-revisiontoggle' ), |
| 67 | + ratings = $( '#mw-fr-revisiondetails' ); |
| 68 | + |
| 69 | + if ( toggle.length && ratings.length ) { |
| 70 | + // Collapsed -> expand |
| 71 | + if ( ratings.css( 'display' ) === 'none' ) { |
| 72 | + fr.showBoxDetails(); |
| 73 | + toggle.text( mw.msg( 'revreview-toggle-hide' ) ); |
| 74 | + // Expanded -> collapse |
| 75 | + } else { |
| 76 | + fr.hideBoxDetails(); |
| 77 | + toggle.text( mw.msg( 'revreview-toggle-show' ) ); |
| 78 | + } |
| 79 | + } |
| 80 | + }, |
| 81 | + |
| 82 | + /** |
| 83 | + * Expands flag info box details on mouseOver |
| 84 | + * @context {jQuery} |
| 85 | + * @param e {jQuery.Event} |
| 86 | + */ |
| 87 | + 'onBoxMouseOver': function( e ) { |
| 88 | + window.clearTimeout( fr.boxCollapseTimer ); |
| 89 | + fr.boxCollapseTimer = null; |
| 90 | + fr.showBoxDetails(); |
| 91 | + }, |
| 92 | + |
| 93 | + /** |
| 94 | + * Hides flag info box details on mouseOut *except* for event bubbling |
| 95 | + * @context {jQuery} |
| 96 | + * @param e {jQuery.Event} |
| 97 | + */ |
| 98 | + 'onBoxMouseOut': function( e ) { |
| 99 | + if ( !fr.isMouseOutBubble( e, 'mw-fr-revisiontag' ) ) { |
| 100 | + fr.boxCollapseTimer = window.setTimeout( fr.hideBoxDetails, 150 ); |
| 101 | + } |
| 102 | + }, |
| 103 | + |
| 104 | + /** |
| 105 | + * Checks if mouseOut event is for a child of parentId |
| 106 | + * @param e {jQuery.Event} |
| 107 | + * @param parentId {String} |
| 108 | + * @return {Boolean} True if given event object originated from a (direct or indirect) |
| 109 | + * child element of an element with an id of parentId. |
| 110 | + */ |
| 111 | + 'isMouseOutBubble': function( e, parentId ) { |
| 112 | + var toNode = e.relatedTarget; |
| 113 | + |
| 114 | + if ( toNode ) { |
| 115 | + var nextParent = toNode.parentNode; |
| 116 | + while ( nextParent ) { |
| 117 | + if ( nextParent.id === parentId ) { |
| 118 | + return true; |
| 119 | + } |
| 120 | + // next up |
| 121 | + nextParent = nextParent.parentNode; |
| 122 | + } |
| 123 | + } |
| 124 | + return false; |
| 125 | + }, |
| 126 | + |
| 127 | + /** |
| 128 | + * Toggles diffs |
| 129 | + * @context {jQuery} |
| 130 | + * @param e {jQuery.Event} |
| 131 | + */ |
| 132 | + 'toggleDiff': function( e ) { |
| 133 | + var diff = $( '#mw-fr-stablediff' ), |
| 134 | + toggle = $( '#mw-fr-difftoggle' ); |
| 135 | + |
| 136 | + if ( diff.length && toggle.length ) { |
| 137 | + if ( diff.css( 'display' ) === 'none' ) { |
| 138 | + diff.show( 'slow' ); |
| 139 | + toggle.children( 'a' ).text( mw.msg( 'revreview-diff-toggle-hide' ) ); |
| 140 | + } else { |
| 141 | + diff.hide( 'slow' ); |
| 142 | + toggle.children( 'a' ).text( mw.msg( 'revreview-diff-toggle-show' ) ); |
| 143 | + } |
| 144 | + } |
| 145 | + }, |
| 146 | + |
| 147 | + /** |
| 148 | + * Toggles log excerpts |
| 149 | + * @context {jQuery} |
| 150 | + * @param e {jQuery.Event} |
| 151 | + */ |
| 152 | + 'toggleLog': function( e ) { |
| 153 | + var hideMsg, showMsg, |
| 154 | + log = $( '#mw-fr-logexcerpt' ), |
| 155 | + toggle = $( '#mw-fr-logtoggle' ); |
| 156 | + |
| 157 | + if ( log.length && toggle.length ) { |
| 158 | + // Two different message sets used here... |
| 159 | + if ( toggle.hasClass( 'fr-logtoggle-details' ) ) { |
| 160 | + hideMsg = mw.msg( 'revreview-log-details-hide' ); |
| 161 | + showMsg = mw.msg( 'revreview-log-details-show' ); |
| 162 | + } else { |
| 163 | + hideMsg = mw.msg( 'revreview-log-toggle-hide' ); |
| 164 | + showMsg = mw.msg( 'revreview-log-toggle-show' ); |
| 165 | + } |
| 166 | + |
| 167 | + if ( log.css( 'display' ) === 'none' ) { |
| 168 | + log.show(); |
| 169 | + toggle.children( 'a' ).text( hideMsg ); |
| 170 | + } else { |
| 171 | + log.hide(); |
| 172 | + toggle.children( 'a' ).text( showMsg ); |
| 173 | + } |
| 174 | + } |
| 175 | + }, |
| 176 | + |
| 177 | + /** |
| 178 | + * Update save button when "review this" checkbox changes |
| 179 | + * @context {jQuery} |
| 180 | + * @param e {jQuery.Event} |
| 181 | + */ |
| 182 | + 'updateSaveButton': function() { |
| 183 | + var $save = $( '#wpSave' ), |
| 184 | + $checkbox = $( '#wpReviewEdit' ); |
| 185 | + |
| 186 | + if ( $save.length && $checkbox.length ) { |
| 187 | + // Review pending changes |
| 188 | + if ( $checkbox.prop( 'checked' ) ) { |
| 189 | + $save |
| 190 | + .val( mw.msg( 'savearticle' ) ) |
| 191 | + .attr( 'title', |
| 192 | + mw.msg( 'tooltip-save' ) + ' [' + mw.msg( 'accesskey-save' ) + ']' |
| 193 | + ); |
| 194 | + // Submit for review |
| 195 | + } else { |
| 196 | + $save |
| 197 | + .val( mw.msg( 'revreview-submitedit' ) ) |
| 198 | + .attr( 'title', |
| 199 | + mw.msg( 'revreview-submitedit-title' ) + ' [' + mw.msg( 'accesskey-save' ) + ']' |
| 200 | + ); |
| 201 | + } |
| 202 | + } |
| 203 | + mw.util.updateTooltipAccessKeys( [ $save ] ); // update accesskey in save.title |
| 204 | + } |
| 205 | +}; |
| 206 | + |
| 207 | +// Perform some onload (which is when this script is included) events: |
| 208 | +fr.init(); |
| 209 | + |
| 210 | +// Expose globally |
| 211 | +window.FlaggedRevs = fr; |
| 212 | + |
| 213 | +})( jQuery ); |
Property changes on: trunk/extensions/FlaggedRevs/presentation/modules/ext.flaggedRevs.advanced.js |
___________________________________________________________________ |
Added: svn:eol-style |
1 | 214 | + native |