From 98c12202603efde60b0f21701c6cd12849c3e54f Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Mon, 14 Dec 2020 07:08:48 +0100 Subject: [PATCH] =?UTF-8?q?start=20to=20add=20suggesestion=20to=20opensear?= =?UTF-8?q?cheng=D1=96ne=20(not=20working=20yet)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- views/bootstrap/class.OpensearchDesc.php | 3 +++ views/bootstrap/class.Search.php | 32 +++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/views/bootstrap/class.OpensearchDesc.php b/views/bootstrap/class.OpensearchDesc.php index 924733585..edb27b7c7 100644 --- a/views/bootstrap/class.OpensearchDesc.php +++ b/views/bootstrap/class.OpensearchDesc.php @@ -44,7 +44,10 @@ class SeedDMS_View_OpensearchDesc extends SeedDMS_Bootstrap_Style { _httpRoot ?>styles/theme ?>/favicon.ico _httpRoot."out/out.Search.php?query={searchTerms}" ?>" /> + _httpRoot."out/out.Search.php?action=opensearchsuggestion&query={searchTerms}" ?>" /> _httpRoot."out/out.Search.php" ?> + UTF-8 + UTF-8 printClickFolderJs(); } /* }}} */ - function typeahead() { /* {{{ */ + function opensearchsuggestion() { /* {{{ */ + $dms = $this->params['dms']; + $user = $this->params['user']; + $query = $this->params['query']; + $entries = $this->params['searchhits']; + $recs = array(); + $content = "\n"; + $content .= "\n"; + $content .= "".$query.""; + if($entries) { + $content .= "
\n"; + foreach ($entries as $entry) { + $content .= "\n"; + if($entry->isType('document')) { + $content .= "".$entry->getName()."\n"; + $content .= "http:".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewDocument.php?documentid=".$entry->getId()."\n"; + } elseif($entry->isType('folder')) { + $content .= "".$entry->getName()."\n"; + $content .= "http:".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$entry->getId()."\n"; + } + $content .= "\n"; + } + $content .= "
\n"; + } + $content .= "
"; + 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'];