r46470 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r46469‎ | r46470 | r46471 >
Date:19:45, 28 January 2009
Author:aaron
Status:deferred
Tags:
Comment:
(bug 17206) Add 'all' to namespace selector
Modified paths:
  • /trunk/extensions/FlaggedRevs/FlaggedRevsXML.php (modified) (history)
  • /trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/FlaggedRevs/specialpages/OldReviewedPages_body.php
@@ -55,7 +55,7 @@
5656 );
5757 # Display dropdown as needed
5858 if( count($wgFlaggedRevsNamespaces) > 1 ) {
59 - $wgOut->addHTML( FlaggedRevsXML::getNamespaceMenu( $this->namespace ) . ' ' );
 59+ $wgOut->addHTML( FlaggedRevsXML::getNamespaceMenu( $this->namespace, '' ) . ' ' );
6060 }
6161 $wgOut->addHTML(
6262 Xml::label( wfMsg("oldreviewed-category"), 'wpCategory' ) . ' ' .
@@ -258,8 +258,8 @@
259259 if( !is_null($namespace) ) {
260260 $namespace = intval($namespace);
261261 }
262 - if( is_null($namespace) || !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
263 - $namespace = empty($wgFlaggedRevsNamespaces) ? -1 : $wgFlaggedRevsNamespaces[0];
 262+ if( !in_array($namespace,$wgFlaggedRevsNamespaces) ) {
 263+ $namespace = '';
264264 }
265265 $this->namespace = $namespace;
266266 $this->category = $category ? str_replace(' ','_',$category) : NULL;
@@ -290,7 +290,9 @@
291291 $conds[] = 'rev_page = fp_page_id AND rev_id = fp_stable';
292292 $conds[] = 'fp_pending_since IS NOT NULL';
293293 # Filter namespace
294 - $conds['page_namespace'] = $this->namespace;
 294+ if( $this->namespace !== NULL ) {
 295+ $conds['page_namespace'] = $this->namespace;
 296+ }
295297 $useIndex = array('flaggedpages' => 'fp_pending_since','page' => 'PRIMARY');
296298 # Filter by category
297299 if( $this->category ) {
Index: trunk/extensions/FlaggedRevs/FlaggedRevsXML.php
@@ -4,8 +4,10 @@
55 /**
66 * Get a selector of reviewable namespaces
77 * @param int $selected, namespace selected
 8+ * @param $all Mixed: Value of an item denoting all namespaces, or null to omit
 9+ * @returns string
810 */
9 - public static function getNamespaceMenu( $selected=null ) {
 11+ public static function getNamespaceMenu( $selected=null, $all=null ) {
1012 global $wgContLang, $wgFlaggedRevsNamespaces;
1113 wfLoadExtensionMessages( 'FlaggedRevs' );
1214 $s = "<label for='namespace'>" . wfMsgHtml('namespace') . "</label>";
@@ -20,9 +22,12 @@
2123 }
2224 $s .= "\n<select id='namespace' name='namespace' class='namespaceselector'>\n";
2325 $arr = $wgContLang->getFormattedNamespaces();
 26+ if( !is_null($all) ) {
 27+ $arr = array( $all => wfMsg( 'namespacesall' ) ) + $arr; // should be first
 28+ }
2429 foreach( $arr as $index => $name ) {
25 - # Content only
26 - if($index < NS_MAIN || !in_array($index, $wgFlaggedRevsNamespaces) ) {
 30+ # Content pages only (except 'all')
 31+ if( $index !== $all && !in_array($index, $wgFlaggedRevsNamespaces) ) {
2732 continue;
2833 }
2934 $name = $index !== 0 ? $name : wfMsg('blanknamespace');

Status & tagging log