Commit 6a339cfd101af9dc29d1c68d0344486d99c56f64
1 parent
c45860c5
status message refactor
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2202 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
51 additions
and
45 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php
| ... | ... | @@ -64,11 +64,12 @@ if (checkSession()) { |
| 64 | 64 | if (isset($fDocumentID)) { |
| 65 | 65 | $oDocument = & Document::get($fDocumentID); |
| 66 | 66 | if (isset($fCollaborationEdit) && Permission::userHasDocumentWritePermission($fDocumentID)) { |
| 67 | - //return value from collaborationBL.php. User attempted to edt | |
| 67 | + //return value from collaborationBL.php. User attempted to edit | |
| 68 | 68 | //a step in the document collaboration process that is currently being |
| 69 | 69 | //executed |
| 70 | - $oPatternCustom->setHtml(getPage($oDocument, true)); | |
| 71 | - $main->setErrorMessage("You cannot edit a document collaboration step that is completed or currently underway"); | |
| 70 | + $sStatusMessage = "You cannot edit a document collaboration step that is completed or currently underway"; | |
| 71 | + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 72 | + $main->setDHTMLScrolling(false); | |
| 72 | 73 | $main->setFormAction("$default->rootUrl/control.php?action=modifyDocument&fDocumentID=" . $oDocument->getID()); |
| 73 | 74 | } else if (isset($fBeginCollaboration) && Permission::userHasDocumentWritePermission($fDocumentID)) { |
| 74 | 75 | //begin the collaboration process |
| ... | ... | @@ -84,51 +85,54 @@ if (checkSession()) { |
| 84 | 85 | //DocumentCollaboration::resetDocumentCollaborationSteps($fDocumentID); |
| 85 | 86 | |
| 86 | 87 | $oDocument->beginCollaborationProcess(); |
| 87 | - $oPatternCustom->setHtml(getPage($oDocument, true)); | |
| 88 | - $main->setErrorMessage("Document collaboration successfully started"); | |
| 88 | + $sStatusMessage = "Document collaboration successfully started"; | |
| 89 | + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 89 | 90 | } else { |
| 90 | 91 | //not all the roles have actual users assigned to them, so we must assign the |
| 91 | 92 | //default users and then proceed |
| 92 | 93 | |
| 93 | 94 | FolderUserRole::createDefaultFolderUserRoles($oDocument); |
| 94 | 95 | $oDocument->beginCollaborationProcess(); |
| 95 | - $oPatternCustom->setHtml(getPage($oDocument, true)); | |
| 96 | - $main->setErrorMessage("Document collaboration successfully started"); | |
| 96 | + $sStatusMessage = "Document collaboration successfully started"; | |
| 97 | + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 97 | 98 | } |
| 98 | 99 | } else { |
| 99 | 100 | //the folder has no collaboration set up yet, so we can't start document collaboration |
| 100 | - $oPatternCustom->setHtml(getPage($oDocument, true)); | |
| 101 | - $main->setErrorMessage("The collaboration steps for the folder must be set up before collaboration can begin"); | |
| 101 | + $sStatusMessage = "The collaboration steps for the folder must be set up before collaboration can begin"; | |
| 102 | + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 102 | 103 | } |
| 104 | + $main->setDHTMLScrolling(false); | |
| 105 | + | |
| 103 | 106 | } else if ((isset($fCollaborationStepComplete)) && (DocumentCollaboration::userIsPerformingCurrentCollaborationStep($fDocumentID))) { |
| 104 | - //the user has signled that they have completed their step in the collaboration process | |
| 105 | - if (DocumentCollaboration::isLastStepInCollaborationProcess($fDocumentID)) { | |
| 106 | - //the last step in the collaboration process has been performed- email the document creator | |
| 107 | - $oDocument->endCollaborationProcess(); | |
| 108 | - | |
| 109 | - // on the last collaboration step- trigger a major revision | |
| 110 | - // major version number rollover | |
| 111 | - $oDocument->setMajorVersionNumber($oDocument->getMajorVersionNumber()+1); | |
| 112 | - // reset minor version number | |
| 113 | - $oDocument->setMinorVersionNumber(0); | |
| 114 | - $oDocument->update(); | |
| 115 | - // TODO: create a transaction? | |
| 116 | - | |
| 117 | - $oUser = User::get($oDocument->getCreatorID()); | |
| 118 | - $sBody = $oUser->getName() . ", the collaboration process for the document, '" . generateLink("/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php", "fDocumentID=" . $oDocument->getID(), $oDocument->getName()) . "', has been completed. "; | |
| 119 | - $oEmail = & new Email(); | |
| 120 | - $oEmail->send($oUser->getEmail(), "Document collaboration complete", $sBody); | |
| 121 | - | |
| 122 | - //possibly set the document up for web publishing???? | |
| 123 | - $oPatternCustom->setHtml(getPage($oDocument, true)); | |
| 124 | - $main->setErrorMessage("Document collaboration complete. The document initiator has been notified"); | |
| 125 | - | |
| 126 | - } else { | |
| 127 | - //start the next steps if all criteria are met | |
| 128 | - DocumentCollaboration::beginNextStepInCollaborationProcess($fDocumentID, $_SESSION["userID"]); | |
| 129 | - $oPatternCustom->setHtml(getPage($oDocument, true)); | |
| 130 | - $main->setErrorMessage("The next steps in the collaboration process have been started"); | |
| 131 | - } | |
| 107 | + //the user has signled that they have completed their step in the collaboration process | |
| 108 | + if (DocumentCollaboration::isLastStepInCollaborationProcess($fDocumentID)) { | |
| 109 | + //the last step in the collaboration process has been performed- email the document creator | |
| 110 | + $oDocument->endCollaborationProcess(); | |
| 111 | + | |
| 112 | + // on the last collaboration step- trigger a major revision | |
| 113 | + // major version number rollover | |
| 114 | + $oDocument->setMajorVersionNumber($oDocument->getMajorVersionNumber()+1); | |
| 115 | + // reset minor version number | |
| 116 | + $oDocument->setMinorVersionNumber(0); | |
| 117 | + $oDocument->update(); | |
| 118 | + // TODO: create a transaction? | |
| 119 | + | |
| 120 | + $oUser = User::get($oDocument->getCreatorID()); | |
| 121 | + $sBody = $oUser->getName() . ", the collaboration process for the document, '" . generateLink("/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php", "fDocumentID=" . $oDocument->getID(), $oDocument->getName()) . "', has been completed. "; | |
| 122 | + $oEmail = & new Email(); | |
| 123 | + $oEmail->send($oUser->getEmail(), "Document collaboration complete", $sBody); | |
| 124 | + | |
| 125 | + //possibly set the document up for web publishing???? | |
| 126 | + $sStatusMessage = "Document collaboration complete. The document initiator has been notified"; | |
| 127 | + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 128 | + } else { | |
| 129 | + //start the next steps if all criteria are met | |
| 130 | + DocumentCollaboration::beginNextStepInCollaborationProcess($fDocumentID, $_SESSION["userID"]); | |
| 131 | + $sStatusMessage = "The next steps in the collaboration process have been started"; | |
| 132 | + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 133 | + } | |
| 134 | + $main->setDHTMLScrolling(false); | |
| 135 | + | |
| 132 | 136 | } else if ((isset($fForPublish)) && (!DocumentCollaboration::documentIsPendingWebPublishing($fDocumentID))) { |
| 133 | 137 | if ($fSubmit) { |
| 134 | 138 | // user wishes to publish document |
| ... | ... | @@ -151,21 +155,22 @@ if (checkSession()) { |
| 151 | 155 | if ((strlen($fWebSiteID) > 0) && (strlen($fComment) > 0)) { |
| 152 | 156 | DocumentCollaboration::notifyWebMaster($fDocumentID, $fComment); |
| 153 | 157 | } |
| 154 | - $oPatternCustom->setHtml(getPage($oDocument, true)); | |
| 155 | 158 | if ((strlen($fWebSiteID) > 0) && (strlen($fComment) > 0)) { |
| 156 | - $main->setErrorMessage("The document has been marked as pending publishing and the web publisher has been notified"); | |
| 159 | + $sStatusMessage = "The document has been marked as pending publishing and the web publisher has been notified"; | |
| 157 | 160 | } else { |
| 158 | - $main->setErrorMessage("The document has been published"); | |
| 161 | + $sStatusMessage = "The document has been published"; | |
| 159 | 162 | } |
| 163 | + $oPatternCustom->setHtml(getPage($oDocument, true, $sStatusMessage)); | |
| 160 | 164 | } else { |
| 161 | - $oPatternCustom->setHtml(getPage($oDocument, false)); | |
| 162 | - $main->setErrorMessage("An error occured while attempting to update the document for publishing"); | |
| 165 | + $sStatusMessage = "An error occured while attempting to update the document for publishing"; | |
| 166 | + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 163 | 167 | } |
| 164 | 168 | } else { |
| 165 | 169 | // prompt for the website to publish to |
| 166 | 170 | $oPatternCustom->setHtml(getWebPublishPage($oDocument)); |
| 167 | 171 | $main->setFormAction($_SERVER['PHP_SELF']); |
| 168 | 172 | } |
| 173 | + $main->setDHTMLScrolling(false); | |
| 169 | 174 | |
| 170 | 175 | } else if (Permission::userHasDocumentWritePermission($fDocumentID) || Permission::userHasDocumentReadPermission($fDocumentID)) { |
| 171 | 176 | |
| ... | ... | @@ -186,8 +191,10 @@ if (checkSession()) { |
| 186 | 191 | } else if (Permission::userHasDocumentReadPermission($fDocumentID)) { |
| 187 | 192 | $oPatternCustom->setHtml(getPage($oDocument, false)); |
| 188 | 193 | } |
| 194 | + $main->setDHTMLScrolling(false); | |
| 195 | + $main->setOnLoadJavaScript("switchDiv('" . (isset($fShowSection) ? $fShowSection : "documentData") . "', 'document')"); | |
| 196 | + | |
| 189 | 197 | } else if ($oDocument->isArchived()) { |
| 190 | - $main->setErrorMessage("This document has been archived."); | |
| 191 | 198 | |
| 192 | 199 | // allow admins to restore the document |
| 193 | 200 | if (Permission::userIsSystemAdministrator() || Permission::userIsUnitAdministrator()) { |
| ... | ... | @@ -200,8 +207,6 @@ if (checkSession()) { |
| 200 | 207 | $oPatternCustom->setHtml("<a href=\"" . generateControllerLink("browse", "fFolderID=" . $oDocument->getFolderID()) . "\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\" /></a>\n"); |
| 201 | 208 | $main->setErrorMessage("The document you have chosen no longer exists in the DMS."); |
| 202 | 209 | } |
| 203 | - $main->setDHTMLScrolling(false); | |
| 204 | - $main->setOnLoadJavaScript("switchDiv('documentData', 'document')"); | |
| 205 | 210 | $main->setFormAction("$default->rootUrl/control.php?action=modifyDocument&fDocumentID=" . $oDocument->getID()); |
| 206 | 211 | } else { |
| 207 | 212 | if ($oDocument) { |
| ... | ... | @@ -211,6 +216,7 @@ if (checkSession()) { |
| 211 | 216 | } |
| 212 | 217 | $main->setErrorMessage("Either you do not have permission to view this document, or the document you have chosen no longer exists on the file system."); |
| 213 | 218 | } |
| 219 | + | |
| 214 | 220 | } else { |
| 215 | 221 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 216 | 222 | $oPatternCustom->setHtml("<a href=\"javascript:history.go(-1)\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\" /></a>\n"); | ... | ... |