From ddd9d1d106cb45ea451cb50166361694cb2557bf Mon Sep 17 00:00:00 2001 From: michael Date: Wed, 6 Aug 2003 10:23:05 +0000 Subject: [PATCH] (#2839) used statusPage for deletion failure error messages also reset document status to live if it can't be deleted on the filesystem --- presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php | 16 +++++++++------- presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentUI.inc | 18 +++++++++++------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php index 125eb0f..f157af3 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php @@ -81,23 +81,25 @@ if (checkSession()) { //could not delete the document from the file system $default->log->error("deleteDocumentBL.php Filesystem error deleting document " . $oDocument->getFileName() . " from folder " . Folder::getFolderPath($oDocument->getFolderID()) . " id=" . $oDocument->getFolderID()); //reverse the document deletion - $oDocument->create(); + $oDocument->setStatusID(LIVE); + $oDocument->update(); //get rid of the document transaction $oDocumentTransaction->delete(); require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(renderErrorPage("The document could not be deleted from the file system")); + $oPatternCustom->setHtml(renderErrorPage("The document could not be deleted from the file system", $fDocumentID)); $main->setCentralPayload($oPatternCustom); $main->render(); } } else { - //could not delete the document in the db + //could not update the documents status in the db $default->log->error("deleteDocumentBL.php DB error deleting document " . $oDocument->getFileName() . " from folder " . Folder::getFolderPath($oDocument->getFolderID()) . " id=" . $oDocument->getFolderID()); + //get rid of the document transaction $oDocumentTransaction->delete(); require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(renderErrorPage("The document could not be deleted from the database")); + $oPatternCustom->setHtml(renderErrorPage("The document could not be deleted from the database", $fDocumentID)); $main->setCentralPayload($oPatternCustom); $main->render(); } @@ -105,7 +107,7 @@ if (checkSession()) { //could not load document object require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(renderErrorPage("An error occured whilst retrieving the document from the database")); + $oPatternCustom->setHtml(renderErrorPage("An error occured whilst retrieving the document from the database", $fDocumentID)); $main->setCentralPayload($oPatternCustom); $main->render(); } @@ -122,7 +124,7 @@ if (checkSession()) { // there are active collaboration roles for this doc require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(renderErrorPage("You can't delete this document because it's still in collaboration")); + $oPatternCustom->setHtml(renderErrorPage("You can't delete this document because it's still in collaboration", $fDocumentID)); $main->setCentralPayload($oPatternCustom); $main->render(); } @@ -130,7 +132,7 @@ if (checkSession()) { //user does not have permission to delete the document require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(renderErrorPage("You do not have permission to delete this document")); + $oPatternCustom->setHtml(renderErrorPage("You do not have permission to delete this document", $fDocumentID)); $main->setCentralPayload($oPatternCustom); $main->render(); } diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentUI.inc b/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentUI.inc index 5416d21..be59176 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentUI.inc @@ -51,13 +51,17 @@ function getPage($iDocumentID, $iFolderID, $sDocumentName) { } -function renderErrorPage($sErrorMessage) { +function renderErrorPage($sErrorMessage, $iDocumentID = "") { global $default; - $sToRender = renderHeading("Delete Document"); - $sToRender .= "\n"; - $sToRender .= "

$sErrorMessage

\n" . - "graphicsUrl/widgets/back.gif\" border=\"0\"/>\n" . - "

\n"; - return $sToRender; + if ($iDocumentID) { + return statusPage("Delete Document", "", $sErrorMessage, "viewDocument", "fDocumentID=$iDocumentID"); + } else { + $sToRender = renderHeading("Delete Document"); + $sToRender .= "\n"; + $sToRender .= "

$sErrorMessage

\n" . + "graphicsUrl/widgets/back.gif\" border=\"0\"/>\n" . + "

\n"; + return $sToRender; + } } ?> -- libgit2 0.21.4