Polybuildr has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/218268

Change subject: Add author and preview text to table in special page
......................................................................

Add author and preview text to table in special page

Special:SmiteSpam now also displays the author of the latest revision
(linked to user's contributions) as well as a 50 character preview of
the page's content.

Change-Id: I073cc7104cda98ad0955af058b6400ba1af6e6a0
---
M SpecialSmiteSpam.php
M i18n/en.json
M i18n/qqq.json
3 files changed, 28 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/SmiteSpam 
refs/changes/68/218268/1

diff --git a/SpecialSmiteSpam.php b/SpecialSmiteSpam.php
index fe7b115..185aaa1 100644
--- a/SpecialSmiteSpam.php
+++ b/SpecialSmiteSpam.php
@@ -51,14 +51,19 @@
                                )
                        )
                );
-               $out->addHTML( Html::openElement( 'table' ) );
+               $out->addHTML( Html::openElement( 'table', array( 'class' => 
'wikitable' ) ) );
                $out->addHTML( '<tr><th>'
                        . $this->msg( 'smitespam-page' )->text()
                        . '</th><th>'
                        . $this->msg( 'smitespam-probability' )->text()
                        . '</th><th>'
+                       . $this->msg( 'smitespam-last-edited-by' )->text()
+                       . '</th><th>'
+                       . $this->msg( 'smitespam-preview-text' )->text()
+                       . '</th><th>'
                        . $this->msg( 'smitespam-delete' )->text()
-                       . '</th></tr>' );
+                       . '</tr>'
+               );
                foreach ( $spamPages as $page ) {
                        $title = $page->getTitle();
                        $out->addHTML( '<tr>' );
@@ -90,6 +95,23 @@
                        }
                        $out->addHTML( '</td>' );
                        $out->addHTML( '<td>' );
+                       $author = $page->getRevision()->getUserText( 
Revision::RAW );
+                       $out->addHTML(
+                               Linker::link(
+                                       SpecialPage::getTitleFor( 
'Contributions', $author ),
+                                       Sanitizer::escapeHtmlAllowEntities( 
$author ),
+                                       array( 'target' => '_blank' )
+                               )
+                       );
+                       $out->addHTML( '</td>' );
+                       $out->addHTML( '<td>' );
+                       $previewText = substr( $page->getMetadata( 'content' ), 
0, 50 );
+                       $out->addHTML( Sanitizer::escapeHtmlAllowEntities( 
$previewText ) );
+                       if ( strlen( $page->getMetadata( 'content' ) ) > 50  ) {
+                               $out->addHTML( '...' );
+                       }
+                       $out->addHTML( '</td>' );
+                       $out->addHTML( '<td>' );
                        $out->addHTML( Html::check(
                                'delete[]', false, array(
                                        'value' => $page->getID(),
diff --git a/i18n/en.json b/i18n/en.json
index d5b53ba..4f06708 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -12,6 +12,8 @@
        "smitespam-page": "Page",
        "smitespam-delete": "Delete",
        "smitespam-probability": "Probability",
+       "smitespam-last-edited-by": "Last edited by",
+       "smitespam-preview-text": "Preview text",
        "smitespam-delete-selected": "Delete selected",
        "smitespam-deleted-reason": "Identified as spam by 
Extension:SmiteSpam.",
        "action-smitespam": "smite spam"
diff --git a/i18n/qqq.json b/i18n/qqq.json
index 3b8b4be..752bd31 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -12,6 +12,8 @@
        "smitespam-page": "A wiki page",
        "smitespam-delete": "The verb 'delete'.",
        "smitespam-probability": "The word for 'probability'.",
+       "smitespam-last-edited-by": "The author of the last revision of a 
page.",
+       "smitespam-preview-text": "Preview text of a page's content.",
        "smitespam-delete-selected": "The phrase for 'delete selected'",
        "smitespam-deleted-reason": "Reason to give for deletion of a page",
        "action-smitespam": "Action for work done by Extesions:SmiteSpam"

-- 
To view, visit https://gerrit.wikimedia.org/r/218268
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I073cc7104cda98ad0955af058b6400ba1af6e6a0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/SmiteSpam
Gerrit-Branch: master
Gerrit-Owner: Polybuildr <v.a.ghai...@gmail.com>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to