Commit 6b6cbc56beea1193506e751e53e07f25e42e144e
1 parent
1b8845bf
made specifying a website and comment optional for publishing a document
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2053 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
2 changed files
with
26 additions
and
20 deletions
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php
| ... | ... | @@ -168,23 +168,38 @@ if (checkSession()) { |
| 168 | 168 | $main->render(); |
| 169 | 169 | } |
| 170 | 170 | } else if ((isset($fForPublish)) && (!DocumentCollaboration::documentIsPendingWebPublishing($fDocumentID))) { |
| 171 | - if (isset($fWebSiteID)) { | |
| 172 | - // user wishes to publish document | |
| 173 | - $oDocument = Document::get($fDocumentID); | |
| 174 | - $aWebDocument = WebDocument::getList("document_id = $fDocumentID"); | |
| 175 | - $oWebDocument = $aWebDocument[0]; | |
| 176 | - $oWebDocument->setStatusID(PENDING); | |
| 177 | - $oWebDocument->setWebSiteID($fWebSiteID); | |
| 171 | + if ($fSubmit) { | |
| 172 | + // user wishes to publish document | |
| 173 | + $oDocument = Document::get($fDocumentID); | |
| 174 | + $aWebDocument = WebDocument::getList("document_id = $fDocumentID"); | |
| 175 | + $oWebDocument = $aWebDocument[0]; | |
| 176 | + | |
| 177 | + if (strlen($fWebSiteID) > 0) { | |
| 178 | + $oWebDocument->setStatusID(PENDING); | |
| 179 | + $oWebDocument->setWebSiteID($fWebSiteID); | |
| 180 | + $oWebDocument->setDateTime(getCurrentDateTime()); | |
| 181 | + } else { | |
| 182 | + $oWebDocument->setStatusID(PUBLISHED); | |
| 183 | + $oWebDocument->setWebSiteID(-1); | |
| 184 | + $oWebDocument->setDateTime(getCurrentDateTime()); | |
| 185 | + } | |
| 186 | + | |
| 178 | 187 | if ($oWebDocument->update()) { |
| 179 | 188 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 180 | 189 | $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document sent for web publishing", UPDATE); |
| 181 | 190 | $oDocumentTransaction->create(); |
| 182 | 191 | $oDocument = Document::get($fDocumentID); |
| 183 | - DocumentCollaboration::notifyWebMaster($fDocumentID, $fComment); | |
| 192 | + if ((strlen($fWebSiteID) > 0) && (strlen($fComment) > 0)) { | |
| 193 | + DocumentCollaboration::notifyWebMaster($fDocumentID, $fComment); | |
| 194 | + } | |
| 184 | 195 | $oPatternCustom = & new PatternCustom(); |
| 185 | 196 | $oPatternCustom->setHtml(getEditPage($oDocument)); |
| 186 | 197 | $main->setCentralPayload($oPatternCustom); |
| 187 | - $main->setErrorMessage("The document has been marked as pending publishing and the web publisher has been notified"); | |
| 198 | + if ((strlen($fWebSiteID) > 0) && (strlen($fComment) > 0)) { | |
| 199 | + $main->setErrorMessage("The document has been marked as pending publishing and the web publisher has been notified"); | |
| 200 | + } else { | |
| 201 | + $main->setErrorMessage("The document has been published"); | |
| 202 | + } | |
| 188 | 203 | $main->render(); |
| 189 | 204 | |
| 190 | 205 | } else { |
| ... | ... | @@ -204,7 +219,6 @@ if (checkSession()) { |
| 204 | 219 | $oPatternCustom->setHtml(getWebPublishPage($oDocument)); |
| 205 | 220 | $main->setCentralPayload($oPatternCustom); |
| 206 | 221 | $main->setFormAction($_SERVER['PHP_SELF']); |
| 207 | - $main->setHasRequiredFields(true); | |
| 208 | 222 | $main->render(); |
| 209 | 223 | } |
| 210 | 224 | ... | ... |
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
| ... | ... | @@ -293,7 +293,7 @@ function getEditPage($oDocument) { |
| 293 | 293 | $sToRender .= "\t\t</tr></table></td>\n"; |
| 294 | 294 | } |
| 295 | 295 | |
| 296 | - if (!DocumentCollaboration::documentIsPendingWebPublishing($iDocumentID)) { | |
| 296 | + if (!DocumentCollaboration::documentIsPendingWebPublishing($iDocumentID) && !DocumentCollaboration::documentIsPublished($iDocumentID)) { | |
| 297 | 297 | // only display for unpublished documents |
| 298 | 298 | // if there is collaboration |
| 299 | 299 | if ($oDocument->hasCollaboration()) { |
| ... | ... | @@ -501,6 +501,7 @@ function getWebPublishPage($oDocument) { |
| 501 | 501 | $sToRender .= "\t<tr>\n"; |
| 502 | 502 | $sToRender .= "\t\t<td>" . $oPatternListBox->render() . "</td>\n"; |
| 503 | 503 | $sToRender .= "\t\t<input type=\"hidden\" name=\"fForPublish\" value=\"1\" />\n"; |
| 504 | + $sToRender .= "\t\t<input type=\"hidden\" name=\"fSubmit\" value=\"1\" />\n"; | |
| 504 | 505 | $sToRender .= "\t</tr>"; |
| 505 | 506 | $sToRender .= "\t<tr>\n"; |
| 506 | 507 | $sToRender .= "\t\t<th nowrap align=\"left\">Enter a comment for the web master:</th>\n"; |
| ... | ... | @@ -517,15 +518,6 @@ function getWebPublishPage($oDocument) { |
| 517 | 518 | $sToRender .= "</tr>\n"; |
| 518 | 519 | $sToRender .= "</table>"; |
| 519 | 520 | |
| 520 | - $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n"; | |
| 521 | - $sToRender .= "function validateForm(theForm) {\n"; | |
| 522 | - $sToRender .= "\tif (!(validRequired(document.MainForm.fWebSiteID,'Website'))) {\n"; | |
| 523 | - $sToRender .= "\t\treturn false;\n\t}\n"; | |
| 524 | - $sToRender .= "\tif (!(validRequired(document.MainForm.fComment,'Publish comment'))) {\n"; | |
| 525 | - $sToRender .= "\t\treturn false;\n\t}\n"; | |
| 526 | - $sToRender .= "return true;\n}\n"; | |
| 527 | - $sToRender .= "//-->\n</script>\n\n"; | |
| 528 | - | |
| 529 | 521 | return $sToRender; |
| 530 | 522 | } |
| 531 | 523 | ... | ... |