Commit 8dbb60ca83ca2db6460e4fb1aeb72b066b8e0f7f

Authored by rob
1 parent 0d71eade

Finished publishing functionality


git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@1312 c91229c3-7414-0410-bfa2-8a42b809f60b
presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php
... ... @@ -43,6 +43,8 @@ require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc");
43 43 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternListFromQuery.inc");
44 44 require_once("$default->fileSystemRoot/lib/visualpatterns/PatternTableSqlQuery.inc");
45 45  
  46 +require_once("$default->fileSystemRoot/lib/web/WebDocument.inc");
  47 +
46 48 require_once("$default->fileSystemRoot/lib/subscriptions/Subscription.inc");
47 49  
48 50 require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/documentmanagement/documentUI.inc");
... ... @@ -142,7 +144,39 @@ if (checkSession()) {
142 144 $main->setCentralPayload($oPatternCustom);
143 145 $main->setErrorMessage("The next steps in the collaboration process have been started");
144 146 $main->render();
145   - }
  147 + }
  148 + } else if ((isset($fForPublish)) && (!Document::documentIsPendingWebPublishing($fDocumentID))) {
  149 + //user wishes to public document
  150 + $oDocument = Document::get($fDocumentID);
  151 + if ($_SESSION["userID"] == $oDocument->getCreatorID()) {
  152 + //only the creator can send the document for publishing
  153 + $aWebDocument = WebDocument::getList("document_id = $fDocumentID");
  154 + $oWebDocument = $aWebDocument[0];
  155 + $oWebDocument->setStatusID(PENDING);
  156 + if ($oWebDocument->update()) {
  157 + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
  158 + $oDocumentTransaction = & new DocumentTransaction($fDocumentID, "Document sent for web publishing", UPDATE);
  159 + $oDocumentTransaction->create();
  160 + $oDocument = Document::get($fDocumentID);
  161 + $oPatternCustom = & new PatternCustom();
  162 + $oPatternCustom->setHtml(getEditPage($oDocument));
  163 + $main->setCentralPayload($oPatternCustom);
  164 + $main->setErrorMessage("The document has been marked as pending publishing and the web publisher has been notified");
  165 + $main->render();
  166 +
  167 + } else {
  168 + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
  169 + $oDocument = Document::get($fDocumentID);
  170 + $oPatternCustom = & new PatternCustom();
  171 + $oPatternCustom->setHtml(getEditPage($oDocument));
  172 + $main->setCentralPayload($oPatternCustom);
  173 + $main->setErrorMessage("An error occured while attempting to update the document for publishing");
  174 + $main->render();
  175 + }
  176 + } else {
  177 +
  178 + }
  179 +
146 180 } else if (Permission::userHasDocumentWritePermission($fDocumentID) || Permission::userHasDocumentReadPermission($fDocumentID)) {
147 181 require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc");
148 182 require_once("$default->fileSystemRoot/lib/subscriptions/SubscriptionEngine.inc");
... ...