mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-11 12:11:19 +00:00
start to add suggesestion to opensearchengіne (not working yet)
This commit is contained in:
parent
44daf8cc10
commit
98c1220260
|
@ -44,7 +44,10 @@ class SeedDMS_View_OpensearchDesc extends SeedDMS_Bootstrap_Style {
|
|||
<Description><?= $sitename ?></Description>
|
||||
<Image height="16" width="16" type="image/x-icon"><?= "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot ?>styles/<?= $this->theme ?>/favicon.ico</Image>
|
||||
<Url type="text/html" method="get" template="<?= "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.Search.php?query={searchTerms}" ?>" />
|
||||
<Url type="application/x-suggestions+xml" rel="suggestions" method="get" template="<?= "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.Search.php?action=opensearchsuggestion&query={searchTerms}" ?>" />
|
||||
<moz:SearchForm><?= "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.Search.php" ?></moz:SearchForm>
|
||||
<OutputEncoding>UTF-8</OutputEncoding>
|
||||
<InputEncoding>UTF-8</InputEncoding>
|
||||
</OpenSearchDescription>
|
||||
<?php
|
||||
} /* }}} */
|
||||
|
|
|
@ -65,7 +65,37 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
|
|||
$this->printClickFolderJs();
|
||||
} /* }}} */
|
||||
|
||||
function typeahead() { /* {{{ */
|
||||
function opensearchsuggestion() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$query = $this->params['query'];
|
||||
$entries = $this->params['searchhits'];
|
||||
$recs = array();
|
||||
$content = "<?xml version=\"1.0\"?>\n";
|
||||
$content .= "<SearchSuggestion version=\"2.0\" xmlns=\"http://opensearch.org/searchsuggest2\">\n";
|
||||
$content .= "<Query xml:space=\"preserve\">".$query."</Query>";
|
||||
if($entries) {
|
||||
$content .= "<Section>\n";
|
||||
foreach ($entries as $entry) {
|
||||
$content .= "<Item>\n";
|
||||
if($entry->isType('document')) {
|
||||
$content .= "<Text xml:space=\"preserve\">".$entry->getName()."</Text>\n";
|
||||
$content .= "<Url xml:space=\"preserve\">http:".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$entry->getId()."</Url>\n";
|
||||
} elseif($entry->isType('folder')) {
|
||||
$content .= "<Text xml:space=\"preserve\">".$entry->getName()."</Text>\n";
|
||||
$content .= "<Url xml:space=\"preserve\">http:".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$entry->getId()."</Url>\n";
|
||||
}
|
||||
$content .= "</Item>\n";
|
||||
}
|
||||
$content .= "</Section>\n";
|
||||
}
|
||||
$content .= "</SearchSuggestion>";
|
||||
header("Content-Disposition: attachment; filename=\"search.xml\"; filename*=UTF-8''search.xml");
|
||||
header('Content-Type: application/x-suggestions+xml');
|
||||
echo $content;
|
||||
} /* }}} */
|
||||
|
||||
function typeahead() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
$query = $this->params['query'];
|
||||
|
|
Loading…
Reference in New Issue
Block a user