diff --git a/views/bootstrap/class.MyDocuments.php b/views/bootstrap/class.MyDocuments.php
index f35477b1a..446ebe7c1 100644
--- a/views/bootstrap/class.MyDocuments.php
+++ b/views/bootstrap/class.MyDocuments.php
@@ -37,6 +37,7 @@ class LetoDMS_View_MyDocuments extends LetoDMS_Bootstrap_Style {
$orderby = $this->params['orderby'];
$showInProcess = $this->params['showinprocess'];
$cachedir = $this->params['cachedir'];
+ $workflowmode = $this->params['workflowmode'];
$db = $dms->getDB();
$previewer = new LetoDMS_Preview_Previewer($cachedir, 40);
@@ -55,40 +56,267 @@ class LetoDMS_View_MyDocuments extends LetoDMS_Bootstrap_Style {
exit;
}
- // Get document list for the current user.
- $reviewStatus = $user->getReviewStatus();
- $approvalStatus = $user->getApprovalStatus();
-
- // Create a comma separated list of all the documentIDs whose information is
- // required.
- $dList = array();
- foreach ($reviewStatus["indstatus"] as $st) {
- if (!in_array($st["documentID"], $dList)) {
- $dList[] = $st["documentID"];
+ if($workflowmode == 'traditional') {
+ // Get document list for the current user.
+ $reviewStatus = $user->getReviewStatus();
+ $approvalStatus = $user->getApprovalStatus();
+
+ // Create a comma separated list of all the documentIDs whose information is
+ // required.
+ $dList = array();
+ foreach ($reviewStatus["indstatus"] as $st) {
+ if (!in_array($st["documentID"], $dList)) {
+ $dList[] = $st["documentID"];
+ }
}
- }
- foreach ($reviewStatus["grpstatus"] as $st) {
- if (!in_array($st["documentID"], $dList)) {
- $dList[] = $st["documentID"];
+ foreach ($reviewStatus["grpstatus"] as $st) {
+ if (!in_array($st["documentID"], $dList)) {
+ $dList[] = $st["documentID"];
+ }
}
- }
- foreach ($approvalStatus["indstatus"] as $st) {
- if (!in_array($st["documentID"], $dList)) {
- $dList[] = $st["documentID"];
+ foreach ($approvalStatus["indstatus"] as $st) {
+ if (!in_array($st["documentID"], $dList)) {
+ $dList[] = $st["documentID"];
+ }
}
- }
- foreach ($approvalStatus["grpstatus"] as $st) {
- if (!in_array($st["documentID"], $dList)) {
- $dList[] = $st["documentID"];
+ foreach ($approvalStatus["grpstatus"] as $st) {
+ if (!in_array($st["documentID"], $dList)) {
+ $dList[] = $st["documentID"];
+ }
}
- }
- $docCSV = "";
- foreach ($dList as $d) {
- $docCSV .= (strlen($docCSV)==0 ? "" : ", ")."'".$d."'";
- }
-
- if (strlen($docCSV)>0) {
- // Get the document information.
+ $docCSV = "";
+ foreach ($dList as $d) {
+ $docCSV .= (strlen($docCSV)==0 ? "" : ", ")."'".$d."'";
+ }
+
+ if (strlen($docCSV)>0) {
+ // Get the document information.
+ $queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ".
+ "`tblDocumentContent`.`version`, `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ".
+ "`tblDocumentStatusLog`.`comment` AS `statusComment`, `tblDocumentStatusLog`.`date` as `statusDate`, ".
+ "`tblDocumentStatusLog`.`userID`, `oTbl`.`fullName` AS `ownerName`, `sTbl`.`fullName` AS `statusName` ".
+ "FROM `tblDocumentContent` ".
+ "LEFT JOIN `tblDocuments` ON `tblDocuments`.`id` = `tblDocumentContent`.`document` ".
+ "LEFT JOIN `tblDocumentStatus` ON `tblDocumentStatus`.`documentID` = `tblDocumentContent`.`document` ".
+ "LEFT JOIN `tblDocumentStatusLog` ON `tblDocumentStatusLog`.`statusID` = `tblDocumentStatus`.`statusID` ".
+ "LEFT JOIN `ttstatid` ON `ttstatid`.`maxLogID` = `tblDocumentStatusLog`.`statusLogID` ".
+ "LEFT JOIN `ttcontentid` ON `ttcontentid`.`maxVersion` = `tblDocumentStatus`.`version` AND `ttcontentid`.`document` = `tblDocumentStatus`.`documentID` ".
+ "LEFT JOIN `tblDocumentLocks` ON `tblDocuments`.`id`=`tblDocumentLocks`.`document` ".
+ "LEFT JOIN `tblUsers` AS `oTbl` on `oTbl`.`id` = `tblDocuments`.`owner` ".
+ "LEFT JOIN `tblUsers` AS `sTbl` on `sTbl`.`id` = `tblDocumentStatusLog`.`userID` ".
+ "WHERE `ttstatid`.`maxLogID`=`tblDocumentStatusLog`.`statusLogID` ".
+ "AND `ttcontentid`.`maxVersion` = `tblDocumentContent`.`version` ".
+ "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.", ".S_EXPIRED.") ".
+ "AND `tblDocuments`.`id` IN (" . $docCSV . ") ".
+ "ORDER BY `statusDate` DESC";
+
+ $resArr = $db->getResultArray($queryStr);
+ if (is_bool($resArr) && !$resArr) {
+ $this->contentHeading(getMLText("warning"));
+ $this->contentContainer(getMLText("internal_error_exit"));
+ $this->htmlEndPage();
+ exit;
+ }
+
+ // Create an array to hold all of these results, and index the array by
+ // document id. This makes it easier to retrieve document ID information
+ // later on and saves us having to repeatedly poll the database every time
+ // new document information is required.
+ $docIdx = array();
+ foreach ($resArr as $res) {
+
+ // verify expiry
+ if ( $res["expires"] && time()>$res["expires"]+24*60*60 ){
+ if ( $res["status"]==S_DRAFT_APP || $res["status"]==S_DRAFT_REV ){
+ $res["status"]=S_EXPIRED;
+ }
+ }
+
+ $docIdx[$res["id"]][$res["version"]] = $res;
+ }
+
+ // List the documents where a review has been requested.
+ $this->contentHeading(getMLText("documents_to_review"));
+ $this->contentContainerStart();
+ $printheader=true;
+ $iRev = array();
+ $dList = array();
+ foreach ($reviewStatus["indstatus"] as $st) {
+
+ if ( $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && !in_array($st["documentID"], $dList) ) {
+ $dList[] = $st["documentID"];
+ $document = $dms->getDocument($st["documentID"]);
+
+ if ($printheader){
+ print "
";
+ print "\n\n";
+ print " | \n";
+ print "".getMLText("name")." | \n";
+ print "".getMLText("owner")." | \n";
+ print "".getMLText("version")." | \n";
+ print "".getMLText("last_update")." | \n";
+ print "".getMLText("expires")." | \n";
+ print "
\n\n\n";
+ $printheader=false;
+ }
+
+ print "\n";
+ $latestContent = $document->getLatestContent();
+ $previewer->createPreview($latestContent);
+ 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 " | ";
+ print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])." | ";
+ print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])." | ";
+ print "".$st["version"]." | ";
+ print "".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"]) ." | ";
+ print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"]))." | ";
+ print "
\n";
+ }
+ }
+ foreach ($reviewStatus["grpstatus"] as $st) {
+
+ if (!in_array($st["documentID"], $iRev) && $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && !in_array($st["documentID"], $dList) && $docIdx[$st["documentID"]][$st["version"]]['owner'] != $user->getId()) {
+ $dList[] = $st["documentID"];
+ $document = $dms->getDocument($st["documentID"]);
+
+ if ($printheader){
+ print "";
+ }else{
+ printMLText("no_docs_to_review");
+ }
+ $this->contentContainerEnd();
+
+ // List the documents where an approval has been requested.
+ $this->contentHeading(getMLText("documents_to_approve"));
+ $this->contentContainerStart();
+ $printheader=true;
+
+ foreach ($approvalStatus["indstatus"] as $st) {
+
+ if ( $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]])) {
+ $document = $dms->getDocument($st["documentID"]);
+
+ if ($printheader){
+ print "";
+ print "\n\n";
+ print " | \n";
+ print "".getMLText("name")." | \n";
+ print "".getMLText("owner")." | \n";
+ print "".getMLText("version")." | \n";
+ print "".getMLText("last_update")." | \n";
+ print "".getMLText("expires")." | \n";
+ print "
\n\n\n";
+ $printheader=false;
+ }
+
+ print "\n";
+ $latestContent = $document->getLatestContent();
+ $previewer->createPreview($latestContent);
+ 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 " | ";
+ print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])." | ";
+ print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])." | ";
+ print "".$st["version"]." | ";
+ print "".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])." | ";
+ print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"]))." | ";
+ print "
\n";
+ }
+ }
+ foreach ($approvalStatus["grpstatus"] as $st) {
+
+ if (!in_array($st["documentID"], $iRev) && $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && $docIdx[$st["documentID"]][$st["version"]]['owner'] != $user->getId()) {
+ if ($printheader){
+ print "\n";
+ }else{
+ printMLText("no_docs_to_approve");
+ }
+ $this->contentContainerEnd();
+ }
+ else {
+
+ $this->contentHeading(getMLText("documents_to_review"));
+ $this->contentContainerStart();
+ printMLText("no_review_needed");
+ $this->contentContainerEnd();
+ $this->contentHeading(getMLText("documents_to_approve"));
+ $this->contentContainerStart();
+ printMLText("no_approval_needed");
+ $this->contentContainerEnd();
+ }
+
+ // Get list of documents owned by current user that are pending review or
+ // pending approval.
$queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ".
"`tblDocumentContent`.`version`, `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ".
"`tblDocumentStatusLog`.`comment` AS `statusComment`, `tblDocumentStatusLog`.`date` as `statusDate`, ".
@@ -104,292 +332,66 @@ class LetoDMS_View_MyDocuments extends LetoDMS_Bootstrap_Style {
"LEFT JOIN `tblUsers` AS `sTbl` on `sTbl`.`id` = `tblDocumentStatusLog`.`userID` ".
"WHERE `ttstatid`.`maxLogID`=`tblDocumentStatusLog`.`statusLogID` ".
"AND `ttcontentid`.`maxVersion` = `tblDocumentContent`.`version` ".
- "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.", ".S_EXPIRED.") ".
- "AND `tblDocuments`.`id` IN (" . $docCSV . ") ".
+ "AND `tblDocuments`.`owner` = '".$user->getID()."' ".
+ "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.") ".
"ORDER BY `statusDate` DESC";
$resArr = $db->getResultArray($queryStr);
if (is_bool($resArr) && !$resArr) {
$this->contentHeading(getMLText("warning"));
- $this->contentContainer(getMLText("internal_error_exit"));
+ $this->contentContainer("Internal error. Unable to complete request. Exiting.");
$this->htmlEndPage();
exit;
}
-
- // Create an array to hold all of these results, and index the array by
- // document id. This makes it easier to retrieve document ID information
- // later on and saves us having to repeatedly poll the database every time
- // new document information is required.
- $docIdx = array();
- foreach ($resArr as $res) {
-
- // verify expiry
- if ( $res["expires"] && time()>$res["expires"]+24*60*60 ){
- if ( $res["status"]==S_DRAFT_APP || $res["status"]==S_DRAFT_REV ){
- $res["status"]=S_EXPIRED;
- }
- }
- $docIdx[$res["id"]][$res["version"]] = $res;
- }
-
- // List the documents where a review has been requested.
- $this->contentHeading(getMLText("documents_to_review"));
+ $this->contentHeading(getMLText("documents_user_requiring_attention"));
$this->contentContainerStart();
- $printheader=true;
- $iRev = array();
- $dList = array();
- foreach ($reviewStatus["indstatus"] as $st) {
-
- if ( $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && !in_array($st["documentID"], $dList) ) {
- $dList[] = $st["documentID"];
- $document = $dms->getDocument($st["documentID"]);
+ if (count($resArr)>0) {
+
+ print "";
+ print "\n\n";
+ print " | ";
+ print "".getMLText("name")." | \n";
+ print "".getMLText("status")." | \n";
+ print "".getMLText("version")." | \n";
+ print "".getMLText("last_update")." | \n";
+ print "".getMLText("expires")." | \n";
+ print "
\n\n\n";
+
+ foreach ($resArr as $res) {
+ $document = $dms->getDocument($res["documentID"]);
- if ($printheader){
- print "";
- print "\n\n";
- print " | \n";
- print "".getMLText("name")." | \n";
- print "".getMLText("owner")." | \n";
- print "".getMLText("version")." | \n";
- print "".getMLText("last_update")." | \n";
- print "".getMLText("expires")." | \n";
- print "
\n\n\n";
- $printheader=false;
+ // verify expiry
+ if ( $res["expires"] && time()>$res["expires"]+24*60*60 ){
+ if ( $res["status"]==S_DRAFT_APP || $res["status"]==S_DRAFT_REV ){
+ $res["status"]=S_EXPIRED;
+ }
}
print "\n";
$latestContent = $document->getLatestContent();
$previewer->createPreview($latestContent);
- print "| ";
+ 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 " | ";
- print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])." | ";
- print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])." | ";
- print "".$st["version"]." | ";
- print "".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"]) ." | ";
- print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"]))." | ";
+ print "" . htmlspecialchars($res["name"]) . " | \n";
+ print "".getOverallStatusText($res["status"])." | ";
+ print "".$res["version"]." | ";
+ print "".$res["statusDate"]." ".htmlspecialchars($res["statusName"])." | ";
+ print "".(!$res["expires"] ? "-":getReadableDate($res["expires"]))." | ";
print "
\n";
- }
- }
- foreach ($reviewStatus["grpstatus"] as $st) {
-
- if (!in_array($st["documentID"], $iRev) && $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && !in_array($st["documentID"], $dList) && $docIdx[$st["documentID"]][$st["version"]]['owner'] != $user->getId()) {
- $dList[] = $st["documentID"];
- $document = $dms->getDocument($st["documentID"]);
-
- if ($printheader){
- print "";
- }else{
- printMLText("no_docs_to_review");
- }
- $this->contentContainerEnd();
-
- // List the documents where an approval has been requested.
- $this->contentHeading(getMLText("documents_to_approve"));
- $this->contentContainerStart();
- $printheader=true;
-
- foreach ($approvalStatus["indstatus"] as $st) {
-
- if ( $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]])) {
- $document = $dms->getDocument($st["documentID"]);
+ }
+ print "
";
- if ($printheader){
- print "";
- print "\n\n";
- print " | \n";
- print "".getMLText("name")." | \n";
- print "".getMLText("owner")." | \n";
- print "".getMLText("version")." | \n";
- print "".getMLText("last_update")." | \n";
- print "".getMLText("expires")." | \n";
- print "
\n\n\n";
- $printheader=false;
- }
-
- print "\n";
- $latestContent = $document->getLatestContent();
- $previewer->createPreview($latestContent);
- 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 " | ";
- print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["name"])." | ";
- print "".htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["ownerName"])." | ";
- print "".$st["version"]." | ";
- print "".$st["date"]." ". htmlspecialchars($docIdx[$st["documentID"]][$st["version"]]["statusName"])." | ";
- print "".(!$docIdx[$st["documentID"]][$st["version"]]["expires"] ? "-":getReadableDate($docIdx[$st["documentID"]][$st["version"]]["expires"]))." | ";
- print "
\n";
- }
}
- foreach ($approvalStatus["grpstatus"] as $st) {
+ else printMLText("no_docs_to_look_at");
- if (!in_array($st["documentID"], $iRev) && $st["status"]==0 && isset($docIdx[$st["documentID"]][$st["version"]]) && $docIdx[$st["documentID"]][$st["version"]]['owner'] != $user->getId()) {
- if ($printheader){
- print "\n";
- }else{
- printMLText("no_docs_to_approve");
- }
$this->contentContainerEnd();
}
- else {
-
- $this->contentHeading(getMLText("documents_to_review"));
- $this->contentContainerStart();
- printMLText("no_review_needed");
- $this->contentContainerEnd();
- $this->contentHeading(getMLText("documents_to_approve"));
- $this->contentContainerStart();
- printMLText("no_approval_needed");
- $this->contentContainerEnd();
- }
-
- // Get list of documents owned by current user that are pending review or
- // pending approval.
- $queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ".
- "`tblDocumentContent`.`version`, `tblDocumentStatus`.*, `tblDocumentStatusLog`.`status`, ".
- "`tblDocumentStatusLog`.`comment` AS `statusComment`, `tblDocumentStatusLog`.`date` as `statusDate`, ".
- "`tblDocumentStatusLog`.`userID`, `oTbl`.`fullName` AS `ownerName`, `sTbl`.`fullName` AS `statusName` ".
- "FROM `tblDocumentContent` ".
- "LEFT JOIN `tblDocuments` ON `tblDocuments`.`id` = `tblDocumentContent`.`document` ".
- "LEFT JOIN `tblDocumentStatus` ON `tblDocumentStatus`.`documentID` = `tblDocumentContent`.`document` ".
- "LEFT JOIN `tblDocumentStatusLog` ON `tblDocumentStatusLog`.`statusID` = `tblDocumentStatus`.`statusID` ".
- "LEFT JOIN `ttstatid` ON `ttstatid`.`maxLogID` = `tblDocumentStatusLog`.`statusLogID` ".
- "LEFT JOIN `ttcontentid` ON `ttcontentid`.`maxVersion` = `tblDocumentStatus`.`version` AND `ttcontentid`.`document` = `tblDocumentStatus`.`documentID` ".
- "LEFT JOIN `tblDocumentLocks` ON `tblDocuments`.`id`=`tblDocumentLocks`.`document` ".
- "LEFT JOIN `tblUsers` AS `oTbl` on `oTbl`.`id` = `tblDocuments`.`owner` ".
- "LEFT JOIN `tblUsers` AS `sTbl` on `sTbl`.`id` = `tblDocumentStatusLog`.`userID` ".
- "WHERE `ttstatid`.`maxLogID`=`tblDocumentStatusLog`.`statusLogID` ".
- "AND `ttcontentid`.`maxVersion` = `tblDocumentContent`.`version` ".
- "AND `tblDocuments`.`owner` = '".$user->getID()."' ".
- "AND `tblDocumentStatusLog`.`status` IN (".S_DRAFT_REV.", ".S_DRAFT_APP.") ".
- "ORDER BY `statusDate` DESC";
-
- $resArr = $db->getResultArray($queryStr);
- if (is_bool($resArr) && !$resArr) {
- $this->contentHeading(getMLText("warning"));
- $this->contentContainer("Internal error. Unable to complete request. Exiting.");
- $this->htmlEndPage();
- exit;
- }
-
- $this->contentHeading(getMLText("documents_user_requiring_attention"));
- $this->contentContainerStart();
- if (count($resArr)>0) {
-
- print "";
-
- }
- else printMLText("no_docs_to_look_at");
-
- $this->contentContainerEnd();
-
// Get list of documents locked by current user
$queryStr = "SELECT `tblDocuments`.*, `tblDocumentLocks`.`userID` as `lockUser`, ".