r32870 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r32869‎ | r32870 | r32871 >
Date:18:53, 6 April 2008
Author:aaron
Status:old
Tags:
Comment:
* Add a sexy page to list stable pages
* Use alphabetical pager
* Remove extra field from select
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevs.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/FlaggedRevsPage.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/FlaggedRevs.php
@@ -192,6 +192,9 @@
193193 # Load reviewed pages list
194194 $wgSpecialPages['ReviewedPages'] = 'ReviewedPages';
195195 $wgAutoloadClasses['ReviewedPages'] = $dir . 'FlaggedRevsPage.php';
 196+# Load stable pages list
 197+$wgSpecialPages['StablePages'] = 'StablePages';
 198+$wgAutoloadClasses['StablePages'] = $dir . 'FlaggedRevsPage.php';
196199 # Stable version config
197200 $wgSpecialPages['Stabilization'] = 'Stabilization';
198201 $wgAutoloadClasses['Stabilization'] = $dir . 'FlaggedRevsPage.php';
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.i18n.php
@@ -203,6 +203,11 @@
204204 'reviewedpages-all' => 'reviewed versions',
205205 'reviewedpages-best' => 'prime revision',
206206
 207+ 'stablepages' => 'Stable pages',
 208+ 'stablepages-text' => 'Below is a list of pages manually configured to show the stable version as the default page content for viewers.',
 209+ 'stablepages-none' => 'There are no pages in this list',
 210+ 'stablepages-config' => 'Configuration',
 211+
207212 'rights-editor-autosum' => 'autopromoted',
208213 'rights-editor-revoke' => 'removed editor status from [[$1]]',
209214 );
Index: trunk/extensions/FlaggedRevs/FlaggedRevsPage.php
@@ -736,10 +736,9 @@
737737 $conds[] = "fr_user = user_id";
738738 $conds[] = 'rev_deleted & '.Revision::DELETED_TEXT.' = 0';
739739 return array(
740 - 'tables' => array('flaggedrevs','revision','user'),
741 - 'fields' => 'fr_rev_id,fr_timestamp,rev_timestamp,fr_quality,
742 - fr_user,user_name',
743 - 'conds' => $conds,
 740+ 'tables' => array('flaggedrevs','revision','user'),
 741+ 'fields' => 'fr_rev_id,fr_timestamp,rev_timestamp,fr_quality,fr_user,user_name',
 742+ 'conds' => $conds,
744743 'options' => array('USE INDEX' => 'PRIMARY')
745744 );
746745 }
@@ -973,7 +972,7 @@
974973 /**
975974 * Query to list out stable versions for a page
976975 */
977 -class ReviewedPagesPager extends ReverseChronologicalPager {
 976+class ReviewedPagesPager extends AlphabeticPager {
978977 public $mForm, $mConds;
979978
980979 function __construct( $form, $conds = array(), $type=0, $namespace=0 ) {
@@ -1001,7 +1000,7 @@
10021001 $conds['page_ext_quality'] = $this->type;
10031002 return array(
10041003 'tables' => array('page'),
1005 - 'fields' => 'page_namespace,page_title,page_id',
 1004+ 'fields' => 'page_namespace,page_title',
10061005 'conds' => $conds,
10071006 'options' => array('USE INDEX' => 'ext_namespace_quality')
10081007 );
@@ -1012,6 +1011,86 @@
10131012 }
10141013 }
10151014
 1015+class StablePages extends SpecialPage
 1016+{
 1017+
 1018+ function __construct() {
 1019+ SpecialPage::SpecialPage( 'StablePages' );
 1020+ }
 1021+
 1022+ function execute( $par ) {
 1023+ global $wgRequest, $wgUser, $wgFlaggedRevValues, $wgFlaggedRevPristine;
 1024+
 1025+ $this->setHeaders();
 1026+ $this->skin = $wgUser->getSkin();
 1027+
 1028+ $this->showPageList();
 1029+ }
 1030+
 1031+ function showPageList() {
 1032+ global $wgOut, $wgUser, $wgLang;
 1033+
 1034+ $wgOut->addHTML( wfMsgExt('stablepages-text', array('parse') ) );
 1035+ $pager = new StablePagesPager( $this, array() );
 1036+ if( $pager->getNumRows() ) {
 1037+ $wgOut->addHTML( $pager->getNavigationBar() );
 1038+ $wgOut->addHTML( "<ul>" . $pager->getBody() . "</ul>" );
 1039+ $wgOut->addHTML( $pager->getNavigationBar() );
 1040+ } else {
 1041+ $wgOut->addHTML( wfMsgExt('stablepages-none', array('parse') ) );
 1042+ }
 1043+ }
 1044+
 1045+ function formatRow( $row ) {
 1046+ global $wgLang, $wgUser;
 1047+
 1048+ $title = Title::makeTitle( $row->page_namespace, $row->page_title );
 1049+ $link = $this->skin->makeKnownLinkObj( $title, $title->getPrefixedText() );
 1050+
 1051+ $stitle = SpecialPage::getTitleFor( 'Stabilization' );
 1052+ $config = $this->skin->makeKnownLinkObj( $stitle, wfMsgHtml('stablepages-config'),
 1053+ 'page=' . $title->getPrefixedUrl() );
 1054+ $best = $this->skin->makeKnownLinkObj( $title, wfMsgHtml('reviewedpages-best'),
 1055+ 'stableid=best' );
 1056+
 1057+ return '<li>'.$link.' ('.$config.') ['.$best.'] </li>';
 1058+ }
 1059+}
 1060+
 1061+/**
 1062+ * Query to list out stable versions for a page
 1063+ */
 1064+class StablePagesPager extends AlphabeticPager {
 1065+ public $mForm, $mConds;
 1066+
 1067+ function __construct( $form, $conds = array() ) {
 1068+ $this->mForm = $form;
 1069+ $this->mConds = $conds;
 1070+
 1071+ parent::__construct();
 1072+ }
 1073+
 1074+ function formatRow( $row ) {
 1075+ return $this->mForm->formatRow( $row );
 1076+ }
 1077+
 1078+ function getQueryInfo() {
 1079+ $conds = $this->mConds;
 1080+ $conds[] = 'page_id = fpc_page_id';
 1081+ $conds['fpc_override'] = 1;
 1082+ return array(
 1083+ 'tables' => array('flaggedpage_config','page'),
 1084+ 'fields' => 'page_namespace,page_title,fpc_page_id',
 1085+ 'conds' => $conds,
 1086+ 'options' => array()
 1087+ );
 1088+ }
 1089+
 1090+ function getIndexField() {
 1091+ return 'fpc_page_id';
 1092+ }
 1093+}
 1094+
10161095 class Stabilization extends UnlistedSpecialPage
10171096 {
10181097

Status & tagging log