Revision: 46275
Author:   werdna
Date:     2009-01-26 19:23:27 +0000 (Mon, 26 Jan 2009)

Log Message:
-----------
Fix up Abuse Log, by adding descriptions for variables, styling the variable 
table.

Also, fix up a message naming conflict introduced by r46272.

Modified Paths:
--------------
    trunk/extensions/AbuseFilter/AbuseFilter.i18n.php
    trunk/extensions/AbuseFilter/SpecialAbuseLog.php
    trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php

Added Paths:
-----------
    trunk/extensions/AbuseFilter/abusefilter.css

Modified: trunk/extensions/AbuseFilter/AbuseFilter.i18n.php
===================================================================
--- trunk/extensions/AbuseFilter/AbuseFilter.i18n.php   2009-01-26 19:11:34 UTC 
(rev 46274)
+++ trunk/extensions/AbuseFilter/AbuseFilter.i18n.php   2009-01-26 19:23:27 UTC 
(rev 46275)
@@ -228,9 +228,13 @@
        'abusefilter-edit-builder-vars-user-name' => 'Name of user account',
        'abusefilter-edit-builder-vars-user-groups' => 'Groups (including 
implicit) user is in',
        'abusefilter-edit-builder-vars-user-emailconfirm' => 'Time email 
address was confirmed',
+       'abusefilter-edit-builder-vars-recent-contributors' => 'Last five 
contributors to the article',
+       'abusefilter-edit-builder-vars-all-links' => 'All external links in the 
new text',
+       'abusefilter-edit-builder-vars-added-links' => 'All external links 
added in the edit',
+       'abusefilter-edit-builder-vars-removed-links' => 'All external links 
removed oin the edit',
 
        // Filter history
-       'abusefilter-log' => 'Recent filter changes',
+       'abusefilter-filter-log' => 'Recent filter changes',
        'abusefilter-history' => 'History for filter $1',
        'abusefilter-history-foruser' => 'Changes by $1',
        'abusefilter-history-hidden' => 'hidden',

Modified: trunk/extensions/AbuseFilter/SpecialAbuseLog.php
===================================================================
--- trunk/extensions/AbuseFilter/SpecialAbuseLog.php    2009-01-26 19:11:34 UTC 
(rev 46274)
+++ trunk/extensions/AbuseFilter/SpecialAbuseLog.php    2009-01-26 19:23:27 UTC 
(rev 46275)
@@ -19,6 +19,9 @@
                $wgOut->setRobotPolicy( "noindex,nofollow" );
                $wgOut->setArticleRelated( false );
                $wgOut->enableClientCache( false );
+
+               global $wgScriptPath;
+               $wgOut->addExtensionStyle( 
$wgScriptPath."/extensions/AbuseFilter/abusefilter.css" );
                
                // Are we allowed?
                if ( count( $errors = 
$this->getTitle()->getUserPermissionsErrors( 'abusefilter-log', $wgUser, true, 
array( 'ns-specialprotected' ) ) ) ) {
@@ -98,6 +101,11 @@
                if (!$this->canSeeDetails()) {
                        return;
                }
+
+               // I don't want to change the names of the pre-existing messages
+               // describing the variables, nor do I want to rewrite them, so 
I'm just
+               // mapping the variable names to builder messages with a 
pre-existing array.
+               $variableMessageMappings = array( 'ACCOUNTNAME' => 
'accountname', 'ACTION' => 'action', 'ADDED_LINES' => 'addedlines', 
'EDIT_DELTA' => 'delta', 'EDIT_DIFF' => 'diff', 'NEW_SIZE' => 'newsize', 
'OLD_SIZE' => 'oldsize', 'REMOVED_LINES' => 'removedlines', 'SUMMARY' => 
'summary', 'ARTICLE_ARTICLEID' => 'article-id', 'ARTICLE_NAMESPACE' => 
'article-ns', 'ARTICLE_TEXT' => 'article-text', 'ARTICLE_PREFIXEDTEXT' => 
'article-prefixedtext', 'MOVED_FROM_ARTICLEID' => 'movedfrom-id', 
'MOVED_FROM_NAMESPACE' => 'movedfrom-ns', 'MOVED_FROM_TEXT' => 
'movedfrom-text', 'MOVED_FROM_PREFIXEDTEXT' => 'movedfrom-prefixedtext', 
'MOVED_TO_ARTICLEID' => 'movedto-id', 'MOVED_TO_NAMESPACE' => 'movedto-ns', 
'MOVED_TO_TEXT' => 'movedto-text', 'MOVED_TO_PREFIXEDTEXT' => 
'movedto-prefixedtext', 'USER_EDITCOUNT' =>  'user-editcount', 'USER_AGE' => 
'user-age', 'USER_NAME' => 'user-name', 'USER_GROUPS' => 'user-groups', 
'USER_EMAILCONFIRM' => 'user-emailconfirm', 'ARTICLE_RECENT_CONTRIBUTORS' => 
'recent-contributors', 'ALL_LINKS' => 'all-links', 'ADDED_LINKS' => 
'added-links', 'REMOVED_LINKS' => 'removed-links');
                
                $dbr = wfGetDB( DB_SLAVE );
                
@@ -115,14 +123,21 @@
                // Build a table.
                $vars = unserialize( $row->afl_var_dump );
                
-               $output .= Xml::openElement( 'table', array( 'class' => 
'wikitable mw-abuselog-details', 'style' => "width: 80%;" ) ) . 
Xml::openElement( 'tbody' );
+               $output .= Xml::openElement( 'table', array( 'class' => 
'mw-abuselog-details', 'style' => "width: 80%;" ) ) . Xml::openElement( 'tbody' 
);
                
                $header = Xml::element( 'th', null, wfMsg( 
'abusefilter-log-details-var' ) ) . Xml::element( 'th', null, wfMsg( 
'abusefilter-log-details-val' ) );
                $output .= Xml::tags( 'tr', null, $header );
                
                // Now, build the body of the table.
                foreach( $vars as $key => $value ) {
-                       $trow = Xml::element( 'td', array( 'class' => 
'mw-abuselog-var', 'style' => 'width: 30%;' ), $key ) . Xml::element( 'td', 
array( 'class' => 'mw-abuselog-var-value', 'style' => "white-space: pre; 
font-family: monospace;" ), $value );
+                       if ( !empty($variableMessageMappings[$key]) ) {
+                               $mapping = $variableMessageMappings[$key];
+                               $keyDisplay = wfMsgExt( 
"abusefilter-edit-builder-vars-$mapping", 'parseinline' ) . ' (' . 
Xml::element( 'tt', null, $key ) . ')';
+                       } else {
+                               $keyDisplay = Xml::element( 'tt', null, $key );
+                       }
+                       
+                       $trow = Xml::tags( 'td', array( 'class' => 
'mw-abuselog-var', 'style' => 'width: 30%;' ), $keyDisplay ) . Xml::element( 
'td', array( 'class' => 'mw-abuselog-var-value', 'style' => "white-space: pre; 
font-family: monospace;" ), $value );
                        $output .= Xml::tags( 'tr', array( 'class' => 
"mw-abuselog-details-$key" ), $trow );
                }
                

Modified: trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php
===================================================================
--- trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php       
2009-01-26 19:11:34 UTC (rev 46274)
+++ trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php       
2009-01-26 19:23:27 UTC (rev 46275)
@@ -20,7 +20,7 @@
                if ($filter)
                        $wgOut->setPageTitle( wfMsg( 'abusefilter-history', 
$filter ) );
                else
-                       $wgOut->setPageTitle( wfMsg( 'abusefilter-log' ) );
+                       $wgOut->setPageTitle( wfMsg( 'abusefilter-filter-log' ) 
);
                        
                $sk = $wgUser->getSkin();
 

Added: trunk/extensions/AbuseFilter/abusefilter.css
===================================================================
--- trunk/extensions/AbuseFilter/abusefilter.css                                
(rev 0)
+++ trunk/extensions/AbuseFilter/abusefilter.css        2009-01-26 19:23:27 UTC 
(rev 46275)
@@ -0,0 +1,21 @@
+/* This code was stolen shamelessly from enwikipedia's Common.css */
+table.mw-abuselog-details {
+       margin: 1em 1em 1em 0;
+       background: #f9f9f9;
+       border: 1px #aaa solid;
+       border-collapse: collapse;
+}
+
+table.mw-abuselog-details th, table.mw-abuselog-details td {
+       border: 1px #aaa solid;
+       padding: 0.2em;
+}
+
+table.mw-abuselog-details th {
+       background: #f2f2f2;
+       text-align: center;
+}
+
+table.mw-abuselog-details caption {
+       font-weight: bold;
+}
\ No newline at end of file



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to