diff --git a/inc/Ui/Search.php b/inc/Ui/Search.php index 6f6d324c01693241fcbefcdca794d9ec4257fcdb..917d28d52e0efd34ebf28fb697d0e99a6ae9cdc2 100644 --- a/inc/Ui/Search.php +++ b/inc/Ui/Search.php @@ -43,10 +43,10 @@ class Search extends Ui { $searchHTML = ''; - $searchHTML .= $this->getSearchFormHTML($this->query); - $searchHTML .= $this->getSearchIntroHTML($this->query); + $searchHTML .= $this->getSearchFormHTML($this->query); + $searchHTML .= $this->getPageLookupHTML($this->pageLookupResults); $searchHTML .= $this->getFulltextResultsHTML($this->fullTextResults, $this->highlight); @@ -460,19 +460,43 @@ class Search extends Ui */ protected function getSearchIntroHTML($query) { - global $ID, $lang; + global $lang; $intro = p_locale_xhtml('searchpage'); - // allow use of placeholder in search intro - $pagecreateinfo = (auth_quickaclcheck($ID) >= AUTH_CREATE) ? $lang['searchcreatepage'] : ''; + + $queryPagename = $this->createPagenameFromQuery($this->parsedQuery); + $createQueryPageLink = html_wikilink($queryPagename . '?do=edit', $queryPagename); + + $pagecreateinfo = ''; + if (auth_quickaclcheck($queryPagename) >= AUTH_CREATE) { + $pagecreateinfo = sprintf($lang['searchcreatepage'], $createQueryPageLink); + } $intro = str_replace( array('@QUERY@', '@SEARCH@', '@CREATEPAGEINFO@'), array(hsc(rawurlencode($query)), hsc($query), $pagecreateinfo), $intro ); + return $intro; } + /** + * Create a pagename based the parsed search query + * + * @param array $parsedQuery + * + * @return string pagename constructed from the parsed query + */ + protected function createPagenameFromQuery($parsedQuery) + { + $pagename = ''; + if (!empty($parsedQuery['ns'])) { + $pagename .= cleanID($parsedQuery['ns'][0]); + } + $pagename .= ':' . cleanID(implode(' ' , $parsedQuery['highlight'])); + return $pagename; + } + /** * Build HTML for a list of pages with matching pagenames * @@ -524,7 +548,9 @@ class Search extends Ui return '<div class="nothing">' . $lang['nothingfound'] . '</div>'; } - $html = ''; + $html = '<div class="search_fulltextresult">'; + $html .= '<h3>' . $lang['search_fullresults'] . ':</h3>'; + $html .= '<dl class="search_results">'; $num = 1; @@ -571,6 +597,8 @@ class Search extends Ui } $html .= '</dl>'; + $html .= '</div>'; + return $html; } diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php index c2c4eb8e517b873c6299756064df0bbd3797e6e6..1cb5733c5ba867645849f2c8673ea94ce40c1f14 100644 --- a/inc/lang/en/lang.php +++ b/inc/lang/en/lang.php @@ -69,8 +69,9 @@ $lang['badpassconfirm'] = 'Sorry, the password was wrong'; $lang['minoredit'] = 'Minor Changes'; $lang['draftdate'] = 'Draft autosaved on'; // full dformat date will be added $lang['nosecedit'] = 'The page was changed in the meantime, section info was out of date loaded full page instead.'; -$lang['searchcreatepage'] = 'If you didn\'t find what you were looking for, you can create or edit the page named after your query with the appropriate tool.'; +$lang['searchcreatepage'] = 'If you didn\'t find what you were looking for, you can create or edit the page %s, named after your query, with the appropriate tool.'; +$lang['search_fullresults'] = 'Fulltext results'; $lang['search_exact_match'] = 'Exact match'; $lang['search_starts_with'] = 'Starts with'; $lang['search_ends_with'] = 'Ends with'; diff --git a/inc/lang/en/searchpage.txt b/inc/lang/en/searchpage.txt index ba0960aa682bcc3e5e6a87a7aecba5f913fc0c77..59cbec251994c0adaea1a965efd1dd35b46f1710 100644 --- a/inc/lang/en/searchpage.txt +++ b/inc/lang/en/searchpage.txt @@ -2,4 +2,3 @@ You can find the results of your search below. @CREATEPAGEINFO@ -===== Results =====