mediawiki-extensions-AbuseF.../Views/AbuseFilterViewTools.php
John Du Hart b30697e94c Adds ResourceLoader support to AbuseFilter
Rewrote javascript to use jQuery
Added API modules to replace sajax_* calls
Solves bug 29714
2011-08-26 20:12:34 +00:00

56 lines
1.4 KiB
PHP

<?php
if ( !defined( 'MEDIAWIKI' ) )
die();
class AbuseFilterViewTools extends AbuseFilterView {
function show() {
global $wgOut, $wgUser;
// Header
$wgOut->addWikiMsg( 'abusefilter-tools-text' );
// Expression evaluator
$eval = '';
$eval .= AbuseFilter::buildEditBox( '', 'wpTestExpr' );
// Only let users with permission actually test it
if ( $wgUser->isAllowed( 'abusefilter-modify' ) ) {
$eval .= Xml::tags( 'p', null,
Xml::element( 'input',
array(
'type' => 'button',
'id' => 'mw-abusefilter-submitexpr',
'value' => wfMsg( 'abusefilter-tools-submitexpr' ) )
)
);
$eval .= Xml::element( 'p', array( 'id' => 'mw-abusefilter-expr-result' ), ' ' );
}
$eval = Xml::fieldset( wfMsg( 'abusefilter-tools-expr' ), $eval );
$wgOut->addHTML( $eval );
$wgOut->addModules( 'ext.abuseFilter.tools' );
if ( $wgUser->isAllowed( 'abusefilter-modify' ) ) {
// Hacky little box to re-enable autoconfirmed if it got disabled
$rac = '';
$rac .= Xml::inputLabel(
wfMsg( 'abusefilter-tools-reautoconfirm-user' ),
'wpReAutoconfirmUser',
'reautoconfirm-user',
45
);
$rac .= '&#160;';
$rac .= Xml::element(
'input',
array(
'type' => 'button',
'id' => 'mw-abusefilter-reautoconfirmsubmit',
'value' => wfMsg( 'abusefilter-tools-reautoconfirm-submit' )
)
);
$rac = Xml::fieldset( wfMsg( 'abusefilter-tools-reautoconfirm' ), $rac );
$wgOut->addHTML( $rac );
}
}
}