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);
|
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() { /* {{{ */
|
function show() { /* {{{ */
|
||||||
$dms = $this->params['dms'];
|
$dms = $this->params['dms'];
|
||||||
$user = $this->params['user'];
|
$user = $this->params['user'];
|
||||||
|
@ -606,45 +620,37 @@ function typeahead() { /* {{{ */
|
||||||
// $this->contentContainerStart();
|
// $this->contentContainerStart();
|
||||||
|
|
||||||
$txt = $this->callHook('searchListHeader', $orderby, 'asc');
|
$txt = $this->callHook('searchListHeader', $orderby, 'asc');
|
||||||
if(is_string($txt))
|
if(is_string($txt)) {
|
||||||
echo $txt;
|
echo $txt;
|
||||||
else {
|
} elseif(is_array($txt)) {
|
||||||
parse_str($_SERVER['QUERY_STRING'], $tmp);
|
|
||||||
$tmp['orderby'] = ($orderby=="n"||$orderby=="na") ? "nd" : "n";
|
|
||||||
print "<table class=\"table table-condensed table-sm table-hover\">";
|
print "<table class=\"table table-condensed table-sm table-hover\">";
|
||||||
print "<thead>\n<tr>\n";
|
print "<thead>\n<tr>\n";
|
||||||
print "<th></th>\n";
|
foreach($txt as $headcol)
|
||||||
print "<th>".getMLText("name");
|
echo "<th>".$headcol."</th>\n";
|
||||||
if(!$fullsearch) {
|
print "</tr>\n</thead>\n";
|
||||||
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>";
|
} else {
|
||||||
$tmp['orderby'] = ($orderby=="d"||$orderby=="da") ? "dd" : "d";
|
echo $this->folderListHeader(null, 'search');
|
||||||
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 "<table class=\"table table-condensed table-sm table-hover\">";
|
||||||
print "</th>\n";
|
print "<thead>\n<tr>\n";
|
||||||
//print "<th>".getMLText("attributes")."</th>\n";
|
$headcols['image'] = $this->folderListHeaderImage();
|
||||||
print "<th>".getMLText("status")."</th>\n";
|
$headcols['name'] = $this->folderListHeaderName();
|
||||||
print "<th>".getMLText("action")."</th>\n";
|
$headcols['status'] = getMLText("status");
|
||||||
print "</tr>\n</thead>\n<tbody>\n";
|
$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);
|
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
|
||||||
foreach ($entries as $entry) {
|
foreach ($entries as $entry) {
|
||||||
if($entry->isType('document')) {
|
if($entry->isType('document')) {
|
||||||
$txt = $this->callHook('documentListItem', $entry, $previewer, false, 'search');
|
|
||||||
if(is_string($txt))
|
|
||||||
echo $txt;
|
|
||||||
else {
|
|
||||||
$document = $entry;
|
$document = $entry;
|
||||||
$owner = $document->getOwner();
|
|
||||||
if($lc = $document->getLatestContent())
|
if($lc = $document->getLatestContent())
|
||||||
$previewer->createPreview($lc);
|
$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;
|
$lcattributes = $lc ? $lc->getAttributes() : null;
|
||||||
$attrstr = '';
|
$attrstr = '';
|
||||||
if($lcattributes) {
|
if($lcattributes) {
|
||||||
|
@ -692,6 +698,11 @@ function typeahead() { /* {{{ */
|
||||||
$extracontent['below_title'] = $this->getListRowPath($document);
|
$extracontent['below_title'] = $this->getListRowPath($document);
|
||||||
if($attrstr)
|
if($attrstr)
|
||||||
$extracontent['bottom_title'] = '<br />'.$this->printPopupBox('<span class="btn btn-mini btn-sm btn-secondary">'.getMLText('attributes').'</span>', $attrstr, true);
|
$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 {
|
||||||
print $this->documentListRow($document, $previewer, false, 0, $extracontent);
|
print $this->documentListRow($document, $previewer, false, 0, $extracontent);
|
||||||
}
|
}
|
||||||
} elseif($entry->isType('folder')) {
|
} elseif($entry->isType('folder')) {
|
||||||
|
@ -700,12 +711,6 @@ function typeahead() { /* {{{ */
|
||||||
echo $txt;
|
echo $txt;
|
||||||
else {
|
else {
|
||||||
$folder = $entry;
|
$folder = $entry;
|
||||||
$owner = $folder->getOwner();
|
|
||||||
if (in_array(2, $searchin)) {
|
|
||||||
$folderName = $this->markQuery(htmlspecialchars($folder->getName()), "i");
|
|
||||||
} else {
|
|
||||||
$folderName = htmlspecialchars($folder->getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
$attrstr = '';
|
$attrstr = '';
|
||||||
$folderattributes = $folder->getAttributes();
|
$folderattributes = $folder->getAttributes();
|
||||||
|
|
|
@ -382,7 +382,6 @@ $('body').on('click', '.order-btn', function(ev) {
|
||||||
if($documents === null)
|
if($documents === null)
|
||||||
$documents = $folder->getDocuments($orderby[0], $orderdir);
|
$documents = $folder->getDocuments($orderby[0], $orderdir);
|
||||||
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
|
$documents = SeedDMS_Core_DMS::filterAccess($documents, $user, M_READ);
|
||||||
$parent = $onepage ? $folder->getParent() : null;
|
|
||||||
|
|
||||||
$txt = $this->callHook('folderListPreContent', $folder, $subFolders, $documents);
|
$txt = $this->callHook('folderListPreContent', $folder, $subFolders, $documents);
|
||||||
if(is_string($txt))
|
if(is_string($txt))
|
||||||
|
@ -390,23 +389,18 @@ $('body').on('click', '.order-btn', function(ev) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
if ((count($subFolders) > 0)||(count($documents) > 0)){
|
if ((count($subFolders) > 0)||(count($documents) > 0)){
|
||||||
$txt = $this->callHook('folderListHeader', $folder, $orderby, $orderdir);
|
$txt = $this->callHook('folderListHeader', $folder, $orderby, $orderdir);
|
||||||
if(is_string($txt))
|
if(is_string($txt)) {
|
||||||
echo $txt;
|
echo $txt;
|
||||||
else {
|
} elseif(is_array($txt)) {
|
||||||
print "<table id=\"viewfolder-table\" class=\"table table-condensed table-sm table-hover\">";
|
print "<table id=\"viewfolder-table\" class=\"table table-condensed table-sm table-hover\">";
|
||||||
print "<thead>\n<tr>\n";
|
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";
|
foreach($txt as $headcol)
|
||||||
print "<th>".getMLText("name");
|
echo "<th>".$headcol."</th>\n";
|
||||||
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 "</tr>\n</thead>\n";
|
||||||
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>";
|
} else {
|
||||||
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>";
|
echo $this->folderListHeader();
|
||||||
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";
|
|
||||||
}
|
}
|
||||||
|
print "<tbody>\n";
|
||||||
|
|
||||||
foreach($subFolders as $subFolder) {
|
foreach($subFolders as $subFolder) {
|
||||||
if(!$maxItemsPerPage || $i < $maxItemsPerPage) {
|
if(!$maxItemsPerPage || $i < $maxItemsPerPage) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user