add method documentListRowStatus()

This commit is contained in:
Uwe Steinmann 2022-01-05 07:34:51 +01:00
parent 4dda2549c7
commit 22915df3e1
2 changed files with 104 additions and 82 deletions

View File

@ -2883,6 +2883,56 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
return "</tr>\n";
} /* }}} */
function documentListRowStatus($latestContent) { /* {{{ */
$user = $this->params['user'];
$workflowmode = $this->params['workflowmode'];
$document = $latestContent->getDocument();
$status = $latestContent->getStatus();
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
}
$needwkflaction = false;
if($workflowmode == 'advanced') {
$workflow = $latestContent->getWorkflow();
if($workflow) {
$needwkflaction = $latestContent->needsWorkflowAction($user);
}
}
if ( $needwkflaction ) {
$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> ";
}
$content = '';
if($attentionstr)
$content .= $attentionstr."<br />";
$content .= "<small>";
/* Retrieve attacheѕ files */
$files = $document->getDocumentFiles($latestContent->getVersion());
$files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files);
/* Retrieve linked documents */
$links = $document->getDocumentLinks();
$links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links);
/* Retrieve reverse linked documents */
$revlinks = $document->getReverseDocumentLinks();
$revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks);
if(count($files))
$content .= count($files)." ".getMLText("linked_files")."<br />";
if(count($links) || count($revlinks))
$content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."<br />";
if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') {
if($workflowstate = $latestContent->getWorkflowState())
$content .= '<span title="'.getOverallStatusText($status["status"]).': '.($workflow ? htmlspecialchars($workflow->getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').'</span>';
} else {
$content .= getOverallStatusText($status["status"]);
}
$content .= "</small>";
return $content;
} /* }}} */
function documentListRowAction($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */
$user = $this->params['user'];
$enableClipboard = $this->params['enableclipboard'];
@ -2963,27 +3013,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$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($latestContent->getVersion());
$files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files);
/* Retrieve linked documents */
$links = $document->getDocumentLinks();
$links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links);
/* Retrieve reverse linked documents */
$revlinks = $document->getReverseDocumentLinks();
$revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks);
if($ec = $this->callHook('documentListRowExtraContent', $document, $latestContent))
$extracontent = array_merge($extracontent, $ec);
@ -3037,27 +3067,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
}
$content .= "<td nowrap>";
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
}
if ( $needwkflaction ) {
$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> ";
}
if($attentionstr)
$content .= $attentionstr."<br />";
$content .= "<small>";
if(count($files))
$content .= count($files)." ".getMLText("linked_files")."<br />";
if(count($links) || count($revlinks))
$content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."<br />";
if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') {
if($workflowstate = $latestContent->getWorkflowState())
$content .= '<span title="'.getOverallStatusText($status["status"]).': '.($workflow ? htmlspecialchars($workflow->getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').'</span>';
} else {
$content .= getOverallStatusText($status["status"]);
}
$content .= "</small></td>";
$content .= $this->documentListRowStatus($latestContent);
$content .= "</td>";
$content .= "<td>";
$content .= $this->documentListRowAction($document, $previewer, $skipcont, $version, $extracontent);
$content .= "</td>";

View File

@ -2954,6 +2954,56 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
return "</tr>\n";
} /* }}} */
function documentListRowStatus($latestContent) { /* {{{ */
$user = $this->params['user'];
$workflowmode = $this->params['workflowmode'];
$document = $latestContent->getDocument();
$status = $latestContent->getStatus();
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
}
$needwkflaction = false;
if($workflowmode == 'advanced') {
$workflow = $latestContent->getWorkflow();
if($workflow) {
$needwkflaction = $latestContent->needsWorkflowAction($user);
}
}
if ( $needwkflaction ) {
$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> ";
}
$content = '';
if($attentionstr)
$content .= $attentionstr."<br />";
$content .= "<small>";
/* Retrieve attacheѕ files */
$files = $document->getDocumentFiles($latestContent->getVersion());
$files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files);
/* Retrieve linked documents */
$links = $document->getDocumentLinks();
$links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links);
/* Retrieve reverse linked documents */
$revlinks = $document->getReverseDocumentLinks();
$revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks);
if(count($files))
$content .= count($files)." ".getMLText("linked_files")."<br />";
if(count($links) || count($revlinks))
$content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."<br />";
if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') {
if($workflowstate = $latestContent->getWorkflowState())
$content .= '<span title="'.getOverallStatusText($status["status"]).': '.($workflow ? htmlspecialchars($workflow->getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').'</span>';
} else {
$content .= getOverallStatusText($status["status"]);
}
$content .= "</small>";
return $content;
} /* }}} */
function documentListRowAction($document, $previewer, $skipcont=false, $version=0, $extracontent=array()) { /* {{{ */
$user = $this->params['user'];
$enableClipboard = $this->params['enableclipboard'];
@ -3034,27 +3084,7 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
$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($latestContent->getVersion());
$files = SeedDMS_Core_DMS::filterDocumentFiles($user, $files);
/* Retrieve linked documents */
$links = $document->getDocumentLinks();
$links = SeedDMS_Core_DMS::filterDocumentLinks($user, $links);
/* Retrieve reverse linked documents */
$revlinks = $document->getReverseDocumentLinks();
$revlinks = SeedDMS_Core_DMS::filterDocumentLinks($user, $revlinks);
if($ec = $this->callHook('documentListRowExtraContent', $document, $latestContent))
$extracontent = array_merge($extracontent, $ec);
@ -3108,27 +3138,8 @@ $('body').on('click', '[id^=\"table-row-folder\"] td:nth-child(2)', function(ev)
}
$content .= "<td nowrap>";
$attentionstr = '';
if ( $document->isLocked() ) {
$attentionstr .= "<img src=\"".$this->getImgPath("lock.png")."\" title=\"". getMLText("locked_by").": ".htmlspecialchars($document->getLockingUser()->getFullName())."\"> ";
}
if ( $needwkflaction ) {
$attentionstr .= "<img src=\"".$this->getImgPath("attention.gif")."\" title=\"". getMLText("workflow").": ".htmlspecialchars($workflow->getName())."\"> ";
}
if($attentionstr)
$content .= $attentionstr."<br />";
$content .= "<small>";
if(count($files))
$content .= count($files)." ".getMLText("linked_files")."<br />";
if(count($links) || count($revlinks))
$content .= count($links)."/".count($revlinks)." ".getMLText("linked_documents")."<br />";
if($status["status"] == S_IN_WORKFLOW && $workflowmode == 'advanced') {
if($workflowstate = $latestContent->getWorkflowState())
$content .= '<span title="'.getOverallStatusText($status["status"]).': '.($workflow ? htmlspecialchars($workflow->getName()) : '').'">'.($workflowstate ? htmlspecialchars($workflowstate->getName()) : '').'</span>';
} else {
$content .= getOverallStatusText($status["status"]);
}
$content .= "</small></td>";
$content .= $this->documentListRowStatus($latestContent);
$content .= "</td>";
$content .= "<td>";
$content .= $this->documentListRowAction($document, $previewer, $skipcont, $version, $extracontent);
$content .= "</td>";