Index: trunk/phase3/maintenance/language/messages.inc |
— | — | @@ -726,6 +726,7 @@ |
727 | 727 | 'difference', |
728 | 728 | 'lineno', |
729 | 729 | 'compareselectedversions', |
| 730 | + 'showhideselectedversions', |
730 | 731 | 'visualcomparison', |
731 | 732 | 'wikicodecomparison', |
732 | 733 | 'editundo', |
Index: trunk/phase3/skins/common/wikibits.js |
— | — | @@ -431,6 +431,7 @@ |
432 | 432 | } |
433 | 433 | for (var i = start; i <= finish; ++i ) { |
434 | 434 | checkboxes[i].checked = endState; |
| 435 | + if( i > start ) checkboxes[i].onchange(); // fire triggers |
435 | 436 | } |
436 | 437 | lastCheckbox = this.index; |
437 | 438 | return true; |
Index: trunk/phase3/skins/common/history.js |
— | — | @@ -9,6 +9,16 @@ |
10 | 10 | return radios; |
11 | 11 | } |
12 | 12 | |
| 13 | +function deleteCheck(parent) { |
| 14 | + var inputs = parent.getElementsByTagName('input'); |
| 15 | + for (var i = 0; i < inputs.length; i++) { |
| 16 | + if (inputs[i].name == "showhiderevisions") { |
| 17 | + return inputs[i]; |
| 18 | + } |
| 19 | + } |
| 20 | + return null; |
| 21 | +} |
| 22 | + |
13 | 23 | // check selection and tweak visibility/class onclick |
14 | 24 | function diffcheck() { |
15 | 25 | var dli = false; // the li where the diff radio is checked |
— | — | @@ -74,13 +84,14 @@ |
75 | 85 | return true; |
76 | 86 | } |
77 | 87 | |
78 | | -// page history stuff |
79 | | -// attach event handlers to the input elements on history page |
| 88 | +// Attach event handlers to the input elements on history page |
80 | 89 | function histrowinit() { |
81 | 90 | var hf = document.getElementById('pagehistory'); |
82 | 91 | if (!hf) { |
83 | 92 | return; |
84 | 93 | } |
| 94 | + var df = document.getElementById('mw-history-revdeleteform'); |
| 95 | + if( df ) df.style.visibility = 'visible'; // Enable JS form |
85 | 96 | var lis = hf.getElementsByTagName('li'); |
86 | 97 | for (var i = 0; i < lis.length; i++) { |
87 | 98 | var inputs = historyRadios(lis[i]); |
— | — | @@ -88,8 +99,28 @@ |
89 | 100 | inputs[0].onclick = diffcheck; |
90 | 101 | inputs[1].onclick = diffcheck; |
91 | 102 | } |
| 103 | + var check = deleteCheck(lis[i]); |
| 104 | + if( df && check ) { |
| 105 | + check.style.visibility = 'visible'; // Enable JS form |
| 106 | + } |
92 | 107 | } |
93 | 108 | diffcheck(); |
94 | 109 | } |
95 | 110 | |
| 111 | +// Multi-item revision delete. 'checked' is the *previous* state. |
| 112 | +function updateShowHideForm( oldid, checked ) { |
| 113 | + var formOldids = document.getElementById('revdel-oldid'); |
| 114 | + if( !formOldids ) return; |
| 115 | + if( checked ) { // add on oldid if checked |
| 116 | + if( formOldids.value ) { |
| 117 | + formOldids.value += ',' + oldid; |
| 118 | + } else { |
| 119 | + formOldids.value = oldid; |
| 120 | + } |
| 121 | + } else if( formOldids.value ) { // remove oldid if unchecked |
| 122 | + var reg = new RegExp( '(^|,)'+oldid+'($|,)' ); |
| 123 | + formOldids.value = formOldids.value.replace( reg, '' ); |
| 124 | + } |
| 125 | +} |
| 126 | + |
96 | 127 | hookEvent("load", histrowinit); |
Index: trunk/phase3/includes/DefaultSettings.php |
— | — | @@ -1477,7 +1477,7 @@ |
1478 | 1478 | * to ensure that client-side caches don't keep obsolete copies of global |
1479 | 1479 | * styles. |
1480 | 1480 | */ |
1481 | | -$wgStyleVersion = '209'; |
| 1481 | +$wgStyleVersion = '210'; |
1482 | 1482 | |
1483 | 1483 | |
1484 | 1484 | # Server-side caching: |
Index: trunk/phase3/includes/PageHistory.php |
— | — | @@ -153,33 +153,48 @@ |
154 | 154 | * @return string HTML output |
155 | 155 | */ |
156 | 156 | function beginHistoryList() { |
157 | | - global $wgTitle, $wgScript, $wgEnableHtmlDiff; |
| 157 | + global $wgTitle, $wgUser, $wgScript, $wgEnableHtmlDiff; |
158 | 158 | $this->lastdate = ''; |
159 | 159 | $s = wfMsgExt( 'histlegend', array( 'parse') ); |
160 | | - $s .= Xml::openElement( 'form', array( 'action' => $wgScript, 'id' => 'mw-history-compare' ) ); |
| 160 | + if( $wgUser->isAllowed('deleterevision') ) { |
| 161 | + $revdel = SpecialPage::getTitleFor( 'Revisiondelete' ); |
| 162 | + $s .= Xml::openElement( 'form', |
| 163 | + array( |
| 164 | + 'action' => $revdel->getFullUrl(), |
| 165 | + 'method' => 'get', 'id' => 'mw-history-revdeleteform', |
| 166 | + 'style' => 'visibility:hidden;float:right;' |
| 167 | + ) |
| 168 | + ); |
| 169 | + $s .= Xml::hidden( 'target', $wgTitle->getPrefixedDbKey() ); |
| 170 | + $s .= Xml::hidden( 'oldid', '', array('id'=>'revdel-oldid') ); |
| 171 | + $s .= Xml::submitButton( wfMsg( 'showhideselectedversions' ) ); |
| 172 | + $s .= Xml::closeElement( 'form' ); |
| 173 | + } |
| 174 | + $s .= Xml::openElement( 'form', array( 'action' => $wgScript, |
| 175 | + 'id' => 'mw-history-compare' ) ); |
161 | 176 | $s .= Xml::hidden( 'title', $wgTitle->getPrefixedDbKey() ); |
162 | 177 | if( $wgEnableHtmlDiff ) { |
163 | 178 | $s .= $this->submitButton( wfMsg( 'visualcomparison'), |
164 | 179 | array( |
165 | | - 'name' => 'htmldiff', |
166 | | - 'class' => 'historysubmit', |
167 | | - 'accesskey' => wfMsg( 'accesskey-visualcomparison' ), |
168 | | - 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
| 180 | + 'name' => 'htmldiff', |
| 181 | + 'class' => 'historysubmit', |
| 182 | + 'accesskey' => wfMsg( 'accesskey-visualcomparison' ), |
| 183 | + 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
169 | 184 | ) |
170 | 185 | ); |
171 | 186 | $s .= $this->submitButton( wfMsg( 'wikicodecomparison'), |
172 | 187 | array( |
173 | | - 'class' => 'historysubmit', |
174 | | - 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), |
175 | | - 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
| 188 | + 'class' => 'historysubmit', |
| 189 | + 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), |
| 190 | + 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
176 | 191 | ) |
177 | 192 | ); |
178 | 193 | } else { |
179 | 194 | $s .= $this->submitButton( wfMsg( 'compareselectedversions'), |
180 | 195 | array( |
181 | | - 'class' => 'historysubmit', |
182 | | - 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), |
183 | | - 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
| 196 | + 'class' => 'historysubmit', |
| 197 | + 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), |
| 198 | + 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
184 | 199 | ) |
185 | 200 | ); |
186 | 201 | } |
— | — | @@ -198,25 +213,25 @@ |
199 | 214 | if( $wgEnableHtmlDiff ) { |
200 | 215 | $s .= $this->submitButton( wfMsg( 'visualcomparison'), |
201 | 216 | array( |
202 | | - 'name' => 'htmldiff', |
203 | | - 'class' => 'historysubmit', |
204 | | - 'accesskey' => wfMsg( 'accesskey-visualcomparison' ), |
205 | | - 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
| 217 | + 'name' => 'htmldiff', |
| 218 | + 'class' => 'historysubmit', |
| 219 | + 'accesskey' => wfMsg( 'accesskey-visualcomparison' ), |
| 220 | + 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
206 | 221 | ) |
207 | 222 | ); |
208 | 223 | $s .= $this->submitButton( wfMsg( 'wikicodecomparison'), |
209 | 224 | array( |
210 | | - 'class' => 'historysubmit', |
211 | | - 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), |
212 | | - 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
| 225 | + 'class' => 'historysubmit', |
| 226 | + 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), |
| 227 | + 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
213 | 228 | ) |
214 | 229 | ); |
215 | 230 | } else { |
216 | 231 | $s .= $this->submitButton( wfMsg( 'compareselectedversions'), |
217 | 232 | array( |
218 | | - 'class' => 'historysubmit', |
219 | | - 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), |
220 | | - 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
| 233 | + 'class' => 'historysubmit', |
| 234 | + 'accesskey' => wfMsg( 'accesskey-compareselectedversions' ), |
| 235 | + 'title' => wfMsg( 'tooltip-compareselectedversions' ), |
221 | 236 | ) |
222 | 237 | ); |
223 | 238 | } |
— | — | @@ -268,15 +283,23 @@ |
269 | 284 | $s = "($curlink) ($lastlink) $arbitrary"; |
270 | 285 | |
271 | 286 | if( $wgUser->isAllowed( 'deleterevision' ) ) { |
| 287 | + // Hide JS by default for non-JS browsing |
| 288 | + $hidden = array( 'style' => 'visibility:hidden' ); |
| 289 | + // If revision was hidden from sysops |
272 | 290 | if( !$rev->userCan( Revision::DELETED_RESTRICTED ) ) { |
273 | | - // If revision was hidden from sysops |
274 | | - $del = Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), '('. |
275 | | - $this->message['rev-delundel'].')' ); |
| 291 | + $del = Xml::check( 'deleterevisions', false, |
| 292 | + $hidden + array('disabled' => 'disabled') ); |
| 293 | + $del .= Xml::tags( 'span', array( 'class'=>'mw-revdelundel-link' ), |
| 294 | + '(' . $this->message['rev-delundel'] . ')' ); |
| 295 | + // Otherwise, show the link... |
276 | 296 | } else { |
| 297 | + $jsCall = 'updateShowHideForm('.$rev->getId().',this.checked)'; |
| 298 | + $del = Xml::check( 'showhiderevisions', false, |
| 299 | + $hidden + array('onchange' => $jsCall) ); |
277 | 300 | $query = array( 'target' => $this->mTitle->getPrefixedDbkey(), |
278 | | - 'oldid' => $rev->getId() |
279 | | - ); |
280 | | - $del = $this->mSkin->revDeleteLink( $query, $rev->isDeleted( Revision::DELETED_RESTRICTED ) ); |
| 301 | + 'oldid' => $rev->getId() ); |
| 302 | + $del .= $this->mSkin->revDeleteLink( $query, |
| 303 | + $rev->isDeleted( Revision::DELETED_RESTRICTED ) ); |
281 | 304 | } |
282 | 305 | $s .= " $del "; |
283 | 306 | } |
Index: trunk/phase3/languages/messages/MessagesEn.php |
— | — | @@ -1396,6 +1396,7 @@ |
1397 | 1397 | 'difference' => '(Difference between revisions)', |
1398 | 1398 | 'lineno' => 'Line $1:', |
1399 | 1399 | 'compareselectedversions' => 'Compare selected versions', |
| 1400 | +'showhideselectedversions' => 'Show/hide selected versions', |
1400 | 1401 | 'visualcomparison' => 'Visual comparison', |
1401 | 1402 | 'wikicodecomparison' => 'Wikitext comparison', |
1402 | 1403 | 'editundo' => 'undo', |