Commit 9777a278f56a2363df77169b35b123b3469e859f
1 parent
113ba37d
Updated function to edit a collaboration step
git-svn-id: https://kt-dms.svn.sourceforge.net/svnroot/kt-dms/trunk@2029 c91229c3-7414-0410-bfa2-8a42b809f60b
Showing
3 changed files
with
61 additions
and
53 deletions
presentation/lookAndFeel/knowledgeTree/foldermanagement/collaborationBL.php
| ... | ... | @@ -26,18 +26,11 @@ if (checkSession()) { |
| 26 | 26 | require_once("$default->fileSystemRoot/presentation/lookAndFeel/knowledgeTree/foldermanagement/folderUI.inc"); |
| 27 | 27 | require_once("$default->fileSystemRoot/presentation/Html.inc"); |
| 28 | 28 | |
| 29 | - if (isset($fForAdd)) { | |
| 30 | - //we are adding a new entry | |
| 31 | - require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); | |
| 32 | - $oPatternCustom = & new PatternCustom(); | |
| 33 | - $oPatternCustom->setHtml(getEditPage($fFolderCollaborationID, $fFolderID)); | |
| 34 | - $main->setCentralPayload($oPatternCustom); | |
| 35 | - $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fForCreate=1"); | |
| 36 | - $main->render(); | |
| 37 | - } else if (isset($fForStore)) { | |
| 38 | - //we are storing a new entry | |
| 29 | + if (isset($fForUpdate)) { | |
| 30 | + //we are updating | |
| 39 | 31 | $oFolderCollaboration = & FolderCollaboration::get($fFolderCollaborationID); |
| 40 | 32 | $oFolderCollaboration->setGroupID($fGroupID); |
| 33 | + $oFolderCollaboration->setUserID($fUserID); | |
| 41 | 34 | if ($fRoleID != -1) { |
| 42 | 35 | $oFolderCollaboration->setRoleID($fRoleID); |
| 43 | 36 | } else { |
| ... | ... | @@ -56,9 +49,10 @@ if (checkSession()) { |
| 56 | 49 | //we are editing an existing entry |
| 57 | 50 | require_once("$default->fileSystemRoot/presentation/webpageTemplate.inc"); |
| 58 | 51 | $oPatternCustom = & new PatternCustom(); |
| 59 | - $oPatternCustom->setHtml(getEditPage($fFolderCollaborationID, $fFolderID)); | |
| 52 | + $oPatternCustom->setHtml(getEditPage($fFolderCollaborationID, $fFolderID, $fGroupID, $fUserID, $fRoleID, $fSequenceNumber)); | |
| 60 | 53 | $main->setCentralPayload($oPatternCustom); |
| 61 | - $main->setFormAction("../store.php?fReturnURL=" . urlencode("$default->rootUrl/control.php?action=editFolder&fFolderID=$fFolderID")); | |
| 54 | + $main->setFormAction($_SERVER["PHP_SELF"] . "?fFolderID=$fFolderID&fFolderCollaborationID=$fFolderCollaborationID&fForUpdate=1"); | |
| 55 | + $main->setHasRequiredFields(true); | |
| 62 | 56 | $main->render(); |
| 63 | 57 | } |
| 64 | 58 | } | ... | ... |
presentation/lookAndFeel/knowledgeTree/foldermanagement/collaborationUI.inc
| ... | ... | @@ -28,61 +28,75 @@ function getFolderPath($iFolderID) { |
| 28 | 28 | return "<table border=\"0\" width = 100%><tr><td bgcolor=\"$sTDBGColour\">$sFolderPathLink</td></tr></table>\n"; |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | -function getFolderCollaborationData($iFolderCollaborationID) { | |
| 31 | +function getGroupDropDown($iFolderCollaborationID, $iFolderID, $iGroupID) { | |
| 32 | 32 | global $default; |
| 33 | - $sQuery = "SELECT GFAL.id, GFAL.folder_id, F.name AS folder_name, GFAL.group_id, G.name AS group_name, GFAL.role_id, R.name AS role_name, GFAL.precedence " . | |
| 34 | - "FROM $default->owl_groups_folders_approval_table AS GFAL INNER JOIN $default->owl_folders_table AS F ON GFAL.folder_id = F.id " . | |
| 35 | - "INNER JOIN $default->owl_groups_table AS G ON GFAL.group_id = G.id " . | |
| 36 | - "LEFT OUTER JOIN $default->owl_roles_table AS R ON GFAL.role_id = R.id " . | |
| 37 | - "WHERE GFAL.id = $iFolderCollaborationID"; | |
| 33 | + $oPatternListBox = & new PatternListBox($default->owl_groups_table, "Name", "ID", "fGroupID"); | |
| 34 | + $oPatternListBox->setPostBackOnChange(true); | |
| 35 | + $oPatternListBox->setOnChangeAction("setActionAndSubmit('" . $_SERVER["userID"] . "?fFolderID=$iFolderID&fFolderCollaborationID=$iFolderCollaborationID');"); | |
| 36 | + if (isset($iGroupID)) { | |
| 37 | + $oPatternListBox->setSelectedValue($iGroupID); | |
| 38 | + } | |
| 39 | + return $oPatternListBox->render(); | |
| 38 | 40 | |
| 39 | - $aDisplayColumns = array("group_name", "role_name", "precedence"); | |
| 40 | - $aStoreColumns = array("group_id", "role_id", "precedence"); | |
| 41 | - $aColumnNames = array("Group","Role", "Sequence"); | |
| 42 | - $aDisplayColumnTypes = array(3,3,1); | |
| 43 | - $aDatabaseColumnTypes = array(0,0,1); | |
| 44 | - $aDropDownListTables = array($default->owl_groups_table, $default->owl_roles_table); | |
| 41 | +} | |
| 42 | + | |
| 43 | +function getUserDropDown($iGroupID, $iUserID) { | |
| 44 | + global $default; | |
| 45 | + if (!(isset($iGroupID))) { | |
| 46 | + $iGroupID = -1; | |
| 47 | + } | |
| 48 | + $oPatternListBox = & new PatternListBox($default->owl_users_table, "Name", "ID", "fUserID", "UGL.group_id = $iGroupID"); | |
| 49 | + $oPatternListBox->setFromClause("INNER JOIN $default->owl_users_groups_table AS UGL ON UGL.user_id = ST.id"); | |
| 50 | + if (isset($iUserID)) { | |
| 51 | + $oPatternListBox->setSelectedValue($iUserID); | |
| 52 | + } | |
| 53 | + return $oPatternListBox->render(); | |
| 45 | 54 | |
| 46 | - $oPatternEditableListFromQuery = & new PatternEditableListFromQuery($sQuery, $default->owl_groups_folders_approval_table, $aDisplayColumns, $aStoreColumns, $aColumnNames, $aDisplayColumnTypes, $aDatabaseColumnTypes); | |
| 47 | - $oPatternEditableListFromQuery->setDropDownListTableNames($aDropDownListTables); | |
| 48 | - $oPatternEditableListFromQuery->setUniqueName("folderCollab"); | |
| 49 | - $oPatternEditableListFromQuery->setColumnsRequired(0,0,1); | |
| 50 | - return $oPatternEditableListFromQuery->render(); | |
| 51 | - | |
| 52 | 55 | } |
| 53 | 56 | |
| 54 | -function getEditPage($iFolderCollaborationID, $iFolderID) { | |
| 57 | +function getEditPage($iFolderCollaborationID, $iFolderID, $iGroupID, $iUserID, $iRoleID, $iSequenceNumber) { | |
| 55 | 58 | global $default; |
| 56 | 59 | $sToRender = renderHeading("Edit Folder Collaboration Step"); |
| 57 | 60 | $sToRender .= getFolderPath($iFolderID); |
| 58 | - $sToRender .= "<table border=\"0\" width=\"100%\">\n"; | |
| 59 | - $sToRender .= "<tr>\n"; | |
| 60 | - $sToRender .= "<td>" . getFolderCollaborationData($iFolderCollaborationID) . "</td>\n"; | |
| 61 | - $sToRender .= "</tr>\n"; | |
| 62 | - $sToRender .= "<tr>\n"; | |
| 63 | - $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"$default->graphicsUrl/widgets/update.gif\" border=\"0\"/></td><td><a href=\"$default->rootUrl/control.php?action=editFolder&fFolderID=" . $iFolderID . "\"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\" /></a></td></tr></table>\n"; | |
| 61 | + $sToRender .= "<table>\n"; | |
| 62 | + $sToRender .= "<tr>\n"; | |
| 63 | + $sToRender .= "<td>Group</td><td>" . getGroupDropDown($iFolderCollaborationID, $iFolderID, $iGroupID) . "</td>\n"; | |
| 64 | + $sToRender .= "</tr>"; | |
| 65 | + $sToRender .= "<tr>\n"; | |
| 66 | + $sToRender .= "<td>User</td><td>" . getUserDropDown($iGroupID, $iUserID) . "</td>\n"; | |
| 67 | + $sToRender .= "</tr>"; | |
| 68 | + $sToRender .= "<tr>\n"; | |
| 69 | + $sToRender .= "<td>Role</td><td>" . getRoleDropDown($iRoleID) . "</td>\n"; | |
| 70 | + $sToRender .= "</tr>"; | |
| 71 | + $sToRender .= "<tr>\n"; | |
| 72 | + $sToRender .= "<td>Sequence</td><td><input type=\"text\" name=\"fSequenceNumber\" value=\"$iSequenceNumber\" /></td>\n"; | |
| 73 | + $sToRender .= "</tr>"; | |
| 74 | + $sToRender .= "<td><table><tr><td><input type=\"image\" src=\"$default->graphicsUrl/widgets/update.gif\" border=\"0\"/></td><td><a href=\"$default->rootUrl/control.php?action=editFolder&fFolderID=" . $iFolderID . "\" /></a></td></tr></table>\n"; | |
| 64 | 75 | $sToRender .= "</tr>\n"; |
| 65 | - $sToRender .= "</table>\n"; | |
| 76 | + $sToRender .= "</table>\n"; | |
| 77 | + | |
| 78 | + $sToRender .= "\n\n<script language=\"javascript\">\n<!--\n"; | |
| 79 | + $sToRender .= "function validateForm(theForm) {\n"; | |
| 80 | + $sToRender .= "\tif (!(validRequired(theForm.fGroupID,'Group')) || !(validRequired(theForm.fUserID,'User')) || !(validRequired(theForm.fRoleID,'Role')) || !(validNum(theForm.fSequenceNumber,'Sequence no.')) || !(validRequired(theForm.fSequenceNumber,'Sequence no.'))) {\n"; | |
| 81 | + $sToRender .= "\t\treturn false;\n\t}\n"; | |
| 82 | + $sToRender .= "return true;\n}\n"; | |
| 83 | + $sToRender .= "//-->\n</script>\n\n"; | |
| 66 | 84 | |
| 67 | 85 | return $sToRender; |
| 68 | 86 | } |
| 69 | 87 | |
| 70 | -function getGroupDropDown() { | |
| 88 | +function getRoleDropDown($iRoleID) { | |
| 71 | 89 | global $default; |
| 72 | - $oPatternListBox = & new PatternListBox("$default->owl_groups_table", "name", "id", "fGroupID"); | |
| 73 | - $oPatternListBox->setIncludeDefaultValue(false); | |
| 74 | - $oPatternListBox->setEmptyErrorMessage("There are no groups"); | |
| 75 | - return $oPatternListBox->render(); | |
| 76 | -} | |
| 77 | - | |
| 78 | -function getRoleDropDown() { | |
| 79 | - global $default; | |
| 80 | - $oPatternListBox = & new PatternListBox("$default->owl_roles_table", "name", "id", "fRoleID"); | |
| 90 | + $oPatternListBox = & new PatternListBox("$default->owl_roles_table", "name", "id", "fRoleID"); | |
| 81 | 91 | $oPatternListBox->setEmptyErrorMessage("There are no users in this group"); |
| 92 | + if (isset($iRoleID)) { | |
| 93 | + $oPatternListBox->setSelectedValue($iRoleID); | |
| 94 | + } | |
| 95 | + | |
| 82 | 96 | return $oPatternListBox->render(); |
| 83 | 97 | } |
| 84 | 98 | |
| 85 | -function getAddPage() { | |
| 99 | +/*function getAddPage() { | |
| 86 | 100 | global $default; |
| 87 | 101 | return "<table border=0>\n" . |
| 88 | 102 | "<caption><b>Edit folder routing information</b></caption>\n" . |
| ... | ... | @@ -103,5 +117,5 @@ function getAddPage() { |
| 103 | 117 | "<td><b><input type=\"image\" src=\"$default->graphicsUrl/widgets/update.gif\" border=\"0\"/></b></td><td><a href=\"$default->rootUrl/control.php?action=editFolder&fFolderID=$iFolderID \"><img src=\"$default->graphicsUrl/widgets/cancel.gif\" border=\"0\" /></a></td>\n" . |
| 104 | 118 | "</tr>\n" . |
| 105 | 119 | "</table>\n"; |
| 106 | -} | |
| 120 | +}*/ | |
| 107 | 121 | ?> | ... | ... |
presentation/lookAndFeel/knowledgeTree/foldermanagement/editUI.inc
| ... | ... | @@ -106,7 +106,7 @@ function getFolderDocTypes($iFolderID) { |
| 106 | 106 | |
| 107 | 107 | function getFolderRouting($iFolderID) { |
| 108 | 108 | global $default; |
| 109 | - $sQuery = "SELECT GFAL.id as id, GFAL.folder_id AS folder_id, G.name AS group_name, R.name AS role_name, GFAL.precedence AS precedence, U.id AS user_id, U.name AS user_name, 'Edit' as edit, 'Delete' as del, 'Dependant Docs' as depn " . | |
| 109 | + $sQuery = "SELECT GFAL.id as id, GFAL.folder_id AS folder_id, G.name AS group_name, G.id AS group_id, GFAL.role_id AS role_id, R.name AS role_name, GFAL.precedence AS precedence, U.id AS user_id, U.name AS user_name, 'Edit' as edit, 'Delete' as del, 'Dependant Docs' as depn " . | |
| 110 | 110 | "FROM $default->owl_groups_folders_approval_table AS GFAL INNER JOIN roles AS R ON GFAL.role_id = R.id " . |
| 111 | 111 | "INNER JOIN $default->owl_groups_table AS G ON G.id = GFAL.group_id " . |
| 112 | 112 | "INNER JOIN $default->owl_users_table AS U ON U.id = GFAL.user_id " . |
| ... | ... | @@ -116,8 +116,8 @@ function getFolderRouting($iFolderID) { |
| 116 | 116 | $aColumns = array("group_name", "role_name", "precedence", "user_name", "edit", "del", "depn"); |
| 117 | 117 | $aColumnHeaders = array("Group", "Role", "Seq", "User", "", ""); |
| 118 | 118 | $aColumnTypes = array(1,1,1,1,3,3,3); |
| 119 | - $aDBColumnArray = array("id","folder_id","user_id"); | |
| 120 | - $aQueryStringVariableNames = array("fFolderCollaborationID", "fFolderID", "fUserID"); | |
| 119 | + $aDBColumnArray = array("id","folder_id","group_id","user_id","precedence","role_id"); | |
| 120 | + $aQueryStringVariableNames = array("fFolderCollaborationID", "fFolderID", "fGroupID","fUserID","fSequenceNumber","fRoleID"); | |
| 121 | 121 | $aLinkURLs = array(4=>"$default->rootUrl/control.php?action=modifyFolderCollaboration",5=>"$default->rootUrl/control.php?action=deleteFolderCollaboration", 5=>"$default->rootUrl/control.php?action=viewDependantDocument"); |
| 122 | 122 | |
| 123 | 123 | $oPatternTableSqlQuery = & new PatternTableSqlQuery($sQuery, $aColumns, $aColumnTypes, $aColumnHeaders, "90%", $aLinkURLs, $aDBColumnArray,$aQueryStringVariableNames); | ... | ... |