r44737 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r44736‎ | r44737 | r44738 >
Date:22:26, 17 December 2008
Author:aaron
Status:deferred
Tags:
Comment:
Add watchlist filter
Modified paths:
  • /trunk/extensions/FlaggedRevs/language/OldReviewedPages.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/language/OldReviewedPages.i18n.php
@@ -9,7 +9,7 @@
1010
1111 $messages['en'] = array(
1212 'oldreviewedpages' => 'Outdated reviewed pages',
13 - 'oldreviewedpages-legend' => 'List reviewed pages with unreviewed revisions',
 13+ 'oldreviewedpages-legend' => 'List reviewed pages with revisions pending review',
1414 'oldreviewedpages-list' => 'This page lists reviewed pages that have pending edits.',
1515 'oldreviewedpages-none' => 'There are currently no pages meeting these criteria',
1616 'oldreviewedpages-stable' => 'sighted',
@@ -18,6 +18,7 @@
1919 'oldreviewedpages-days' => '($1 {{PLURAL:$1|day|days}})',
2020 'oldreviewedpages-recent' => '(less than 1 hour)',
2121 'oldreviewed-category' => 'Category:',
 22+ 'oldreviewed-watched' => 'On my watchlist',
2223 'oldreviewed-diff' => 'review',
2324 'oldreviewed-size' => 'Max change (bytes):',
2425 'oldreviewedpages-unwatched' => '(unwatched)',
Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -24,6 +24,7 @@
2525 $this->namespace = $wgRequest->getIntOrNull( 'namespace' );
2626 $this->category = trim( $wgRequest->getVal( 'category' ) );
2727 $this->size = $wgRequest->getIntOrNull( 'size' );
 28+ $this->watched = $wgRequest->getCheck( 'watched' );
2829 $feedType = $wgRequest->getVal( 'feed' );
2930 if( $feedType ) {
3031 return $this->feed( $feedType );
@@ -45,25 +46,31 @@
4647 function showList( $par ) {
4748 global $wgOut, $wgScript, $wgTitle, $wgFlaggedRevsNamespaces;
4849 $limit = $this->parseParams( $par );
49 - $pager = new OldReviewedPagesPager( $this, $this->namespace, $this->category, $this->size );
50 - if( $limit )
51 - $pager->mLimit = $limit;
 50+ $pager = new OldReviewedPagesPager( $this, $this->namespace, $this->category,
 51+ $this->size, $this->watched );
 52+ $pager->mLimit = $limit ? $limit : $pager->mLimit;
5253 // Viewing the page normally...
5354 if( !$this->including() ) {
5455 $action = htmlspecialchars( $wgScript );
55 - $wgOut->addHTML( "<form action=\"$action\" method=\"get\">\n" .
 56+ $wgOut->addHTML(
 57+ "<form action=\"$action\" method=\"get\">\n" .
5658 '<fieldset><legend>' . wfMsg('oldreviewedpages-legend') . '</legend>' .
57 - Xml::hidden( 'title', $wgTitle->getPrefixedDBKey() ) );
 59+ Xml::hidden( 'title', $wgTitle->getPrefixedDBKey() )
 60+ );
5861 # Display dropdown as needed
5962 if( count($wgFlaggedRevsNamespaces) > 1 ) {
6063 $wgOut->addHTML( FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . '&nbsp;' );
6164 }
62 - $wgOut->addHTML( Xml::label( wfMsg("oldreviewed-category"), 'category' ) . '&nbsp;' .
63 - Xml::input( 'category', 35, $this->category, array('id' => 'category') ) . '<br/>' .
64 - Xml::label( wfMsg('oldreviewed-size'), 'size' ) . '&nbsp;' .
65 - Xml::input( 'size', 6, $this->size, array( 'id' => 'wpSize' ) ) .
 65+ $wgOut->addHTML(
 66+ Xml::label( wfMsg("oldreviewed-category"), 'wpCategory' ) . '&nbsp;' .
 67+ Xml::input( 'category', 35, $this->category, array('id' => 'wpCategory') ) . '<br/>' .
 68+ Xml::label( wfMsg('oldreviewed-size'), 'wpSize' ) . '&nbsp;' .
 69+ Xml::input( 'size', 5, $this->size, array( 'id' => 'wpSize' ) ) . '&nbsp;' .
 70+ Xml::label( wfMsg('oldreviewed-watched'), 'wpWatched' ) . '&nbsp;' .
 71+ Xml::check( 'watched', $this->watched, array( 'id' => 'wpWatched' ) ) .
6672 '&nbsp;&nbsp;' . Xml::submitButton( wfMsg( 'allpagessubmit' ) ) . "\n" .
67 - "</fieldset></form>" );
 73+ "</fieldset></form>"
 74+ );
6875 $wgOut->addHTML( wfMsgExt('oldreviewedpages-list', array('parse') ) );
6976 if( $pager->getNumRows() ) {
7077 $wgOut->addHTML( $pager->getNavigationBar() );
@@ -239,9 +246,8 @@
240247 public $mForm, $mConds;
241248 private $category, $namespace;
242249
243 - function __construct( $form, $namespace, $category=NULL, $size=NULL, $conds = array() ) {
 250+ function __construct( $form, $namespace, $category='', $size=NULL, $watched=false ) {
244251 $this->mForm = $form;
245 - $this->mConds = $conds;
246252 # Must be a content page...
247253 global $wgFlaggedRevsNamespaces;
248254 if( !is_null($namespace) ) {
@@ -253,7 +259,7 @@
254260 $this->namespace = $namespace;
255261 $this->category = $category ? str_replace(' ','_',$category) : NULL;
256262 $this->size = $size ? $size : NULL;
257 -
 263+ $this->watched = (bool)$watched;
258264 parent::__construct();
259265 }
260266
@@ -266,6 +272,7 @@
267273 }
268274
269275 function getQueryInfo() {
 276+ global $wgUser;
270277 $conds = $this->mConds;
271278 $tables = array( 'flaggedpages', 'page', 'revision' );
272279 $fields = array('page_namespace','page_title','page_len','fp_stable','fp_quality',
@@ -284,6 +291,13 @@
285292 $conds['cl_to'] = $this->category;
286293 $useIndex['categorylinks'] = 'cl_from';
287294 }
 295+ # Filter by watchlist
 296+ if( $this->watched && $uid = $wgUser->getId() ) {
 297+ $tables[] = 'watchlist';
 298+ $conds[] = "wl_user = '$uid'";
 299+ $conds[] = 'page_namespace = wl_namespace';
 300+ $conds[] = 'page_title = wl_title';
 301+ }
288302 # Filter by bytes changed
289303 if( $this->size ) {
290304 $conds[] = 'ABS(page_len - rev_len) < '.intval($this->size);

Status & tagging log