r46893 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46892‎ | r46893 | r46894 >
Date:05:12, 6 February 2009
Author:aaron
Status:deferred
Tags:
Comment:
Added precedence dropdown to stablepages
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/language/StablePages.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/StablePages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/language/FlaggedRevs.i18n.php
@@ -200,6 +200,7 @@
201201 'revreview-filter-manual' => 'Manual',
202202 'revreview-filter-level-0' => 'Sighted versions',
203203 'revreview-filter-level-1' => 'Quality versions',
 204+ 'revreview-filter-level-2' => 'Pristine versions',
204205 'revreview-statusfilter' => 'Status:',
205206 'revreview-typefilter' => 'Type:',
206207 'revreview-tagfilter' => 'Tag:',
Index: trunk/extensions/FlaggedRevs/language/StablePages.i18n.php
@@ -8,11 +8,15 @@
99 $messages = array();
1010
1111 $messages['en'] = array(
12 - 'stablepages' => 'Stable pages',
13 - 'stablepages-stable' => 'stable version',
14 - 'stablepages-text' => 'Below is a list of pages manually configured to show the stable version as the default page content for viewers.',
15 - 'stablepages-none' => 'There are no pages in this list',
16 - 'stablepages-config' => 'Configuration',
 12+ 'stablepages' => 'Stable pages',
 13+ 'stablepages-stable' => 'stable version',
 14+ 'stablepages-text' => 'Below is a list of pages manually configured to show the stable version as the default page content for viewers.',
 15+ 'stablepages-none' => 'There are no pages in this list',
 16+ 'stablepages-config' => 'Configuration',
 17+ 'stablepages-prec-none' => 'no precedence',
 18+ 'stablepages-prec-quality' => 'quality precedence',
 19+ 'stablepages-prec-pristine' => 'pristine precedence',
 20+ 'stablepages-precedence' => 'Precedence:',
1721 );
1822
1923 /** Message documentation (Message documentation)
Index: trunk/extensions/FlaggedRevs/specialpages/StablePages_body.php
@@ -19,6 +19,7 @@
2020 $this->skin = $wgUser->getSkin();
2121
2222 $this->namespace = $wgRequest->getInt( 'namespace' );
 23+ $this->precedence = $wgRequest->getInt( 'precedence', FlaggedRevs::getPrecedence() );
2324
2425 $this->showForm();
2526 $this->showPageList();
@@ -31,6 +32,8 @@
3233 $form = Xml::openElement( 'form', array( 'name' => 'stablepages', 'action' => $wgScript, 'method' => 'get' ) );
3334 $form .= "<fieldset><legend>".wfMsg('stablepages')."</legend>\n";
3435 $form .= FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . '&nbsp;';
 36+ $form .= Xml::label( wfMsg('stablepages-precedence'), 'precedence', 'precedence' ) . '&nbsp;';
 37+ $form .= FlaggedRevsXML::getPrecedenceMenu( $this->precedence ) . '&nbsp;';
3538 $form .= " ".Xml::submitButton( wfMsg( 'go' ) );
3639 $form .= Xml::hidden( 'title', $wgTitle->getPrefixedDBKey() );
3740 $form .= "</fieldset></form>\n";
@@ -42,7 +45,7 @@
4346 global $wgOut, $wgUser, $wgLang;
4447 # Take this opportunity to purge out expired configurations
4548 FlaggedRevs::purgeExpiredConfigurations();
46 - $pager = new StablePagesPager( $this, array(), $this->namespace );
 49+ $pager = new StablePagesPager( $this, array(), $this->namespace, $this->precedence );
4750 if( $pager->getNumRows() ) {
4851 $wgOut->addHTML( $pager->getNavigationBar() );
4952 $wgOut->addHTML( $pager->getBody() );
@@ -61,15 +64,23 @@
6265 $stitle = SpecialPage::getTitleFor( 'Stabilization' );
6366 $config = $this->skin->makeKnownLinkObj( $stitle, wfMsgHtml('stablepages-config'),
6467 'page=' . $title->getPrefixedUrl() );
65 - $stable = $this->skin->makeKnownLinkObj( $title, wfMsgHtml('stablepages-stable'),
66 - 'stable=1' );
 68+ $stable = $this->skin->makeKnownLinkObj( $title, wfMsgHtml('stablepages-stable'), 'stable=1' );
 69+
 70+ if( intval($row->fpc_select) === FLAGGED_VIS_PRISTINE ) {
 71+ $type = wfMsgHtml('stablepages-prec-pristine');
 72+ } else if( intval($row->fpc_select) === FLAGGED_VIS_NORMAL ) {
 73+ $type = wfMsgHtml('stablepages-prec-quality');
 74+ } else {
 75+ $type = wfMsgHtml('stablepages-prec-none');
 76+ }
 77+
6778 if( $row->fpc_expiry != 'infinity' && strlen($row->fpc_expiry) ) {
6879 $expiry_description = " (".wfMsgForContent( 'protect-expiring', $wgLang->timeanddate($row->fpc_expiry) ).")";
6980 } else {
7081 $expiry_description = "";
7182 }
7283
73 - return "<li>{$link} ({$config}) [{$stable}]{$expiry_description}</li>";
 84+ return "<li>{$link} ({$config}) [{$stable}] (<b>{$type}</b>) <i>{$expiry_description}</i></li>";
7485 }
7586 }
7687
@@ -79,7 +90,7 @@
8091 class StablePagesPager extends AlphabeticPager {
8192 public $mForm, $mConds, $namespace;
8293
83 - function __construct( $form, $conds = array(), $namespace=0 ) {
 94+ function __construct( $form, $conds = array(), $namespace=0, $precedence=NULL ) {
8495 $this->mForm = $form;
8596 $this->mConds = $conds;
8697 # Must be a content page...
@@ -91,6 +102,7 @@
92103 $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
93104 }
94105 $this->namespace = $namespace;
 106+ $this->precedence = $precedence;
95107 parent::__construct();
96108 }
97109
@@ -102,10 +114,13 @@
103115 $conds = $this->mConds;
104116 $conds[] = 'page_id = fpc_page_id';
105117 $conds['fpc_override'] = 1;
 118+ if( $this->precedence !== NULL && $this->precedence >= 0 ) {
 119+ $conds['fpc_select'] = $this->precedence;
 120+ }
106121 $conds['page_namespace'] = $this->namespace;
107122 return array(
108123 'tables' => array('flaggedpage_config','page'),
109 - 'fields' => 'page_namespace,page_title,fpc_expiry,fpc_page_id',
 124+ 'fields' => 'page_namespace,page_title,fpc_expiry,fpc_page_id,fpc_select',
110125 'conds' => $conds,
111126 'options' => array()
112127 );
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -51,9 +51,24 @@
5252 $s .= Xml::option( wfMsg( "revreview-filter-level-0" ), 0, $selected===0 );
5353 if( FlaggedRevs::qualityVersions() )
5454 $s .= Xml::option( wfMsg( "revreview-filter-level-1" ), 1, $selected===1 );
 55+ # Pristine not tracked at sp:QualityOversight
 56+ #if( FlaggedRevs::pristineVersions() )
 57+ # $s .= Xml::option( wfMsg( "revreview-filter-level-2" ), 2, $selected===2 );
5558 $s .= Xml::closeElement('select')."\n";
5659 return $s;
5760 }
 61+
 62+ public static function getPrecedenceMenu( $selected=null ) {
 63+ wfLoadExtensionMessages( 'FlaggedRevs' );
 64+ $s = Xml::openElement( 'select', array('name' => 'precedence') );
 65+ $s .= Xml::option( wfMsg( "revreview-filter-level-0" ), FLAGGED_VIS_LATEST, $selected==FLAGGED_VIS_LATEST );
 66+ if( FlaggedRevs::qualityVersions() )
 67+ $s .= Xml::option( wfMsg( "revreview-filter-level-1" ), FLAGGED_VIS_NORMAL, $selected==FLAGGED_VIS_NORMAL );
 68+ if( FlaggedRevs::pristineVersions() )
 69+ $s .= Xml::option( wfMsg( "revreview-filter-level-2" ), FLAGGED_VIS_PRISTINE, $selected==FLAGGED_VIS_PRISTINE );
 70+ $s .= Xml::closeElement('select')."\n";
 71+ return $s;
 72+ }
5873
5974 /**
6075 * Get a selector of "approved"/"unapproved"

Follow-up revisions

RevisionCommit summaryAuthorDate
r46988Recommit r46893 removing non-unicode character in ksh:'interwiki_intro'siebrand22:51, 7 February 2009

Status & tagging log