[[Special:Undelete]] should use JavaScript to invert all checkboxes without reloading the page
Closed, ResolvedPublic

Description

Currently, if an admin goes to [[Special:Undelete]] to undelete various revisions of certain page, he may want to invert the selection of all checkboxes. If he clicks in the [ Invert selection ] button, the page will be reloaded in order to invert the selection.

On [[Special:Search]], there are two buttons ([ All ] / [ None ]) which uses JavaScript to set the state of the checkboxes, so that the page doesn't needs to be reloaded. Both buttons calls the function

mwToggleSearchCheckboxes()

which is defined at
http://svn.wikimedia.org/viewvc/mediawiki/trunk/phase3/skins/common/search.js?annotate=77922#l24

I think the same idea should be applied on [[Special:Undelete]].

Indeed, right now, there is a gadget on Wikibooks which does exactly that:

  • [[MediaWiki:Gadget-purgetab.js]]

Version: 1.20.x
Severity: enhancement

bzimport set Reference to bz29443.
He7d3r created this task.Via LegacyJun 17 2011, 12:23 AM
He7d3r added a comment.Via ConduitJun 17 2011, 12:24 AM

(In reply to comment #0)

Indeed, right now, there is a gadget on Wikibooks which does exactly that:

  • [[MediaWiki:Gadget-purgetab.js]]

Copy paste fail...
I mean [[MediaWiki:Gadget-EnhancedUndelete.js]].

He7d3r added a comment.Via ConduitJun 17 2011, 12:27 AM

(In reply to comment #1)

(In reply to comment #0)
> Indeed, right now, there is a gadget on Wikibooks which does exactly that:
> * [[MediaWiki:Gadget-purgetab.js]]

Copy paste fail...
I mean [[MediaWiki:Gadget-EnhancedUndelete.js]].

Err... [[b:MediaWiki:Gadget-EnhancedUndelete.js]].

brion added a comment.Via ConduitJun 17 2011, 8:37 PM

This should indeed be pretty straightforward to add:

  • add resources/mediawiki.special/mediawiki.special.undelete.js with a little JS bits (take over the button's click handler and iterate over the checkboxes, swapping their state)
  • add an entry in Resources.php for it
  • load it with $wgOut->addModules('mediawiki.special.undelete') in SpecialUndelete::showHistory()
He7d3r added a comment.Via ConduitJun 18 2011, 12:30 AM

Created attachment 8672
Proposed patch

(In reply to comment #3)

This should indeed be pretty straightforward to add:

  • add resources/mediawiki.special/mediawiki.special.undelete.js with a little JS bits (take over the button's click handler and iterate over the checkboxes, swapping their state)
  • add an entry in Resources.php for it
  • load it with $wgOut->addModules('mediawiki.special.undelete') in SpecialUndelete::showHistory()

Thank you Brion for these valuable tips!
The attached patch seems to solve the bug.

Attached: undelete.patch

mgrabovsky added a comment.Via ConduitJun 18 2011, 7:57 PM

Commited in r90359.

Add Comment