diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/collaborationRollbackBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/collaborationRollbackBL.php new file mode 100644 index 0000000..a89bebd --- /dev/null +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/collaborationRollbackBL.php @@ -0,0 +1,68 @@ +fileSystemRoot/lib/security/permission.inc"); + +require_once("$default->fileSystemRoot/lib/email/Email.inc"); + +require_once("$default->fileSystemRoot/lib/users/User.inc"); + +require_once("$default->fileSystemRoot/lib/documentmanagement/PhysicalDocumentManager.inc"); +require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc"); +require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); + +require_once("$default->fileSystemRoot/lib/foldermanagement/FolderCollaboration.inc"); +require_once("$default->fileSystemRoot/lib/foldermanagement/FolderUserRole.inc"); +require_once("$default->fileSystemRoot/lib/roles/Role.inc"); +require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); + +require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/documentmanagement/documentUI.inc"); +require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/documentmanagement/collaborationRollbackUI.inc"); +require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); + +if (checkSession()) { + if (isset($fDocumentID)) { + if (Document::userIsPerformingCurrentCollaborationStep($fDocumentID)) { + if (isset($fForStore)) { + //user has entered a comment + //create the transaction and rollback the step + $oDocumentTransaction = & new DocumentTransaction($fDocumentID, $fComment, COLLAB_ROLLBACK); + if ($oDocumentTransaction->create()) { + Document::rollbackCollaborationStep($fDocumentID, $fComment); + redirect("$default->rootUrl/control.php?action=viewDocument&fDocumentID=$fDocumentID"); + } else { + $oDocument = Document::get($fDocumentID); + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); + $oPatternCustom = & new PatternCustom(); + $oPatternCustom->setHtml(getPage($oDocument->getFolderID(), $oDocument->getID(), $oDocument->getName())); + $main->setCentralPayload($oPatternCustom); + $main->setHasRequiredFields(true); + $main->setErrorMessage("An error occured while creating the document transaction"); + $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1"); + $main->render(); + } + } else { + $oDocument = Document::get($fDocumentID); + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); + $oPatternCustom = & new PatternCustom(); + $oPatternCustom->setHtml(getPage($oDocument->getFolderID(), $oDocument->getID(), $oDocument->getName())); + $main->setCentralPayload($oPatternCustom); + $main->setHasRequiredFields(true); + $main->setFormAction($_SERVER["PHP_SELF"] . "?fDocumentID=$fDocumentID&fForStore=1"); + $main->render(); + } + } else { + redirect("$default->rootUrl/control.php?action=viewDocument&fDocumentID=$fDocumentID"); + } + } +} + + +?> diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/collaborationRollbackUI.inc b/presentation/lookAndFeel/knowledgeTree/documentmanagement/collaborationRollbackUI.inc new file mode 100644 index 0000000..cd03e21 --- /dev/null +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/collaborationRollbackUI.inc @@ -0,0 +1,47 @@ +siteMap->getSectionName(substr($_SERVER["PHP_SELF"], strlen($default->rootUrl), strlen($_SERVER["PHP_SELF"]))); + $sTDBGColour = $default->siteMap->getSectionColour($sSectionName, "td"); + $sDocumentPath = displayFolderPathLink(Folder::getFolderPathAsArray($iFolderID), Folder::getFolderPathNamesAsArray($iFolderID), "$default->rootUrl/control.php?action=browse") . " > rootUrl/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php?fDocumentID=" . $iDocumentID . "&fForInlineView=1\" target=\"View document\">" . $sDocumentName . ""; + return "
$sDocumentPath
\n"; +} + +function getPage($iFolderID, $iDocumentID, $sDocumentName) { + global $default; + $sToRender = getDocumentPath($iFolderID, $iDocumentID, $sDocumentName); + $sToRender .= "

You have chosen to reject the previous collaboration step for the document, '$sDocumentName'. " . + "Please enter a valid reason

\n"; + $sToRender .= "
\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "\n"; + $sToRender .= "
Comment
\n"; + + $sToRender .= "graphicsUrl/widgets/done.gif\" border=\"0\" />\n"; + $sToRender .= "rootUrl/control.php?action=viewDocument&fDocumentID=$iDocumentID\">graphicsUrl/widgets/cancel.gif\" border=\"0\" />\n"; + + + + return $sToRender . getValidationJavaScript(); +} + +function getValidationJavaScript() { + $sToRender = "\n\n\n\n"; + return $sToRender; + +} + +?>