Index: trunk/extensions/AbuseFilter/SpecialAbuseLog.php |
— | — | @@ -19,6 +19,9 @@ |
20 | 20 | $wgOut->setRobotPolicy( "noindex,nofollow" ); |
21 | 21 | $wgOut->setArticleRelated( false ); |
22 | 22 | $wgOut->enableClientCache( false ); |
| 23 | + |
| 24 | + global $wgScriptPath; |
| 25 | + $wgOut->addExtensionStyle( $wgScriptPath."/extensions/AbuseFilter/abusefilter.css" ); |
23 | 26 | |
24 | 27 | // Are we allowed? |
25 | 28 | if ( count( $errors = $this->getTitle()->getUserPermissionsErrors( 'abusefilter-log', $wgUser, true, array( 'ns-specialprotected' ) ) ) ) { |
— | — | @@ -98,6 +101,11 @@ |
99 | 102 | if (!$this->canSeeDetails()) { |
100 | 103 | return; |
101 | 104 | } |
| 105 | + |
| 106 | + // I don't want to change the names of the pre-existing messages |
| 107 | + // describing the variables, nor do I want to rewrite them, so I'm just |
| 108 | + // mapping the variable names to builder messages with a pre-existing array. |
| 109 | + $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'); |
102 | 110 | |
103 | 111 | $dbr = wfGetDB( DB_SLAVE ); |
104 | 112 | |
— | — | @@ -115,14 +123,21 @@ |
116 | 124 | // Build a table. |
117 | 125 | $vars = unserialize( $row->afl_var_dump ); |
118 | 126 | |
119 | | - $output .= Xml::openElement( 'table', array( 'class' => 'wikitable mw-abuselog-details', 'style' => "width: 80%;" ) ) . Xml::openElement( 'tbody' ); |
| 127 | + $output .= Xml::openElement( 'table', array( 'class' => 'mw-abuselog-details', 'style' => "width: 80%;" ) ) . Xml::openElement( 'tbody' ); |
120 | 128 | |
121 | 129 | $header = Xml::element( 'th', null, wfMsg( 'abusefilter-log-details-var' ) ) . Xml::element( 'th', null, wfMsg( 'abusefilter-log-details-val' ) ); |
122 | 130 | $output .= Xml::tags( 'tr', null, $header ); |
123 | 131 | |
124 | 132 | // Now, build the body of the table. |
125 | 133 | foreach( $vars as $key => $value ) { |
126 | | - $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 ); |
| 134 | + if ( !empty($variableMessageMappings[$key]) ) { |
| 135 | + $mapping = $variableMessageMappings[$key]; |
| 136 | + $keyDisplay = wfMsgExt( "abusefilter-edit-builder-vars-$mapping", 'parseinline' ) . ' (' . Xml::element( 'tt', null, $key ) . ')'; |
| 137 | + } else { |
| 138 | + $keyDisplay = Xml::element( 'tt', null, $key ); |
| 139 | + } |
| 140 | + |
| 141 | + $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 ); |
127 | 142 | $output .= Xml::tags( 'tr', array( 'class' => "mw-abuselog-details-$key" ), $trow ); |
128 | 143 | } |
129 | 144 | |
Index: trunk/extensions/AbuseFilter/abusefilter.css |
— | — | @@ -0,0 +1,21 @@ |
| 2 | +/* This code was stolen shamelessly from enwikipedia's Common.css */ |
| 3 | +table.mw-abuselog-details { |
| 4 | + margin: 1em 1em 1em 0; |
| 5 | + background: #f9f9f9; |
| 6 | + border: 1px #aaa solid; |
| 7 | + border-collapse: collapse; |
| 8 | +} |
| 9 | + |
| 10 | +table.mw-abuselog-details th, table.mw-abuselog-details td { |
| 11 | + border: 1px #aaa solid; |
| 12 | + padding: 0.2em; |
| 13 | +} |
| 14 | + |
| 15 | +table.mw-abuselog-details th { |
| 16 | + background: #f2f2f2; |
| 17 | + text-align: center; |
| 18 | +} |
| 19 | + |
| 20 | +table.mw-abuselog-details caption { |
| 21 | + font-weight: bold; |
| 22 | +} |
\ No newline at end of file |
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php |
— | — | @@ -20,7 +20,7 @@ |
21 | 21 | if ($filter) |
22 | 22 | $wgOut->setPageTitle( wfMsg( 'abusefilter-history', $filter ) ); |
23 | 23 | else |
24 | | - $wgOut->setPageTitle( wfMsg( 'abusefilter-log' ) ); |
| 24 | + $wgOut->setPageTitle( wfMsg( 'abusefilter-filter-log' ) ); |
25 | 25 | |
26 | 26 | $sk = $wgUser->getSkin(); |
27 | 27 | |
Index: trunk/extensions/AbuseFilter/AbuseFilter.i18n.php |
— | — | @@ -228,9 +228,13 @@ |
229 | 229 | 'abusefilter-edit-builder-vars-user-name' => 'Name of user account', |
230 | 230 | 'abusefilter-edit-builder-vars-user-groups' => 'Groups (including implicit) user is in', |
231 | 231 | 'abusefilter-edit-builder-vars-user-emailconfirm' => 'Time email address was confirmed', |
| 232 | + 'abusefilter-edit-builder-vars-recent-contributors' => 'Last five contributors to the article', |
| 233 | + 'abusefilter-edit-builder-vars-all-links' => 'All external links in the new text', |
| 234 | + 'abusefilter-edit-builder-vars-added-links' => 'All external links added in the edit', |
| 235 | + 'abusefilter-edit-builder-vars-removed-links' => 'All external links removed oin the edit', |
232 | 236 | |
233 | 237 | // Filter history |
234 | | - 'abusefilter-log' => 'Recent filter changes', |
| 238 | + 'abusefilter-filter-log' => 'Recent filter changes', |
235 | 239 | 'abusefilter-history' => 'History for filter $1', |
236 | 240 | 'abusefilter-history-foruser' => 'Changes by $1', |
237 | 241 | 'abusefilter-history-hidden' => 'hidden', |