Commit 5a44c0a0bafc8a5e2a782b5c608a18e72d77fff7
1 parent
9f4f3e1a
Added all business logic functionality
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@835 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
1 changed file
with
78 additions
and
16 deletions
presentation/lookAndFeel/knowledgeTree/foldermanagement/addFolderCollaborationBL.php
| 1 | 1 | <?php |
| 2 | - | |
| 2 | +/** | |
| 3 | +* Business logic for adding a new step in the folder collaboration process | |
| 4 | +* Will used addFolderCollaborationUI.inc for presentation information | |
| 5 | +* | |
| 6 | +* Expected form variables: | |
| 7 | +* o $fFolderID - primary key of folder user is currently editing | |
| 8 | +* @author Rob Cherry, Jam Warehouse (Pty) Ltd, South Africa | |
| 9 | +* @date 6 February 2003 | |
| 10 | +* @package presentation.lookAndFeel.knowledgeTree.foldermanagement | |
| 11 | +* | |
| 12 | +*/ | |
| 3 | 13 | require_once("../../../../config/dmsDefaults.php"); |
| 4 | 14 | |
| 5 | 15 | if (checkSession()) { |
| 6 | - require_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); | |
| 7 | - require_once("$default->owl_fs_root/lib/visualpatterns/PatternCreate.inc"); | |
| 8 | - require_once("addFolderCollaborationUI.inc"); | |
| 9 | - require_once("$default->owl_fs_root/lib/security/permission.inc"); | |
| 10 | - require_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | |
| 11 | - require_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | |
| 12 | - require_once("$default->owl_fs_root/lib/foldermanagement/Folder.inc"); | |
| 13 | - require_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 14 | - require_once("$default->owl_fs_root/presentation/Html.inc"); | |
| 15 | - | |
| 16 | - $oPatternCustom = & new PatternCustom(); | |
| 17 | - $oPatternCustom->setHtml(getPage()); | |
| 18 | - $main->setCentralPayload($oPatternCustom); | |
| 19 | - $main->setFormAction("$default->owl_root_url/presentation/lookAndFeel/knowledgeTree/create.php"); | |
| 20 | - $main->render(); | |
| 16 | + if (isset($fFolderID)) { | |
| 17 | + //if a folder has been selected | |
| 18 | + include_once("$default->owl_fs_root/lib/foldermanagement/Folder.inc"); | |
| 19 | + include_once("$default->owl_fs_root/lib/security/permission.inc"); | |
| 20 | + if (Permission::userHasFolderWritePermission($fFolderID)) { | |
| 21 | + //can only create new collaboration steps if the user has folder write permission | |
| 22 | + if (isset($fForStore)) { | |
| 23 | + //attempt to create the new folder collaboration entry | |
| 24 | + include_once("$default->owl_fs_root/lib/foldermanagement/FolderCollaboration.inc"); | |
| 25 | + $oFolderCollaboration = & new FolderCollaboration($fFolderID, $fGroupID, $fSequenceNumber, $fRoleID); | |
| 26 | + if ($oFolderCollaboration->create()) { | |
| 27 | + //on successful creation, redirect to the folder edit page | |
| 28 | + include_once("$default->owl_fs_root/presentation/Html.inc"); | |
| 29 | + redirect("$default->owl_root_url/control.php?action=editFolder&fFolderID=$fFolderID"); | |
| 30 | + } else { | |
| 31 | + //otherwise display an error message | |
| 32 | + include_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); | |
| 33 | + include_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | |
| 34 | + | |
| 35 | + include_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 36 | + include_once("$default->owl_fs_root/presentation/Html.inc"); | |
| 37 | + include_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | |
| 38 | + include_once("addFolderCollaborationUI.inc"); | |
| 39 | + | |
| 40 | + $oPatternCustom = & new PatternCustom(); | |
| 41 | + $oPatternCustom->setHtml(getPage($fFolderID, $fGroupID, $fRoleID, $fSequenceNumber)); | |
| 42 | + $main->setErrorTextMessage("The folder collaboration entry could not be created in the database"); | |
| 43 | + $main->setCentralPayload($oPatternCustom); | |
| 44 | + $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1"); | |
| 45 | + $main->setHasRequiredFields(true); | |
| 46 | + $main->render(); | |
| 47 | + | |
| 48 | + } | |
| 49 | + } else { | |
| 50 | + //display the browse page | |
| 51 | + include_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); | |
| 52 | + include_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | |
| 53 | + include_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 54 | + include_once("$default->owl_fs_root/presentation/Html.inc"); | |
| 55 | + include_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | |
| 56 | + include_once("addFolderCollaborationUI.inc"); | |
| 57 | + | |
| 58 | + $oPatternCustom = & new PatternCustom(); | |
| 59 | + $oPatternCustom->setHtml(getPage($fFolderID, $fGroupID, $fRoleID, $fSequenceNumber)); | |
| 60 | + $main->setCentralPayload($oPatternCustom); | |
| 61 | + $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1"); | |
| 62 | + $main->setHasRequiredFields(true); | |
| 63 | + $main->render(); | |
| 64 | + } | |
| 65 | + } | |
| 66 | + } else { | |
| 67 | + //display an error message | |
| 68 | + include_once("$default->owl_fs_root/lib/visualpatterns/PatternListBox.inc"); | |
| 69 | + include_once("$default->owl_fs_root/lib/visualpatterns/PatternCustom.inc"); | |
| 70 | + include_once("$default->owl_fs_root/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); | |
| 71 | + include_once("$default->owl_fs_root/presentation/Html.inc"); | |
| 72 | + include_once("$default->owl_fs_root/presentation/webpageTemplate.inc"); | |
| 73 | + include_once("addFolderCollaborationUI.inc"); | |
| 74 | + | |
| 75 | + $oPatternCustom = & new PatternCustom(); | |
| 76 | + $oPatternCustom->setHtml(""); | |
| 77 | + $main->setCentralPayload($oPatternCustom); | |
| 78 | + $main->setErrorTextMessage("No folder currently selected"); | |
| 79 | + $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForStore=1"); | |
| 80 | + $main->setHasRequiredFields(true); | |
| 81 | + $main->render(); | |
| 82 | + } | |
| 21 | 83 | } |
| 22 | 84 | ?> | ... | ... |