From 67fd771a0030322741e2fa1c6ac75f242ac1f262 Mon Sep 17 00:00:00 2001 From: Brion Vibber Date: Thu, 17 Sep 2009 17:23:26 +0000 Subject: [PATCH] Fix for r55592: show the direct-page link/create link on search *above* actual results but *below* "no results" notice. --- includes/specials/SpecialSearch.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/includes/specials/SpecialSearch.php b/includes/specials/SpecialSearch.php index 9e7d7e4800..7f26b5beb6 100644 --- a/includes/specials/SpecialSearch.php +++ b/includes/specials/SpecialSearch.php @@ -261,6 +261,8 @@ class SpecialSearch { // prev/next links if( $num || $this->offset ) { + // Show the create link ahead + $this->showCreateLink( $t ); $prevnext = wfViewPrevNext( $this->offset, $this->limit, SpecialPage::getTitleFor( 'Search' ), wfArrayToCGI( $this->powerSearchOptions(), array( 'search' => $term ) ), @@ -301,8 +303,22 @@ class SpecialSearch { } if( $num === 0 ) { $wgOut->addWikiMsg( 'search-nonefound', wfEscapeWikiText( $term ) ); + $this->showCreateLink( $t ); + } + $wgOut->addHtml( "" ); + if( $num === 0 ) { + $wgOut->addHTML( $this->searchFocus() ); } + if( $num || $this->offset ) { + $wgOut->addHTML( "

{$prevnext}

\n" ); + } + wfProfileOut( __METHOD__ ); + } + + protected function showCreateLink( $t ) { + global $wgOut; + // show direct page/create link if( !is_null($t) ) { if( !$t->exists() ) { @@ -314,15 +330,6 @@ class SpecialSearch { // preserve the paragraph for margins etc... $wgOut->addHTML('

'); } - $wgOut->addHtml( "" ); - if( $num === 0 ) { - $wgOut->addHTML( $this->searchFocus() ); - } - - if( $num || $this->offset ) { - $wgOut->addHTML( "

{$prevnext}

\n" ); - } - wfProfileOut( __METHOD__ ); } /** -- 2.20.1