From 899967e703bcb5006148ba18d107a6f8193d0d4e Mon Sep 17 00:00:00 2001 From: Raimond Spekking Date: Wed, 21 Feb 2007 10:42:04 +0000 Subject: [PATCH] * (bug 8919) Suppress paging links and related messages where there are no rows to list for query pages Based on patch by Sui Min --- RELEASE-NOTES | 2 ++ includes/QueryPage.php | 7 +++++++ includes/SpecialIpblocklist.php | 8 ++++---- includes/SpecialProtectedpages.php | 6 +++--- includes/SpecialSearch.php | 12 +++++++----- languages/messages/MessagesDe.php | 7 ++++--- languages/messages/MessagesEn.php | 2 +- maintenance/language/messages.inc | 1 + 8 files changed, 29 insertions(+), 16 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index 24399bace7..52cd439433 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -220,6 +220,8 @@ lighter making things easier to read. * (bug 9044) Send a comment with action=raw pages in CSS/JS output mode to work around IE/Mac bug where empty pages time out verrrrryyyyy slowly, particularly with new keepalive-friendly HTTP on Wikipedia +* (bug 8919) Suppress paging links and related messages where there are no + rows to list for query pages == Languages updated == diff --git a/includes/QueryPage.php b/includes/QueryPage.php index fd91f9e61a..42e8a6b5b4 100644 --- a/includes/QueryPage.php +++ b/includes/QueryPage.php @@ -332,6 +332,13 @@ class QueryPage { if($shownavigation) { $wgOut->addHTML( $this->getPageHeader() ); + + # if list is empty, show it + if( $num == 0 ) { + $wgOut->addHTML( '

' . wfMsgHTML('specialpage-empty') . '

' ); + return; + } + $top = wfShowingResults( $offset, $num); $wgOut->addHTML( "

{$top}\n" ); diff --git a/includes/SpecialIpblocklist.php b/includes/SpecialIpblocklist.php index f65fe5af12..8fc74fe416 100644 --- a/includes/SpecialIpblocklist.php +++ b/includes/SpecialIpblocklist.php @@ -198,16 +198,16 @@ class IPUnblockForm { } $pager = new IPBlocklistPager( $this, $conds ); - $s = $pager->getNavigationBar() . - $this->searchForm(); if ( $pager->getNumRows() ) { + $s = $this->searchForm() . + $pager->getNavigationBar(); $s .= "

"; + $s .= $pager->getNavigationBar(); } else { - $s .= '

' . wfMsgHTML( 'ipblocklistempty' ) . '

'; + $s = '

' . wfMsgHTML( 'ipblocklistempty' ) . '

'; } - $s .= $pager->getNavigationBar(); $wgOut->addHTML( $s ); } diff --git a/includes/SpecialProtectedpages.php b/includes/SpecialProtectedpages.php index 8c2c20f2f4..a50096f9d7 100644 --- a/includes/SpecialProtectedpages.php +++ b/includes/SpecialProtectedpages.php @@ -23,16 +23,16 @@ class ProtectedPagesForm { } $pager = new ProtectedPagesPager( $this ); - $s = $pager->getNavigationBar(); if ( $pager->getNumRows() ) { + $s = $pager->getNavigationBar(); $s .= ""; + $s .= $pager->getNavigationBar(); } else { - $s .= '

' . wfMsgHTML( 'protectedpagesempty' ) . '

'; + $s = '

' . wfMsgHTML( 'protectedpagesempty' ) . '

'; } - $s .= $pager->getNavigationBar(); $wgOut->addHTML( $s ); } diff --git a/includes/SpecialSearch.php b/includes/SpecialSearch.php index b58f91d030..e96c875351 100644 --- a/includes/SpecialSearch.php +++ b/includes/SpecialSearch.php @@ -159,12 +159,14 @@ class SpecialSearch { $num = ( $titleMatches ? $titleMatches->numRows() : 0 ) + ( $textMatches ? $textMatches->numRows() : 0); - if ( $num >= $this->limit ) { - $top = wfShowingResults( $this->offset, $this->limit ); - } else { - $top = wfShowingResultsNum( $this->offset, $this->limit, $num ); + if ( $num > 0 ) { + if ( $num >= $this->limit ) { + $top = wfShowingResults( $this->offset, $this->limit ); + } else { + $top = wfShowingResultsNum( $this->offset, $this->limit, $num ); + } + $wgOut->addHTML( "

{$top}

\n" ); } - $wgOut->addHTML( "

{$top}

\n" ); if( $num || $this->offset ) { $prevnext = wfViewPrevNext( $this->offset, $this->limit, diff --git a/languages/messages/MessagesDe.php b/languages/messages/MessagesDe.php index 1894d12d81..06dbf98226 100644 --- a/languages/messages/MessagesDe.php +++ b/languages/messages/MessagesDe.php @@ -1080,10 +1080,11 @@ Davon haben '''$2''' (=$4%) $5-Rechte.", # Miscellaneous special pages 'nbytes' => '$1 {{PLURAL:$1|Byte|Bytes}}', 'ncategories' => '$1 {{PLURAL:$1|Kategorie|Kategorien}}', -'nlinks' => '{{PLURAL:$1|ein Verweis|$1 Verweise}}', +'nlinks' => '{{PLURAL:$1|1 Verweis|$1 Verweise}}', 'nmembers' => '– {{PLURAL:$1|1 Eintrag|$1 Einträge}}', -'nrevisions' => '{{PLURAL:$1|eine Bearbeitung|$1 Bearbeitungen}}', -'nviews' => '{{PLURAL:$1|eine Abfrage|$1 Abfragen}}', +'nrevisions' => '{{PLURAL:$1|1 Bearbeitung|$1 Bearbeitungen}}', +'nviews' => '{{PLURAL:$1|1 Abfrage|$1 Abfragen}}', +'specialpage-empty' => 'Die Seite enthält aktuell keine Einträge.', 'lonelypages' => 'Verwaiste Seiten', 'lonelypages-summary' => 'Diese Spezialseite zeigt Seiten, auf die von keiner anderen Seite verlinkt wird. Diese verwaisten Seiten sind deshalb nicht erwünscht, oder eventuell fragwürdig, weil sie über die normale Navigation durch {{SITENAME}} nie aufgerufen werden können. ', 'lonelypagestext' => '', diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index e4bfeae582..28724b5f19 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -1484,7 +1484,7 @@ The [http://meta.wikimedia.org/wiki/Help:Job_queue job queue] length is '''$7''' 'nmembers' => '$1 {{PLURAL:$1|member|members}}', 'nrevisions' => '$1 {{PLURAL:$1|revision|revisions}}', 'nviews' => '$1 {{PLURAL:$1|view|views}}', - +'specialpage-empty' => 'This page is empty.', 'lonelypages' => 'Orphaned pages', 'lonelypages-summary' => '', 'lonelypagestext' => 'The following pages are not linked from other pages in this wiki.', diff --git a/maintenance/language/messages.inc b/maintenance/language/messages.inc index ff7644297f..a0b922443d 100644 --- a/maintenance/language/messages.inc +++ b/maintenance/language/messages.inc @@ -879,6 +879,7 @@ $wgMessageStructure = array( 'nmembers', 'nrevisions', 'nviews', + 'specialpage-empty', 'lonelypages', 'lonelypages-summary', 'lonelypagestext', -- 2.20.1