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.
This commit is contained in:
Andrew Garrett 2009-01-30 00:54:20 +00:00
parent b566499222
commit 7cbfa0597a
9 changed files with 41 additions and 4 deletions

View file

@ -331,6 +331,7 @@ To load an existing filter, type its filter ID into the box below the edit textb
'abusefilter-test-user' => 'Changes by user:',
'abusefilter-test-period-start' => 'Changes made after:',
'abusefilter-test-period-end' => 'Changes made before:',
'abusefilter-test-shownegative' => 'Show changes that do not match the filter',
'abusefilter-changeslist-examine' => 'examine',
// And these messages are for examining specific actions.

View file

@ -11,6 +11,8 @@ if ( ! defined( 'MEDIAWIKI' ) )
*
* @author Andrew Garrett <andrew@epstone.net>
* @license http://www.gnu.org/copyleft/gpl.html GNU General Public License 2.0 or later
* Includes GFDL-licensed images retrieved from http://commons.wikimedia.org/wiki/File:Yes_check.svg
* and http://commons.wikimedia.org/wiki/File:Red_x.svg -- both have been downsampled and converted to PNG.
*/
$dir = dirname(__FILE__);
@ -89,6 +91,6 @@ $wgAjaxExportList[] = 'AbuseFilter::ajaxGetFilter';
$wgAjaxExportList[] = 'AbuseFilter::ajaxCheckFilterWithVars';
// Bump the version number every time you change any of the .css/.js files
$wgAbuseFilterStyleVersion = 4;
$wgAbuseFilterStyleVersion = 5;
$wgAbuseFilterRestrictedActions = array( 'block', 'degroup' );

View file

@ -29,12 +29,18 @@ abstract class AbuseFilterView {
class AbuseFilterChangesList extends OldChangesList {
protected function insertExtra( &$s, &$rc, &$classes ) {
## Empty, used for subclassers to add anything special.
$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;
}
}
}

View file

@ -24,7 +24,7 @@ class AbuseFilterViewTestBatch extends AbuseFilterView {
$output = Xml::tags( 'div', array( 'id' => 'mw-abusefilter-test-editor' ), $output );
// Removed until I can distinguish between positives and negatives :)
// $output .= Xml::tags( 'p', null, Xml::checkLabel( wfMsg( 'abusefilter-test-shownegative' ), 'wpShowNegative', 'wpShowNegative', $this->mShowNegative ) );
$output .= Xml::tags( 'p', null, Xml::checkLabel( wfMsg( 'abusefilter-test-shownegative' ), 'wpShowNegative', 'wpShowNegative', $this->mShowNegative ) );
// Selectory stuff
$selectFields = array();
@ -80,7 +80,9 @@ class AbuseFilterViewTestBatch extends AbuseFilterView {
$result = AbuseFilter::checkConditions( $this->mFilter, $vars );
if ($result || $this->mShowNegative) {
// Stash result in RC item
$rc = RecentChange::newFromRow( $row );
$rc->filterResult = $result;
$rc->counter = $counter++;
$output .= $changesList->recentChangesLine( $rc, false );
}

View file

@ -11,9 +11,12 @@ function examinerCheckFilter() {
if (response == 'MATCH') {
changeText( el, wgMessageMatch );
el.className = 'mw-abusefilter-examine-match';
} else if (response == 'NOMATCH') {
changeText( el, wgMessageNomatch );
el.className = 'mw-abusefilter-examine-nomatch';
} else if (response == 'SYNTAXERROR' ) {
el.className = 'mw-abusefilter-examine-syntaxerror';
changeText( el, wgMessageError );
}
} );

View file

@ -47,4 +47,25 @@ tr.mw-abusefilter-list-disabled, tr.mw-abusefilter-list-disabled td {
tr.mw-abusefilter-list-deleted, tr.mw-abusefilter-list-deleted td {
color: #aaaaaa;
}
}
.mw-abusefilter-examine-match,
.mw-abusefilter-syntaxresult-ok,
li.mw-abusefilter-changeslist-match {
background-image: url(yes_check.png);
}
.mw-abusefilter-examine-nomatch,
.mw-abusefilter-examine-syntaxerror,
.mw-abusefilter-syntaxresult-error,
li.mw-abusefilter-changeslist-nomatch {
background-image: url(red_x.png);
}
#mw-abusefilter-syntaxresult,
li.mw-abusefilter-changeslist-nomatch,
li.mw-abusefilter-changeslist-match {
background-repeat: no-repeat;
padding-left: 25px;
background-position: left center;
}

View file

@ -19,10 +19,12 @@ function processSyntaxResult( request ) {
// Successful
changeText( el, 'No syntax errors.' );
el.syntaxOk = true;
el.className = 'mw-abusefilter-syntaxresult-ok';
} else {
var errorData = eval(response.substr(4));
changeText( el, 'Syntax error: '+errorData[0] );
el.syntaxOk = false;
el.className = 'mw-abusefilter-syntaxresult-error';
var position = errorData[1];
var textArea = document.getElementById( wgFilterBoxName );

BIN
red_x.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 409 B

BIN
yes_check.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 B