Commit 8fdf0887f74d4920396a5353d2df6e8647de81f4
1 parent
99f100b1
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,23 +168,38 @@ if (checkSession()) { | ||
| 168 | $main->render(); | 168 | $main->render(); |
| 169 | } | 169 | } |
| 170 | } else if ((isset($fForPublish)) && (!DocumentCollaboration::documentIsPendingWebPublishing($fDocumentID))) { | 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 | if ($oWebDocument->update()) { | 187 | if ($oWebDocument->update()) { |
| 179 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | 188 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 180 | $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document sent for web publishing", UPDATE); | 189 | $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document sent for web publishing", UPDATE); |
| 181 | $oDocumentTransaction->create(); | 190 | $oDocumentTransaction->create(); |
| 182 | $oDocument = Document::get($fDocumentID); | 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 | $oPatternCustom = & new PatternCustom(); | 195 | $oPatternCustom = & new PatternCustom(); |
| 185 | $oPatternCustom->setHtml(getEditPage($oDocument)); | 196 | $oPatternCustom->setHtml(getEditPage($oDocument)); |
| 186 | $main->setCentralPayload($oPatternCustom); | 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 | $main->render(); | 203 | $main->render(); |
| 189 | 204 | ||
| 190 | } else { | 205 | } else { |
| @@ -204,7 +219,6 @@ if (checkSession()) { | @@ -204,7 +219,6 @@ if (checkSession()) { | ||
| 204 | $oPatternCustom->setHtml(getWebPublishPage($oDocument)); | 219 | $oPatternCustom->setHtml(getWebPublishPage($oDocument)); |
| 205 | $main->setCentralPayload($oPatternCustom); | 220 | $main->setCentralPayload($oPatternCustom); |
| 206 | $main->setFormAction($_SERVER['PHP_SELF']); | 221 | $main->setFormAction($_SERVER['PHP_SELF']); |
| 207 | - $main->setHasRequiredFields(true); | ||
| 208 | $main->render(); | 222 | $main->render(); |
| 209 | } | 223 | } |
| 210 | 224 |
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewUI.inc
| @@ -293,7 +293,7 @@ function getEditPage($oDocument) { | @@ -293,7 +293,7 @@ function getEditPage($oDocument) { | ||
| 293 | $sToRender .= "\t\t</tr></table></td>\n"; | 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 | // only display for unpublished documents | 297 | // only display for unpublished documents |
| 298 | // if there is collaboration | 298 | // if there is collaboration |
| 299 | if ($oDocument->hasCollaboration()) { | 299 | if ($oDocument->hasCollaboration()) { |
| @@ -501,6 +501,7 @@ function getWebPublishPage($oDocument) { | @@ -501,6 +501,7 @@ function getWebPublishPage($oDocument) { | ||
| 501 | $sToRender .= "\t<tr>\n"; | 501 | $sToRender .= "\t<tr>\n"; |
| 502 | $sToRender .= "\t\t<td>" . $oPatternListBox->render() . "</td>\n"; | 502 | $sToRender .= "\t\t<td>" . $oPatternListBox->render() . "</td>\n"; |
| 503 | $sToRender .= "\t\t<input type=\"hidden\" name=\"fForPublish\" value=\"1\" />\n"; | 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 | $sToRender .= "\t</tr>"; | 505 | $sToRender .= "\t</tr>"; |
| 505 | $sToRender .= "\t<tr>\n"; | 506 | $sToRender .= "\t<tr>\n"; |
| 506 | $sToRender .= "\t\t<th nowrap align=\"left\">Enter a comment for the web master:</th>\n"; | 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,15 +518,6 @@ function getWebPublishPage($oDocument) { | ||
| 517 | $sToRender .= "</tr>\n"; | 518 | $sToRender .= "</tr>\n"; |
| 518 | $sToRender .= "</table>"; | 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 | return $sToRender; | 521 | return $sToRender; |
| 530 | } | 522 | } |
| 531 | 523 |