[Vtigercrm-commits] [vtiger-commits] r5903 - /vtigercrm/trunk/modules/Users/CreateSharingRule.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri May 12 06:02:56 EDT 2006
Author: don
Date: Fri May 12 04:02:53 2006
New Revision: 5903
Log:
Edit Sharing Rules done
Modified:
vtigercrm/trunk/modules/Users/CreateSharingRule.php
Modified: vtigercrm/trunk/modules/Users/CreateSharingRule.php
==============================================================================
--- vtigercrm/trunk/modules/Users/CreateSharingRule.php (original)
+++ vtigercrm/trunk/modules/Users/CreateSharingRule.php Fri May 12 04:02:53 2006
@@ -13,7 +13,6 @@
require_once('include/database/PearDatabase.php');
require_once('include/utils/utils.php');
-
//Constructing the Role Array
$roleDetails=getAllRoleDetails();
$output='';
@@ -21,172 +20,310 @@
//Constructing the Group Array
$grpDetails=getAllGroupName();
$combovalues='';
-foreach($roleDetails as $roleid=>$rolename)
-{
- $combovalues .='<option value="roles::'.$roleid.'">Roles::'.$rolename[0].'</option>';
-}
-
-foreach($roleDetails as $roleid=>$rolename)
-{
- $combovalues .='<option value="rs::'.$roleid.'">Roles and Subordinates::'.$rolename[0].'</option>';
-}
-
-foreach($grpDetails as $groupid=>$groupname)
-{
- $combovalues .='<option value="groups::'.$groupid.'" selected>Group::'.$groupname.'</option>';
-}
- global $adb;
- $mode = $_REQUEST['mode'];
- if(isset($_REQUEST['shareid']) && $_REQUEST['shareid'] != '')
- {
- $shareid=$_REQUEST['shareid'];
- $shareInfo=getSharingRuleInfo($shareid);
- $tabid=$shareInfo[1];
- $sharing_module=getTabModuleName($tabid);
-
+
+global $adb;
+$mode = $_REQUEST['mode'];
+if(isset($_REQUEST['shareid']) && $_REQUEST['shareid'] != '')
+{
+ $shareid=$_REQUEST['shareid'];
+ $shareInfo=getSharingRuleInfo($shareid);
+ $tabid=$shareInfo[1];
+ $sharing_module=getTabModuleName($tabid);
+
+}
+else
+{
+ $sharing_module=$_REQUEST['sharing_module'];
+ $tabid=getTabid($sharing_module);
+}
+
+if($mode == 'create')
+{
+ foreach($roleDetails as $roleid=>$rolename)
+ {
+ $combovalues .='<option value="roles::'.$roleid.'">Roles::'.$rolename[0].'</option>';
+ }
+
+ foreach($roleDetails as $roleid=>$rolename)
+ {
+ $combovalues .='<option value="rs::'.$roleid.'">Roles and Subordinates::'.$rolename[0].'</option>';
+ }
+
+ foreach($grpDetails as $groupid=>$groupname)
+ {
+ $combovalues .='<option value="groups::'.$groupid.'">Group::'.$groupname.'</option>';
+ }
+
+ $fromComboValues=$combovalues;
+ $toComboValues=$combovalues;
+
+}
+elseif($mode == 'edit')
+{
+
+
+ //constructing the from combo values
+ $fromtype=$shareInfo[3];
+ $fromid=$shareInfo[5];
+
+
+ foreach($roleDetails as $roleid=>$rolename)
+ {
+ $selected='';
+
+ if($fromtype == 'roles')
+ {
+ if($roleid == $fromid)
+ {
+ $selected='selected';
+ }
}
- else
- {
- $sharing_module=$_REQUEST['sharing_module'];
- $tabid=getTabid($sharing_module);
+ $fromComboValues .='<option value="roles::'.$roleid.'" '.$selected.'>Roles::'.$rolename[0].'</option>';
+ }
+
+ foreach($roleDetails as $roleid=>$rolename)
+ {
+
+ $selected='';
+ if($fromtype == 'rs')
+ {
+ if($roleid == $fromid)
+ {
+ $selected='selected';
+ }
+ }
+
+ $fromComboValues .='<option value="rs::'.$roleid.'" '.$selected.'>Roles and Subordinates::'.$rolename[0].'</option>';
+ }
+
+ foreach($grpDetails as $groupid=>$groupname)
+ {
+ $selected='';
+ if($fromtype == 'groups')
+ {
+ if($groupid == $fromid)
+ {
+ $selected='selected';
+ }
+ }
+
+
+ $fromComboValues .='<option value="groups::'.$groupid.'" '.$selected.'>Group::'.$groupname.'</option>';
+ }
+
+ //constructing the to combo values
+ $totype=$shareInfo[4];
+ $toid=$shareInfo[6];
+
+
+ foreach($roleDetails as $roleid=>$rolename)
+ {
+ $selected='';
+
+ if($totype == 'roles')
+ {
+ if($roleid == $toid)
+ {
+ $selected='selected';
+ }
}
+ $toComboValues .='<option value="roles::'.$roleid.'" '.$selected.'>Roles::'.$rolename[0].'</option>';
+ }
+
+ foreach($roleDetails as $roleid=>$rolename)
+ {
+
+ $selected='';
+ if($totype == 'rs')
+ {
+ if($roleid == $toid)
+ {
+ $selected='selected';
+ }
+ }
+
+ $toComboValues .='<option value="rs::'.$roleid.'" '.$selected.'>Roles and Subordinates::'.$rolename[0].'</option>';
+ }
+
+ foreach($grpDetails as $groupid=>$groupname)
+ {
+ $selected='';
+ if($totype == 'groups')
+ {
+ if($groupid == $toid)
+ {
+ $selected='selected';
+ }
+ }
- $relatedmodule='';
- $relatedlistscombo='';
- $relatedModuleSharingArr=getRelatedSharingModules($tabid);
- $size=sizeof($relatedModuleSharingArr);
- if($size > 0)
- {
- if($mode=='edit')
- {
- $relatedModuleSharingPerrArr=getRelatedModuleSharingPermission($shareid);
+
+ $toComboValues .='<option value="groups::'.$groupid.'" '.$selected.'>Group::'.$groupname.'</option>';
+ }
+
+}
+
+
+
+$relatedmodule='';
+$relatedlistscombo='';
+$relatedModuleSharingArr=getRelatedSharingModules($tabid);
+$size=sizeof($relatedModuleSharingArr);
+if($size > 0)
+{
+ if($mode=='edit')
+ {
+ $relatedModuleSharingPerrArr=getRelatedModuleSharingPermission($shareid);
+ }
+ foreach($relatedModuleSharingArr as $reltabid=>$relmode_shareid)
+ {
+ $rel_module=getTabModuleName($reltabid);
+ $relatedmodule .=$rel_module.'###';
+ }
+ foreach($relatedModuleSharingArr as $reltabid=>$relmode_shareid)
+ {
+ $ro_selected='';
+ $rw_selected='';
+ $rel_module=getTabModuleName($reltabid);
+ if($mode=='create')
+ {
+ $ro_selected='selected';
+ }
+ elseif($mode=='edit')
+ {
+ $perr=$relatedModuleSharingPerrArr[$reltabid];
+ if($perr == 0)
+ {
+ $ro_selected='selected';
}
- foreach($relatedModuleSharingArr as $reltabid=>$relmode_shareid)
- {
- $rel_module=getTabModuleName($reltabid);
- $relatedmodule .=$rel_module.'###';
+ elseif($perr == 1)
+ {
+ $rw_selected='selected';
}
- foreach($relatedModuleSharingArr as $reltabid=>$relmode_shareid)
- {
- $ro_selected='';
- $rw_selected='';
- $rel_module=getTabModuleName($reltabid);
- if($mode=='create')
- {
- $ro_selected='selected';
- }
- elseif($mode=='edit')
- {
- $perr=$relatedModuleSharingPerrArr[$reltabid];
- if($perr == 0)
- {
- $ro_selected='selected';
- }
- elseif($perr == 1)
- {
- $rw_selected='selected';
- }
- }
-
+ }
+
$relatedlistscombo.='<tr><td align="right" nowrap style="padding-right:10px;"><b>'.$rel_module.' :</b></td>
- <td width="70%">';
+ <td width="70%">';
$relatedlistscombo.='<select id="'.$rel_module.'_accessopt" name="'.$rel_module.'_accessopt" onChange=fnwriteRules("'.$sharing_module.'","'.$relatedmodule.'")>
- <option value="0" '.$ro_selected.' >Read Only</option>
- <option value="1" '.$rw_selected.' >Read/Write</option>
- </select></td></tr>';
-
-
- }
- }
- $output.='<form name="newGroupForm" action="index.php" method="post">
- <input type="hidden" name="module" value="Users">
- <input type="hidden" name="parenttab" value="Settings">
- <input type="hidden" name="action" value="SaveSharingRule">
- <input type="hidden" name="sharing_module" value="'.$sharing_module.'">
- <input type="hidden" name="shareId" value="'.$shareid.'">
- <input type="hidden" name="mode" value="'.$mode.'">
-
- <div id="orgLay" style="display:block;">
- <table width="100%" border="0" cellpadding="3" cellspacing="0">
- <tr>
- <td class="genHeaderSmall" align="left" style="border-bottom:1px solid #CCCCCC;" width="60%">'.$sharing_module.' - Add Custom Privilege Rule</td>
- <td align="right" style="border-bottom:1px solid #CCCCCC;" width="40%"><a href="javascript:onClick=hide(\'orgLay\')";>Close</a></td>
-
- </tr>
- <tr><td colspan="2"> </td></tr>
- <tr>
- <td><b>Step 1 :'.$sharing_module.' of </b>(Select an entity below)</td>
- <td> </td>
-
- </tr>
- <tr>
- <td style="padding-left:20px;text-align:left;">';
- //combovalues
-
- $output.='<select id="'.$sharing_module.'_share" name="'.$sharing_module.'_share" onChange=fnwriteRules("'.$sharing_module.'","'.$relatedmodule.'")>'.$combovalues.'</select>';
- $output.='</td>
-
- <td> </td>
- </tr>
- <tr><td colspan="2"> </td></tr>
- <tr>
-
- <td style="text-align:left;"><b>Step 2 : Can be accessed by</b>(Select an entity below)</td>
- <td align="left"><b>Permissions</b></td>
- </tr>
- <tr>
- <td style="padding-left:20px;text-align:left;">
-
- <select id="'.$sharing_module.'_access" name="'.$sharing_module.'_access" onChange=fnwriteRules("'.$sharing_module.'","'.$relatedmodule.'")>';
-
- $output.=$combovalues.'</select>
-
- </td><td>
-
- <select id="share_memberType" name="share_memberType" onChange=fnwriteRules("'.$sharing_module.'","'.$relatedmodule.'")>
- <option value="0" selected>Read Only</option>
- <option value="1">Read/Write</option>
- </select>
-
- </td>
- </tr>
- <tr><td colspan="2"> </td></tr>
- <tr>
- <td style="text-align:left;"><b>Step 3 : Access rights for relative modules </b></td>
- <td> </td>
-
- </tr>
- <tr>
- <td style="padding-left:20px;text-align:left;">
- <table width="75%" border="0" cellspacing="0" cellpadding="0">';
-
-
+ <option value="0" '.$ro_selected.' >Read Only</option>
+ <option value="1" '.$rw_selected.' >Read/Write</option>
+ </select></td></tr>';
+
+
+ }
+}
+
+
+if($mode == 'create')
+{
+ $sharPerCombo = '<option value="0" selected>Read Only</option>';
+ $sharPerCombo .= '<option value="1">Read/Write</option>';
+}
+elseif($mode == 'edit')
+{
+ $selected1='';
+ $selected2='';
+ if($shareInfo[7] == 0)
+ {
+ $selected1='selected';
+ }
+ elseif($shareInfo[7] == 1)
+ {
+ $selected2='selected';
+ }
+
+ $sharPerCombo = '<option value="0" '.$selected1.'>Read Only</option>';
+ $sharPerCombo .= '<option value="1" '.$selected2.'>Read/Write</option>';
+}
+
- $output .=$relatedlistscombo.'</table>
- </td>
- <td> </td>
- </tr>
- <tr><td colspan="2" align="left"> </td></tr>
- <tr>
- <td colspan="2" class="detailedViewHeader"><b>Rule Construction Display</b></td>
-
- </tr>
- <tr>
- <td style="white-space:normal;" colspan="2" class="dvtCellLabel" id="rules">
- </td>
- </tr>
- <tr>
- <td style="white-space:normal;" colspan="2" class="dvtCellLabel" id="relrules">
- </td>
- </tr>
- <tr>
- <td colspan="2" align="center">
- <input type="submit" class="small" name="add" value="Add Rule" onClick="return validate()">
- </td>
- </tr>
- </table>
- </div>';
-
- $output.='</form>';
- echo $output;
+$output.='<form name="newGroupForm" action="index.php" method="post">
+<input type="hidden" name="module" value="Users">
+<input type="hidden" name="parenttab" value="Settings">
+<input type="hidden" name="action" value="SaveSharingRule">
+<input type="hidden" name="sharing_module" value="'.$sharing_module.'">
+<input type="hidden" name="shareId" value="'.$shareid.'">
+<input type="hidden" name="mode" value="'.$mode.'">
+
+<div id="orgLay" style="display:block;">
+<table width="100%" border="0" cellpadding="3" cellspacing="0">
+<tr>
+<td class="genHeaderSmall" align="left" style="border-bottom:1px solid #CCCCCC;" width="60%">'.$sharing_module.' - Add Custom Privilege Rule</td>
+<td align="right" style="border-bottom:1px solid #CCCCCC;" width="40%"><a href="javascript:onClick=hide(\'orgLay\')";>Close</a></td>
+
+</tr>
+<tr><td colspan="2"> </td></tr>
+<tr>
+<td><b>Step 1 :'.$sharing_module.' of </b>(Select an entity below)</td>
+<td> </td>
+
+</tr>
+<tr>
+<td style="padding-left:20px;text-align:left;">';
+//combovalues
+
+$output.='<select id="'.$sharing_module.'_share" name="'.$sharing_module.'_share" onChange=fnwriteRules("'.$sharing_module.'","'.$relatedmodule.'")>'.$fromComboValues.'</select>';
+$output.='</td>
+
+<td> </td>
+</tr>
+<tr><td colspan="2"> </td></tr>
+<tr>
+
+<td style="text-align:left;"><b>Step 2 : Can be accessed by</b>(Select an entity below)</td>
+<td align="left"><b>Permissions</b></td>
+</tr>
+<tr>
+<td style="padding-left:20px;text-align:left;">
+
+<select id="'.$sharing_module.'_access" name="'.$sharing_module.'_access" onChange=fnwriteRules("'.$sharing_module.'","'.$relatedmodule.'")>';
+
+$output.=$toComboValues.'</select>
+
+</td><td>
+
+<select id="share_memberType" name="share_memberType" onChange=fnwriteRules("'.$sharing_module.'","'.$relatedmodule.'")>';
+$output .= $sharPerCombo;
+$output .= '</select>
+
+</td>
+</tr>
+<tr><td colspan="2"> </td></tr>
+<tr>
+<td style="text-align:left;"><b>Step 3 : Access rights for relative modules </b></td>
+<td> </td>
+
+</tr>
+<tr>
+<td style="padding-left:20px;text-align:left;">
+<table width="75%" border="0" cellspacing="0" cellpadding="0">';
+
+
+
+$output .=$relatedlistscombo.'</table>
+</td>
+<td> </td>
+</tr>
+<tr><td colspan="2" align="left"> </td></tr>
+<tr>
+<td colspan="2" class="detailedViewHeader"><b>Rule Construction Display</b></td>
+
+</tr>
+<tr>
+<td style="white-space:normal;" colspan="2" class="dvtCellLabel" id="rules">
+</td>
+</tr>
+<tr>
+<td style="white-space:normal;" colspan="2" class="dvtCellLabel" id="relrules">
+</td>
+</tr>
+<tr>
+<td colspan="2" align="center">
+<input type="submit" class="small" name="add" value="Add Rule" onClick="return validate()">
+</td>
+</tr>
+</table>
+</div>';
+
+$output.='</form>';
+echo $output;
?>
More information about the vtigercrm-commits
mailing list