From dbf1b2b9077c589537f007561d19b5bd717dbed3 Mon Sep 17 00:00:00 2001 From: Michael Joseph Date: Fri, 1 Aug 2003 13:30:11 +0000 Subject: [PATCH] (#2806) corrected web publishing code --- presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php | 68 +++++++++++++++++++++++++++++++++++++++----------------------------- 1 file changed, 39 insertions(+), 29 deletions(-) diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php index 5343d68..c76d003 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php @@ -155,37 +155,47 @@ if (checkSession()) { } $main->setDHTMLScrolling(false); - } else if ((isset($fForPublish)) && (!DocumentCollaboration::documentIsPendingWebPublishing($fDocumentID))) { + } else if (isset($fForPublish) && + !DocumentCollaboration::documentIsPublished($fDocumentID) && + !DocumentCollaboration::documentIsPendingWebPublishing($fDocumentID)) { + if ($fSubmit) { // user wishes to publish document - $aWebDocument = WebDocument::get(lookupID($default->owl_web_documents_table, "document_id", $fDocumentID)); - - if (strlen($fWebSiteID) > 0) { - $oWebDocument->setStatusID(PENDING); - $oWebDocument->setWebSiteID($fWebSiteID); - $oWebDocument->setDateTime(getCurrentDateTime()); - } else { - $oWebDocument->setStatusID(PUBLISHED); - $oWebDocument->setWebSiteID(-1); - $oWebDocument->setDateTime(getCurrentDateTime()); - } - - if ($oWebDocument->update()) { - $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document sent for web publishing", UPDATE); - $oDocumentTransaction->create(); - if ((strlen($fWebSiteID) > 0) && (strlen($fComment) > 0)) { - DocumentCollaboration::notifyWebMaster($fDocumentID, $fComment); - } - if ((strlen($fWebSiteID) > 0) && (strlen($fComment) > 0)) { - $sStatusMessage = "The document has been marked as pending publishing and the web publisher has been notified"; - } else { - $sStatusMessage = "The document has been published"; - } - $oPatternCustom->setHtml(getPage($oDocument, true, $sStatusMessage)); - } else { - $sStatusMessage = "An error occured while attempting to update the document for publishing"; - $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); - } + $oWebDocument = WebDocument::get(lookupID($default->owl_web_documents_table, "document_id", $fDocumentID)); + $default->log->info("retrieved web document=" . arrayToString($oWebDocument)); + if ($oWebDocument) { + if ($fWebSiteID) { + $oWebDocument->setStatusID(PENDING); + $oWebDocument->setWebSiteID($fWebSiteID); + $oWebDocument->setDateTime(getCurrentDateTime()); + } else { + $oWebDocument->setStatusID(PUBLISHED); + $oWebDocument->setWebSiteID(-1); + $oWebDocument->setDateTime(getCurrentDateTime()); + } + + if ($oWebDocument->update()) { + $default->log->info("updated status=" . arrayToString($oWebDocument)); + $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document sent for web publishing", UPDATE); + $oDocumentTransaction->create(); + if ((strlen($fWebSiteID) > 0)) { + DocumentCollaboration::notifyWebMaster($fDocumentID, $fComment); + } + if ($fWebSiteID) { + $sStatusMessage = "The document has been marked as pending publishing and the web publisher has been notified"; + } else { + $sStatusMessage = "The document has been published"; + } + $default->log->info("printing page"); + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); + } else { + $sStatusMessage = "An error occured while attempting to update the document for publishing. Please try again later."; + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); + } + } else { + $sStatusMessage = "An error occured while attempting to update the document for publishing. Please try again later."; + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); + } } else { // prompt for the website to publish to $oPatternCustom->setHtml(getWebPublishPage($oDocument)); -- libgit2 0.21.4