- search form is splitt in to regular database search and fulltext search

This commit is contained in:
steinm 2011-03-10 14:48:10 +00:00
parent c7d2c3a642
commit b94bed96e7

View File

@ -1,166 +1,246 @@
<?php <?php
// MyDMS. Document Management System // MyDMS. Document Management System
// Copyright (C) 2002-2005 Markus Westphal // Copyright (C) 2002-2005 Markus Westphal
// Copyright (C) 2006-2008 Malcolm Cowe // Copyright (C) 2006-2008 Malcolm Cowe
// Copyright (C) 2010 Matteo Lucarelli // Copyright (C) 2010 Matteo Lucarelli
// //
// This program is free software; you can redistribute it and/or modify // 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 // it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or // the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version. // (at your option) any later version.
// //
// This program is distributed in the hope that it will be useful, // This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of // but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details. // GNU General Public License for more details.
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software // along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
include("../inc/inc.Settings.php"); include("../inc/inc.Settings.php");
include("../inc/inc.Utils.php"); include("../inc/inc.Utils.php");
include("../inc/inc.DBInit.php"); include("../inc/inc.DBInit.php");
include("../inc/inc.Language.php"); include("../inc/inc.Language.php");
include("../inc/inc.ClassUI.php"); include("../inc/inc.ClassUI.php");
include("../inc/inc.Authentication.php"); include("../inc/inc.Authentication.php");
if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) { if (!isset($_GET["folderid"]) || !is_numeric($_GET["folderid"]) || intval($_GET["folderid"])<1) {
$folderid=$settings->_rootFolderID; $folderid=$settings->_rootFolderID;
$folder = $dms->getFolder($folderid); $folder = $dms->getFolder($folderid);
} }
else { else {
$folderid = $_GET["folderid"]; $folderid = $_GET["folderid"];
$folder = $dms->getFolder($folderid); $folder = $dms->getFolder($folderid);
} }
if (!is_object($folder)) { if (!is_object($folder)) {
UI::exitError(getMLText("search"),getMLText("invalid_folder_id")); UI::exitError(getMLText("search"),getMLText("invalid_folder_id"));
} }
$folderPathHTML = getFolderPathHTML($folder, true); $folderPathHTML = getFolderPathHTML($folder, true);
UI::htmlStartPage(getMLText("search")); UI::htmlStartPage(getMLText("search"));
UI::globalNavigation($folder); UI::globalNavigation($folder);
UI::pageNavigation($folderPathHTML, "", $folder); UI::pageNavigation($folderPathHTML, "", $folder);
?> ?>
<script language="JavaScript"> <script language="JavaScript">
function checkForm() function checkForm()
{ {
msg = ""; msg = "";
if (document.form1.query.value == "") if (document.form1.query.value == "")
{ {
if (!document.form1.creationdate.checked && !document.form1.lastupdate.checked && if (!document.form1.creationdate.checked && !document.form1.lastupdate.checked &&
!document.form1.pendingReview.checked && !document.form1.pendingApproval.checked) !document.form1.pendingReview.checked && !document.form1.pendingApproval.checked)
msg += "<?php printMLText("js_no_query");?>\n"; msg += "<?php printMLText("js_no_query");?>\n";
} }
if (msg != "") if (msg != "")
{ {
alert(msg); alert(msg);
return false; return false;
} }
else else
return true; return true;
} }
</script> </script>
<?php <?php
UI::contentHeading(getMLText("search")); UI::contentHeading(getMLText("search"));
UI::contentContainerStart(); UI::contentContainerStart();
?> ?>
<form action="../op/op.Search.php" name="form1" onsubmit="return checkForm();"> <div style="width: 35%; float: left;">
<table class="searchform"> <h2><?= getMLText('databasesearch') ?></h2>
<tr> <form action="../op/op.Search.php" name="form1" onsubmit="return checkForm();">
<td><?php printMLText("search_query");?>:</td> <table class="searchform">
<td> <tr>
<input name="query"> <td><?php printMLText("search_query");?>:</td>
<select name="mode"> <td>
<option value="1" selected><?php printMLText("search_mode_and");?><br> <input name="query">
<option value="0"><?php printMLText("search_mode_or");?> <select name="mode">
</select> <option value="1" selected><?php printMLText("search_mode_and");?><br>
</td> <option value="0"><?php printMLText("search_mode_or");?>
</select>
</td>
</tr> </tr>
<tr> <tr>
<td><?php printMLText("search_in");?>:</td> <td><?php printMLText("search_in");?>:</td>
<td><ul class="actions"> <td><ul class="actions">
<li class="first"><input type="Checkbox" id="keywords" name="searchin[]" value="1"><label for="keywords"><?php printMLText("keywords");?></label></li> <li class="first"><input type="Checkbox" id="keywords" name="searchin[]" value="1"><label for="keywords"><?php printMLText("keywords");?></label></li>
<li><input type="Checkbox" name="searchin[]" id="searchName" value="2"><label for="searchName"><?php printMLText("name");?></label></li> <li><input type="Checkbox" name="searchin[]" id="searchName" value="2"><label for="searchName"><?php printMLText("name");?></label></li>
<li><input type="Checkbox" name="searchin[]" id="comment" value="3"><label for="comment"><?php printMLText("comment");?></label></li> <li><input type="Checkbox" name="searchin[]" id="comment" value="3"><label for="comment"><?php printMLText("comment");?></label></li>
</ul> </ul>
</td> </td>
</tr> </tr>
<tr> <tr>
<td><?php printMLText("status");?>:</td> <td><?php printMLText("category");?>:</td>
<td> <td>
<ul class="actions"> <select name="categoryids[]" multiple>
<li class="first"><input type="checkbox" id="pendingReview" name="pendingReview" value="1"><label for='pendingReview'><?php printOverallStatusText(S_DRAFT_REV);?></label></li> <option value="-1"><?php printMLText("all_categories");?>
<li><input type="checkbox" id="pendingApproval" name="pendingApproval" value="1"><label for='pendingApproval'><?php printOverallStatusText(S_DRAFT_APP);?></label></li> <?php
<li><input type="checkbox" id="released" name="released" value="1"><label for='released'><?php printOverallStatusText(S_RELEASED);?></label></li> $allCats = $dms->getDocumentCategories();
<li><input type="checkbox" id="rejected" name="rejected" value="1"><label for='rejected'><?php printOverallStatusText(S_REJECTED);?></label></li> foreach ($allCats as $catObj) {
<li><input type="checkbox" id="obsolete" name="obsolete" value="1"><label for='obsolete'><?php printOverallStatusText(S_OBSOLETE);?></label></li> print "<option value=\"".$catObj->getID()."\">" . $catObj->getName() . "\n";
<li><input type="checkbox" id="expired" name="expired" value="1"><label for='expired'><?php printOverallStatusText(S_EXPIRED);?></label></li> }
</ul> ?>
</td> </select>
</tr> </td>
<tr> </tr>
<td><?php printMLText("owner");?>:</td> <tr>
<td> <td><?php printMLText("status");?>:</td>
<select name="ownerid"> <td>
<option value="-1"><?php printMLText("all_users");?> <ul class="actions">
<?php <li class="first"><input type="checkbox" id="pendingReview" name="pendingReview" value="1"><label for='pendingReview'><?php printOverallStatusText(S_DRAFT_REV);?></label></li>
$allUsers = getAllUsers(); <li><input type="checkbox" id="pendingApproval" name="pendingApproval" value="1"><label for='pendingApproval'><?php printOverallStatusText(S_DRAFT_APP);?></label></li>
foreach ($allUsers as $userObj) <li><input type="checkbox" id="released" name="released" value="1"><label for='released'><?php printOverallStatusText(S_RELEASED);?></label></li>
{ <li><input type="checkbox" id="rejected" name="rejected" value="1"><label for='rejected'><?php printOverallStatusText(S_REJECTED);?></label></li>
if ($userObj->isGuest()) <li><input type="checkbox" id="obsolete" name="obsolete" value="1"><label for='obsolete'><?php printOverallStatusText(S_OBSOLETE);?></label></li>
continue; <li><input type="checkbox" id="expired" name="expired" value="1"><label for='expired'><?php printOverallStatusText(S_EXPIRED);?></label></li>
print "<option value=\"".$userObj->getID()."\">" . $userObj->getFullName() . "\n"; </ul>
} </td>
?> </tr>
</select> <tr>
</td> <td><?php printMLText("owner");?>:</td>
</tr> <td>
<tr> <select name="ownerid">
<td><?php printMLText("under_folder")?>:</td> <option value="-1"><?php printMLText("all_users");?>
<td><?php UI::printFolderChooser("form1", M_READ, -1, $folder);?></td> <?php
</tr> $allUsers = $dms->getAllUsers();
<tr> foreach ($allUsers as $userObj)
<td><?php printMLText("creation_date");?>:</td> {
<td> if ($userObj->isGuest())
<input type="Checkbox" name="creationdate" value="true"> continue;
<?php print "<option value=\"".$userObj->getID()."\">" . $userObj->getFullName() . "\n";
printMLText("between"); }
print "&nbsp;&nbsp;"; ?>
UI::printDateChooser(-1, "createstart"); </select>
print "&nbsp;&nbsp;"; </td>
printMLText("and"); </tr>
print "&nbsp;&nbsp;"; <tr>
UI::printDateChooser(-1, "createend"); <td><?php printMLText("under_folder")?>:</td>
?> <td><?php UI::printFolderChooser("form1", M_READ, -1, $folder);?></td>
</td> </tr>
</tr> <tr>
<?php <td><?php printMLText("creation_date");?>:</td>
/* <td>
echo "<tr>\n<td>".getMLText("last_update").":</td>\n"; <input type="Checkbox" name="creationdate" value="true">
echo "<td><input type=\"Checkbox\" name=\"lastupdate\" value=\"true\">"; <?php
printMLText("between"); printMLText("between");
print "&nbsp;&nbsp;"; print "&nbsp;&nbsp;";
UI::printDateChooser(-1, "updatestart"); UI::printDateChooser(-1, "createstart");
print "&nbsp;&nbsp;"; print "&nbsp;&nbsp;";
printMLText("and"); printMLText("and");
print "&nbsp;&nbsp;"; print "&nbsp;&nbsp;";
UI::printDateChooser(-1, "updateend"); UI::printDateChooser(-1, "createend");
echo "</td>\n</tr>\n"; ?>
*/ </td>
?> </tr>
<tr> <?php
<td colspan="2"><input type="Submit" value="<?php printMLText("search"); ?>"></td> /*
</tr> echo "<tr>\n<td>".getMLText("last_update").":</td>\n";
echo "<td><input type=\"Checkbox\" name=\"lastupdate\" value=\"true\">";
</table> printMLText("between");
print "&nbsp;&nbsp;";
</form> UI::printDateChooser(-1, "updatestart");
print "&nbsp;&nbsp;";
<?php printMLText("and");
UI::contentContainerEnd(); print "&nbsp;&nbsp;";
UI::htmlEndPage(); UI::printDateChooser(-1, "updateend");
?> echo "</td>\n</tr>\n";
*/
?>
<tr>
<td colspan="2"><input type="Submit" value="<?php printMLText("search"); ?>"></td>
</tr>
</table>
</form>
</div>
<?php
if($settings->_enableFullSearch) {
?>
<div style="width: 35%; float: left; margin-left: 20px;">
<form action="../op/op.SearchFulltext.php" name="form2" onsubmit="return checkForm();">
<table class="searchform">
<h2><?= getMLText('fullsearch') ?></h2>
<tr>
<td><?php printMLText("search_query");?>:</td>
<td>
<input name="query">
<!--
<select name="mode">
<option value="1" selected><?php printMLText("search_mode_and");?><br>
<option value="0"><?php printMLText("search_mode_or");?>
</select>
-->
</td>
</tr>
<tr>
<td><?php printMLText("category_filter");?>:</td>
<td>
<select name="categoryids[]" multiple>
<!--
<option value="-1"><?php printMLText("all_categories");?>
-->
<?php
$allCats = $dms->getDocumentCategories();
foreach ($allCats as $catObj) {
print "<option value=\"".$catObj->getID()."\">" . $catObj->getName() . "\n";
}
?>
</select>
</td>
</tr>
<tr>
<td><?php printMLText("owner");?>:</td>
<td>
<select name="ownerid">
<option value="-1"><?php printMLText("all_users");?>
<?php
$allUsers = $dms->getAllUsers();
foreach ($allUsers as $userObj)
{
if ($userObj->isGuest())
continue;
print "<option value=\"".$userObj->getID()."\">" . $userObj->getFullName() . "\n";
}
?>
</select>
</td>
</tr>
<tr>
<td colspan="2"><input type="Submit" value="<?php printMLText("search"); ?>"></td>
</tr>
</table>
</form>
</div>
<div style="clear: both"></div>
<?php
}
?>
<?php
UI::contentContainerEnd();
UI::htmlEndPage();
?>