mediawiki-extensions-AbuseF.../Views/AbuseFilterView.php
Andrew Garrett 7cbfa0597a Prettify and enhance usability of test and examine views.
* Adopt pretty logos for "Match" and "No Match" for visual distinguishment.
* Allow negatives to be reported as well in 'test' interface.
2009-01-30 00:54:20 +00:00

46 lines
1 KiB
PHP

<?php
if (!defined( 'MEDIAWIKI' ))
die();
abstract class AbuseFilterView {
function __construct( $page, $params ) {
$this->mPage = $page;
$this->mParams = $params;
}
function getTitle( $subpage='' ) {
return $this->mPage->getTitle( $subpage );
}
abstract function show();
function canEdit() {
global $wgUser;
static $canEdit = 'unset';
if ($canEdit == 'unset') {
$canEdit = $wgUser->isAllowed( 'abusefilter-modify' );
}
return $canEdit;
}
}
class AbuseFilterChangesList extends OldChangesList {
protected function insertExtra( &$s, &$rc, &$classes ) {
$sk = $this->skin;
$title = SpecialPage::getTitleFor( 'AbuseFilter', "examine/".$rc->mAttribs['rc_id'] );
$examineLink = $sk->link( $title, wfMsgExt( 'abusefilter-changeslist-examine', 'parseinline' ) );
$s .= " ($examineLink)";
## If we have a match..
if ( isset( $rc->filterResult ) ) {
$class = $rc->filterResult ? 'mw-abusefilter-changeslist-match' : 'mw-abusefilter-changeslist-nomatch';
$classes[] = $class;
}
}
}