Glaisher has uploaded a new change for review.
https://gerrit.wikimedia.org/r/261639
Change subject: Rewrite Special:CheckUserLog search form with HTMLForm
......................................................................
Rewrite Special:CheckUserLog search form with HTMLForm
Replace a bunch of concatenated raw html strings with HTMLForm.
This also changes the weird dropdown+text field in the form to
two separate fields, target and type.
Also:
* Changed form legend's wording
* Update documentation
* Enable mediawiki.userSuggest autocompletions in target field
Change-Id: I6db886cd8cc3a04566746451a73360ab9259225d
---
M i18n/en.json
M i18n/qqq.json
M specials/SpecialCheckUserLog.php
3 files changed, 47 insertions(+), 35 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CheckUser
refs/changes/39/261639/1
diff --git a/i18n/en.json b/i18n/en.json
index c3fc7d1..70bcd88 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -28,7 +28,6 @@
"checkuser-users": "Get users",
"checkuser-edits": "Get edits",
"checkuser-ips": "Get IP addresses",
- "checkuser-search": "Search",
"checkuser-period": "Duration:",
"checkuser-week-1": "last week",
"checkuser-week-2": "last two weeks",
@@ -62,10 +61,12 @@
"checkuser-accounts": "$1 new {{PLURAL:$1|account|accounts}}",
"checkuser-too-many": "Too many results (according to query estimate),
please narrow down the CIDR.\nHere are the IP addresses used (5000 max, sorted
by address):",
"checkuser-user-nonexistent": "The specified user does not exist.",
- "checkuser-search-form": "Find log entries where the $1 is $2",
+ "checkuser-search": "Search check user log entries",
"checkuser-search-submit": "Search",
"checkuser-search-initiator": "initiator",
"checkuser-search-target": "target",
+ "checkuser-log-search-target": "Target:",
+ "checkuser-log-search-type": "Search by:",
"checkuser-ipeditcount": "~$1 from all users",
"checkuser-log-return": "Switch to CheckUser main form",
"checkuser-limited": "'''These results have been truncated for
performance reasons.'''",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index c1a20d1..494bcd6 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -47,7 +47,6 @@
"checkuser-users": "Radio button option on CheckUser Special page. See
screenshot '[[mw:Extension:CheckUser#Basic_interface|Basic CheckUser
interface]]'.",
"checkuser-edits": "Radio button option on CheckUser Special page. See
screenshot '[[mw:Extension:CheckUser#Basic_interface|Basic CheckUser
interface]]'.",
"checkuser-ips": "Option on CheckUser Special page. See screenshot
'[[mw:Extension:CheckUser#Basic_interface|Basic CheckUser interface]]'.",
- "checkuser-search": "Heading of fieldset on log of CheckUser searches.
See screenshot \"[[mw:Extension:CheckUser#Basic_interface|Example
log]]\".\n{{Identical|Search}}",
"checkuser-period": "Field name next to drop-down input box on
CheckUser Special page. See screenshot
'[[mw:Extension:CheckUser#Basic_interface|Basic CheckUser
interface]]'.\n{{Identical|Duration}}",
"checkuser-week-1": "Option in drop-down input box \"Duration\" on
CheckUser Special page. See screenshot
'[[mw:Extension:CheckUser#Basic_interface|Basic CheckUser
interface]]'.\n{{Identical|Last week}}",
"checkuser-week-2": "Option in drop-down input box \"Duration\" on
CheckUser Special page. See screenshot
'[[mw:Extension:CheckUser#Basic_interface|Basic CheckUser interface]]'.",
@@ -81,10 +80,12 @@
"checkuser-accounts": "Used in Special:CheckUser. Parameters:\n* $1 -
number of accounts",
"checkuser-too-many": "Used in [[Special:CheckUser]].\n\nThis message
is followed by a list of IPs that have edits.\n\nIf the number of IPs is 5000
or more, the following message is shown:\n* {{msg-mw|checkuser-limited}}",
"checkuser-user-nonexistent": "Used as error message in
[[Special:CheckUserLog]].",
- "checkuser-search-form": "This message is a search form for the
checkuser log. Parameters:\n* $1 - a drop down box with search types\n* $2 - a
text input field for the search pattern\n\nSee screenshot
\"[[mw:Extension:CheckUser#Basic_interface|Example log]]\".",
+ "checkuser-search": "Heading of fieldset on log of CheckUser searches.
See screenshot \"[[mw:Extension:CheckUser#Basic_interface|Example log]]",
"checkuser-search-submit": "Button label on log of CheckUser searches.
See screenshot \"[[mw:Extension:CheckUser#Basic_interface|Example
log]]\".\n{{Identical|Search}}",
- "checkuser-search-initiator": "This message is an option in an input
box on the search form for the checkuser log.\n\nUsed as <code>$1</code> in the
message {{msg-mw|Checkuser-search-form}}.\n\nSee screenshot
\"[[mw:Extension:CheckUser#Basic_interface|Example log]]\".\n\nInitiator means
the CheckUser who checks someone's information.\n{{Identical|Initiator}}",
- "checkuser-search-target": "The target of the check. The user
checked.\n{{Identical|Target}}",
+ "checkuser-search-initiator": "This message is an option in a radio
button on the search form for the checkuser log.\n\nSee screenshot
\"[[mw:Extension:CheckUser#Basic_interface|Example log]]\".\n\nInitiator means
the CheckUser who checks someone's information.\n{{Identical|Initiator}}",
+ "checkuser-search-target": "This message is used in an option in a
radio button on the search form for the checkuser log. The target of the check
means the user which was checked.\n{{Identical|Target}}",
+ "checkuser-log-search-target": "Label of form field on
Special:CheckUserLog's search form. Valid values in the field can be either an
IP address or an IP range or a username.",
+ "checkuser-log-search-type": "Label of form field on
Special:CheckUserLog's search form. This corresponds to the radio buttons for
the search type. See {{msg-mw|checkuser-search-initiator}} and
{{msg-mw|checkuser-log-search-target}}.",
"checkuser-ipeditcount": "This information is shown on the result page
of [[mw:Extension:CheckUser#Basic_interface|Special:CheckUser]] (when doing the
''{{int:Checkuser-users}}'' check), next to the individual listed IPs.\n\nSee
[[mw:Extension:CheckUser#Basic_interface|screenshot]] \"Example user name
check\").\n\nParameters:\n* $1 - an estimate of the total number of edits from
the respective IP (i.e. the number of edits by all users, not only by the
requested user). As the comment in the code says: ''If we get some results, it
helps to know if the IP in general has a lot more edits, e.g. \"tip of the
iceberg\"…''",
"checkuser-log-return": "Link label on log of CheckUser searches. See
screenshot \"[[mw:Extension:CheckUser#Basic_interface|Example log]]\".",
"checkuser-limited": "A message shown above CheckUser results if the
result list would be longer than the specified limit (5000 entries), and has
been truncated.",
diff --git a/specials/SpecialCheckUserLog.php b/specials/SpecialCheckUserLog.php
index b52dd40..1f3673d 100644
--- a/specials/SpecialCheckUserLog.php
+++ b/specials/SpecialCheckUserLog.php
@@ -80,35 +80,7 @@
$this->getCheckUserFormTitle(),
$this->msg( 'checkuser-log-return' ) ) );
- // Give grep a chance to find the usages:
- // checkuser-search-initiator, checkuser-search-target
- $searchTypes = array( 'initiator', 'target' );
- $select = "<select name=\"cuSearchType\"
style='margin-top:.2em;'>\n";
- foreach ( $searchTypes as $searchType ) {
- if ( $type == $searchType ) {
- $checked = 'selected="selected"';
- } else {
- $checked = '';
- }
- $caption = $this->msg( 'checkuser-search-' .
$searchType )->escaped();
- $select .= "<option value=\"$searchType\"
$checked>$caption</option>\n";
- }
- $select .= '</select>';
-
- $encTarget = htmlspecialchars( $target );
- $msgSearch = $this->msg( 'checkuser-search' )->escaped();
- $input = "<input type=\"text\" name=\"cuSearch\"
value=\"$encTarget\" size=\"40\"/>";
- $msgSearchForm = $this->msg( 'checkuser-search-form'
)->rawParams( $select, $input )->escaped();
- $formAction = htmlspecialchars(
$this->getPageTitle()->getLocalURL() );
- $msgSearchSubmit = '  ' . $this->msg(
'checkuser-search-submit' )->escaped() . '  ';
-
- $s = "<form method='get' action=\"$formAction\">\n" .
- "<fieldset><legend>$msgSearch</legend>\n" .
- "<p>$msgSearchForm</p>\n" .
- "<p>" . Xml::dateMenu( $year, $month ) .
"   \n" .
- "<input type=\"submit\" name=\"cuSearchSubmit\"
value=\"$msgSearchSubmit\"/></p>\n" .
- "</fieldset></form>\n";
- $out->addHTML( $s );
+ $this->displaySearchForm();
if ( $error !== false ) {
$out->wrapWikiMsg( '<div class="errorbox">$1</div>',
$error );
@@ -123,6 +95,44 @@
);
}
+ protected function displaySearchForm() {
+ $this->getOutput()->addModules( 'mediawiki.userSuggest' );
+ $request = $this->getRequest();
+ $fields = array(
+ 'target' => array(
+ 'type' => 'text',
+ 'name' => 'cuSearch',
+ 'size' => 40,
+ 'cssclass' => 'mw-autocomplete-user', // for
mediawiki.userSuggest autocompletions
+ 'label-message' =>
'checkuser-log-search-target',
+ ),
+ 'type' => array(
+ 'type' => 'radio',
+ 'name' => 'cuSearchType',
+ 'label-message' => 'checkuser-log-search-type',
+ 'options-messages' => array(
+ 'checkuser-search-target' => 'target',
+ 'checkuser-search-initiator' =>
'initiator',
+ ),
+ 'flatlist' => true,
+ 'default' => 'target',
+ ),
+ // @todo hack until HTMLFormField has a a proper date
selector
+ 'monthyear' => array(
+ 'type' => 'info',
+ 'default' => Xml::dateMenu( $request->getInt(
'year' ), $request->getInt( 'month' ) ),
+ 'raw' => true,
+ ),
+ );
+
+ $form = HTMLForm::factory( 'table', $fields,
$this->getContext() );
+ $form->setMethod( 'get' )
+ ->setWrapperLegendMsg( 'checkuser-search' )
+ ->setSubmitTextMsg( 'checkuser-search-submit' )
+ ->prepareForm()
+ ->displayForm( false );
+ }
+
protected function getGroupName() {
return 'changes';
}
--
To view, visit https://gerrit.wikimedia.org/r/261639
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I6db886cd8cc3a04566746451a73360ab9259225d
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CheckUser
Gerrit-Branch: master
Gerrit-Owner: Glaisher <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits