diff --git a/config/siteMap.inc b/config/siteMap.inc index 8eb7883..97e285a 100644 --- a/config/siteMap.inc +++ b/config/siteMap.inc @@ -65,25 +65,10 @@ $default->siteMap->addPage("copyFolderPermissions", "/presentation/lookAndFeel/k $default->siteMap->addPage("modifyFolderData", "/presentation/lookAndFeel/knowledgeTree/foldermanagement/modifyFolderDataBL.php", "Manage Documents", User, "Modify Folder Data", false); $default->siteMap->addPage("deleteFolder", "/presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderBL.php", "Manage Documents", User, _("Delete Current Folder")); - -// folder access -$default->siteMap->addPage("addGroupFolderLink", "/presentation/lookAndFeel/knowledgeTree/foldermanagement/addGroupFolderLinkBL.php", "Manage Documents", User, "Add Folder Access", false); -$default->siteMap->addPage("modifyGroupFolderLink", "/presentation/lookAndFeel/knowledgeTree/foldermanagement/editGroupFolderLinkBL.php", "Manage Documents", User, "Edit Folder Access", false); -$default->siteMap->addPage("deleteGroupFolderLink", "/presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteGroupFolderLinkBL.php", "Manage Documents", User, "Delete Folder Access", false); - // document actions $default->siteMap->addPage("modifyDocumentTypeMetaData", "/presentation/lookAndFeel/knowledgeTree/documentmanagement/modifySpecificMetaDataBL.php", "Manage Documents", User, ""); -$default->siteMap->addPage("modifyDocumentRouting", "/presentation/lookAndFeel/knowledgeTree/documentmanagement/collaborationBL.php", "Manage Documents", User, ""); -$default->siteMap->addPage("collaborationStepReject", "/presentation/lookAndFeel/knowledgeTree/documentmanagement/collaborationRollbackBL.php", "Manage Documents", User, ""); -$default->siteMap->addPage("modifyFolderCollaboration", "/presentation/lookAndFeel/knowledgeTree/foldermanagement/collaborationBL.php", "Manage Documents", User, "", false); -$default->siteMap->addPage("addFolderCollaboration", "/presentation/lookAndFeel/knowledgeTree/foldermanagement/addFolderCollaborationBL.php", "Manage Documents", User, "", false); -$default->siteMap->addPage("deleteFolderCollaboration", "/presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderCollaborationBL.php", "Manage Documents", User, "", false); -$default->siteMap->addPage("viewDependantDocument", "/presentation/lookAndFeel/knowledgeTree/foldermanagement/viewDependantDocumentsBL.php", "Manage Documents", User, "", false); -$default->siteMap->addPage("deleteDependantDocument", "/presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteDependantDocumentBL.php", "Manage Documents", User, "", false); $default->siteMap->addPage("removeDocumentLink", "/presentation/lookAndFeel/knowledgeTree/documentmanagement/removeDocumentLinkBL.php", "Manage Documents", User, "", false); $default->siteMap->addPage("addDocumentLink", "/presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocumentLinkBL.php", "Manage Documents", User, "", false); -$default->siteMap->addPage("createDependantDocument", "/presentation/lookAndFeel/knowledgeTree/documentmanagement/createDependantDocumentBL.php", "Manage Documents", User, "", false); -$default->siteMap->addPage("escalateDependantDocument", "/presentation/lookAndFeel/knowledgeTree/documentmanagement/escalateDependantDocumentBL.php", "Manage Documents", User, "", false); $default->siteMap->addPage("addSubscription", "/presentation/lookAndFeel/knowledgeTree/subscriptions/addSubscriptionBL.php", "Manage Documents", User, _("Add Folder Subscription")); $default->siteMap->addPage("removeSubscription", "/presentation/lookAndFeel/knowledgeTree/subscriptions/removeSubscriptionBL.php", "Manage Documents", User, _("Remove Folder Subscription")); diff --git a/config/tableMappings.inc b/config/tableMappings.inc index aaa31cb..e48be37 100644 --- a/config/tableMappings.inc +++ b/config/tableMappings.inc @@ -51,12 +51,6 @@ $default->folder_doctypes_table = "folder_doctypes_link"; $default->folder_subscriptions_table = "folder_subscriptions"; // stores folders $default->folders_table = "folders"; -// links folders to users (and roles) for approval collaboration -$default->folders_user_roles_table = "folders_users_roles_link"; -// stores approval collaboration information- approval roles mapped to folders with order -$default->groups_folders_approval_table = "groups_folders_approval_link"; -// links groups to folders -$default->groups_folders_table = "groups_folders_link"; // stores group information $default->groups_table = "groups_lookup"; // links groups to units @@ -102,8 +96,6 @@ $default->web_sites_table = "web_sites"; //stores help text $default->help_table = "help"; $default->document_text_table = "document_text"; -$default->dependant_document_template_table = "dependant_document_template"; -$default->dependant_document_instance_table = "dependant_document_instance"; $default->document_link_table = "document_link"; // archive settings $default->document_archiving_table = "document_archiving_link"; diff --git a/lib/dashboard/Dashboard.inc b/lib/dashboard/Dashboard.inc index 0f617cf..c1e9aa3 100644 --- a/lib/dashboard/Dashboard.inc +++ b/lib/dashboard/Dashboard.inc @@ -2,7 +2,6 @@ require_once(KT_LIB_DIR . "/subscriptions/SubscriptionManager.inc"); require_once(KT_LIB_DIR . "/web/WebDocument.inc"); require_once(KT_LIB_DIR . "/links/Link.inc"); -require_once(KT_LIB_DIR . "/documentmanagement/DependantDocumentInstance.inc"); require_once(KT_LIB_DIR . "/archiving/ArchiveRestorationRequest.inc"); /** * $Id$ @@ -72,25 +71,6 @@ class Dashboard { } /** - * Retrieves the collaboration documents that the current user has pending - * - * @param integer the user to retrieve pending collaboration documents for - */ - function getPendingCollaborationDocuments(){ - global $default; - - $sQuery = array("SELECT document_id FROM $default->folders_user_roles_table WHERE active = ? AND user_id = ?", array(true, $this->iUserID));/*ok*/ - $aDocumentList = array(); - $sql = $default->db; - if ($sql->query($sQuery)) { - while ($sql->next_record()) { - $aDocumentList[] = & Document::get($sql->f("document_id")); - } - } - return $aDocumentList; - } - - /** * Retrieve checked out documents for this user * * @return array of documents @@ -118,22 +98,6 @@ class Dashboard { } /** - * Retrieves details of supporting documents that the current user must create - */ - function getDependantDocuments() { - global $default; - $sQuery = array("SELECT id FROM $default->dependant_document_instance_table WHERE user_id = ?", $this->iUserID);/*ok*/ - $aDocumentList = array(); - $sql = $default->db; - $sql->query($sQuery); - while ($sql->next_record()) { - $aDocumentList[] = & DependantDocumentInstance::get($sql->f("id")); - } - return $aDocumentList; - } - - - /** * Retrieves Public Folders */ function getPublicFolders() { diff --git a/lib/documentmanagement/Document.inc b/lib/documentmanagement/Document.inc index 2d407e7..38f72db 100644 --- a/lib/documentmanagement/Document.inc +++ b/lib/documentmanagement/Document.inc @@ -389,113 +389,6 @@ class Document extends KTEntity { } // }}} - // {{{ collaboration/approval - - // {{{ beginCollaborationProcess - /** - * Begin the current document's collaboration process - * - */ - function beginCollaborationProcess() { - global $default; - //get the steps in this document's collaboration process - $sQuery = array("SELECT FURL.id, GFAL.precedence " ./*ok*/ - "FROM $default->folders_user_roles_table AS FURL " . - "INNER JOIN $default->groups_folders_approval_table AS GFAL ON FURL.group_folder_approval_id = GFAL.id " . - "WHERE document_id = ? " . - "ORDER BY GFAL.precedence ASC", $this->iId); - $sql = $default->db; - $sql->query($sQuery); - if ($sql->next_record()) { - //get the first step in the collaboration process - $iMinimumSequenceNumber = $sql->f("precedence"); - $oFolderUserRole = FolderUserRole::get($sql->f("id")); - $oFolderUserRole->setActive(true); - $oFolderUserRole->update(); - $oFolderCollaboration = FolderCollaboration::get($oFolderUserRole->getGroupFolderApprovalID()); - //get the role the user must perform - $oRole = Role::get($oFolderCollaboration->getRoleID()); - //get the user to email - $oUser = User::get($oFolderUserRole->getUserID()); - // FIXME: delegate this to message templating handling messaging layer - // construct and send the mail - $sBody = $oUser->getUserName() . ", your role of '" . $oRole->getName() . "' in the document, '" . $this->sName . "' collaboration process is now active. " . - "Click " . generateLink("/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php", "fDocumentID=" . $this->iId, "here") . " to access " . - "the document"; - $oEmail = & new Email(); - $oEmail->send($oUser->getEmail(), "Document collaboration role active", $sBody); - DocumentCollaboration::createDependantDocuments($oFolderUserRole); - - //check if there are any other parallel steps that have to be started - while ($sql->next_record()) { - if ($sql->f("precedence") == $iMinimumSequenceNumber) { - $oFolderUserRole = FolderUserRole::get($sql->f("id")); - $oFolderUserRole->setActive(true); - $oFolderUserRole->update(); - $oFolderCollaboration = FolderCollaboration::get($oFolderUserRole->getGroupFolderApprovalID()); - //get the role the user must perform - $oRole = Role::get($oFolderCollaboration->getRoleID()); - //get the user to email - $oUser = User::get($oFolderUserRole->getUserID()); - // FIXME: delegate this to message templating handling messaging layer - // construct and send the mail - $sBody = $oUser->getUserName() . ", your role of '" . $oRole->getName() . "' in the document, '" . $this->sName . "' collaboration process is now active. " . - "Click " . generateLink("/presentation/lookAndFeel/knowledgeTree/documentmanagement/viewBL.php", "fDocumentID=" . $this->iId, "here") . " to access " . - "the document"; - $oEmail = & new Email(); - $oEmail->send($oUser->getEmail(), "Document collaboration role active", $sBody); - DocumentCollaboration::createDependantDocuments($oFolderUserRole); - } else { - return; - } - } - } - } - // }}} - - // {{{ endCollaborationProcess - function endCollaborationProcess() { - global $default; - $sql = $default->db; - //get the current step - //if the user is assinged to two or more roles, make sure we get the current - //one by ordering by precedence - $sql->query(array("SELECT FURL.id AS id, GFAT.precedence " ./*ok*/ - "FROM $default->groups_folders_approval_table AS GFAT " . - "INNER JOIN $default->folders_user_roles_table AS FURL ON GFAT.id = FURL.group_folder_approval_id " . - "WHERE document_id = ? AND FURL.user_id = ? " . - "AND done = 0 " . - "ORDER BY precedence ASC", array($this->iId, $_SESSION["userID"]))); - if ($sql->next_record()) { - //set it as done - $oFolderUserRole = FolderUserRole::get($sql->f("id")); - $oFolderUserRole->setActive(false); - $oFolderUserRole->setDone(true); - $oFolderUserRole->setDateTime(getCurrentDateTime()); - return $oFolderUserRole->update(); - } - return false; - } - // }}} - - // {{{ hasCollaboration - /** - * Checks if there is collaboration for this document - * - * @param integer the id of the document - */ - function hasCollaboration() { - global $default; - $sql = $default->db; - $sql->query(array("SELECT id AS count from $default->groups_folders_approval_table WHERE folder_id = ?", $this->iFolderID));/*ok*/ - if ($sql->next_record()) { - return true; - } - return false; - } - // }}} - // }}} - // {{{ get function &get($iId) { return KTEntityUtil::get('Document', $iId); diff --git a/lib/foldermanagement/Folder.inc b/lib/foldermanagement/Folder.inc index f426b03..94c1e21 100644 --- a/lib/foldermanagement/Folder.inc +++ b/lib/foldermanagement/Folder.inc @@ -584,31 +584,6 @@ class Folder extends KTEntity { } return false; } - - /** - * Returns whether this folder has any documents currently in collaboration - */ - function hasDocumentInCollaboration($iFolderID) { - global $default; - $sDocumentIDs = Folder::getDocumentIDs($iFolderID); - if (strlen($sDocumentIDs) > 0) { - $aDocumentIDs = split(',', $sDocumentIDs); - $sQms = DBUtil::paramArray($aDocumentIDs); - - $sQuery = "SELECT * FROM folders_users_roles_link WHERE document_id in ($sQms) AND (active = ?)";/*ok*/ - $aParams = $aDocumentIDs; - $aParams[] = true; - $sql = $default->db; - $sql->query(array($sQuery, $aParams)); - if ($sql->next_record()) { - return true; - } - return false; - } else { - // no documents - return false; - } - } function getByParentIDAndLookupID($iParentID, $iLookupID) { return KTEntityUtil::getByDict('Folder', array( diff --git a/lib/groups/Group.inc b/lib/groups/Group.inc index 4eb1ec6..485167e 100644 --- a/lib/groups/Group.inc +++ b/lib/groups/Group.inc @@ -111,25 +111,6 @@ class Group extends KTEntity { } /** - * Checks if this group has outstanding approval process - * requirements - */ - function hasRoutingSteps() { - global $default; - - $sql = $default->db; - $query = "SELECT id FROM $default->groups_folders_approval_table WHERE group_id = ?";/*ok*/ - $aParams = array($this->iId); - $sql->query(array($query, $aParams)); - $rows = $sql->num_rows(); - if ($rows > 0){ - return true; - } else { - return false; - } - } - - /** * Static function. * Given a groups primary key it will create a * Group object and populate it with the diff --git a/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/removeGroupBL.php b/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/removeGroupBL.php index 860cd71..ba4d5b4 100644 --- a/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/removeGroupBL.php +++ b/presentation/lookAndFeel/knowledgeTree/administration/groupmanagement/removeGroupBL.php @@ -45,22 +45,17 @@ if (checkSession()) { if (isset($fGroupID)) { $oGroup = Group::get($fGroupID); - if (!$oGroup->hasRoutingSteps()) { - if (isset($fForDelete)) { - if ($oGroup->delete()) { - // FIXME: refactor getStatusPage in Html.inc - $oPatternCustom->setHtml(statusPage(_("Remove Group"), _("Group successfully removed"), "", "listGroups")); - } else { - $oPatternCustom->setHtml(statusPage(_("Remove Group"), _("Group deletion failed!"), _("There was an error deleting this group. Please try again later."), "listGroups")); - } + if (isset($fForDelete)) { + if ($oGroup->delete()) { + // FIXME: refactor getStatusPage in Html.inc + $oPatternCustom->setHtml(statusPage(_("Remove Group"), _("Group successfully removed"), "", "listGroups")); } else { - $oPatternCustom->setHtml(getDeletePage($fGroupID)); - $main->setFormAction($_SERVER["PHP_SELF"] . "?fForDelete=1"); + $oPatternCustom->setHtml(statusPage(_("Remove Group"), _("Group deletion failed!"), _("There was an error deleting this group. Please try again later."), "listGroups")); } } else { - $oPatternCustom->setHtml(statusPage(_("Remove Group"), _("This group is part of a document routing step!"), _("This group can not be deleted because it is involved in the document routing process."), "listGroups")); + $oPatternCustom->setHtml(getDeletePage($fGroupID)); + $main->setFormAction($_SERVER["PHP_SELF"] . "?fForDelete=1"); } - } else { $oPatternCustom->setHtml(statusPage(_("Remove Group"), _("No group was selected for deletion"), "", "listGroups")); } diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocument.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocument.php index 293789b..b27d3b3 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocument.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/addDocument.php @@ -27,11 +27,9 @@ require_once("../../../../config/dmsDefaults.php"); require_once(KT_LIB_DIR . '/dispatcher.inc.php'); -// KTUtil::extractGPC('fFolderID', 'fStore', 'fDocumentTypeID', 'fName', 'fDependantDocumentID'); require_once(KT_LIB_DIR . '/documentmanagement/Document.inc'); require_once(KT_LIB_DIR . '/foldermanagement/Folder.inc'); -require_once(KT_LIB_DIR . '/documentmanagement/DependantDocumentInstance.inc'); require_once(KT_LIB_DIR . '/documentmanagement/DocumentLink.inc'); require_once(KT_LIB_DIR . '/storage/storagemanager.inc.php'); @@ -216,35 +214,6 @@ class KTAddDocumentDispatcher extends KTStandardDispatcher { exit(0); } - //the document was created/uploaded due to a collaboration step in another - //document and must be linked to that document - if (isset($fDependantDocumentID)) { - $oDependantDocument = DependantDocumentInstance::get($fDependantDocumentID); - $oDocumentLink = & new DocumentLink($oDependantDocument->getParentDocumentID(), $oDocument->getID(), -1); // XXX: KT_LINK_DEPENDENT - if ($oDocumentLink->create()) { - //no longer a dependant document, but a linked document - $oDependantDocument->delete(); - } else { - //an error occured whilst trying to link the two documents automatically. Email the parent document - //original to inform him/her that the two documents must be linked manually - $oParentDocument = Document::get($oDependantDocument->getParentDocumentID()); - $oUserDocCreator = User::get($oParentDocument->getCreatorID()); - - $sBody = $oUserDocCreator->getName() . ", an error occured whilst attempting to automatically link the document, '" . - $oDocument->getName() . "' to the document, '" . $oParentDocument->getName() . "'. These two documents " . - " are meant to be linked for collaboration purposes. As creator of the document, ' " . $oParentDocument->getName() . "', you are requested to " . - "please link them manually by browsing to the parent document, " . - generateControllerLink("viewDocument","fDocumentId=" . $oParentDocument->getID(), $oParentDocument->getName()) . - " and selecting the link button. " . $oDocument->getName() . " can be found at " . $oDocument->getDisplayPath(); - - $oEmail = & new Email(); - $oEmail->send($oUserDocCreator->getEmail(), "Automatic document linking failed", $sBody); - - //document no longer dependant document, but must be linked manually - $oDependantDocument->delete(); - } - } - $this->commitTransaction(); //redirect to the document details page controllerRedirect("viewDocument", "fDocumentId=" . $oDocument->getID()); diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php index c4cf973..a1dd2a7 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentBL.php @@ -44,10 +44,7 @@ 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/documentmanagement/DocumentCollaboration.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"); diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentUI.inc b/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentUI.inc index 89afa57..678d884 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkInDocumentUI.inc @@ -51,13 +51,7 @@ function renderCheckInPage($oDocument) { $sToRender .= "\n"; $sToRender .= "\n"; $sToRender .= "getID() . "\"/>\n"; - // if collaboration has started then revisions are minor - if (DocumentCollaboration::documentCollaborationStarted($oDocument->getID())) { - $sToRender .= "\n"; - // else there is no collaboration, revisions are major (or override?) - } else { - $sToRender .= "\n"; - } + $sToRender .= "\n"; /* $sToRender .= "\n"; diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkOutDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkOutDocumentBL.php index 86023b5..7a8de25 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkOutDocumentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/checkOutDocumentBL.php @@ -42,8 +42,6 @@ if (checkSession()) { 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"); diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php index 57325b7..ebe0bd6 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/deleteDocumentBL.php @@ -31,7 +31,6 @@ require_once("../../../../config/dmsDefaults.php"); KTUtil::extractGPC('fDeleteConfirmed', 'fDocumentIDs', 'fRememberDocumentID'); require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); -require_once("$default->fileSystemRoot/lib/foldermanagement/FolderUserRole.inc"); require_once("$default->fileSystemRoot/lib/users/User.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/Document.inc"); require_once("$default->fileSystemRoot/lib/documentmanagement/DocumentTransaction.inc"); @@ -47,58 +46,53 @@ require_once("deleteDocumentUI.inc"); $aNondeletedDocs = array(); -if (checkSession()) { - - if (isset($fRememberDocumentID)) { - $fDocumentIDs = $_SESSION['documents'][$fRememberDocumentID]; - } else { - $sUniqueID = KTUtil::randomString(); - $_SESSION["documents"][$sUniqueID] = $fDocumentIDs; - $fRememberDocumentID = $sUniqueID; - } - - if (isset($fDocumentIDs)) { - - // Check permission and collaboration for all documents - for ($i = 0; $i < count($fDocumentIDs); $i++) { - - $oDocument = Document::get($fDocumentIDs[$i]); - if (!Permission::userHasDocumentWritePermission($oDocument)) { - - // user does not have permission to delete the document - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(renderErrorPage(_("You do not have, at least, permission to delete one document") . ": " . - $oDocument->getName() . "
" . _("Please deselect it and retry."))); - $main->setCentralPayload($oPatternCustom); - $main->render(); - return; - - } else { - - // check if there is collaboration for this document - $aFolderUserRoles = FolderUserRole::getList(array("document_id = ?", $fDocumentIDs[$i]));/*ok*/ - // check if any of them are active - $bActive = false; - for ($j=0; $jlog->info("delDoc bActive=" . ($bActive ? "1" : "0") . ";folderUserRoleID=" . $aFolderUserRoles[$j]->getGroupFolderApprovalID() . "; active=" . ($aFolderUserRoles[$j]->getActive() ? "1" : "0")); - $bActive = $bActive || $aFolderUserRoles[$j]->getActive(); - } - - if ($bActive) { - - // there are active collaboration roles for this doc - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(renderErrorPage(_("You can't, at least, delete one document") . ": " . - $oDocument->getName() . "
" . _("It's still in collaboration"))); - $main->setCentralPayload($oPatternCustom); - $main->render(); - return; - } - } +if (!checkSession()) { + die(); +} + +if (isset($fRememberDocumentID)) { + $fDocumentIDs = $_SESSION['documents'][$fRememberDocumentID]; +} else { + $sUniqueID = KTUtil::randomString(); + $_SESSION["documents"][$sUniqueID] = $fDocumentIDs; + $fRememberDocumentID = $sUniqueID; +} + +if (!isset($fDocumentIDs)) { + //no document selected for deletion + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); + $oPatternCustom = & new PatternCustom(); + $oPatternCustom->setHtml(renderErrorPage(_("No document currently selected"))); + $main->setCentralPayload($oPatternCustom); + $main->render(); + exit(0); +} + + +// Check permission and collaboration for all documents +for ($i = 0; $i < count($fDocumentIDs); $i++) { + $oDocument = Document::get($fDocumentIDs[$i]); + + if (!Permission::userHasDocumentWritePermission($oDocument)) { + // user does not have permission to delete the document + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); + $oPatternCustom = & new PatternCustom(); + $oPatternCustom->setHtml(renderErrorPage(_("You do not have, at least, permission to delete one document") . ": " . + $oDocument->getName() . "
" . _("Please deselect it and retry."))); + $main->setCentralPayload($oPatternCustom); + $main->render(); + exit(0); } +} +if (!isset($fDeleteConfirmed)) { + //get confirmation first + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); + $oPatternCustom = & new PatternCustom(); + $oPatternCustom->addHtml(getPage($fRememberDocumentID)); + $main->setCentralPayload($oPatternCustom); + $main->render(); +} /* Delete all files If an error occured while deleting a file, then: @@ -111,127 +105,97 @@ if (checkSession()) { - if is not empty then show the nondeleted files list */ - // Delete all files with possible rollback - if (isset($fDeleteConfirmed)) { - - // deletion of all documents are confirmed - for ($i = 0; $i < count($fDocumentIDs); $i++) { - - $oDocument = Document::get($fDocumentIDs[$i]); - if (isset($oDocument)) { - // New transaction - $sDocumentPath = Folder::getFolderPath($oDocument->getFolderID()) . $oDocument->getFileName(); - $oDocumentTransaction = & new DocumentTransaction($fDocumentIDs[$i], "Document deleted", DELETE); - $oDocumentTransaction->create(); - - // flip the status id - $oDocument->setStatusID(DELETED); - - // store - if ($oDocument->update()) { - // now move the document to the delete folder - if (PhysicalDocumentManager::delete($oDocument)) { - // successfully deleted the document - $default->log->info("deleteDocumentBL.php successfully deleted document " . - $oDocument->getFileName() . " from folder " . - Folder::getFolderPath($oDocument->getFolderID()) . - " id=" . $oDocument->getFolderID()); - - // delete all collaboration roles - for ($j=0; $jlog->info("delDoc deleting folderuserroleID=" . $aFolderUserRoles[$j]->getGroupFolderApprovalID()); - $aFolderUserRoles[$j]->delete(); - } - - // fire subscription alerts for the deleted document - $count = SubscriptionEngine::fireSubscription($fDocumentIDs[$i], - SubscriptionConstants::subscriptionAlertType("RemoveSubscribedDocument"), - SubscriptionConstants::subscriptionType("DocumentSubscription"), - array( "folderID" => $oDocument->getFolderID(), - "removedDocumentName" => $oDocument->getName(), - "folderName" => Folder::getFolderDisplayPath($oDocument->getFolderID()))); - $default->log->info("deleteDocumentBL.php fired $count subscription alerts for removed document " . $oDocument->getName()); - - // remove all document subscriptions for this document - if (SubscriptionManager::removeSubscriptions($fDocumentIDs[$i], SubscriptionConstants::subscriptionType("DocumentSubscription"))) { - $default->log->info("deleteDocumentBL.php removed all subscriptions for this document"); - } else { - $default->log->error("deleteDocumentBL.php couldn't remove document subscriptions"); - } - - } else { - //could not delete the document from the file system - $default->log->error("deleteDocumentBL.php Filesystem error deleting document " . $oDocument->getFileName() . " from folder " . Folder::getFolderPath($oDocument->getFolderID()) . " id=" . $oDocument->getFolderID()); - //reverse the document deletion - $oDocument->setStatusID(LIVE); - $oDocument->update(); - //get rid of the document transaction - $oDocumentTransaction->delete(); - - // Store the doc with problem - array_push($aNondeletedDocs, array($oDocument, _("Could not delete document on file system"))); - - } - } else { - //could not update the documents status in the db - $default->log->error("deleteDocumentBL.php DB error deleting document " . $oDocument->getFileName() . " from folder " . Folder::getFolderPath($oDocument->getFolderID()) . " id=" . $oDocument->getFolderID()); +for ($i = 0; $i < count($fDocumentIDs); $i++) { + $oDocument = Document::get($fDocumentIDs[$i]); + if (isset($oDocument)) { + // Store the doc with problem + array_push($aNondeletedDocs, array($oDocument, _("Could not load document in database"))); + } + + // New transaction + $sDocumentPath = Folder::getFolderPath($oDocument->getFolderID()) . $oDocument->getFileName(); + $oDocumentTransaction = & new DocumentTransaction($fDocumentIDs[$i], "Document deleted", DELETE); + $oDocumentTransaction->create(); + + // flip the status id + $oDocument->setStatusID(DELETED); + + // store + if ($oDocument->update()) { + //could not update the documents status in the db + $default->log->error("deleteDocumentBL.php DB error deleting document " . + $oDocument->getFileName() . " from folder " . + Folder::getFolderPath($oDocument->getFolderID()) . + " id=" . $oDocument->getFolderID()); + + //get rid of the document transaction + $oDocumentTransaction->delete(); + + // Store the doc with problem + array_push($aNondeletedDocs, array($oDocument, + _("Could not update document in database"))); + } + + // now move the document to the delete folder + if (PhysicalDocumentManager::delete($oDocument)) { + //could not delete the document from the file system + $default->log->error("deleteDocumentBL.php Filesystem error deleting document " . + $oDocument->getFileName() . " from folder " . + Folder::getFolderPath($oDocument->getFolderID()) . + " id=" . $oDocument->getFolderID()); + //reverse the document deletion + $oDocument->setStatusID(LIVE); + $oDocument->update(); + //get rid of the document transaction + $oDocumentTransaction->delete(); + + // Store the doc with problem + array_push($aNondeletedDocs, array($oDocument, _("Could not delete document on file system"))); + } + + // successfully deleted the document + $default->log->info("deleteDocumentBL.php successfully deleted document " . + $oDocument->getFileName() . " from folder " . + Folder::getFolderPath($oDocument->getFolderID()) . + " id=" . $oDocument->getFolderID()); + + // fire subscription alerts for the deleted document + $count = SubscriptionEngine::fireSubscription($fDocumentIDs[$i], + SubscriptionConstants::subscriptionAlertType("RemoveSubscribedDocument"), + SubscriptionConstants::subscriptionType("DocumentSubscription"), + array( + "folderID" => $oDocument->getFolderID(), + "removedDocumentName" => $oDocument->getName(), + "folderName" => Folder::getFolderDisplayPath($oDocument->getFolderID()), + )); + $default->log->info("deleteDocumentBL.php fired $count subscription alerts for removed document " . $oDocument->getName()); - //get rid of the document transaction - $oDocumentTransaction->delete(); - - // Store the doc with problem - array_push($aNondeletedDocs, array($oDocument, _("Could not update document in database"))); - - } - } else { - //could not load document object - - // Store the doc with problem - array_push($aNondeletedDocs, array($oDocument, _("Could not load document in database"))); - - } - } - - // List nondeleted documents - if (!empty($aNondeletedDocs) ) { - - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $oPatternCustom = & new PatternCustom(); - - $sError = _("An error occured deleting the following document(s):") . "

"; - foreach ($aNondeletedDocs as $oDoc) { - $sError .= $oDoc[0]->getDisplayPath() . ":   " .$oDoc[1] . "
"; - } - $sError .= "
" . _("The other documents are been deleted."); - - $oPatternCustom->addHtml(renderErrorPage($sError)); - $main->setCentralPayload($oPatternCustom); - $main->render(); - - reset($aNondeletedDocs); - - } else { - // redirect to the browse folder page - redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID()); - } - - - } else { - //get confirmation first - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $oPatternCustom = & new PatternCustom(); - $oPatternCustom->addHtml(getPage($fRememberDocumentID)); - $main->setCentralPayload($oPatternCustom); - $main->render(); - } - } else { - //no document selected for deletion - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); - $oPatternCustom = & new PatternCustom(); - $oPatternCustom->setHtml(renderErrorPage(_("No document currently selected"))); - $main->setCentralPayload($oPatternCustom); - $main->render(); - } + // remove all document subscriptions for this document + if (SubscriptionManager::removeSubscriptions($fDocumentIDs[$i], SubscriptionConstants::subscriptionType("DocumentSubscription"))) { + $default->log->info("deleteDocumentBL.php removed all subscriptions for this document"); + } else { + $default->log->error("deleteDocumentBL.php couldn't remove document subscriptions"); + } +} + +// List nondeleted documents +if (!empty($aNondeletedDocs) ) { + require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); + $oPatternCustom = & new PatternCustom(); + + $sError = _("An error occured deleting the following document(s):") . "

"; + foreach ($aNondeletedDocs as $oDoc) { + $sError .= $oDoc[0]->getDisplayPath() . ":   " .$oDoc[1] . "
"; + } + $sError .= "
" . _("The other documents are been deleted."); + + $oPatternCustom->addHtml(renderErrorPage($sError)); + $main->setCentralPayload($oPatternCustom); + $main->render(); + exit(0); } +// redirect to the browse folder page +redirect("$default->rootUrl/control.php?action=browse&fFolderID=" . $oDocument->getFolderID()); +exit(0); ?> diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/editDocument.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/editDocument.php index 2612290..902af17 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/editDocument.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/editDocument.php @@ -11,7 +11,6 @@ require_once(KT_LIB_DIR . '/dispatcher.inc.php'); require_once(KT_LIB_DIR . '/documentmanagement/Document.inc'); require_once(KT_LIB_DIR . '/foldermanagement/Folder.inc'); -require_once(KT_LIB_DIR . '/documentmanagement/DependantDocumentInstance.inc'); require_once(KT_LIB_DIR . '/documentmanagement/DocumentLink.inc'); require_once(KT_LIB_DIR . '/documentmanagement/documentutil.inc.php'); diff --git a/presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentBL.php b/presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentBL.php index 480a51d..2b665a9 100644 --- a/presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentBL.php +++ b/presentation/lookAndFeel/knowledgeTree/documentmanagement/webDocumentBL.php @@ -7,7 +7,6 @@ KTUtil::extractGPC('fUploadUrl', 'fUploaded', 'fWebDocumentID'); require_once("$default->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/documentmanagement/DocumentCollaboration.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"); diff --git a/presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderBL.php b/presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderBL.php index 4937687..50b090c 100644 --- a/presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderBL.php +++ b/presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderBL.php @@ -31,7 +31,6 @@ require_once("../../../../config/dmsDefaults.php"); KTUtil::extractGPC('fDeleteConfirmed', 'fFolderID'); require_once("$default->fileSystemRoot/lib/foldermanagement/Folder.inc"); -require_once("$default->fileSystemRoot/lib/foldermanagement/FolderCollaboration.inc"); require_once("$default->fileSystemRoot/lib/foldermanagement/FolderDocTypeLink.inc"); require_once("$default->fileSystemRoot/lib/foldermanagement/PhysicalFolderManagement.inc"); require_once("$default->fileSystemRoot/lib/groups/GroupUnitLink.inc"); @@ -63,12 +62,6 @@ if (checkSession()) { // successfully deleted the folder from the file system $default->log->info("deleteFolderBL.php successfully deleted folder " . $oFolder->getName() . " from parent folder " . Folder::getFolderPath($oFolder->getParentID()) . " id=" . $oFolder->getParentID()); - // delete folder collaboration entries - $aFolderCollaboration = FolderCollaboration::getList(array("folder_id = ?", $fFolderID));/*ok*/ - for ($i=0; $idelete(); - } - // delete folder document types link $aFolderDocTypeLink = FolderDocTypeLink::getList(array("folder_id = ?", $fFolderID));/*ok*/ for ($i=0; $isetHtml(getStatusPage($fFolderID, _("You cannot edit this folder collaboration process as a document is currently undergoing this collaboration process"))); - - $main->setHasRequiredFields(true); - $_SESSION["pageAccess"][$default->rootUrl . '/presentation/lookAndFeel/knowledgeTree/store.php'] = true; - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/store.php?fReturnURL=" . urlencode("$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID")); -} else if (isset($fCollaborationDelete)) { - //user attempted to delete the folder collaboration process but could not because there is - //a document currently in this process - $oPatternCustom->setHtml(getStatusPage($fFolderID, _("You cannot delete this folder collaboration process as a document is currently undergoing this collaboration process"))); - $main->setHasRequiredFields(true); - $_SESSION["pageAccess"][$default->rootUrl . '/presentation/lookAndFeel/knowledgeTree/store.php'] = true; - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/store.php?fReturnURL=" . urlencode("$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID")); -} else { - // does this folder have a document in it that has started collaboration? - $bCollaboration = Folder::hasDocumentInCollaboration($fFolderID); - $main->setDHTMLScrolling(false); - $main->setOnLoadJavaScript("switchDiv('" . (isset($fShowSection) ? $fShowSection : "folderData") . "', 'folder')"); - - $oPatternCustom->setHtml(getPage($fFolderID, "", $bCollaboration)); - $main->setHasRequiredFields(true); - $_SESSION["pageAccess"][$default->rootUrl . '/presentation/lookAndFeel/knowledgeTree/store.php'] = true; - $main->setFormAction("$default->rootUrl/presentation/lookAndFeel/knowledgeTree/store.php?fReturnURL=" . urlencode("$default->rootUrl/control.php?action=browse&fFolderID=$fFolderID")); -} - $main->setCentralPayload($oPatternCustom); $main->render(); diff --git a/presentation/lookAndFeel/knowledgeTree/foldermanagement/editUI.inc b/presentation/lookAndFeel/knowledgeTree/foldermanagement/editUI.inc index 1b1747f..1519c68 100644 --- a/presentation/lookAndFeel/knowledgeTree/foldermanagement/editUI.inc +++ b/presentation/lookAndFeel/knowledgeTree/foldermanagement/editUI.inc @@ -68,44 +68,6 @@ function getFolderData($iFolderID, $sDivName, $sStatusMessage = "") { } } -function getFolderRouting($iFolderID, $sDivName, $bCollaboration) { - global $default; - //had to use coalesce and left outer join for user_id because this column was a new addition - //and the user_ids for existing documents before this change will be null - /*ok*/ $sQuery = array("SELECT GFAL.id as id, GFAL.folder_id AS folder_id, COALESCE(G.name, 'Not Assigned') AS group_name, G.id AS group_id, GFAL.role_id AS role_id, R.name AS role_name, GFAL.precedence AS precedence, COALESCE(U.id, -1) AS user_id, COALESCE(U.name, 'Not Assigned') AS user_name, 'Edit' as edit, 'Delete' as del, 'Dependant docs' as depn " . - "FROM $default->groups_folders_approval_table AS GFAL INNER JOIN roles AS R ON GFAL.role_id = R.id " . - "LEFT OUTER JOIN $default->groups_table AS G ON G.id = GFAL.group_id " . - "LEFT OUTER JOIN $default->users_table AS U ON U.id = GFAL.user_id " . - "WHERE GFAL.folder_id = ? " . - "ORDER BY GFAL.precedence, role_name ASC", $iFolderID); - - $aColumns = array("group_name", "role_name", "precedence", "user_name", "edit", "del", "depn"); - $aColumnHeaders = array(_("Group"), _("Role"), _("Seq"), _("User"), "", ""); - $aColumnTypes = array(1,1,1,1,3,3,3); - $aDBColumnArray = array("id","folder_id","group_id","user_id","precedence","role_id"); - $aQueryStringVariableNames = array("fFolderCollaborationID", "fFolderID", "fGroupID","fUserID","fSequenceNumber","fRoleID"); - $aLinkURLs = array(4=>"$default->rootUrl/control.php?action=modifyFolderCollaboration",5=>"$default->rootUrl/control.php?action=deleteFolderCollaboration", 6=>"$default->rootUrl/control.php?action=viewDependantDocument"); - - $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "610", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames); - $oPatternTableSqlQuery->setTableHeading(_("Document Routing")); - $oPatternTableSqlQuery->setDisplayColumnHeadings(true); - - $sToRender .= ""; - if ($bCollaboration) { - $sToRender .= ""; - } - $sToRender .= ""; - if (!$bCollaboration) { - $sToRender .= "\n"; - $sToRender .= "\n"; - $sToRender .= "\n"; - } - $sToRender .= "
" . _("Documents in this folder are currently undergoing this collaboration process, so these steps can't be altered") . "
" . $oPatternTableSqlQuery->render() . "
\n"; - $sToRender .= "rootUrl/control.php?action=addFolderCollaboration&fFolderID=$iFolderID\">\n"; - $sToRender .= "
"; - return renderSectionDiv($sDivName, $sToRender); -} - function getFolderDocTypes($iFolderID, $sDivName) { $sTable = KTUtil::getTableName('folder_doctypes'); $aQuery = array( @@ -153,7 +115,7 @@ function renderFolderSection($sSectionName, $sHeadingText, $bDisplayLink, $iFold return "$sLink\n"; } -function getPage($iFolderID, $sStatusMessage, $bCollaboration = false) { +function getPage($iFolderID, $sStatusMessage) { global $default; $sToRender = "
"; @@ -168,7 +130,6 @@ function getPage($iFolderID, $sStatusMessage, $bCollaboration = false) { $bDisplayLink = ($sStatusMessage) ? true : false; $sToRender .= renderFolderSection("folderData", _("Folder Data"), $bDisplayLink, $iFolderID); - $sToRender .= renderFolderSection("folderRouting", _("Document Routing"), $bDisplayLink, $iFolderID); $sToRender .= renderFolderSection("documentTypes", _("Document Types"), $bDisplayLink, $iFolderID); $sToRender .= ""; $sToRender .= ""; @@ -180,7 +141,6 @@ function getPage($iFolderID, $sStatusMessage, $bCollaboration = false) { $sToRender .= ""; @@ -202,7 +162,6 @@ function getStatusPage($iFolderID, $sStatusMessage) { $bDisplayLink = ($sStatusMessage) ? true : false; $sToRender .= renderFolderSection("folderData", _("Folder Data"), $bDisplayLink, $iFolderID); - $sToRender .= renderFolderSection("folderRouting", _("Document Routing"), $bDisplayLink, $iFolderID); $sToRender .= renderFolderSection("documentTypes", _("Document Types"), $bDisplayLink, $iFolderID); $sToRender .= renderFolderSection("folderPermissions", _("Folder Permissions"), $bDisplayLink, $iFolderID); diff --git a/presentation/lookAndFeel/knowledgeTree/help/modifyDocumentRoutingHelp.html b/presentation/lookAndFeel/knowledgeTree/help/modifyDocumentRoutingHelp.html deleted file mode 100644 index 0a26176..0000000 --- a/presentation/lookAndFeel/knowledgeTree/help/modifyDocumentRoutingHelp.html +++ /dev/null @@ -1,9 +0,0 @@ -

Modify Document Routing

- -
    -
  1. Use the drowp-down list to select the player that will fulfil the -selected role. Note: Only users belonging to the displayed group -will appear in the drop-down list.
  2. -
  3. Click the Update button to save your selection or the Cancel button -to discard it.
  4. -
diff --git a/presentation/lookAndFeel/knowledgeTree/js/divSwitch.js b/presentation/lookAndFeel/knowledgeTree/js/divSwitch.js index 5b81dcb..7ad2d45 100644 --- a/presentation/lookAndFeel/knowledgeTree/js/divSwitch.js +++ b/presentation/lookAndFeel/knowledgeTree/js/divSwitch.js @@ -6,8 +6,8 @@ function switchDiv(div_id, object) { var aDocumentDivs = new Array("documentData", "genericMetaData", "typeSpecificMetaData", - "archiveSettings", "documentRouting", "linkedDocuments"); - var aFolderDivs = new Array("folderData", "folderRouting", "documentTypes", "folderPermissions"); + "archiveSettings", "linkedDocuments", "metadataVersions"); + var aFolderDivs = new Array("folderData", "documentTypes", "folderPermissions"); var aSearchDivs = new Array("searchLess", "searchMore"); var style_sheet = getStyleObject(div_id);