Commit ddd9d1d106cb45ea451cb50166361694cb2557bf
1 parent
25de8399
(#2839) used statusPage for deletion failure error messages
also reset document status to live if it can't be deleted on the filesystem git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2544 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
20 additions
and
14 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php
| ... | ... | @@ -81,23 +81,25 @@ if (checkSession()) { |
| 81 | 81 | //could not delete the document from the file system |
| 82 | 82 | $default->log->error("deleteDocumentBL.php Filesystem error deleting document " . $oDocument->getFileName() . " from folder " . Folder::getFolderPath($oDocument->getFolderID()) . " id=" . $oDocument->getFolderID()); |
| 83 | 83 | //reverse the document deletion |
| 84 | - $oDocument->create(); | |
| 84 | + $oDocument->setStatusID(LIVE); | |
| 85 | + $oDocument->update(); | |
| 85 | 86 | //get rid of the document transaction |
| 86 | 87 | $oDocumentTransaction->delete(); |
| 87 | 88 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 88 | 89 | $oPatternCustom = & new PatternCustom(); |
| 89 | - $oPatternCustom->setHtml(renderErrorPage("The document could not be deleted from the file system")); | |
| 90 | + $oPatternCustom->setHtml(renderErrorPage("The document could not be deleted from the file system", $fDocumentID)); | |
| 90 | 91 | $main->setCentralPayload($oPatternCustom); |
| 91 | 92 | $main->render(); |
| 92 | 93 | } |
| 93 | 94 | } else { |
| 94 | - //could not delete the document in the db | |
| 95 | + //could not update the documents status in the db | |
| 95 | 96 | $default->log->error("deleteDocumentBL.php DB error deleting document " . $oDocument->getFileName() . " from folder " . Folder::getFolderPath($oDocument->getFolderID()) . " id=" . $oDocument->getFolderID()); |
| 96 | 97 | |
| 98 | + //get rid of the document transaction | |
| 97 | 99 | $oDocumentTransaction->delete(); |
| 98 | 100 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 99 | 101 | $oPatternCustom = & new PatternCustom(); |
| 100 | - $oPatternCustom->setHtml(renderErrorPage("The document could not be deleted from the database")); | |
| 102 | + $oPatternCustom->setHtml(renderErrorPage("The document could not be deleted from the database", $fDocumentID)); | |
| 101 | 103 | $main->setCentralPayload($oPatternCustom); |
| 102 | 104 | $main->render(); |
| 103 | 105 | } |
| ... | ... | @@ -105,7 +107,7 @@ if (checkSession()) { |
| 105 | 107 | //could not load document object |
| 106 | 108 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 107 | 109 | $oPatternCustom = & new PatternCustom(); |
| 108 | - $oPatternCustom->setHtml(renderErrorPage("An error occured whilst retrieving the document from the database")); | |
| 110 | + $oPatternCustom->setHtml(renderErrorPage("An error occured whilst retrieving the document from the database", $fDocumentID)); | |
| 109 | 111 | $main->setCentralPayload($oPatternCustom); |
| 110 | 112 | $main->render(); |
| 111 | 113 | } |
| ... | ... | @@ -122,7 +124,7 @@ if (checkSession()) { |
| 122 | 124 | // there are active collaboration roles for this doc |
| 123 | 125 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 124 | 126 | $oPatternCustom = & new PatternCustom(); |
| 125 | - $oPatternCustom->setHtml(renderErrorPage("You can't delete this document because it's still in collaboration")); | |
| 127 | + $oPatternCustom->setHtml(renderErrorPage("You can't delete this document because it's still in collaboration", $fDocumentID)); | |
| 126 | 128 | $main->setCentralPayload($oPatternCustom); |
| 127 | 129 | $main->render(); |
| 128 | 130 | } |
| ... | ... | @@ -130,7 +132,7 @@ if (checkSession()) { |
| 130 | 132 | //user does not have permission to delete the document |
| 131 | 133 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 132 | 134 | $oPatternCustom = & new PatternCustom(); |
| 133 | - $oPatternCustom->setHtml(renderErrorPage("You do not have permission to delete this document")); | |
| 135 | + $oPatternCustom->setHtml(renderErrorPage("You do not have permission to delete this document", $fDocumentID)); | |
| 134 | 136 | $main->setCentralPayload($oPatternCustom); |
| 135 | 137 | $main->render(); |
| 136 | 138 | } | ... | ... |
presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentUI.inc
| ... | ... | @@ -51,13 +51,17 @@ function getPage($iDocumentID, $iFolderID, $sDocumentName) { |
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | -function renderErrorPage($sErrorMessage) { | |
| 54 | +function renderErrorPage($sErrorMessage, $iDocumentID = "") { | |
| 55 | 55 | global $default; |
| 56 | - $sToRender = renderHeading("Delete Document"); | |
| 57 | - $sToRender .= "<table>\n"; | |
| 58 | - $sToRender .= "<tr><td><p class=\"errorText\">$sErrorMessage</p>\n" . | |
| 59 | - "<a href=\"javascript:history.go(-1)\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\"/></a>\n" . | |
| 60 | - "</p></td></tr></table>\n"; | |
| 61 | - return $sToRender; | |
| 56 | + if ($iDocumentID) { | |
| 57 | + return statusPage("Delete Document", "", $sErrorMessage, "viewDocument", "fDocumentID=$iDocumentID"); | |
| 58 | + } else { | |
| 59 | + $sToRender = renderHeading("Delete Document"); | |
| 60 | + $sToRender .= "<table>\n"; | |
| 61 | + $sToRender .= "<tr><td><p class=\"errorText\">$sErrorMessage</p>\n" . | |
| 62 | + "<a href=\"javascript:history.go(-1)\"><img src=\"$default->graphicsUrl/widgets/back.gif\" border=\"0\"/></a>\n" . | |
| 63 | + "</p></td></tr></table>\n"; | |
| 64 | + return $sToRender; | |
| 65 | + } | |
| 62 | 66 | } |
| 63 | 67 | ?> | ... | ... |