[Vtigercrm-commits] [vtiger-commits] r4279 - in /vtigercrm/trunk: modules/Users/CreateSharingRule.php modules/Users/OrgSharingDetailView.php modules/Users/UsersAjax.php themes/blue/style.css
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Fri Mar 17 06:49:34 EST 2006
Author: saraj
Date: Fri Mar 17 04:49:26 2006
New Revision: 4279
Log:
code modified to implement new UI for orgprivilege
Modified:
vtigercrm/trunk/modules/Users/CreateSharingRule.php
vtigercrm/trunk/modules/Users/OrgSharingDetailView.php
vtigercrm/trunk/modules/Users/UsersAjax.php
vtigercrm/trunk/themes/blue/style.css
Modified: vtigercrm/trunk/modules/Users/CreateSharingRule.php
==============================================================================
--- vtigercrm/trunk/modules/Users/CreateSharingRule.php (original)
+++ vtigercrm/trunk/modules/Users/CreateSharingRule.php Fri Mar 17 04:49:26 2006
@@ -14,221 +14,27 @@
require_once('include/database/PearDatabase.php');
require_once('include/utils/utils.php');
-?>
-
-
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
-<html lang="en">
-<head>
- <title>Role Details</title>
-<!--meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"-->
-</head>
-<body>
-
-<?php
//Constructing the Role Array
$roleDetails=getAllRoleDetails();
-$i=0;
-$roleIdStr="";
-$roleNameStr="";
-$userIdStr="";
-$userNameStr="";
-$grpIdStr="";
-$grpNameStr="";
+$output='';
-foreach($roleDetails as $roleId=>$roleInfo)
+//Constructing the Group Array
+$grpDetails=getAllGroupName();
+$combovalues='';
+foreach($roleDetails as $roleid=>$rolename)
{
- if($i !=0)
- {
- if($i !=1)
- {
- $roleIdStr .= ", ";
- $roleNameStr .= ", ";
- }
-
- $roleName=$roleInfo[0];
- $roleIdStr .= "'".$roleId."'";
- $roleNameStr .= "'".$roleName."'";
- }
-
- $i++;
+ $combovalues .='<option value="roles::'.$roleid.'">Roles::'.$rolename[0].'</option>';
}
-//Constructing the User Array
-/*
-$l=0;
-$userDetails=getAllUserName();
-foreach($userDetails as $userId=>$userInfo)
+foreach($roleDetails as $roleid=>$rolename)
{
- if($l !=0)
- {
- $userIdStr .= ", ";
- $userNameStr .= ", ";
- }
-
- $userIdStr .= "'".$userId."'";
- $userNameStr .= "'".$userInfo."'";
-
- $l++;
-}
-*/
-//Constructing the Group Array
-$m=0;
-$grpDetails=getAllGroupName();
-foreach($grpDetails as $grpId=>$grpName)
-{
- if($m !=0)
- {
- $grpIdStr .= ", ";
- $grpNameStr .= ", ";
- }
-
- $grpIdStr .= "'".$grpId."'";
- $grpNameStr .= "'".$grpName."'";
-
- $m++;
+ $combovalues .='<option value="rs::'.$roleid.'">Roles and Subordinates::'.$rolename[0].'</option>';
}
-?>
-
-<script language="javascript">
-var constructedOptionValue;
-var constructedOptionName;
-
-var roleIdArr=new Array(<?php echo $roleIdStr; ?>);
-var roleNameArr=new Array(<?php echo $roleNameStr; ?>);
-//var userIdArr=new Array(<?php echo $userIdStr; ?>);
-//var userNameArr=new Array(<?php echo $userNameStr; ?>);
-var grpIdArr=new Array(<?php echo $grpIdStr; ?>);
-var grpNameArr=new Array(<?php echo $grpNameStr; ?>);
-
-function showOptions(comboName)
+foreach($grpDetails as $groupid=>$groupname)
{
- //alert(comboName);
- if(comboName == 'availList')
- {
-
- var selectedOption=document.newGroupForm.memberType.value;
- }
- else if(comboName == 'share_availList')
- {
- var selectedOption=document.newGroupForm.share_memberType.value;
- }
-
-
- //alert(selectedOption);
- //Completely clear the select box
- getObj(comboName).options.length = 0;
-
- if(selectedOption == 'groups')
- {
- constructSelectOptions('groups',grpIdArr,grpNameArr,comboName);
- }
- else if(selectedOption == 'roles')
- {
- constructSelectOptions('roles',roleIdArr,roleNameArr,comboName);
- }
- else if(selectedOption == 'rs')
- {
-
- constructSelectOptions('rs',roleIdArr,roleNameArr,comboName);
- }
- /*
- else if(selectedOption == 'users')
- {
- constructSelectOptions('users',userIdArr,userNameArr,comboName);
- }
- */
-
+ $combovalues .='<option value="groups::'.$groupid.'" selected>Group::'.$groupname.'</option>';
}
-//Call on page loading
-
-
-
-function constructSelectOptions(selectedMemberType,idArr,nameArr,comboName)
-{
-
- constructedOptionValue = idArr;
- constructedOptionName = nameArr;
-
- //Constructing the selectoptions
- var j;
- var nowNamePrefix;
- for(j=0;j<constructedOptionName.length;j++)
- {
-
- if(selectedMemberType == 'roles')
- {
- nowNamePrefix = 'Roles::'
- }
- else if(selectedMemberType == 'rs')
- {
- nowNamePrefix = 'RoleAndSubordinates::'
- }
- else if(selectedMemberType == 'groups')
- {
- nowNamePrefix = 'Group::'
- }
-
- /*
- else if(selectedMemberType == 'users')
- {
- nowNamePrefix = 'User::'
- }
- */
-
- var nowName = nowNamePrefix + constructedOptionName[j];
- //var nowId = selectedMemberType + '::' + constructedOptionValue[j]
- var nowId = constructedOptionValue[j];
- getObj(comboName).options[j] = new Option(nowName,nowId);
- //getObj(comboName).value=H1
- //getObj(comboName).options['H1'].selected=true;
- }
- //clearing the array
- constructedOptionValue = new Array();
- constructedOptionName = new Array();
-
-
-}
-
-function validate()
-{
- if(document.newGroupForm.availList.value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0)
- {
- var selOption=document.newGroupForm.memberType.value;
- var entname=getEntityName(selOption);
- alert('The '+entname+' to be shared is not selected');
- return false;
- }
- if(document.newGroupForm.share_availList.value.replace(/^\s+/g, '').replace(/\s+$/g, '').length==0)
- {
- var selOption=document.newGroupForm.memberType.value;
- var entname=getEntityName(selOption);
- alert('The Share With '+entname+' is not selected');
- return false;
- }
- return true;
-}
-
-function getEntityName(selectedMemberType)
-{
- var nowNamePrefix='';
- if(selectedMemberType == 'roles')
- {
- nowNamePrefix = 'Role'
- }
- else if(selectedMemberType == 'rs')
- {
- nowNamePrefix = 'Role And Subordinates'
- }
- else if(selectedMemberType == 'groups')
- {
- nowNamePrefix = 'Group'
- }
- return nowNamePrefix;
-}
-</script>
- <?
global $adb;
if(isset($_REQUEST['shareid']) && $_REQUEST['shareid'] != '')
{
@@ -245,186 +51,142 @@
$sharing_module=$_REQUEST['sharing_module'];
$tabid=getTabid($sharing_module);
}
-
- ?>
-
+
+ $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';
+ }
+ elseif($perr == 1)
+ {
+ $rw_selected='selected';
+ }
+ }
+
+ $relatedlistscombo.='<tr><td align="right" nowrap style="padding-right:10px;"><b>'.$rel_module.' :</b></td>
+ <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>';
- <?php
- ?>
- <div class="bodyText mandatory"> </div>
- <form name="newGroupForm" action="index.php" method="post">
+
+ }
+ }
+ $output.='<form name="newGroupForm" action="index.php" method="post">
<input type="hidden" name="module" value="Users">
<input type="hidden" name="action" value="SaveSharingRule">
- <input type="hidden" name="sharing_module" value="<?php echo $sharing_module; ?>">
- <input type="hidden" name="shareId" value="<?php echo $shareid; ?>">
- <input type="hidden" name="mode" value="<?php echo $mode; ?>">
- <table border=0 cellspacing=0 cellpadding=5 width=100% >
- <tr>
- <td class=small><font class=big><b>Settings</b></font><br><font class=h2><b><?php echo $sharing_module ?> Sharing Rule</b></font></td>
- </tr>
+ <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">
+ <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="#" onClick="document.getElementById(\'orgLay\').style.display=\'none\'";>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">';
+
+
+
+ $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>';
- <hr noshade size=2>
- <br>
-
-
- <table border=0 cellspacing=1 cellpadding=5 class=small width=100%>
- <tr bgcolor=white>
- <td nowrap class=small align=left valign=top>
- <!-- basic details-->
- <table border=0 cellspacing=0 cellpadding=3 width=100% class=big><tr><td style="height:2px;background-color:#dadada"><b>Sharing Rule Details</b></td></tr></table>
-
- <table border=0 cellspacing=0 cellpadding=5 width=100% class=small>
- <tr>
- <td align=right width=20%><b><?php echo $sharing_module; ?> owned by members of</b></td>
-
- <td>
- <select id="memberType" name="memberType" onchange="showOptions('availList')">
- <option value="groups" selected>Groups</option>
- <option value="roles">Roles</option>
- <option value="rs">Roles and Subordinates</option>
- </select>
- </td>
- <td>
- <select id="availList" name="availList">
- </select>
- </td>
-
- </tr>
- <tr>
- <td align=right width=20%><b>Share with</b></td>
-
- <td>
- <select id="share_memberType" name="share_memberType" onchange="showOptions('share_availList')">
- <option value="groups" selected>Groups</option>
- <option value="roles">Roles</option>
- <option value="rs">Roles and Subordinates</option>
- </select>
- </td>
- <td>
- <select id="share_availList" name="share_availList">
- </select>
- </td>
-
- </tr>
- <tr>
- <td align=right width=20%><b><?php echo $sharing_module; ?> Access</b></td>
-
- <td colspan="2">
- <select id="<?php echo $sharing_module; ?>_access" name="<?php echo $sharing_module; ?>_access">
- <option value="0" selected>Read Only</option>
- <option value="1">Read/Write</option>
- </select>
- </td>
-
- </tr>
- <?php
- $relatedModuleSharingArr=getRelatedSharingModules($tabid);
- $size=sizeof($relatedModuleSharingArr);
- if($size > 0)
- {
-
- if($mode=='edit')
- {
- $relatedModuleSharingPerrArr=getRelatedModuleSharingPermission($shareid);
- }
- 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';
- }
-
- }
-
- ?>
- <tr>
- <td align=right width=20%><b><?php echo $rel_module; ?> Access</b></td>
-
- <td colspan="2">
- <select id="<?php echo $rel_module; ?>_access" name="<?php echo $rel_module; ?>_access">
- <option value="0" <?php echo $ro_selected ?> >Read Only</option>
- <option value="1"<?php echo $rw_selected ?> >Read/Write</option>
- </select>
- </td>
-
- </tr>
- <?php
- }
- }
- ?>
-
-
-
- </table>
-
- <!-- Buttons -->
- <table border=0 cellspacing=0 cellpadding=5 width=100% bgcolor="#efefef">
- <tr>
- <td align=center>
- <input type="submit" class="button" name="add" value="Add Rule" onClick="return validate()">
- <input type="button" class="button" name="cancel" value="Cancel" onClick="window.history.back()">
-
- </td>
-
- </tr>
- </table>
- </td>
- </tr>
- </table>
-
-
- <?php
- if($mode == 'create')
- {
- ?>
- <script language="javascript">
- getObj('memberType').value='roles';
- getObj('share_memberType').value='roles';
- constructSelectOptions('roles',roleIdArr,roleNameArr,'availList');
- constructSelectOptions('roles',roleIdArr,roleNameArr,'share_availList');
- </script>
- <?php
- }
- elseif($mode=='edit')
- {
- $share_ent_type=$shareInfo[3];
- $to_ent_type=$shareInfo[4];
- $share_id=$shareInfo[5];
- $to_id=$shareInfo[6];
- $perr=$shareInfo[7];
-
- ?>
- <script language="javascript">
- var share_type= '<?php echo $share_ent_type;?>';
- var to_type='<?php echo $to_ent_type;?>;'
- getObj('memberType').value='<?php echo $share_ent_type;?>';
- getObj('share_memberType').value='<?php echo $to_ent_type;?>';
- showOptions('availList');
- showOptions('share_availList');
- getObj('availList').value='<?php echo $share_id;?>';
- getObj('share_availList').value='<?php echo $to_id;?>';
- getObj('<?php echo $sharing_module; ?>'+'_access').value='<?php echo $perr;?>';
-
- </script>
- <?php
- }
- ?>
- </form>
- </body>
-
-</html>
+ $output.='</form>';
+ echo $output;
+?>
Modified: vtigercrm/trunk/modules/Users/OrgSharingDetailView.php
==============================================================================
Binary files - no diff available.
Modified: vtigercrm/trunk/modules/Users/UsersAjax.php
==============================================================================
--- vtigercrm/trunk/modules/Users/UsersAjax.php (original)
+++ vtigercrm/trunk/modules/Users/UsersAjax.php Fri Mar 17 04:49:26 2006
@@ -11,7 +11,11 @@
global $current_user;
global $adb;
-if(isset($_REQUEST['announce_rss']) && ($_REQUEST['announce_rss'] != ''))
+if(isset($_REQUEST['orgajax']) && ($_REQUEST['orgajax'] !=''))
+{
+ require_once('modules/Users/CreateSharingRule.php');
+}
+elseif(isset($_REQUEST['announce_rss']) && ($_REQUEST['announce_rss'] != ''))
{
$announcement='';
$sql="select * from announcement order by time";
@@ -37,5 +41,5 @@
$query="insert into announcement values (".$current_user->id.",".$adb->formatString("announcement","announcement",$announcement).",".$adb->formatString("announcement","time",$date_var).",'".$date_var."')";
$result=$adb->query($query);
echo $announcement;
- }
+}
?>
Modified: vtigercrm/trunk/themes/blue/style.css
==============================================================================
--- vtigercrm/trunk/themes/blue/style.css (original)
+++ vtigercrm/trunk/themes/blue/style.css Fri Mar 17 04:49:26 2006
@@ -1,7 +1,6 @@
.small {
font-family: Arial, Helvetica, sans-serif;
font-size: 11px;
- line-height: 14px;
color: #000000;
}
.big {
@@ -1325,11 +1324,6 @@
}
/* profile */
-.small {
- font-family: Arial, Helvetica, sans-serif;
- font-size: 11px;
-}
-
.prvPrfBigText {
font-family: Arial, Helvetica, sans-serif;
font-size: 14px;
@@ -1400,3 +1394,114 @@
border-right:1px solid #a1a1a1;
}
+/* Organization */
+
+.orgTab{
+ font-family:Arial, Helvetica, sans-serif;
+ font-size:11px;
+ font-weight:normal;
+color:#000000;
+border:0px solid #9B9B9B;
+ border-collapse:collapse;
+width:100%;
+}
+
+.orgTab tr th{
+ text-align:left;
+ font-family:Arial, Helvetica, sans-serif;
+ font-size:12px;
+ text-decoration:none;
+ font-weight:bold;
+height:20px;
+ padding-left:5px;
+}
+
+.orgTab tr td{
+ font-family:Arial, Helvetica, sans-serif;
+ font-size:11px;
+ text-decoration:none;
+ font-weight:none;
+ padding-left:5px;
+height:20px;
+ border-bottom:1px solid #CCCCCC;
+ border-right:1px solid #CCCCCC;
+}
+
+.globTab{
+ font-family:Arial, Helvetica, sans-serif;
+ font-size:11px;
+ font-weight:normal;
+color:#000000;
+border:1px solid #999999;
+ border-collapse:collapse;
+width:100%;
+}
+
+.globTab tr th{
+ text-align:right;
+ background-color:#CCCCCC;
+ border-bottom:1px solid #999999;
+ border-right:2px solid #999999;
+color:#000000;
+ font-family:Arial, Helvetica, sans-serif;
+ font-size:12px;
+ text-decoration:none;
+ font-weight:bold;
+height:20px;
+ padding-right:5px;
+
+}
+
+.globTab tr td{
+ text-align:left;
+border:1px solid #CCCCCC;
+color:#666666;
+ font-family:Arial, Helvetica, sans-serif;
+ font-size:11px;
+ text-decoration:none;
+ font-weight:none;
+ padding-left:5px;
+height:20px;
+}
+
+#orgLay{
+ font-family:Arial, Helvetica, sans-serif;
+ font-size:11px;
+ text-align:left;
+width:500px;
+border:3px solid #CCCCCC;
+ background-color:#FFFFFF;
+padding:5px;
+}
+/*#tempdiv{
+ font-family:Arial, Helvetica, sans-serif;
+ font-size:11px;
+ text-align:left;
+width:500px;
+border:3px solid #CCCCCC;
+ background-color:#FFFFFF;
+padding:5px;
+}
+*/
+/* Groups */
+
+.groupul{
+margin:0px;
+ font-family:Arial, Helvetica, sans-serif;
+ font-weight:bold;
+ font-size:12px;
+color:#000000;
+ text-decoration:underline;
+ text-align:left;
+}
+
+.groupli{
+ margin-left:20px;
+ font-family:Arial, Helvetica, sans-serif;
+ font-weight:normal;
+ font-size:12px;
+ text-decoration:none;
+color:#333333;
+ list-style-type:none;
+ text-align:left;
+}
More information about the vtigercrm-commits
mailing list