From ee318b643a8a9f5ed3e88bd68c9dfc9a642884ed Mon Sep 17 00:00:00 2001 From: Uwe Steinmann Date: Wed, 31 Jul 2013 17:29:55 +0200 Subject: [PATCH] call hook documentListItem if available --- views/bootstrap/class.ViewFolder.php | 164 ++++++++++++++------------- 1 file changed, 84 insertions(+), 80 deletions(-) diff --git a/views/bootstrap/class.ViewFolder.php b/views/bootstrap/class.ViewFolder.php index f482654ac..5905d288d 100644 --- a/views/bootstrap/class.ViewFolder.php +++ b/views/bootstrap/class.ViewFolder.php @@ -280,93 +280,97 @@ class SeedDMS_View_ViewFolder extends SeedDMS_Bootstrap_Style { $previewer = new SeedDMS_Preview_Previewer($cachedir, 40); foreach($documents as $document) { - - $owner = $document->getOwner(); - $comment = $document->getComment(); - if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; - $docID = $document->getID(); - if($latestContent = $document->getLatestContent()) { - $previewer->createPreview($latestContent); - $version = $latestContent->getVersion(); - $status = $latestContent->getStatus(); - $needwkflaction = false; - if($workflowmode == 'advanced') { - $workflow = $latestContent->getWorkflow(); - if($workflow) { - $needwkflaction = $latestContent->needsWorkflowAction($user); + $txt = $this->callHook('documentListItem', $document, $previewer); + if(is_string($txt)) + echo $txt; + else { + $owner = $document->getOwner(); + $comment = $document->getComment(); + if (strlen($comment) > 150) $comment = substr($comment, 0, 147) . "..."; + $docID = $document->getID(); + if($latestContent = $document->getLatestContent()) { + $previewer->createPreview($latestContent); + $version = $latestContent->getVersion(); + $status = $latestContent->getStatus(); + $needwkflaction = false; + if($workflowmode == 'advanced') { + $workflow = $latestContent->getWorkflow(); + if($workflow) { + $needwkflaction = $latestContent->needsWorkflowAction($user); + } } - } - - /* Retrieve attacheѕ files */ - $files = $document->getDocumentFiles(); + + /* Retrieve attacheѕ files */ + $files = $document->getDocumentFiles(); - /* Retrieve linked documents */ - $links = $document->getDocumentLinks(); - $links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links); + /* Retrieve linked documents */ + $links = $document->getDocumentLinks(); + $links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links); - print ""; + print ""; - if (file_exists($dms->contentDir . $latestContent->getPath())) { - print ""; - if($previewer->hasPreview($latestContent)) { - print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + if (file_exists($dms->contentDir . $latestContent->getPath())) { + print ""; + if($previewer->hasPreview($latestContent)) { + print "getID()."&version=".$latestContent->getVersion()."&width=40\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } else { + print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + } + print ""; + } else + print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + + print "" . htmlspecialchars($document->getName()) . ""; + print "
".getMLText('owner').": ".htmlspecialchars($owner->getFullName()).", ".getMLText('creation_date').": ".date('Y-m-d', $document->getDate()).", ".getMLText('version')." ".$version." - ".date('Y-m-d', $latestContent->getDate()).""; + if($comment) { + print "
".htmlspecialchars($comment).""; + } + print "\n"; + // print "".htmlspecialchars($owner->getFullName()).""; + print ""; + $attentionstr = ''; + if ( $document->isLocked() ) { + $attentionstr .= "getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> "; + } + if ( $needwkflaction ) { + $attentionstr .= "getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": "."\"> "; + } + if($attentionstr) + print $attentionstr."
"; + print ""; + if(count($files)) + print count($files)." ".getMLText("linked_files")."
"; + if(count($links)) + print count($links)." ".getMLText("linked_documents")."
"; + print getOverallStatusText($status["status"])."
"; + // print "".$version.""; + print ""; + print "
"; + if($document->getAccessMode($user) >= M_ALL) { + ?> + + getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; + ?> + + "; - } else - print "getMimeIcon($latestContent->getFileType())."\" title=\"".htmlspecialchars($latestContent->getMimeType())."\">"; - - print "" . htmlspecialchars($document->getName()) . ""; - print "
".getMLText('owner').": ".htmlspecialchars($owner->getFullName()).", ".getMLText('creation_date').": ".date('Y-m-d', $document->getDate()).", ".getMLText('version')." ".$version." - ".date('Y-m-d', $latestContent->getDate()).""; - if($comment) { - print "
".htmlspecialchars($comment).""; + if($document->getAccessMode($user) >= M_READWRITE) { + ?> + + + + + " msg="" _href="../op/op.AddToClipboard.php?folderid=getID(); ?>&type=document&id=" title=""> + "; + print ""; + print "\n"; } - print "\n"; -// print "".htmlspecialchars($owner->getFullName()).""; - print ""; - $attentionstr = ''; - if ( $document->isLocked() ) { - $attentionstr .= "getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> "; - } - if ( $needwkflaction ) { - $attentionstr .= "getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": "."\"> "; - } - if($attentionstr) - print $attentionstr."
"; - print ""; - if(count($files)) - print count($files)." ".getMLText("linked_files")."
"; - if(count($links)) - print count($links)." ".getMLText("linked_documents")."
"; - print getOverallStatusText($status["status"])."
"; -// print "".$version.""; - print ""; - print "
"; - if($document->getAccessMode($user) >= M_ALL) { -?> - - - -getAccessMode($user) >= M_READWRITE) { -?> - - - - - " msg="" _href="../op/op.AddToClipboard.php?folderid=getID(); ?>&type=document&id=" title=""> -"; - print ""; - print "\n"; } }