add open search description

This commit is contained in:
Uwe Steinmann 2018-07-13 15:25:33 +02:00
parent d4392c8e59
commit 84e87715da
3 changed files with 92 additions and 1 deletions

View File

@ -0,0 +1,37 @@
<?php
// MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010-2016 Uwe Steinmann
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Settings.php");
include("../inc/inc.LogInit.php");
include("../inc/inc.Utils.php");
include("../inc/inc.Language.php");
include("../inc/inc.Init.php");
include("../inc/inc.Extension.php");
include("../inc/inc.DBInit.php");
include("../inc/inc.ClassUI.php");
include("../inc/inc.ClassAccessOperation.php");
include("../inc/inc.Authentication.php");
$tmp = explode('.', basename($_SERVER['SCRIPT_FILENAME']));
$view = UI::factory($theme, $tmp[1], array('dms'=>$dms, 'user'=>$user));
if($view) {
$view($_GET);
exit;
}

View File

@ -79,6 +79,8 @@ class SeedDMS_Bootstrap_Style extends SeedDMS_View_Common {
echo '<base href="'.$base.'">'."\n";
elseif($this->baseurl)
echo '<base href="'.$this->baseurl.'">'."\n";
if($this->params['session'])
echo '<link rel="search" type="application/opensearchdescription+xml" href="../out/out.OpensearchDesc.php" title="'.(strlen($sitename)>0 ? $sitename : "SeedDMS").'"/>'."\n";
echo '<link href="../styles/'.$this->theme.'/bootstrap/css/bootstrap.css" rel="stylesheet">'."\n";
echo '<link href="../styles/'.$this->theme.'/bootstrap/css/bootstrap-responsive.css" rel="stylesheet">'."\n";
echo '<link href="../styles/'.$this->theme.'/font-awesome/css/font-awesome.css" rel="stylesheet">'."\n";
@ -365,7 +367,7 @@ background-image: linear-gradient(to bottom, #882222, #111111);;
echo " <input type=\"hidden\" name=\"folderid\" value=\"".$folder->getID()."\" />";
}
echo " <input type=\"hidden\" name=\"navBar\" value=\"1\" />";
echo " <input name=\"query\" class=\"search-query\" ".($this->params['defaultsearchmethod'] == 'fulltext' ? "" : "id=\"searchfield\"")." data-provide=\"typeahead\" type=\"text\" style=\"width: 150px;\" placeholder=\"".getMLText("search")."\"/>";
echo " <input name=\"query\" class=\"search-query\" ".($this->params['defaultsearchmethod'] == 'fulltext' ? "" : "id=\"searchfield\"")." data-provide=\"typeahead\" type=\"search\" style=\"width: 150px;\" placeholder=\"".getMLText("search")."\"/>";
if($this->params['defaultsearchmethod'] == 'fulltext')
echo " <input type=\"hidden\" name=\"fullsearch\" value=\"1\" />";
// if($this->params['enablefullsearch']) {

View File

@ -0,0 +1,52 @@
<?php
/**
* Implementation of OpensearchDesc view
*
* @category DMS
* @package SeedDMS
* @license GPL 2
* @version @version@
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2002-2005 Markus Westphal,
* 2006-2008 Malcolm Cowe, 2010 Matteo Lucarelli,
* 2010-2012 Uwe Steinmann
* @version Release: @package_version@
*/
/**
* Include parent class
*/
require_once("class.Bootstrap.php");
/**
* Class which outputs the html page for OpensearchDesc view
*
* @category DMS
* @package SeedDMS
* @author Uwe Steinmann <uwe@steinmann.cx>
* @copyright Copyright (C) 2010-2018 Uwe Steinmann
* @version Release: @package_version@
*/
class SeedDMS_View_OpensearchDesc extends SeedDMS_Bootstrap_Style {
function show() { /* {{{ */
$dms = $this->params['dms'];
$sitename = $this->params['sitename'];
$settings = $this->params['settings'];
ob_get_clean();
header("Content-Disposition: attachment; filename=\"opensearch_desc.xml\"");
header('Content-Type: application/opensearchdescription+xml');
?>
<?xml version="1.0" encoding="UTF-8"?>
<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/" xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName><?= $sitename ?></ShortName>
<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}" ?>" />
<moz:SearchForm><?= "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.Search.php" ?></moz:SearchForm>
</OpenSearchDescription>
<?php
} /* }}} */
}