Commit dbf1b2b9077c589537f007561d19b5bd717dbed3
1 parent
837be8d9
(#2806) corrected web publishing code
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2477 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
39 additions
and
29 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php
| ... | ... | @@ -155,37 +155,47 @@ if (checkSession()) { |
| 155 | 155 | } |
| 156 | 156 | $main->setDHTMLScrolling(false); |
| 157 | 157 | |
| 158 | - } else if ((isset($fForPublish)) && (!DocumentCollaboration::documentIsPendingWebPublishing($fDocumentID))) { | |
| 158 | + } else if (isset($fForPublish) && | |
| 159 | + !DocumentCollaboration::documentIsPublished($fDocumentID) && | |
| 160 | + !DocumentCollaboration::documentIsPendingWebPublishing($fDocumentID)) { | |
| 161 | + | |
| 159 | 162 | if ($fSubmit) { |
| 160 | 163 | // user wishes to publish document |
| 161 | - $aWebDocument = WebDocument::get(lookupID($default->owl_web_documents_table, "document_id", $fDocumentID)); | |
| 162 | - | |
| 163 | - if (strlen($fWebSiteID) > 0) { | |
| 164 | - $oWebDocument->setStatusID(PENDING); | |
| 165 | - $oWebDocument->setWebSiteID($fWebSiteID); | |
| 166 | - $oWebDocument->setDateTime(getCurrentDateTime()); | |
| 167 | - } else { | |
| 168 | - $oWebDocument->setStatusID(PUBLISHED); | |
| 169 | - $oWebDocument->setWebSiteID(-1); | |
| 170 | - $oWebDocument->setDateTime(getCurrentDateTime()); | |
| 171 | - } | |
| 172 | - | |
| 173 | - if ($oWebDocument->update()) { | |
| 174 | - $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document sent for web publishing", UPDATE); | |
| 175 | - $oDocumentTransaction->create(); | |
| 176 | - if ((strlen($fWebSiteID) > 0) && (strlen($fComment) > 0)) { | |
| 177 | - DocumentCollaboration::notifyWebMaster($fDocumentID, $fComment); | |
| 178 | - } | |
| 179 | - if ((strlen($fWebSiteID) > 0) && (strlen($fComment) > 0)) { | |
| 180 | - $sStatusMessage = "The document has been marked as pending publishing and the web publisher has been notified"; | |
| 181 | - } else { | |
| 182 | - $sStatusMessage = "The document has been published"; | |
| 183 | - } | |
| 184 | - $oPatternCustom->setHtml(getPage($oDocument, true, $sStatusMessage)); | |
| 185 | - } else { | |
| 186 | - $sStatusMessage = "An error occured while attempting to update the document for publishing"; | |
| 187 | - $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 188 | - } | |
| 164 | + $oWebDocument = WebDocument::get(lookupID($default->owl_web_documents_table, "document_id", $fDocumentID)); | |
| 165 | + $default->log->info("retrieved web document=" . arrayToString($oWebDocument)); | |
| 166 | + if ($oWebDocument) { | |
| 167 | + if ($fWebSiteID) { | |
| 168 | + $oWebDocument->setStatusID(PENDING); | |
| 169 | + $oWebDocument->setWebSiteID($fWebSiteID); | |
| 170 | + $oWebDocument->setDateTime(getCurrentDateTime()); | |
| 171 | + } else { | |
| 172 | + $oWebDocument->setStatusID(PUBLISHED); | |
| 173 | + $oWebDocument->setWebSiteID(-1); | |
| 174 | + $oWebDocument->setDateTime(getCurrentDateTime()); | |
| 175 | + } | |
| 176 | + | |
| 177 | + if ($oWebDocument->update()) { | |
| 178 | + $default->log->info("updated status=" . arrayToString($oWebDocument)); | |
| 179 | + $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document sent for web publishing", UPDATE); | |
| 180 | + $oDocumentTransaction->create(); | |
| 181 | + if ((strlen($fWebSiteID) > 0)) { | |
| 182 | + DocumentCollaboration::notifyWebMaster($fDocumentID, $fComment); | |
| 183 | + } | |
| 184 | + if ($fWebSiteID) { | |
| 185 | + $sStatusMessage = "The document has been marked as pending publishing and the web publisher has been notified"; | |
| 186 | + } else { | |
| 187 | + $sStatusMessage = "The document has been published"; | |
| 188 | + } | |
| 189 | + $default->log->info("printing page"); | |
| 190 | + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 191 | + } else { | |
| 192 | + $sStatusMessage = "An error occured while attempting to update the document for publishing. Please try again later."; | |
| 193 | + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 194 | + } | |
| 195 | + } else { | |
| 196 | + $sStatusMessage = "An error occured while attempting to update the document for publishing. Please try again later."; | |
| 197 | + $oPatternCustom->setHtml(getStatusPage($oDocument, $sStatusMessage)); | |
| 198 | + } | |
| 189 | 199 | } else { |
| 190 | 200 | // prompt for the website to publish to |
| 191 | 201 | $oPatternCustom->setHtml(getWebPublishPage($oDocument)); | ... | ... |