Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php |
— | — | @@ -301,7 +301,7 @@ |
302 | 302 | $wgAvailableRights[] = 'stablesettings'; |
303 | 303 | |
304 | 304 | # Bump this number every time you change flaggedrevs.css/flaggedrevs.js |
305 | | -$wgFlaggedRevStyleVersion = 70; |
| 305 | +$wgFlaggedRevStyleVersion = 71; |
306 | 306 | |
307 | 307 | $wgExtensionFunctions[] = 'efLoadFlaggedRevs'; |
308 | 308 | |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.class.php |
— | — | @@ -1454,10 +1454,11 @@ |
1455 | 1455 | # ################ Auto-review function ################# |
1456 | 1456 | |
1457 | 1457 | /** |
1458 | | - * Automatically review an edit and add a log entry in the review log. |
1459 | | - * LinksUpdate was already called via edit operations, so the page |
1460 | | - * fields will be up to date. This updates the stable version. |
| 1458 | + * Automatically review an revision and add a log entry in the review log. |
1461 | 1459 | * |
| 1460 | + * This is called during edit operations after the new revision is added |
| 1461 | + * and the page tables updated, but before LinksUpdate is called. |
| 1462 | + * |
1462 | 1463 | * $auto is here for revisions checked off to be reviewed. Auto-review |
1463 | 1464 | * triggers on edit, but we don't want it to count as just automatic. |
1464 | 1465 | * This also makes it so the user's name shows up in the page history. |
Index: trunk/extensions/FlaggedRevs/specialpages/Stabilization_body.php |
— | — | @@ -20,24 +20,27 @@ |
21 | 21 | # Let anyone view, but not submit... |
22 | 22 | if ( $wgRequest->wasPosted() ) { |
23 | 23 | if ( $wgUser->isBlocked( !$confirm ) ) { |
24 | | - return $wgOut->blockedPage(); |
| 24 | + $wgOut->blockedPage(); |
| 25 | + return; |
25 | 26 | } elseif ( !$this->isAllowed ) { |
26 | | - return $wgOut->permissionRequired( 'stablesettings' ); |
| 27 | + $wgOut->permissionRequired( 'stablesettings' ); |
| 28 | + return; |
27 | 29 | } elseif ( wfReadOnly() ) { |
28 | | - return $wgOut->readOnlyPage(); |
| 30 | + $wgOut->readOnlyPage(); |
| 31 | + return; |
29 | 32 | } |
30 | 33 | } |
31 | 34 | # Set page title |
32 | 35 | $this->setHeaders(); |
33 | | - |
| 36 | + |
34 | 37 | $this->skin = $wgUser->getSkin(); |
35 | 38 | # Our target page |
36 | | - $this->target = $wgRequest->getText( 'page', $par ); |
| 39 | + $this->target = $wgRequest->getVal( 'page', $par ); |
37 | 40 | # Watch checkbox |
38 | 41 | $this->watchThis = (bool)$wgRequest->getCheck( 'wpWatchthis' ); |
39 | 42 | # Reason |
40 | 43 | $this->reason = $wgRequest->getText( 'wpReason' ); |
41 | | - $this->reasonSelection = $wgRequest->getText( 'wpReasonSelection' ); |
| 44 | + $this->reasonSelection = $wgRequest->getVal( 'wpReasonSelection' ); |
42 | 45 | # Expiry |
43 | 46 | $this->expiry = $wgRequest->getText( 'mwStabilize-expiry' ); |
44 | 47 | $this->expirySelection = $wgRequest->getVal( 'wpExpirySelection' ); |
— | — | @@ -55,24 +58,25 @@ |
56 | 59 | |
57 | 60 | # We need a page... |
58 | 61 | if ( is_null( $this->page ) ) { |
59 | | - return $wgOut->showErrorPage( 'notargettitle', 'notargettext' ); |
| 62 | + $wgOut->showErrorPage( 'notargettitle', 'notargettext' ); |
| 63 | + return; |
60 | 64 | } elseif ( !$this->page->exists() ) { |
61 | | - return $wgOut->addHTML( wfMsgExt( 'stabilization-notexists', array( 'parseinline' ), |
62 | | - $this->page->getPrefixedText() ) ); |
| 65 | + $wgOut->addWikiText( |
| 66 | + wfMsg( 'stabilization-notexists', $this->page->getPrefixedText() ) ); |
| 67 | + return; |
63 | 68 | } elseif ( !FlaggedRevs::inReviewNamespace( $this->page ) ) { |
64 | | - return $wgOut->addHTML( wfMsgExt( 'stabilization-notcontent', array( 'parseinline' ), |
65 | | - $this->page->getPrefixedText() ) ); |
| 69 | + $wgOut->addWikiText( |
| 70 | + wfMsg( 'stabilization-notcontent', $this->page->getPrefixedText() ) ); |
| 71 | + return; |
66 | 72 | } |
67 | | - |
68 | 73 | # Users who cannot edit or review the page cannot set this |
69 | | - if ( $this->isAllowed && !( $this->page->userCan( 'edit' ) |
70 | | - && $this->page->userCan( 'review' ) ) ) |
71 | | - { |
| 74 | + if ( !$this->page->userCan( 'edit' ) || !$this->page->userCan( 'review' ) ) { |
72 | 75 | $this->isAllowed = false; |
73 | 76 | } |
| 77 | + |
74 | 78 | # Disable some elements as needed |
75 | | - $this->disabledAttrib = !$this->isAllowed ? |
76 | | - array( 'disabled' => 'disabled' ) : array(); |
| 79 | + $this->disabledAttrib = $this->isAllowed ? |
| 80 | + array() : array( 'disabled' => 'disabled' ); |
77 | 81 | # Show form or submit... |
78 | 82 | if ( $this->isAllowed && $isValid && $confirm ) { |
79 | 83 | $status = $this->submit(); |
— | — | @@ -85,58 +89,49 @@ |
86 | 90 | $this->showSettings(); |
87 | 91 | } |
88 | 92 | } |
89 | | - |
| 93 | + |
90 | 94 | /** |
91 | | - * Fetch and check parameters. Items may not all be set if false is returned. |
| 95 | + * Verify and clean up parameters and preload data from DB. |
| 96 | + * Note: if false is returned items may not all be set. |
92 | 97 | * @return bool success |
93 | 98 | */ |
94 | 99 | public function handleParams() { |
95 | | - # Our target page |
96 | 100 | $this->page = Title::newFromURL( $this->target ); |
97 | | - # We need a page... |
98 | 101 | if ( is_null( $this->page ) ) { |
99 | | - return false; // can't continue |
| 102 | + return false; // page title is invalid |
100 | 103 | } |
101 | | - # Get old config |
| 104 | + # Get the current page config and GMT expiry |
102 | 105 | $this->config = FlaggedRevs::getPageVisibilitySettings( $this->page, FR_MASTER ); |
103 | | - # Make user readable date for GET requests |
104 | | - $this->oldExpiry = $this->config['expiry'] !== 'infinity' ? |
105 | | - wfTimestamp( TS_RFC2822, $this->config['expiry'] ) : 'infinite'; |
106 | | - # If not posted, then fill in existing values/defaults |
| 106 | + $this->oldExpiry = $this->config['expiry'] === 'infinity' |
| 107 | + ? 'infinite' |
| 108 | + : wfTimestamp( TS_RFC2822, $this->config['expiry'] ); |
| 109 | + # Handle views (GET) |
107 | 110 | if ( !$this->wasPosted ) { |
108 | | - # Get visiblity settings... |
109 | | - $this->select = $this->config['select']; |
110 | | - $this->override = $this->config['override']; |
111 | | - # Get autoreview restrictions... |
112 | | - $this->autoreview = $this->config['autoreview']; |
113 | | - # Handle submission data |
| 111 | + # Fill in existing settings |
| 112 | + $this->preloadSettings( $this->config ); |
| 113 | + # Handle submission data (POST) |
114 | 114 | } else { |
115 | | - // Custom expiry takes precedence |
116 | | - $this->expiry = strlen( $this->expiry ) ? |
117 | | - $this->expiry : $this->expirySelection; |
118 | | - if ( $this->expiry == 'existing' ) { |
119 | | - $this->expiry = $this->oldExpiry; |
120 | | - } |
121 | | - // Custom reason takes precedence |
122 | | - if ( $this->reasonSelection != 'other' ) { |
123 | | - $comment = $this->reasonSelection; // start with dropdown reason |
124 | | - if ( $this->reason != '' ) { |
125 | | - // Append custom reason |
126 | | - $comment .= wfMsgForContent( 'colon-separator' ) . $this->reason; |
127 | | - } |
128 | | - } else { |
129 | | - $comment = $this->reason; // just use custom reason |
130 | | - } |
131 | | - $this->reason = $comment; |
| 115 | + $this->loadReason(); |
| 116 | + $this->loadExpiry(); |
132 | 117 | // Protection level case... |
133 | | - if( FlaggedRevs::useProtectionLevels() ) { |
| 118 | + if ( FlaggedRevs::useProtectionLevels() ) { |
134 | 119 | # Autoreview restriction => use stable |
135 | 120 | # No autoreview restriction => site default |
136 | | - $this->override = ($this->autoreview != '') |
| 121 | + $this->override = ( $this->autoreview != '' ) |
137 | 122 | ? 1 // edits require review before being published |
138 | 123 | : (int)FlaggedRevs::isStableShownByDefault(); |
139 | | - # Leave the selection precedence alone |
| 124 | + # Leave the selection precedence to the site default |
140 | 125 | $this->select = FlaggedRevs::getPrecedence(); |
| 126 | + # Autoreview only when protecting currently unprotected pages |
| 127 | + $this->reviewThis = ( FlaggedRevs::getProtectionLevel( $this->config ) == 'none' ); |
| 128 | + # Check that settings are a valid protection level... |
| 129 | + $newConfig = array( |
| 130 | + 'override' => $this->override, |
| 131 | + 'autoreview' => $this->autoreview |
| 132 | + ); |
| 133 | + if ( FlaggedRevs::getProtectionLevel( $newConfig ) == 'invalid' ) { |
| 134 | + return false; // this is not a valid configuration |
| 135 | + } |
141 | 136 | // General case... |
142 | 137 | } else { |
143 | 138 | if ( $this->override !== 0 && $this->override !== 1 ) { |
— | — | @@ -145,24 +140,45 @@ |
146 | 141 | if ( !FlaggedRevs::isValidPrecedence( $this->select ) ) { |
147 | 142 | return false; // invalid precedence value |
148 | 143 | } |
| 144 | + // Check autoreview restriction setting |
| 145 | + if ( !self::userCanSetAutoreviewLevel( $this->autoreview ) ) { |
| 146 | + return false; // invalid value |
| 147 | + } |
149 | 148 | } |
150 | | - // Check autoreview setting |
151 | | - if ( !self::userCanSetAutoreviewLevel( $this->autoreview ) ) { |
152 | | - return false; // invalid value |
| 149 | + } |
| 150 | + return true; |
| 151 | + } |
| 152 | + |
| 153 | + private function preloadSettings( $config ) { |
| 154 | + # Get visiblity settings... |
| 155 | + $this->select = $config['select']; |
| 156 | + $this->override = $config['override']; |
| 157 | + # Get autoreview restrictions... |
| 158 | + $this->autoreview = $config['autoreview']; |
| 159 | + } |
| 160 | + |
| 161 | + private function loadExpiry() { |
| 162 | + // Custom expiry takes precedence |
| 163 | + if ( $this->expiry == '' ) { |
| 164 | + $this->expiry = $this->expirySelection; |
| 165 | + if ( $this->expiry == 'existing' ) { |
| 166 | + $this->expiry = $this->oldExpiry; |
153 | 167 | } |
154 | 168 | } |
155 | | - # If we use protection levels, check that settings match one... |
156 | | - if ( FlaggedRevs::useProtectionLevels() ) { |
157 | | - $config = array( |
158 | | - 'select' => $this->select, |
159 | | - 'override' => $this->override, |
160 | | - 'autoreview' => $this->autoreview |
161 | | - ); |
162 | | - if ( FlaggedRevs::getProtectionLevel( $config ) == 'invalid' ) { |
163 | | - return false; // this is not a valid configuration |
| 169 | + } |
| 170 | + |
| 171 | + private function loadReason() { |
| 172 | + // Custom reason takes precedence |
| 173 | + if ( $this->reasonSelection != 'other' ) { |
| 174 | + $comment = $this->reasonSelection; // start with dropdown reason |
| 175 | + if ( $this->reason != '' ) { |
| 176 | + // Append custom reason |
| 177 | + $comment .= wfMsgForContent( 'colon-separator' ) . $this->reason; |
164 | 178 | } |
| 179 | + } else { |
| 180 | + $comment = $this->reason; // just use custom reason |
165 | 181 | } |
166 | | - return true; |
| 182 | + $this->reason = $comment; |
167 | 183 | } |
168 | 184 | |
169 | 185 | /** |
— | — | @@ -205,19 +221,6 @@ |
206 | 222 | $form = wfMsgExt( 'stabilization-text', array( 'parse' ), |
207 | 223 | $this->page->getPrefixedText() ); |
208 | 224 | } |
209 | | - # Add some script for expiry dropdowns |
210 | | - $wgOut->addScript( |
211 | | - "<script type=\"text/javascript\"> |
212 | | - function updateStabilizationDropdowns() { |
213 | | - val = document.getElementById('mwExpirySelection').value; |
214 | | - if( val == 'existing' ) |
215 | | - document.getElementById('mwStabilize-expiry').value = " . |
216 | | - Xml::encodeJsVar( $this->oldExpiry ) . "; |
217 | | - else if( val != 'othertime' ) |
218 | | - document.getElementById('mwStabilize-expiry').value = val; |
219 | | - } |
220 | | - </script>" |
221 | | - ); |
222 | 225 | # Borrow some protection messages for dropdowns |
223 | 226 | $reasonDropDown = Xml::listDropDown( 'wpReasonSelection', |
224 | 227 | wfMsgForContent( 'protect-dropdown' ), |
— | — | @@ -287,26 +290,26 @@ |
288 | 291 | $form .= " |
289 | 292 | <tr> |
290 | 293 | <td class='mw-label'>" . |
291 | | - Xml::label( wfMsg( 'stabilization-expiry' ), 'mwExpirySelection' ) . |
| 294 | + Xml::label( wfMsg( 'stabilization-expiry' ), 'mwStabilizeExpirySelection' ) . |
292 | 295 | "</td> |
293 | 296 | <td class='mw-input'>" . |
294 | 297 | Xml::tags( 'select', |
295 | 298 | array( |
296 | | - 'id' => 'mwExpirySelection', |
297 | | - 'name' => 'wpExpirySelection', |
298 | | - 'onchange' => 'updateStabilizationDropdowns()', |
| 299 | + 'id' => 'mwStabilizeExpirySelection', |
| 300 | + 'name' => 'wpExpirySelection', |
| 301 | + 'onchange' => 'onFRChangeExpiryDropdown()', |
299 | 302 | ) + $this->disabledAttrib, |
300 | 303 | $expiryFormOptions ) . |
301 | 304 | "</td> |
302 | 305 | </tr>"; |
303 | 306 | } |
304 | 307 | # Add custom expiry field |
305 | | - $attribs = array( 'id' => "mwStabilize-expiry", |
306 | | - 'onkeyup' => 'updateStabilizationDropdowns()' ) + $this->disabledAttrib; |
| 308 | + $attribs = array( 'id' => "mwStabilizeExpiryOther", |
| 309 | + 'onkeyup' => 'onFRChangeExpiryField()' ) + $this->disabledAttrib; |
307 | 310 | $form .= " |
308 | 311 | <tr> |
309 | 312 | <td class='mw-label'>" . |
310 | | - Xml::label( wfMsg( 'stabilization-othertime' ), 'mwStabilize-expiry' ) . |
| 313 | + Xml::label( wfMsg( 'stabilization-othertime' ), 'mwStabilizeExpiryOther' ) . |
311 | 314 | '</td> |
312 | 315 | <td class="mw-input">' . |
313 | 316 | Xml::input( "mwStabilize-expiry", 50, |
— | — | @@ -369,8 +372,25 @@ |
370 | 373 | $wgOut->addHTML( Xml::element( 'h2', null, |
371 | 374 | htmlspecialchars( LogPage::logName( 'stable' ) ) ) ); |
372 | 375 | LogEventsList::showLogExtract( $wgOut, 'stable', $this->page->getPrefixedText() ); |
| 376 | + |
| 377 | + # Add some script for expiry dropdowns |
| 378 | + self::addProtectionJS(); |
373 | 379 | } |
374 | | - |
| 380 | + |
| 381 | + public static function addProtectionJS() { |
| 382 | + global $wgOut; |
| 383 | + $wgOut->addScript( |
| 384 | + "<script type=\"text/javascript\"> |
| 385 | + function onFRChangeExpiryDropdown() { |
| 386 | + document.getElementById('mwStabilizeExpiryOther').value = ''; |
| 387 | + } |
| 388 | + function onFRChangeExpiryField() { |
| 389 | + document.getElementById('mwStabilizeExpirySelection').value = 'othertime'; |
| 390 | + } |
| 391 | + </script>" |
| 392 | + ); |
| 393 | + } |
| 394 | + |
375 | 395 | protected function buildSelector( $selected ) { |
376 | 396 | global $wgUser; |
377 | 397 | $allowedLevels = array(); |
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php |
— | — | @@ -293,7 +293,7 @@ |
294 | 294 | } |
295 | 295 | # Make fancy box... |
296 | 296 | $box = '<div class="flaggedrevs_short_basic">' . $shtml . |
297 | | - ' ' . self::ratingToggle() . "</div>\n"; |
| 297 | + ' ' . self::ratingArrow() . "</div>\n"; |
298 | 298 | $box .= '<div style="position: relative;">'; // for rel-absolute child div |
299 | 299 | $box .= '<div id="mw-fr-revisionratings" class="flaggedrevs_short_details">'; |
300 | 300 | $box .= $html; // details text |
— | — | @@ -309,15 +309,27 @@ |
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
| 313 | + * Generates JS toggle arrow icon |
| 314 | + * @returns string |
| 315 | + */ |
| 316 | + public static function ratingArrow() { |
| 317 | + $encPath = htmlspecialchars( FlaggedRevs::styleUrlPath() . '/img' ); |
| 318 | + return "<img id=\"mw-fr-revisiontoggle\" class=\"fr-toggle-arrow\"" . |
| 319 | + " src=\"{$encPath}/arrow-up.png\" style=\"display:none;\" " . |
| 320 | + " onclick=\"FlaggedRevs.toggleRevRatings()\" title=\"" . |
| 321 | + wfMsgHtml( 'revreview-toggle-title' ) . "\" alt=\"" . |
| 322 | + wfMsgHtml( 'revreview-toggle-show' ) . "\" />"; |
| 323 | + } |
| 324 | + |
| 325 | + /** |
313 | 326 | * Generates (+/-) JS toggle HTML (monospace to keep things in place) |
314 | 327 | * @returns string |
315 | 328 | */ |
316 | 329 | public static function ratingToggle() { |
317 | | - return '<strong><a id="mw-fr-revisiontoggle" class="flaggedrevs_toggle"' . |
318 | | - ' style="display:none; font-family: monospace;"' . |
319 | | - ' onclick="FlaggedRevs.toggleRevRatings()" title="' . |
| 330 | + return '<a id="mw-fr-revisiontoggle" class="fr-toggle-symbol"' . |
| 331 | + ' style="display:none;" onclick="FlaggedRevs.toggleRevRatings()" title="' . |
320 | 332 | wfMsgHtml( 'revreview-toggle-title' ) . '" >' . |
321 | | - wfMsgHtml( 'revreview-toggle-show' ) . '</a></strong>'; |
| 333 | + wfMsgHtml( 'revreview-toggle-show' ) . '</a>'; |
322 | 334 | } |
323 | 335 | |
324 | 336 | /** |
— | — | @@ -325,7 +337,7 @@ |
326 | 338 | * @returns string |
327 | 339 | */ |
328 | 340 | public static function diffToggle() { |
329 | | - $toggle = '<a id="mw-fr-difftoggle" class="flaggedrevs_toggle" style="display:none;"' . |
| 341 | + $toggle = '<a id="mw-fr-difftoggle" class="fr-toggle-text" style="display:none;"' . |
330 | 342 | ' onclick="FlaggedRevs.toggleDiff()" title="' . |
331 | 343 | wfMsgHtml( 'revreview-diff-toggle-title' ) . '" >' . |
332 | 344 | wfMsgHtml( 'revreview-diff-toggle-show' ) . '</a>'; |
— | — | @@ -337,7 +349,7 @@ |
338 | 350 | * @returns string |
339 | 351 | */ |
340 | 352 | public static function logToggle() { |
341 | | - $toggle = '<a id="mw-fr-logtoggle" class="flaggedrevs_toggle" style="display:none;"' . |
| 353 | + $toggle = '<a id="mw-fr-logtoggle" class="fr-toggle-text" style="display:none;"' . |
342 | 354 | ' onclick="FlaggedRevs.toggleLog()" title="' . |
343 | 355 | wfMsgHtml( 'revreview-log-toggle-show' ) . '" >' . |
344 | 356 | wfMsgHtml( 'revreview-log-toggle-show' ) . '</a>'; |
— | — | @@ -349,7 +361,7 @@ |
350 | 362 | * @returns string |
351 | 363 | */ |
352 | 364 | public static function logDetailsToggle() { |
353 | | - $toggle = '<a id="mw-fr-logtoggle" class="flaggedrevs_toggle" style="display:none;"' . |
| 365 | + $toggle = '<a id="mw-fr-logtoggle" class="fr-toggle-text" style="display:none;"' . |
354 | 366 | ' onclick="FlaggedRevs.toggleLogDetails()" title="' . |
355 | 367 | wfMsgHtml( 'revreview-log-details-show' ) . '" >' . |
356 | 368 | wfMsgHtml( 'revreview-log-details-show' ) . '</a>'; |
— | — | @@ -520,7 +532,7 @@ |
521 | 533 | $encPath = htmlspecialchars( FlaggedRevs::styleUrlPath() . '/img' ); |
522 | 534 | $encTitle = wfMsgHtml( 'revreview-draft-title' ); |
523 | 535 | return "<img class=\"flaggedrevs-icon\" src=\"$encPath/1.png\"" . |
524 | | - " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\"></img>"; |
| 536 | + " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\" />"; |
525 | 537 | } |
526 | 538 | |
527 | 539 | /* |
— | — | @@ -535,7 +547,7 @@ |
536 | 548 | ? wfMsgHtml( 'revreview-quality-title' ) |
537 | 549 | : wfMsgHtml( 'revreview-basic-title' ); |
538 | 550 | return "<img class=\"flaggedrevs-icon\" src=\"$encPath/$file\"" . |
539 | | - " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\"></img>"; |
| 551 | + " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\" />"; |
540 | 552 | } |
541 | 553 | |
542 | 554 | /* |
— | — | @@ -548,11 +560,11 @@ |
549 | 561 | if ( $flaggedArticle->isPageLocked() ) { |
550 | 562 | $encTitle = wfMsgHtml( 'revreview-locked-title' ); |
551 | 563 | return "<img class=\"flaggedrevs-icon\" src=\"$encPath/lock-closed.png\"" . |
552 | | - " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\"></img>"; |
| 564 | + " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\" />"; |
553 | 565 | } elseif ( $flaggedArticle->isPageUnlocked() ) { |
554 | 566 | $encTitle = wfMsgHtml( 'revreview-unlocked-title' ); |
555 | 567 | return "<img class=\"flaggedrevs-icon\" src=\"$encPath/lock-open.png\"" . |
556 | | - " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\"></img>"; |
| 568 | + " width=\"16px\" alt=\"$encTitle\" title=\"$encTitle\" />"; |
557 | 569 | } |
558 | 570 | } |
559 | 571 | |
Index: trunk/extensions/FlaggedRevs/FlaggedRevs.hooks.php |
— | — | @@ -2081,8 +2081,8 @@ |
2082 | 2082 | } |
2083 | 2083 | # Can the user actually do anything? |
2084 | 2084 | $isAllowed = $wgUser->isAllowed( 'stablesettings' ); |
2085 | | - $disabledAttrib = !$isAllowed ? |
2086 | | - array( 'disabled' => 'disabled' ) : array(); |
| 2085 | + $disabledAttrib = $isAllowed ? |
| 2086 | + array() : array( 'disabled' => 'disabled' ); |
2087 | 2087 | |
2088 | 2088 | # Get the current config/expiry |
2089 | 2089 | $config = FlaggedRevs::getPageVisibilitySettings( $article->getTitle(), FR_MASTER ); |
— | — | @@ -2194,24 +2194,10 @@ |
2195 | 2195 | $output .= "</td></tr>"; |
2196 | 2196 | |
2197 | 2197 | # Add some script for expiry dropdowns |
2198 | | - self::addProtectionJS(); |
| 2198 | + Stabilization::addProtectionJS(); |
2199 | 2199 | return true; |
2200 | 2200 | } |
2201 | 2201 | |
2202 | | - private static function addProtectionJS() { |
2203 | | - global $wgOut; |
2204 | | - $wgOut->addScript( |
2205 | | - "<script type=\"text/javascript\"> |
2206 | | - function onFRChangeExpiryDropdown() { |
2207 | | - document.getElementById('mwStabilizeExpiryOther').value = ''; |
2208 | | - } |
2209 | | - function onFRChangeExpiryField() { |
2210 | | - document.getElementById('mwStabilizeExpirySelection').value = 'othertime'; |
2211 | | - } |
2212 | | - </script>" |
2213 | | - ); |
2214 | | - } |
2215 | | - |
2216 | 2202 | // Add stability log extract to protection form |
2217 | 2203 | public static function insertStabilityLog( $article, $out ) { |
2218 | 2204 | if ( !FlaggedRevs::useProtectionLevels() || !$article->exists() ) { |
— | — | @@ -2248,13 +2234,12 @@ |
2249 | 2235 | $permission = $wgRequest->getVal( 'mwStabilityConfig' ); |
2250 | 2236 | if ( $permission == "none" ) { |
2251 | 2237 | $form->autoreview = ''; // default |
2252 | | - $form->reviewThis = false; |
2253 | 2238 | } else if ( in_array( $permission, FlaggedRevs::getRestrictionLevels() ) ) { |
2254 | 2239 | $form->autoreview = $permission; // autoreview restriction |
2255 | | - $form->reviewThis = true; // auto-review page; protection-like |
2256 | 2240 | } else { |
2257 | 2241 | return false; // bad level, don't save! |
2258 | 2242 | } |
| 2243 | + $form->reviewThis = null; // autoreview if not currently protected state |
2259 | 2244 | $form->override = null; // implied by autoreview level |
2260 | 2245 | $form->select = null; // site default |
2261 | 2246 | $form->wasPosted = $wgRequest->wasPosted(); |
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.css |
— | — | @@ -186,12 +186,24 @@ |
187 | 187 | background-color: #faebd7; |
188 | 188 | } |
189 | 189 | |
190 | | -a.flaggedrevs_toggle { |
| 190 | +a.fr-toggle-symbol { |
191 | 191 | color: blue; |
192 | 192 | white-space: nowrap; |
| 193 | + font-family: monospace; |
| 194 | + font-weight: bold; |
193 | 195 | cursor: pointer; |
194 | 196 | } |
195 | 197 | |
| 198 | +a.fr-toggle-text { |
| 199 | + color: blue; |
| 200 | + font-weight: bold; |
| 201 | + cursor: pointer; |
| 202 | +} |
| 203 | + |
| 204 | +img.fr-toggle-arrow { |
| 205 | + cursor: pointer; |
| 206 | +} |
| 207 | + |
196 | 208 | li.fr-hist-stable-margin { |
197 | 209 | margin-top: 2em; |
198 | 210 | } |
Index: trunk/extensions/FlaggedRevs/client/flaggedrevs.js |
— | — | @@ -47,12 +47,24 @@ |
48 | 48 | if( !ratings ) return; |
49 | 49 | var toggle = document.getElementById('mw-fr-revisiontoggle'); |
50 | 50 | if( !toggle ) return; |
| 51 | + // Collapsed -> expand |
51 | 52 | if( ratings.style.display == 'none' ) { |
52 | 53 | ratings.style.display = 'block'; |
53 | | - toggle.innerHTML = this.messages.toggleHide; |
| 54 | + if( toggle.tagName == 'IMG' ) { // arrow |
| 55 | + toggle.alt = this.messages.toggleHide; // fallback text |
| 56 | + toggle.src = toggle.src.replace( 'arrow-up.png', 'arrow-down.png' ); |
| 57 | + } else { // text |
| 58 | + toggle.innerHTML = this.messages.toggleHide; |
| 59 | + } |
| 60 | + // Expanded -> collapse |
54 | 61 | } else { |
55 | 62 | ratings.style.display = 'none'; |
56 | | - toggle.innerHTML = this.messages.toggleShow; |
| 63 | + if( toggle.tagName == 'IMG' ) { // arrow |
| 64 | + toggle.alt = this.messages.toggleShow; // fallback text |
| 65 | + toggle.src = toggle.src.replace( 'arrow-down.png', 'arrow-up.png' ); |
| 66 | + } else { // text |
| 67 | + toggle.innerHTML = this.messages.toggleShow; |
| 68 | + } |
57 | 69 | } |
58 | 70 | }, |
59 | 71 | |
Index: trunk/extensions/FlaggedRevs/client/img/arrow-down.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/client/img/arrow-down.png |
___________________________________________________________________ |
Name: svn:mime-type |
60 | 72 | + image/png |
Index: trunk/extensions/FlaggedRevs/client/img/arrow-up.png |
Cannot display: file marked as a binary type. |
svn:mime-type = image/png |
Property changes on: trunk/extensions/FlaggedRevs/client/img/arrow-up.png |
___________________________________________________________________ |
Name: svn:mime-type |
61 | 73 | + image/png |