From 2b1f9c0492ee676e51ba1588f0d8ed12589e9083 Mon Sep 17 00:00:00 2001 From: Michael Joseph Date: Mon, 10 Mar 2003 14:52:57 +0000 Subject: [PATCH] web publishing functionality --- presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentBL.php | 76 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentUI.inc | 67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 143 insertions(+), 0 deletions(-) create mode 100644 presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentBL.php create mode 100644 presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentUI.inc diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentBL.php new file mode 100644 index 0000000..4442028 --- /dev/null +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentBL.php @@ -0,0 +1,76 @@ +fileSystemRoot/lib/email/Email.inc"); +require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); +require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); +require_once("$default->fileSystemRoot/lib/web/WebDocument.inc"); +require_once("$default->fileSystemRoot/lib/web/WebSite.inc"); +require_once("$default->fileSystemRoot/lib/visualpatterns/PatternCustom.inc"); +require_once("webDocumentUI.inc"); + +/** + * $Id$ + * + * This page displays a web document pending publication and allows the webmaster + * to flag the upload to 3rd party website as completed. + * + * Licensed under the GNU GPL. For full terms see the file DOCS/COPYING. + * + * @version $Revision$ + * @author Michael Joseph , Jam Warehouse (Pty) Ltd, South Africa + * @package presentation.lookAndFeel.knowledgeTree.documentmanagement + */ + +/* + * Querystring variables + * --------------------- + * fWebDocumentID - the web document to process + */ + +// ------------------------------- +// page start +// ------------------------------- + +// only if we have a valid session +if (checkSession()) { + + $oContent = new PatternCustom(); + + // retrieve variables + if ($fWebDocumentID) { + $oWebDocument = WebDocument::get($fWebDocumentID); + if ($oWebDocument) { + if ($fUploaded && $fUploadUrl) { + // the web document has been uploaded, so update the document status + $oWebDocument->setStatusID(PUBLISHED); + $oWebDocument->setDateTime(getCurrentDateTime()); + if ($oWebDocument->update()) { + // successfully updated- notify the originator + $oDocument = Document::get($oWebDocument->getDocumentID()); + $oUser = User::get($oDocument->getCreatorID()); + $oEmail = new Email(); + $sBody = "The document entitled '" . $oDocument->getName() . "' you requested for web publication has been uploaded to $fUploadUrl."; + $oEmail->send($oUser->getEmail(), "Web publication", $sBody); + // redirect to the dashboard + controllerRedirect("dashboard", ""); + } else { + $oContent->setHtml(renderErrorPage("There was an error updating the web document status")); + } + } else { + // display the upload instructions for the web master + $oContent->setHtml(renderUploadPage($oWebDocument)); + } + } else { + $oContent->setHtml(renderErrorPage("The web document could not be retrieved from the database")); + } + } else { + $oContent->setHtml(renderErrorPage("No web document selected")); + } + + require_once("../../../webpageTemplate.inc"); + $main->setCentralPayload($oContent); + $main->setFormAction($_SERVER["PHP_SELF"]); + $main->render(); +} +?> diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentUI.inc b/presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentUI.inc new file mode 100644 index 0000000..d415678 --- /dev/null +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentUI.inc @@ -0,0 +1,67 @@ +, Jam Warehouse (Pty) Ltd, South Africa + * @package presentation.lookAndFeel.knowledgeTree.documentmanagement + */ + +function renderHeading() { + global $default; + $sSectionName = $default->siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); + $sColor = $default->siteMap->getSectionColour($sSectionName, "th"); + $sToRender = "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "
Web Document
\n"; + return $sToRender; +} + +/** + * Prompts the user for a checkout comment + * + * @param object the document we're checking out + */ +function renderUploadPage($oWebDocument) { + global $default; + $oDocument = Document::get($oWebDocument->getDocumentID()); + $oWebSite = WebSite::get($oWebDocument->getWebSiteID()); + $oUser = User::get($oDocument->getCreatorID()); + + $sToRender = renderHeading(); + $sToRender .= "\n"; + $sToRender .= ""; + $sToRender .= ""; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "
'" . $oUser->getName() . "' has requested that the document
" . generateControllerLink("viewDocument", "fDocumentID=" . $oDocument->getID(), $oDocument->getDisplayPath()) . "
be uploaded to website '" . $oWebSite->getWebSiteName() . "' (" . $oWebSite->getWebSiteURL() . ")
Once the document has been uploaded, please enter the URL that it has been uploaded to in the text box below and click 'Done'
Upload URL: getWebSiteURL() . "\"/>
getID() . "\"/>
graphicsUrl/widgets/done.gif\" value=\"Submit\" onClick=\"return validRequired(document.MainForm.fUploadUrl, 'upload URL');\" />\n"; + $sToRender .= "rootUrl/control.php?action=dashboard\">graphicsUrl/widgets/cancel.gif\" border=\"0\">
\n"; + + return $sToRender; +} + +function renderErrorPage($sErrorMessage, $iDocumentID = -1) { + global $default; + return "

$sErrorMessage

\n" . + (($iDocumentID == -1) ? + "rootUrl/control.php?action=viewDocument&fDocumentID=$iDocumentID\">" : + "") . + "graphicsUrl/widgets/back.gif\" border=\"0\"/>\n"; +} +?> -- libgit2 0.21.4