diff --git a/views/bootstrap/class.Search.php b/views/bootstrap/class.Search.php index a437912d6..d9f2a8a0c 100644 --- a/views/bootstrap/class.Search.php +++ b/views/bootstrap/class.Search.php @@ -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." ".($orderby=="n"||$orderby=="na"?' ':($orderby=="nd"?' ':' ')).""; + $tmp['orderby'] = ($orderby=="d"||$orderby=="da") ? "dd" : "d"; + $headcol .= " ".($orderby=="d"||$orderby=="da"?' ':($orderby=="dd"?' ':' ')).""; + } + 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 ""; print "\n\n"; - print "\n"; - print "\n"; - //print "\n"; - print "\n"; - print "\n"; - print "\n\n\n"; + foreach($txt as $headcol) + echo "\n"; + print "\n\n"; + } else { + echo $this->folderListHeader(null, 'search'); + /* + print "
".getMLText("name"); - if(!$fullsearch) { - print $orderby." ".($orderby=="n"||$orderby=="na"?' ':($orderby=="nd"?' ':' ')).""; - $tmp['orderby'] = ($orderby=="d"||$orderby=="da") ? "dd" : "d"; - print " ".($orderby=="d"||$orderby=="da"?' ':($orderby=="dd"?' ':' ')).""; - } - print "".getMLText("attributes")."".getMLText("status")."".getMLText("action")."
".$headcol."
"; + print "\n\n"; + $headcols['image'] = $this->folderListHeaderImage(); + $headcols['name'] = $this->folderListHeaderName(); + $headcols['status'] = getMLText("status"); + $headcols['action'] = getMLText("action"); + foreach($headcols as $headcol) + echo "\n"; + print "\n\n"; + */ } + print "\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 .= "
".$headcol."
\n"; + $attrstr .= ""; + foreach($lcattributes as $lcattribute) { + $arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute); + if(is_array($arr)) { + $attrstr .= ""; + $attrstr .= ""; + $attrstr .= ""; + $attrstr .= ""; + } elseif(is_string($arr)) { + $attrstr .= $arr; + } else { + $attrdef = $lcattribute->getAttributeDefinition(); + $attrstr .= "\n"; + // TODO: better use printAttribute() + // $this->printAttribute($lcattribute); + } + } + $attrstr .= "
".getMLText('name')."".getMLText('attribute_value')."
".$arr[0].":".$arr[1]."
".htmlspecialchars($attrdef->getName())."".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."
\n"; + } + $docattributes = $document->getAttributes(); + if($docattributes) { + $attrstr .= "\n"; + $attrstr .= ""; + foreach($docattributes as $docattribute) { + $arr = $this->callHook('showDocumentAttribute', $document, $docattribute); + if(is_array($arr)) { + $attrstr .= ""; + $attrstr .= ""; + $attrstr .= ""; + $attrstr .= ""; + } elseif(is_string($arr)) { + $attrstr .= $arr; + } else { + $attrdef = $docattribute->getAttributeDefinition(); + $attrstr .= "\n"; + } + } + $attrstr .= "
".getMLText('name')."".getMLText('attribute_value')."
".$arr[0].":".$arr[1]."
".htmlspecialchars($attrdef->getName())."".htmlspecialchars(implode(', ', $docattribute->getValueAsArray()))."
\n"; + } + $extracontent = array(); + $extracontent['below_title'] = $this->getListRowPath($document); + if($attrstr) + $extracontent['bottom_title'] = '
'.$this->printPopupBox(''.getMLText('attributes').'', $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 .= "\n"; - $attrstr .= ""; - foreach($lcattributes as $lcattribute) { - $arr = $this->callHook('showDocumentContentAttribute', $lc, $lcattribute); - if(is_array($arr)) { - $attrstr .= ""; - $attrstr .= ""; - $attrstr .= ""; - $attrstr .= ""; - } elseif(is_string($arr)) { - $attrstr .= $arr; - } else { - $attrdef = $lcattribute->getAttributeDefinition(); - $attrstr .= "\n"; - // TODO: better use printAttribute() - // $this->printAttribute($lcattribute); - } - } - $attrstr .= "
".getMLText('name')."".getMLText('attribute_value')."
".$arr[0].":".$arr[1]."
".htmlspecialchars($attrdef->getName())."".htmlspecialchars(implode(', ', $lcattribute->getValueAsArray()))."
\n"; - } - $docattributes = $document->getAttributes(); - if($docattributes) { - $attrstr .= "\n"; - $attrstr .= ""; - foreach($docattributes as $docattribute) { - $arr = $this->callHook('showDocumentAttribute', $document, $docattribute); - if(is_array($arr)) { - $attrstr .= ""; - $attrstr .= ""; - $attrstr .= ""; - $attrstr .= ""; - } elseif(is_string($arr)) { - $attrstr .= $arr; - } else { - $attrdef = $docattribute->getAttributeDefinition(); - $attrstr .= "\n"; - } - } - $attrstr .= "
".getMLText('name')."".getMLText('attribute_value')."
".$arr[0].":".$arr[1]."
".htmlspecialchars($attrdef->getName())."".htmlspecialchars(implode(', ', $docattribute->getValueAsArray()))."
\n"; - } - $extracontent = array(); - $extracontent['below_title'] = $this->getListRowPath($document); - if($attrstr) - $extracontent['bottom_title'] = '
'.$this->printPopupBox(''.getMLText('attributes').'', $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(); diff --git a/views/bootstrap/class.ViewFolder.php b/views/bootstrap/class.ViewFolder.php index ffd14c398..78d071436 100644 --- a/views/bootstrap/class.ViewFolder.php +++ b/views/bootstrap/class.ViewFolder.php @@ -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 ""; print "\n\n"; - print "\n"; - print "\n"; - // print "\n"; - print "\n"; - // print "\n"; - print "\n"; - print "\n\n\n"; + foreach($txt as $headcol) + echo "\n"; + print "\n\n"; + } else { + echo $this->folderListHeader(); } + print "\n"; foreach($subFolders as $subFolder) { if(!$maxItemsPerPage || $i < $maxItemsPerPage) {
".($parent ? '' : '')."".getMLText("name"); - print " 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"?' ':($orderby=="nd"?' ':' ')).""; - print " 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"?' ':($orderby=="sd"?' ':' ')).""; - print " 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"?' ':($orderby=="dd"?' ':' ')).""; - print "".getMLText("owner")."".getMLText("status")."".getMLText("version")."".getMLText("action")."
".$headcol."