use attribute def. groups

show only selected attributes in search list and search form
This commit is contained in:
Uwe Steinmann 2016-08-05 17:47:30 +02:00
parent c0d149e9dc
commit 0066c58e9c

View File

@ -109,11 +109,15 @@ $(document).ready( function() {
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
$showtree = $this->params['showtree'];
$enableRecursiveCount = $this->params['enableRecursiveCount'];
$maxRecursiveCount = $this->params['maxRecursiveCount'];
$fullsearch = $this->params['fullsearch'];
$totaldocs = $this->params['totaldocs'];
$totalfolders = $this->params['totalfolders'];
$limit = $this->params['limit'];
$attrdefs = $this->params['attrdefs'];
$attrdefgrps = $this->params['attrdefgrps'];
$allCats = $this->params['allcategories'];
$allUsers = $this->params['allusers'];
$mode = $this->params['mode'];
@ -182,10 +186,13 @@ $(document).ready( function() {
?>
</ul>
<div class="tab-content">
<?php
// Database search Form {{{
?>
<div class="tab-pane <?php echo ($fullsearch == false) ? 'active' : ''; ?>" id="database">
<form action="../out/out.Search.php" name="form1">
<?php
// Database search Form {{{
// General search options {{{
$this->contentContainerStart();
?>
<table class="table-condensed">
@ -256,7 +263,33 @@ $(document).ready( function() {
</tr>
<?php
if($attrdefs) {
if($attrdefgrps) {
$attrdefids = array();
foreach($attrdefgrps as $attrdefgrp) {
if($attrdefs = $attrdefgrp->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_all), SeedDMS_Core_AttributeDefinitionGroup::show_search)) {
echo "<tr><td colspan=\"2\"><b>".htmlspecialchars($attrdefgrp->getName())."</b></td></tr>";
foreach($attrdefs as $attrdefarr) {
$attrdef = $attrdefarr['attrdef'];
if(!in_array($attrdef->getID(), $attrdefids)) {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<td><?php $this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '') ?></td>
</tr>
<?php
$attrdefids[] = $attrdef->getID();
} else {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
<td><?php echo isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : ''; ?></td>
</tr>
<?php
}
}
}
}
} elseif($attrdefs) {
foreach($attrdefs as $attrdef) {
$attricon = '';
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_all) {
@ -279,9 +312,9 @@ $(document).ready( function() {
</table>
<?php
$this->contentContainerEnd();
// }}}
?>
<?php
// }}}
// Seach options for documents {{{
/* First check if any of the folder filters are set. If it is,
* open the accordion.
*/
@ -399,7 +432,33 @@ $(document).ready( function() {
</td>
</tr>
<?php
if($attrdefs) {
if($attrdefgrps) {
$attrdefids = array();
foreach($attrdefgrps as $attrdefgrp) {
if($attrdefs = $attrdefgrp->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_document, SeedDMS_Core_AttributeDefinition::objtype_documentcontent), SeedDMS_Core_AttributeDefinitionGroup::show_search)) {
echo "<tr><td colspan=\"2\"><b>".htmlspecialchars($attrdefgrp->getName())."</b></td></tr>";
foreach($attrdefs as $attrdefarr) {
$attrdef = $attrdefarr['attrdef'];
if(!in_array($attrdef->getID(), $attrdefids)) {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<td><?php $this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '') ?></td>
</tr>
<?php
$attrdefids[] = $attrdef->getID();
} else {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
<td><?php echo isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : ''; ?></td>
</tr>
<?php
}
}
}
}
} elseif($attrdefs) {
foreach($attrdefs as $attrdef) {
$attricon = '';
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_document || $attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_documentcontent) {
@ -420,6 +479,9 @@ $(document).ready( function() {
</div>
</div>
<?php
// }}}
// Seach options for folders {{{
/* First check if any of the folder filters are set. If it is,
* open the accordion.
*/
@ -445,7 +507,33 @@ $(document).ready( function() {
<div class="accordion-inner">
<table class="table-condensed">
<?php
if($attrdefs) {
if($attrdefgrps) {
$attrdefids = array();
foreach($attrdefgrps as $attrdefgrp) {
if($attrdefs = $attrdefgrp->getAttributeDefinitions(array(SeedDMS_Core_AttributeDefinition::objtype_folder), SeedDMS_Core_AttributeDefinitionGroup::show_search)) {
echo "<tr><td colspan=\"2\"><b>".htmlspecialchars($attrdefgrp->getName())."</b></td></tr>";
foreach($attrdefs as $attrdefarr) {
$attrdef = $attrdefarr['attrdef'];
if(!in_array($attrdef->getID(), $attrdefids)) {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?>:</td>
<td><?php $this->printAttributeEditField($attrdef, isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : '') ?></td>
</tr>
<?php
$attrdefids[] = $attrdef->getID();
} else {
?>
<tr>
<td><?php echo htmlspecialchars($attrdef->getName()); ?></td>
<td><?php echo isset($attributes[$attrdef->getID()]) ? $attributes[$attrdef->getID()] : ''; ?></td>
</tr>
<?php
}
}
}
}
} elseif($attrdefs) {
foreach($attrdefs as $attrdef) {
$attricon = '';
if($attrdef->getObjType() == SeedDMS_Core_AttributeDefinition::objtype_folder) {
@ -467,6 +555,10 @@ $(document).ready( function() {
</form>
</div>
<?php
// }}}
// }}}
// Fulltext search Form {{{
if($enablefullsearch) {
echo "<div class=\"tab-pane ".(($fullsearch == true) ? 'active' : '')."\" id=\"fulltext\">\n";
$this->contentContainerStart();
@ -529,12 +621,13 @@ $(document).ready( function() {
$this->contentContainerEnd();
echo "</div>\n";
}
// }}}
?>
</div>
</div>
<?php
echo "</div>\n";
echo "<div class=\"span8\">\n";
// Search Result {{{
// Search Result {{{
$foldercount = $doccount = 0;
if($entries) {
/*
@ -550,14 +643,18 @@ $(document).ready( function() {
$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $urlparams);
// $this->contentContainerStart();
print "<table class=\"table table-hover\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("attributes")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$txt = $this->callHook('folderListHeader', null, null);
if(is_string($txt))
echo $txt;
else {
print "<table class=\"table table-condensed table-hover\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
}
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout);
$previewer->setConverters($previewconverters);
@ -567,6 +664,8 @@ $(document).ready( function() {
if(is_string($txt))
echo $txt;
else {
echo $this->documentListRow($entry, $previewer, false, 0, SeedDMS_Core_AttributeDefinitionGroup::show_searchlist);
/*
$document = $entry;
$owner = $document->getOwner();
$lc = $document->getLatestContent();
@ -655,8 +754,11 @@ $(document).ready( function() {
print "</div>";
print "</td>";
print "</tr>\n";
*/
}
} elseif(get_class($entry) == $dms->getClassname('folder')) {
echo $this->folderListRow($entry, SeedDMS_Core_AttributeDefinitionGroup::show_list);
/*
$folder = $entry;
$owner = $folder->getOwner();
if (in_array(2, $searchin)) {
@ -719,9 +821,14 @@ $(document).ready( function() {
print "</div>";
print "</td>";
print "</tr>\n";
*/
}
}
print "</tbody></table>\n";
$txt = $this->callHook('folderListFooter', null);
if(is_string($txt))
echo $txt;
else
print "</tbody></table>\n";
// $this->contentContainerEnd();
$this->pageList($pageNumber, $totalpages, "../out/out.Search.php", $_GET);
} else {