From a37f439491a51ad0a9de52e6cdb77f115c82289c Mon Sep 17 00:00:00 2001 From: =?utf8?q?=C3=86var=20Arnfj=C3=B6r=C3=B0=20Bjarmason?= Date: Sun, 16 Oct 2005 02:03:21 +0000 Subject: [PATCH] * Support plain list output * Minor code cleanup --- includes/QueryPage.php | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-) diff --git a/includes/QueryPage.php b/includes/QueryPage.php index 3b34359057..54a32b9d6b 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -47,6 +47,21 @@ if( !$wgDisableCounters ) { * @package MediaWiki */ class QueryPage { + /** + * Whether or not we want plain listoutput rather than an ordered list + * + * @var bool + */ + var $listoutput = false; + + /** + * A mutator for $this->listoutput; + * + * @param bool $bool + */ + function setListoutput( $bool ) { + $this->listoutput = $bool; + } /** * Subclasses return their name here. Make sure the name is also @@ -266,7 +281,7 @@ class QueryPage { $wgOut->addHTML( "

{$top}\n" ); # often disable 'next' link when we reach the end - if($num < $limit) { $atend = true; } else { $atend = false; } + $atend = $num < $limit; $sl = wfViewPrevNext( $offset, $limit , $wgContLang->specialPage( $sname ), @@ -274,7 +289,9 @@ class QueryPage { $wgOut->addHTML( "
{$sl}

\n" ); } if ( $num > 0 ) { - $s = "
    "; + $s = array(); + if ( ! $this->listoutput ) + $s[] = "
      "; # Only read at most $num rows, because $res may contain the whole 1000 for ( $i = 0; $i < $num && $obj = $dbr->fetchObject( $res ); $i++ ) { @@ -282,7 +299,7 @@ class QueryPage { if ( $format ) { $attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol && $obj->patrolled == 0 ) ? ' class="not-patrolled"' : ''; - $s .= "{$format}\n"; + $s[] = $this->listoutput ? $format : "{$format}\n"; } } @@ -293,13 +310,15 @@ class QueryPage { if( $format ) { $attr = ( isset ( $obj->usepatrol ) && $obj->usepatrol && $obj->patrolled == 0 ) ? ' class="not-patrolled"' : ''; - $s .= "{$format}\n"; + $s[] = "{$format}\n"; } } $dbr->freeResult( $res ); - $s .= '
    '; - $wgOut->addHTML( $s ); + if ( ! $this->listoutput ) + $s[] = '
'; + $str = $this->listoutput ? $wgContLang->listToText( $s ) : implode( '', $s ); + $wgOut->addHTML( $str ); } if($shownavigation) { $wgOut->addHTML( "

{$sl}

\n" ); -- 2.20.1