diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php index bdeb6b8..c622059 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php @@ -168,23 +168,38 @@ if (checkSession()) { $main->render(); } } else if ((isset($fForPublish)) && (!DocumentCollaboration::documentIsPendingWebPublishing($fDocumentID))) { - if (isset($fWebSiteID)) { - // user wishes to publish document - $oDocument = Document::get($fDocumentID); - $aWebDocument = WebDocument::getList("document_id = $fDocumentID"); - $oWebDocument = $aWebDocument[0]; - $oWebDocument->setStatusID(PENDING); - $oWebDocument->setWebSiteID($fWebSiteID); + if ($fSubmit) { + // user wishes to publish document + $oDocument = Document::get($fDocumentID); + $aWebDocument = WebDocument::getList("document_id = $fDocumentID"); + $oWebDocument = $aWebDocument[0]; + + 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()) { require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document sent for web publishing", UPDATE); $oDocumentTransaction->create(); $oDocument = Document::get($fDocumentID); - DocumentCollaboration::notifyWebMaster($fDocumentID, $fComment); + if ((strlen($fWebSiteID) > 0) && (strlen($fComment) > 0)) { + DocumentCollaboration::notifyWebMaster($fDocumentID, $fComment); + } $oPatternCustom = & new PatternCustom(); $oPatternCustom->setHtml(getEditPage($oDocument)); $main->setCentralPayload($oPatternCustom); - $main->setErrorMessage("The document has been marked as pending publishing and the web publisher has been notified"); + if ((strlen($fWebSiteID) > 0) && (strlen($fComment) > 0)) { + $main->setErrorMessage("The document has been marked as pending publishing and the web publisher has been notified"); + } else { + $main->setErrorMessage("The document has been published"); + } $main->render(); } else { @@ -204,7 +219,6 @@ if (checkSession()) { $oPatternCustom->setHtml(getWebPublishPage($oDocument)); $main->setCentralPayload($oPatternCustom); $main->setFormAction($_SERVER['PHP_SELF']); - $main->setHasRequiredFields(true); $main->render(); } diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc b/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc index b5a7ba0..5e657e1 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc @@ -293,7 +293,7 @@ function getEditPage($oDocument) { $sToRender .= "\t\t\n"; } - if (!DocumentCollaboration::documentIsPendingWebPublishing($iDocumentID)) { + if (!DocumentCollaboration::documentIsPendingWebPublishing($iDocumentID) && !DocumentCollaboration::documentIsPublished($iDocumentID)) { // only display for unpublished documents // if there is collaboration if ($oDocument->hasCollaboration()) { @@ -501,6 +501,7 @@ function getWebPublishPage($oDocument) { $sToRender .= "\t\n"; $sToRender .= "\t\t" . $oPatternListBox->render() . "\n"; $sToRender .= "\t\t\n"; + $sToRender .= "\t\t\n"; $sToRender .= "\t"; $sToRender .= "\t\n"; $sToRender .= "\t\tEnter a comment for the web master:\n"; @@ -517,15 +518,6 @@ function getWebPublishPage($oDocument) { $sToRender .= "\n"; $sToRender .= ""; - $sToRender .= "\n\n\n\n"; - return $sToRender; }