use documentListRow()

This commit is contained in:
Uwe Steinmann 2020-05-13 13:29:32 +02:00
parent 2b15816228
commit d66b6346e5

View File

@ -36,6 +36,17 @@ require_once("SeedDMS/Preview.php");
*/
class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
function js() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
header('Content-Type: application/javascript');
parent::jsTranslations(array('cancel', 'splash_move_document', 'confirm_move_document', 'move_document', 'confirm_transfer_link_document', 'transfer_content', 'link_document', 'splash_move_folder', 'confirm_move_folder', 'move_folder'));
$this->printDeleteDocumentButtonJs();
/* Add js for catching click on document in one page mode */
$this->printClickDocumentJs();
} /* }}} */
function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -47,6 +58,8 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
$timeout = $this->params['timeout'];
$xsendfile = $this->params['xsendfile'];
$this->htmlAddHeader('<script type="text/javascript" src="../styles/'.$this->theme.'/bootbox/bootbox.min.js"></script>'."\n", 'js');
$db = $dms->getDB();
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -147,7 +160,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
// List the documents where a review has been requested.
if($workflowmode == 'traditional') {
$this->contentHeading(getMLText("documents_to_review"));
$this->contentContainerStart();
//$this->contentContainerStart();
$printheader=true;
$dList = array();
foreach ($reviewStatus["indstatus"] as $st) {
@ -162,14 +175,14 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
$previewer->createPreview($latestContent);
@ -186,6 +199,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"]) ."</td>";
print "<td".($docIdx[$st["documentID"]][$st["version"]]['status']!=S_EXPIRED?"":" class=\"warning\"").">".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"]))."</td>";
print "</tr>\n";
*/
}
}
foreach ($reviewStatus["grpstatus"] as $st) {
@ -200,14 +214,14 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
$previewer->createPreview($latestContent);
@ -224,6 +238,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])."</td>";
print "<td".($docIdx[$st["documentID"]][$st["version"]]['status']!=S_EXPIRED?"":" class=\"warning\"").">".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"]))."</td>";
print "</tr>\n";
*/
}
}
if (!$printheader){
@ -231,12 +246,12 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}else{
printMLText("no_docs_to_review");
}
$this->contentContainerEnd();
// $this->contentContainerEnd();
}
// List the documents where an approval has been requested.
$this->contentHeading(getMLText("documents_to_approve"));
$this->contentContainerStart();
// $this->contentContainerStart();
$printheader=true;
foreach ($approvalStatus["indstatus"] as $st) {
@ -250,14 +265,14 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
$previewer->createPreview($latestContent);
@ -274,6 +289,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])."</td>";
print "<td".($docIdx[$st["documentID"]][$st["version"]]['status']!=S_EXPIRED?"":" class=\"warning\"").">".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"]))."</td>";
print "</tr>\n";
*/
}
}
foreach ($approvalStatus["grpstatus"] as $st) {
@ -286,13 +302,14 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
$previewer->createPreview($latestContent);
@ -309,6 +326,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])."</td>";
print "<td".($docIdx[$st["documentID"]][$st["version"]]['status']!=S_EXPIRED?"":" class=\"warning\"").">".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"]))."</td>";
print "</tr>\n";
*/
}
}
if (!$printheader){
@ -316,7 +334,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}else{
printMLText("no_docs_to_approve");
}
$this->contentContainerEnd();
//$this->contentContainerEnd();
}
else {
if($workflowmode == 'traditional') {
@ -361,7 +379,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}
$this->contentHeading(getMLText("documents_user_requiring_attention"));
$this->contentContainerStart();
//$this->contentContainerStart();
if (count($resArr)>0) {
print "<table class=\"table table-condensed\">";
@ -369,9 +387,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<th></th>";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach ($resArr as $res) {
@ -385,6 +401,8 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
$previewer->createPreview($latestContent);
@ -401,13 +419,14 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$res["statusDate"]." ".htmlspecialchars($res["statusName"])."</td>";
print "<td>".(!$res["expires"] ? "-":getReadableDate($res["expires"]))."</td>";
print "</tr>\n";
*/
}
print "</tbody></table>";
}
else printMLText("no_docs_to_look_at");
$this->contentContainerEnd();
//$this->contentContainerEnd();
// Get list of documents owned by current user that are pending review or
// pending approval.
@ -439,7 +458,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}
$this->contentHeading(getMLText("documents_user_rejected"));
$this->contentContainerStart();
//$this->contentContainerStart();
if (count($resArr)>0) {
print "<table class=\"table table-condensed\">";
@ -447,9 +466,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<th></th>";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach ($resArr as $res) {
@ -463,6 +480,8 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
$previewer->createPreview($latestContent);
@ -479,13 +498,14 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$res["statusDate"]." ".htmlspecialchars($res["statusName"])."</td>";
print "<td>".(!$res["expires"] ? "-":getReadableDate($res["expires"]))."</td>";
print "</tr>\n";
*/
}
print "</tbody></table>";
}
else printMLText("no_docs_to_look_at");
$this->contentContainerEnd();
//$this->contentContainerEnd();
} elseif($workflowmode == 'advanced') {
// Get document list for the current user.
$workflowStatus = $user->getWorkflowStatus();
@ -556,7 +576,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
// List the documents where a review has been requested.
$this->contentHeading(getMLText("documents_to_process"));
$this->contentContainerStart();
//$this->contentContainerStart();
$printheader=true;
$iRev = array();
$dList = array();
@ -572,15 +592,14 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
$workflow = $latestContent->getWorkflow();
@ -600,6 +619,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$st["date"]." ". htmlspecialchars($docIdx[$st["document"]][$st["version"]]["statusName"]) ."</td>";
print "<td".($docIdx[$st["document"]][$st["version"]]['status']!=S_EXPIRED?"":" class=\"warning\"").">".(!$docIdx[$st["document"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["document"]][$st["version"]]["expires"]))."</td>";
print "</tr>\n";
*/
}
}
foreach ($workflowStatus["g"] as $st) {
@ -614,15 +634,14 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("owner")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$printheader=false;
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
$workflow = $latestContent->getWorkflow();
@ -642,6 +661,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$st["date"]." ". htmlspecialchars($docIdx[$st["document"]][$st["version"]]["statusName"])."</td>";
print "<td".($docIdx[$st["document"]][$st["version"]]['status']!=S_EXPIRED?"":" class=\"warning\"").">".(!$docIdx[$st["document"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["document"]][$st["version"]]["expires"]))."</td>";
print "</tr>\n";
*/
}
}
if (!$printheader){
@ -649,7 +669,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}else{
printMLText("no_docs_to_check");
}
$this->contentContainerEnd();
//$this->contentContainerEnd();
}
// Get list of documents owned by current user that are pending review or
@ -682,7 +702,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}
$this->contentHeading(getMLText("documents_user_requiring_attention"));
$this->contentContainerStart();
//$this->contentContainerStart();
if (count($resArr)>0) {
print "<table class=\"table table-condensed\">";
@ -690,9 +710,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<th></th>";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach ($resArr as $res) {
@ -706,6 +724,8 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
$workflow = $latestContent->getWorkflow();
@ -725,13 +745,14 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$res["statusDate"]." ".htmlspecialchars($res["statusName"])."</td>";
print "<td>".(!$res["expires"] ? "-":getReadableDate($res["expires"]))."</td>";
print "</tr>\n";
*/
}
print "</tbody></table>";
}
else printMLText("no_docs_to_look_at");
$this->contentContainerEnd();
//$this->contentContainerEnd();
}
// Get list of documents locked by current user
@ -762,7 +783,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}
$this->contentHeading(getMLText("documents_locked_by_you"));
$this->contentContainerStart();
//$this->contentContainerStart();
if (count($resArr)>0) {
print "<table class=\"table table-condensed\">";
@ -770,9 +791,7 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<th></th>";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach ($resArr as $res) {
@ -786,6 +805,8 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
if($workflowmode == 'advanced')
@ -809,18 +830,19 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$res["statusDate"]." ".htmlspecialchars($res["statusName"])."</td>";
print "<td>".(!$res["expires"] ? "-":getReadableDate($res["expires"]))."</td>";
print "</tr>\n";
*/
}
print "</tbody></table>";
}
else printMLText("no_docs_locked");
$this->contentContainerEnd();
//$this->contentContainerEnd();
/* Documents expired */
if($docs = $dms->getDocumentsExpired(-3*365, $user)) {
$this->contentHeading(getMLText("documents_expired"));
$this->contentContainerStart();
//$this->contentContainerStart();
if (count($docs)>0) {
print "<table class=\"table table-condensed\">";
@ -828,13 +850,13 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<th></th>";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th>".getMLText("last_update")."</th>\n";
print "<th>".getMLText("expires")."</th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
foreach ($docs as $document) {
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
if($workflowmode == 'advanced')
@ -859,13 +881,14 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
print "<td>".$status["date"]." ".htmlspecialchars($dms->getUser($status["userID"])->getFullName())."</td>";
print "<td>".(!$document->getExpires() ? "-":getReadableDate($document->getExpires()))."</td>";
print "</tr>\n";
}
*/
}
print "</tbody></table>";
}
else printMLText("no_docs_expired");
$this->contentContainerEnd();
//$this->contentContainerEnd();
}
}
@ -916,18 +939,18 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}
$this->contentHeading(getMLText("all_documents"));
$this->contentContainerStart();
//$this->contentContainerStart();
if (count($resArr)>0) {
print "<table class=\"table table-condensed\">";
print "<thead>\n<tr>\n";
print "<th></th>";
print "<th><a href=\"../out/out.MyDocuments.php?orderby=n\">".getMLText("name")."</a></th>\n";
print "<th><a href=\"../out/out.MyDocuments.php?orderby=n\">".getMLText("name")."</a> — \n";
print "<a href=\"../out/out.MyDocuments.php?orderby=u\">".getMLText("last_update")."</a> — \n";
print "<a href=\"../out/out.MyDocuments.php?orderby=e\">".getMLText("expires")."</a></th>\n";
print "<th><a href=\"../out/out.MyDocuments.php?orderby=s\">".getMLText("status")."</a></th>\n";
print "<th>".getMLText("version")."</th>\n";
print "<th><a href=\"../out/out.MyDocuments.php?orderby=u\">".getMLText("last_update")."</a></th>\n";
print "<th><a href=\"../out/out.MyDocuments.php?orderby=e\">".getMLText("expires")."</a></th>\n";
print "<th>".getMLText("action")."</th>\n";
print "</tr>\n</thead>\n<tbody>\n";
$previewer = new SeedDMS_Preview_Previewer($cachedir, $previewwidth, $timeout, $xsendfile);
@ -942,6 +965,8 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
}
}
echo $this->documentListRow($document, $previewer);
/*
print "<tr>\n";
$latestContent = $document->getLatestContent();
$previewer->createPreview($latestContent);
@ -959,12 +984,13 @@ class SeedDMS_View_MyDocuments extends SeedDMS_Bootstrap_Style {
//print "<td>".(!$res["expires"] ? getMLText("does_not_expire"):getReadableDate($res["expires"]))."</td>";
print "<td>".(!$res["expires"] ? "-":getReadableDate($res["expires"]))."</td>";
print "</tr>\n";
*/
}
print "</tbody></table>";
}
else printMLText("empty_notify_list");
$this->contentContainerEnd();
//$this->contentContainerEnd();
}
$this->contentEnd();