mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/AbuseFilter.git
synced 2024-12-03 01:56:28 +00:00
c1b4f1084c
The <pre> element is now hidden with CSS, and is only shown after the user clicks the "Eval" button. Moreover, make the button primary and progressive, as to indicate that it activates the primary function of that page. Bug: T253492 Change-Id: I300ce6ec0a84ea73025a5af9173024df7c291e03
65 lines
1.7 KiB
PHP
65 lines
1.7 KiB
PHP
<?php
|
|
|
|
class AbuseFilterViewTools extends AbuseFilterView {
|
|
/**
|
|
* Shows the page
|
|
*/
|
|
public function show() {
|
|
$out = $this->getOutput();
|
|
$out->enableOOUI();
|
|
$request = $this->getRequest();
|
|
|
|
if ( !AbuseFilter::canViewPrivate( $this->getUser() ) ) {
|
|
$out->addWikiMsg( 'abusefilter-mustviewprivateoredit' );
|
|
return;
|
|
}
|
|
|
|
// Header
|
|
$out->addWikiMsg( 'abusefilter-tools-text' );
|
|
|
|
// Expression evaluator
|
|
$eval = '';
|
|
$eval .= $this->buildEditBox(
|
|
$request->getText( 'wpFilterRules' ),
|
|
true,
|
|
false,
|
|
false
|
|
);
|
|
|
|
$eval .=
|
|
Xml::tags( 'p', null,
|
|
new OOUI\ButtonInputWidget( [
|
|
'label' => $this->msg( 'abusefilter-tools-submitexpr' )->text(),
|
|
'id' => 'mw-abusefilter-submitexpr',
|
|
'flags' => [ 'primary', 'progressive' ]
|
|
] )
|
|
);
|
|
$eval .= Xml::element( 'pre', [ 'id' => 'mw-abusefilter-expr-result' ], ' ' );
|
|
|
|
$eval = Xml::fieldset( $this->msg( 'abusefilter-tools-expr' )->text(), $eval );
|
|
$out->addHTML( $eval );
|
|
|
|
$out->addModules( 'ext.abuseFilter.tools' );
|
|
|
|
if ( AbuseFilter::canEdit( $this->getUser() ) ) {
|
|
// Hacky little box to re-enable autoconfirmed if it got disabled
|
|
$formDescriptor = [
|
|
'RestoreAutoconfirmed' => [
|
|
'label-message' => 'abusefilter-tools-reautoconfirm-user',
|
|
'type' => 'user',
|
|
'name' => 'wpReAutoconfirmUser',
|
|
'id' => 'reautoconfirm-user',
|
|
'infusable' => true
|
|
],
|
|
];
|
|
$htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
|
|
$htmlForm->setWrapperLegendMsg( 'abusefilter-tools-reautoconfirm' )
|
|
->setSubmitTextMsg( 'abusefilter-tools-reautoconfirm-submit' )
|
|
->setSubmitName( 'wpReautoconfirmSubmit' )
|
|
->setSubmitId( 'mw-abusefilter-reautoconfirmsubmit' )
|
|
->prepareForm()
|
|
->displayForm( false );
|
|
}
|
|
}
|
|
}
|