Commit 89ee2728834aa6e89dedbb1c7021a742edad1e18
1 parent
8fd07b53
Added checks for documents currenlty undergoing the collaboration process
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@878 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
93 additions
and
94 deletions
presentation/lookAndFeel/knowledgeTree/foldermanagement/collaborationBL.php
| @@ -46,29 +46,21 @@ if (checkSession()) { | @@ -46,29 +46,21 @@ if (checkSession()) { | ||
| 46 | $oFolderCollaboration->setSequenceNumber($fSequenceNumber); | 46 | $oFolderCollaboration->setSequenceNumber($fSequenceNumber); |
| 47 | $oFolderCollaboration->update(); | 47 | $oFolderCollaboration->update(); |
| 48 | redirect("$default->owl_root_url/control.php?action=editFolder&fFolderID=$fFolderID"); | 48 | redirect("$default->owl_root_url/control.php?action=editFolder&fFolderID=$fFolderID"); |
| 49 | - } else { | ||
| 50 | - //we are editing an existing entry | ||
| 51 | - require_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | ||
| 52 | - $oPatternCustom = & new PatternCustom(); | ||
| 53 | - $oPatternCustom->setHtml(getEditPage($fFolderCollaborationID, $fFolderID)); | ||
| 54 | - $main->setCentralPayload($oPatternCustom); | ||
| 55 | - $main->setFormAction("../store.php?fReturnURL=" . urlencode("$default->owl_root_url/control.php?action=editFolder&fFolderID=$fFolderID")); | ||
| 56 | - $main->render(); | ||
| 57 | - } | ||
| 58 | - /*if (isset($fForAdd)) { | ||
| 59 | - require_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | ||
| 60 | - $oPatternCustom = & new PatternCustom(); | ||
| 61 | - $oPatternCustom->setHtml(getEditPage($fFolderCollaborationID, $fFolderID)); | ||
| 62 | - $main->setCentralPayload($oPatternCustom); | ||
| 63 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForCreate=1"); | ||
| 64 | - $main->render(); | ||
| 65 | - } else { | ||
| 66 | - require_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | ||
| 67 | - $oPatternCustom = & new PatternCustom(); | ||
| 68 | - $oPatternCustom->setHtml(getEditPage($fFolderCollaborationID, $fFolderID)); | ||
| 69 | - $main->setCentralPayload($oPatternCustom); | ||
| 70 | - $main->setFormAction("../store.php?fReturnURL=" . urlencode("$default->owl_root_url/control.php?action=editFolder&fFolderID$fFolderID")); | ||
| 71 | - $main->render(); | ||
| 72 | - }*/ | 49 | + } else { |
| 50 | + $oFolderCollaboration = FolderCollaboration::get($fFolderCollaborationID); | ||
| 51 | + if ($oFolderCollaboration->hasDocumentInProcess()) { | ||
| 52 | + //you cannot alter collaboration process at the folder level if a document is currently | ||
| 53 | + //going through the process | ||
| 54 | + redirect("$default->owl_root_url/control.php?action=editFolder&fFolderID=$fFolderID&fCollaborationEdit=0"); | ||
| 55 | + } else { | ||
| 56 | + //we are editing an existing entry | ||
| 57 | + require_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | ||
| 58 | + $oPatternCustom = & new PatternCustom(); | ||
| 59 | + $oPatternCustom->setHtml(getEditPage($fFolderCollaborationID, $fFolderID)); | ||
| 60 | + $main->setCentralPayload($oPatternCustom); | ||
| 61 | + $main->setFormAction("../store.php?fReturnURL=" . urlencode("$default->owl_root_url/control.php?action=editFolder&fFolderID=$fFolderID")); | ||
| 62 | + $main->render(); | ||
| 63 | + } | ||
| 64 | + } | ||
| 73 | } | 65 | } |
| 74 | ?> | 66 | ?> |
presentation/lookAndFeel/knowledgeTree/foldermanagement/deleteFolderCollaborationBL.php
| @@ -23,85 +23,72 @@ if (checkSession()) { | @@ -23,85 +23,72 @@ if (checkSession()) { | ||
| 23 | include_once("$default->owl_fs_root/lib/groups/Group.inc"); | 23 | include_once("$default->owl_fs_root/lib/groups/Group.inc"); |
| 24 | include_once("$default->owl_fs_root/lib/roles/Role.inc"); | 24 | include_once("$default->owl_fs_root/lib/roles/Role.inc"); |
| 25 | if (Permission::userHasFolderWritePermission($fFolderID)) { | 25 | if (Permission::userHasFolderWritePermission($fFolderID)) { |
| 26 | - //can only create new collaboration steps if the user has folder write permission | ||
| 27 | - if (isset($fForDelete)) { | ||
| 28 | - //attempt to delete the new folder collaboration entry | ||
| 29 | - $oFolderCollaboration = FolderCollaboration::get($fFolderCollaborationID); | 26 | + //can only delete new collaboration steps if the user has folder write permission |
| 27 | + if (isset($fForDelete)) { | ||
| 28 | + if ($oFolderCollaboration->delete()) { | ||
| 29 | + //on successful deletion, redirect to the folder edit page | ||
| 30 | + include_once("$default->owl_fs_root/presentation/Html.inc"); | ||
| 31 | + redirect("$default->owl_root_url/control.php?action=editFolder&fFolderID=$fFolderID"); | ||
| 32 | + } else { | ||
| 33 | + //otherwise display an error message | ||
| 34 | + include_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); | ||
| 35 | + include_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | ||
| 36 | + | ||
| 37 | + include_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | ||
| 38 | + include_once("$default->owl_fs_root/presentation/Html.inc"); | ||
| 39 | + include_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | ||
| 40 | + include_once("deleteFolderCollaborationUI.inc"); | ||
| 41 | + | ||
| 42 | + $oPatternCustom = & new PatternCustom(); | ||
| 43 | + $oFolderCollaboration = FolderCollaboration::get($fFolderCollaborationID); | ||
| 44 | + $oPatternCustom->setHtml(getPage($oFolderCollaboration->getFolderID(), $oFolderCollaboration->getGroupID(), $oFolderCollaboration->getRoleID(), $oFolderCollaboration->getSequenceNumber())); | ||
| 45 | + $main->setErrorMessage("The folder collaboration entry could not be deleted from the database"); | ||
| 46 | + $main->setCentralPayload($oPatternCustom); | ||
| 47 | + $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForDelete=1"); | ||
| 48 | + $main->setHasRequiredFields(true); | ||
| 49 | + $main->render(); | ||
| 50 | + } | ||
| 51 | + } else { | ||
| 52 | + $oFolderCollaboration = & FolderCollaboration::get($fFolderCollaborationID); | ||
| 30 | if ($oFolderCollaboration->hasDocumentInProcess()) { | 53 | if ($oFolderCollaboration->hasDocumentInProcess()) { |
| 54 | + //can't delete a step in the folder collaboration process if there is a document | ||
| 55 | + //currently undergoing the process | ||
| 56 | + redirect("$default->owl_root_url/control.php?action=editFolder&fFolderID=$fFolderID&fCollaborationDelete=0"); | ||
| 57 | + } else { | ||
| 58 | + //display the browse page | ||
| 31 | include_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); | 59 | include_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); |
| 32 | include_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | 60 | include_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); |
| 33 | include_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | 61 | include_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); |
| 34 | include_once("$default->owl_fs_root/presentation/Html.inc"); | 62 | include_once("$default->owl_fs_root/presentation/Html.inc"); |
| 35 | include_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | 63 | include_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); |
| 36 | include_once("deleteFolderCollaborationUI.inc"); | 64 | include_once("deleteFolderCollaborationUI.inc"); |
| 37 | - | 65 | + |
| 38 | $oPatternCustom = & new PatternCustom(); | 66 | $oPatternCustom = & new PatternCustom(); |
| 39 | - $oPatternCustom->setHtml(""); | 67 | + $oFolderCollaboration = FolderCollaboration::get($fFolderCollaborationID); |
| 68 | + $oPatternCustom->setHtml(getPage($oFolderCollaboration->getFolderID(), $oFolderCollaboration->getGroupID(), $oFolderCollaboration->getRoleID(), $oFolderCollaboration->getSequenceNumber())); | ||
| 40 | $main->setCentralPayload($oPatternCustom); | 69 | $main->setCentralPayload($oPatternCustom); |
| 41 | - $main->setErrorMessage("You cannot delete this step as there is a "); | ||
| 42 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForDelete=1"); | 70 | $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForDelete=1"); |
| 43 | $main->setHasRequiredFields(true); | 71 | $main->setHasRequiredFields(true); |
| 44 | $main->render(); | 72 | $main->render(); |
| 45 | - } else { | ||
| 46 | - if ($oFolderCollaboration->delete()) { | ||
| 47 | - //on successful deletion, redirect to the folder edit page | ||
| 48 | - include_once("$default->owl_fs_root/presentation/Html.inc"); | ||
| 49 | - redirect("$default->owl_root_url/control.php?action=editFolder&fFolderID=$fFolderID"); | ||
| 50 | - } else { | ||
| 51 | - //otherwise display an error message | ||
| 52 | - include_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); | ||
| 53 | - include_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | ||
| 54 | - | ||
| 55 | - include_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | ||
| 56 | - include_once("$default->owl_fs_root/presentation/Html.inc"); | ||
| 57 | - include_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | ||
| 58 | - include_once("deleteFolderCollaborationUI.inc"); | ||
| 59 | - | ||
| 60 | - $oPatternCustom = & new PatternCustom(); | ||
| 61 | - $oFolderCollaboration = FolderCollaboration::get($fFolderCollaborationID); | ||
| 62 | - $oPatternCustom->setHtml(getPage($oFolderCollaboration->getFolderID(), $oFolderCollaboration->getGroupID(), $oFolderCollaboration->getRoleID(), $oFolderCollaboration->getSequenceNumber())); | ||
| 63 | - $main->setErrorMessage("The folder collaboration entry could not be deleted from the database"); | ||
| 64 | - $main->setCentralPayload($oPatternCustom); | ||
| 65 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForDelete=1"); | ||
| 66 | - $main->setHasRequiredFields(true); | ||
| 67 | - $main->render(); | ||
| 68 | - | ||
| 69 | - } | ||
| 70 | } | 73 | } |
| 71 | - } else { | ||
| 72 | - //display the browse page | ||
| 73 | - include_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); | ||
| 74 | - include_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | ||
| 75 | - include_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | ||
| 76 | - include_once("$default->owl_fs_root/presentation/Html.inc"); | ||
| 77 | - include_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | ||
| 78 | - include_once("deleteFolderCollaborationUI.inc"); | ||
| 79 | - | ||
| 80 | - $oPatternCustom = & new PatternCustom(); | ||
| 81 | - $oFolderCollaboration = FolderCollaboration::get($fFolderCollaborationID); | ||
| 82 | - $oPatternCustom->setHtml(getPage($oFolderCollaboration->getFolderID(), $oFolderCollaboration->getGroupID(), $oFolderCollaboration->getRoleID(), $oFolderCollaboration->getSequenceNumber())); | ||
| 83 | - $main->setCentralPayload($oPatternCustom); | ||
| 84 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForDelete=1"); | ||
| 85 | - $main->setHasRequiredFields(true); | ||
| 86 | - $main->render(); | ||
| 87 | } | 74 | } |
| 75 | + } else { | ||
| 76 | + //display an error message | ||
| 77 | + include_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); | ||
| 78 | + include_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | ||
| 79 | + include_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | ||
| 80 | + include_once("$default->owl_fs_root/presentation/Html.inc"); | ||
| 81 | + include_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | ||
| 82 | + include_once("deleteFolderCollaborationUI.inc"); | ||
| 83 | + | ||
| 84 | + $oPatternCustom = & new PatternCustom(); | ||
| 85 | + $oPatternCustom->setHtml(""); | ||
| 86 | + $main->setCentralPayload($oPatternCustom); | ||
| 87 | + $main->setErrorMessage("No folder currently selected"); | ||
| 88 | + $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForDelete=1"); | ||
| 89 | + $main->setHasRequiredFields(true); | ||
| 90 | + $main->render(); | ||
| 88 | } | 91 | } |
| 89 | - } else { | ||
| 90 | - //display an error message | ||
| 91 | - include_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); | ||
| 92 | - include_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | ||
| 93 | - include_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | ||
| 94 | - include_once("$default->owl_fs_root/presentation/Html.inc"); | ||
| 95 | - include_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | ||
| 96 | - include_once("deleteFolderCollaborationUI.inc"); | ||
| 97 | - | ||
| 98 | - $oPatternCustom = & new PatternCustom(); | ||
| 99 | - $oPatternCustom->setHtml(""); | ||
| 100 | - $main->setCentralPayload($oPatternCustom); | ||
| 101 | - $main->setErrorMessage("No folder currently selected"); | ||
| 102 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForDelete=1"); | ||
| 103 | - $main->setHasRequiredFields(true); | ||
| 104 | - $main->render(); | ||
| 105 | } | 92 | } |
| 106 | } | 93 | } |
| 107 | ?> | 94 | ?> |
presentation/lookAndFeel/knowledgeTree/foldermanagement/editBL.php
| @@ -25,13 +25,33 @@ if (checkSession()) { | @@ -25,13 +25,33 @@ if (checkSession()) { | ||
| 25 | require_once("$default->owl_fs_root/presentation/Html.inc"); | 25 | require_once("$default->owl_fs_root/presentation/Html.inc"); |
| 26 | 26 | ||
| 27 | if (Permission::userHasFolderWritePermission($fFolderID)) { | 27 | if (Permission::userHasFolderWritePermission($fFolderID)) { |
| 28 | - //if the user can edit the folder | 28 | + //if the user can edit the folder |
| 29 | if (isset($fFolderID)) { | 29 | if (isset($fFolderID)) { |
| 30 | - $oPatternCustom = & new PatternCustom(); | ||
| 31 | - $oPatternCustom->setHtml(getPage($fFolderID)); | ||
| 32 | - $main->setCentralPayload($oPatternCustom); | ||
| 33 | - $main->setFormAction("../store.php?fReturnURL=" . urlencode("$default->owl_root_url/control.php?action=browse&fFolderID=$fFolderID")); | ||
| 34 | - $main->render(); | 30 | + if (isset($fCollaborationEdit)) { |
| 31 | + //user attempted to edit the folder collaboration process but could not because there is | ||
| 32 | + //a document currently in this process | ||
| 33 | + $oPatternCustom = & new PatternCustom(); | ||
| 34 | + $oPatternCustom->setHtml(getPage($fFolderID)); | ||
| 35 | + $main->setErrorMessage("You cannot edit this folder collaboration process as a document is currently undergoing this collaboration process"); | ||
| 36 | + $main->setCentralPayload($oPatternCustom); | ||
| 37 | + $main->setFormAction("../store.php?fReturnURL=" . urlencode("$default->owl_root_url/control.php?action=browse&fFolderID=$fFolderID")); | ||
| 38 | + $main->render(); | ||
| 39 | + } else if (isset($fCollaborationDelete)) { | ||
| 40 | + //user attempted to delete the folder collaboration process but could not because there is | ||
| 41 | + //a document currently in this process | ||
| 42 | + $oPatternCustom = & new PatternCustom(); | ||
| 43 | + $oPatternCustom->setHtml(getPage($fFolderID)); | ||
| 44 | + $main->setErrorMessage("You cannot delete this folder collaboration process as a document is currently undergoing this collaboration process"); | ||
| 45 | + $main->setCentralPayload($oPatternCustom); | ||
| 46 | + $main->setFormAction("../store.php?fReturnURL=" . urlencode("$default->owl_root_url/control.php?action=browse&fFolderID=$fFolderID")); | ||
| 47 | + $main->render(); | ||
| 48 | + } else { | ||
| 49 | + $oPatternCustom = & new PatternCustom(); | ||
| 50 | + $oPatternCustom->setHtml(getPage($fFolderID)); | ||
| 51 | + $main->setCentralPayload($oPatternCustom); | ||
| 52 | + $main->setFormAction("../store.php?fReturnURL=" . urlencode("$default->owl_root_url/control.php?action=browse&fFolderID=$fFolderID")); | ||
| 53 | + $main->render(); | ||
| 54 | + } | ||
| 35 | } else { | 55 | } else { |
| 36 | //else display an error message | 56 | //else display an error message |
| 37 | $oPatternCustom = & new PatternCustom(); | 57 | $oPatternCustom = & new PatternCustom(); |