mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-06-18 02:59:27 +00:00
use new methods to show list of docs/folders
This commit is contained in:
parent
5c93d53e60
commit
771b9674cc
|
@ -123,6 +123,20 @@ function typeahead() { /* {{{ */
|
|||
echo json_encode($recs);
|
||||
} /* }}} */
|
||||
|
||||
public function folderListHeaderName() { /* {{{ */
|
||||
$orderby = $this->params['orderby'];
|
||||
$fullsearch = $this->params['fullsearch'];
|
||||
parse_str($_SERVER['QUERY_STRING'], $tmp);
|
||||
$tmp['orderby'] = ($orderby=="n"||$orderby=="na") ? "nd" : "n";
|
||||
$headcol = getMLText("name");
|
||||
if(!$fullsearch) {
|
||||
$headcol .= $orderby." <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
|
||||
$tmp['orderby'] = ($orderby=="d"||$orderby=="da") ? "dd" : "d";
|
||||
$headcol .= " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="fa fa-sort-amount-asc selected"></i>':($orderby=="dd"?' <i class="fa fa-sort-amount-desc selected"></i>':' <i class="fa fa-sort-amount-asc"></i>'))."</a>";
|
||||
}
|
||||
return $headcol;
|
||||
} /* }}} */
|
||||
|
||||
function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$user = $this->params['user'];
|
||||
|
@ -606,92 +620,89 @@ function typeahead() { /* {{{ */
|
|||
// $this->contentContainerStart();
|
||||
|
||||
$txt = $this->callHook('searchListHeader', $orderby, 'asc');
|
||||
if(is_string($txt))
|
||||
if(is_string($txt)) {
|
||||
echo $txt;
|
||||
else {
|
||||
parse_str($_SERVER['QUERY_STRING'], $tmp);
|
||||
$tmp['orderby'] = ($orderby=="n"||$orderby=="na") ? "nd" : "n";
|
||||
} elseif(is_array($txt)) {
|
||||
print "<table class=\"table table-condensed table-sm table-hover\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
print "<th></th>\n";
|
||||
print "<th>".getMLText("name");
|
||||
if(!$fullsearch) {
|
||||
print $orderby." <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
|
||||
$tmp['orderby'] = ($orderby=="d"||$orderby=="da") ? "dd" : "d";
|
||||
print " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="fa fa-sort-amount-asc selected"></i>':($orderby=="dd"?' <i class="fa fa-sort-amount-desc selected"></i>':' <i class="fa fa-sort-amount-asc"></i>'))."</a>";
|
||||
}
|
||||
print "</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";
|
||||
foreach($txt as $headcol)
|
||||
echo "<th>".$headcol."</th>\n";
|
||||
print "</tr>\n</thead>\n";
|
||||
} else {
|
||||
echo $this->folderListHeader(null, 'search');
|
||||
/*
|
||||
print "<table class=\"table table-condensed table-sm table-hover\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
$headcols['image'] = $this->folderListHeaderImage();
|
||||
$headcols['name'] = $this->folderListHeaderName();
|
||||
$headcols['status'] = getMLText("status");
|
||||
$headcols['action'] = getMLText("action");
|
||||
foreach($headcols as $headcol)
|
||||
echo "<th>".$headcol."</th>\n";
|
||||
print "</tr>\n</thead>\n";
|
||||
*/
|
||||
}
|
||||
print "<tbody>\n";
|
||||
|
||||
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||
foreach ($entries as $entry) {
|
||||
if($entry->isType('document')) {
|
||||
$txt = $this->callHook('documentListItem', $entry, $previewer, false, 'search');
|
||||
$document = $entry;
|
||||
if($lc = $document->getLatestContent())
|
||||
$previewer->createPreview($lc);
|
||||
|
||||
$lcattributes = $lc ? $lc->getAttributes() : null;
|
||||
$attrstr = '';
|
||||
if($lcattributes) {
|
||||
$attrstr .= "<table class=\"table table-condensed table-sm\">\n";
|
||||
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
|
||||
foreach($lcattributes as $lcattribute) {
|
||||
$arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute);
|
||||
if(is_array($arr)) {
|
||||
$attrstr .= "<tr>";
|
||||
$attrstr .= "<td>".$arr[0].":</td>";
|
||||
$attrstr .= "<td>".$arr[1]."</td>";
|
||||
$attrstr .= "</tr>";
|
||||
} elseif(is_string($arr)) {
|
||||
$attrstr .= $arr;
|
||||
} else {
|
||||
$attrdef = $lcattribute->getAttributeDefinition();
|
||||
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."</td></tr>\n";
|
||||
// TODO: better use printAttribute()
|
||||
// $this->printAttribute($lcattribute);
|
||||
}
|
||||
}
|
||||
$attrstr .= "</table>\n";
|
||||
}
|
||||
$docattributes = $document->getAttributes();
|
||||
if($docattributes) {
|
||||
$attrstr .= "<table class=\"table table-condensed table-sm\">\n";
|
||||
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
|
||||
foreach($docattributes as $docattribute) {
|
||||
$arr = $this->callHook('showDocumentAttribute', $document, $docattribute);
|
||||
if(is_array($arr)) {
|
||||
$attrstr .= "<tr>";
|
||||
$attrstr .= "<td>".$arr[0].":</td>";
|
||||
$attrstr .= "<td>".$arr[1]."</td>";
|
||||
$attrstr .= "</tr>";
|
||||
} elseif(is_string($arr)) {
|
||||
$attrstr .= $arr;
|
||||
} else {
|
||||
$attrdef = $docattribute->getAttributeDefinition();
|
||||
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $docattribute->getValueAsArray()))."</td></tr>\n";
|
||||
}
|
||||
}
|
||||
$attrstr .= "</table>\n";
|
||||
}
|
||||
$extracontent = array();
|
||||
$extracontent['below_title'] = $this->getListRowPath($document);
|
||||
if($attrstr)
|
||||
$extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-sm btn-secondary">'.getMLText('attributes').'</span>', $attrstr, true);
|
||||
|
||||
$txt = $this->callHook('documentListItem', $entry, $previewer, false, 'search', $extracontent);
|
||||
if(is_string($txt))
|
||||
echo $txt;
|
||||
else {
|
||||
$document = $entry;
|
||||
$owner = $document->getOwner();
|
||||
if($lc = $document->getLatestContent())
|
||||
$previewer->createPreview($lc);
|
||||
|
||||
if (in_array(3, $searchin))
|
||||
$comment = $this->markQuery(htmlspecialchars($document->getComment()));
|
||||
else
|
||||
$comment = htmlspecialchars($document->getComment());
|
||||
if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "...";
|
||||
|
||||
$lcattributes = $lc ? $lc->getAttributes() : null;
|
||||
$attrstr = '';
|
||||
if($lcattributes) {
|
||||
$attrstr .= "<table class=\"table table-condensed table-sm\">\n";
|
||||
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
|
||||
foreach($lcattributes as $lcattribute) {
|
||||
$arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute);
|
||||
if(is_array($arr)) {
|
||||
$attrstr .= "<tr>";
|
||||
$attrstr .= "<td>".$arr[0].":</td>";
|
||||
$attrstr .= "<td>".$arr[1]."</td>";
|
||||
$attrstr .= "</tr>";
|
||||
} elseif(is_string($arr)) {
|
||||
$attrstr .= $arr;
|
||||
} else {
|
||||
$attrdef = $lcattribute->getAttributeDefinition();
|
||||
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."</td></tr>\n";
|
||||
// TODO: better use printAttribute()
|
||||
// $this->printAttribute($lcattribute);
|
||||
}
|
||||
}
|
||||
$attrstr .= "</table>\n";
|
||||
}
|
||||
$docattributes = $document->getAttributes();
|
||||
if($docattributes) {
|
||||
$attrstr .= "<table class=\"table table-condensed table-sm\">\n";
|
||||
$attrstr .= "<tr><th>".getMLText('name')."</th><th>".getMLText('attribute_value')."</th></tr>";
|
||||
foreach($docattributes as $docattribute) {
|
||||
$arr = $this->callHook('showDocumentAttribute', $document, $docattribute);
|
||||
if(is_array($arr)) {
|
||||
$attrstr .= "<tr>";
|
||||
$attrstr .= "<td>".$arr[0].":</td>";
|
||||
$attrstr .= "<td>".$arr[1]."</td>";
|
||||
$attrstr .= "</tr>";
|
||||
} elseif(is_string($arr)) {
|
||||
$attrstr .= $arr;
|
||||
} else {
|
||||
$attrdef = $docattribute->getAttributeDefinition();
|
||||
$attrstr .= "<tr><td>".htmlspecialchars($attrdef->getName())."</td><td>".htmlspecialchars(implode(', ', $docattribute->getValueAsArray()))."</td></tr>\n";
|
||||
}
|
||||
}
|
||||
$attrstr .= "</table>\n";
|
||||
}
|
||||
$extracontent = array();
|
||||
$extracontent['below_title'] = $this->getListRowPath($document);
|
||||
if($attrstr)
|
||||
$extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-sm btn-secondary">'.getMLText('attributes').'</span>', $attrstr, true);
|
||||
print $this->documentListRow($document, $previewer, false, 0, $extracontent);
|
||||
}
|
||||
} elseif($entry->isType('folder')) {
|
||||
|
@ -700,12 +711,6 @@ function typeahead() { /* {{{ */
|
|||
echo $txt;
|
||||
else {
|
||||
$folder = $entry;
|
||||
$owner = $folder->getOwner();
|
||||
if (in_array(2, $searchin)) {
|
||||
$folderName = $this->markQuery(htmlspecialchars($folder->getName()), "i");
|
||||
} else {
|
||||
$folderName = htmlspecialchars($folder->getName());
|
||||
}
|
||||
|
||||
$attrstr = '';
|
||||
$folderattributes = $folder->getAttributes();
|
||||
|
|
|
@ -382,7 +382,6 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
if($documents === null)
|
||||
$documents = $folder->getDocuments($orderby[0], $orderdir);
|
||||
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
|
||||
$parent = $onepage ? $folder->getParent() : null;
|
||||
|
||||
$txt = $this->callHook('folderListPreContent', $folder, $subFolders, $documents);
|
||||
if(is_string($txt))
|
||||
|
@ -390,23 +389,18 @@ $('body').on('click', '.order-btn', function(ev) {
|
|||
$i = 0;
|
||||
if ((count($subFolders) > 0)||(count($documents) > 0)){
|
||||
$txt = $this->callHook('folderListHeader', $folder, $orderby, $orderdir);
|
||||
if(is_string($txt))
|
||||
if(is_string($txt)) {
|
||||
echo $txt;
|
||||
else {
|
||||
} elseif(is_array($txt)) {
|
||||
print "<table id=\"viewfolder-table\" class=\"table table-condensed table-sm table-hover\">";
|
||||
print "<thead>\n<tr>\n";
|
||||
print "<th>".($parent ? '<button class="btn btn-mini btn-secondary btn-sm" id="goto-parent" data-parentid="'.$parent->getID().'"><i class="fa fa-arrow-up"></i></button>' : '')."</th>\n";
|
||||
print "<th>".getMLText("name");
|
||||
print " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="n"||$orderby=="na"?"&orderby=nd":"&orderby=n")."\" data-orderby=\"".($orderby=="n"||$orderby=="na"?"nd":"n")."\"title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="fa fa-sort-alpha-asc selected"></i>':($orderby=="nd"?' <i class="fa fa-sort-alpha-desc selected"></i>':' <i class="fa fa-sort-alpha-asc"></i>'))."</a>";
|
||||
print " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="s"||$orderby=="sa"?"&orderby=sd":"&orderby=s")."\" data-orderby=\"".($orderby=="s"||$orderby=="sa"?"sd":"s")."\" title=\"".getMLText("sort_by_sequence")."\">".($orderby=="s"||$orderby=="sa"?' <i class="fa fa-sort-numeric-asc selected"></i>':($orderby=="sd"?' <i class="fa fa-sort-numeric-desc selected"></i>':' <i class="fa fa-sort-numeric-asc"></i>'))."</a>";
|
||||
print " <a class=\"order-btn\" href=\"".$this->params['settings']->_httpRoot."out/out.ViewFolder.php?folderid=". $folderid .($orderby=="d"||$orderby=="da"?"&orderby=dd":"&orderby=d")."\" data-orderby=\"".($orderby=="d"||$orderby=="da"?"dd":"d")."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="fa fa-sort-amount-asc selected"></i>':($orderby=="dd"?' <i class="fa fa-sort-amount-desc selected"></i>':' <i class="fa fa-sort-amount-asc"></i>'))."</a>";
|
||||
print "</th>\n";
|
||||
// print "<th>".getMLText("owner")."</th>\n";
|
||||
print "<th>".getMLText("status")."</th>\n";
|
||||
// print "<th>".getMLText("version")."</th>\n";
|
||||
print "<th>".getMLText("action")."</th>\n";
|
||||
print "</tr>\n</thead>\n<tbody>\n";
|
||||
foreach($txt as $headcol)
|
||||
echo "<th>".$headcol."</th>\n";
|
||||
print "</tr>\n</thead>\n";
|
||||
} else {
|
||||
echo $this->folderListHeader();
|
||||
}
|
||||
print "<tbody>\n";
|
||||
|
||||
foreach($subFolders as $subFolder) {
|
||||
if(!$maxItemsPerPage || $i < $maxItemsPerPage) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user