[Vtigercrm-commits] [vtiger-commits] r6557 - in /vtigercrm/trunk/modules/Users: RoleDragDrop.php listroles.php
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Sat May 27 18:15:47 EDT 2006
Author: don
Date: Sat May 27 16:15:42 2006
New Revision: 6557
Log:
Role Drag Drop Done
Added:
vtigercrm/trunk/modules/Users/RoleDragDrop.php
Modified:
vtigercrm/trunk/modules/Users/listroles.php
Modified: vtigercrm/trunk/modules/Users/listroles.php
==============================================================================
--- vtigercrm/trunk/modules/Users/listroles.php (original)
+++ vtigercrm/trunk/modules/Users/listroles.php Sat May 27 16:15:42 2006
@@ -11,26 +11,21 @@
********************************************************************************/
-require_once('include/database/PearDatabase.php');
-require_once('XTemplate/xtpl.php');
-require_once('themes/'.$theme.'/layout_utils.php');
require_once('include/utils/UserInfoUtil.php');
+require_once('Smarty_setup.php');
+$smarty = new vtigerCRM_Smarty;
global $mod_strings;
global $app_strings;
global $app_list_strings;
-echo '<form action="index.php" method="post" name="new" id="form">';
-echo get_module_title("Users",'Roles', true);
+
global $adb;
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
-require_once($theme_path.'layout_utils.php');
-
-$xtpl=new XTemplate ('modules/Users/listroles.html');
//Retreiving the hierarchy
$hquery = "select * from role order by parentrole asc";
@@ -60,14 +55,8 @@
$i++;
}
- //echo '<BR> Now the last array is';
- //print_r($y);
- //echo '<BR>';
$y[$roleid] = Array();
- //print_r($y);
- //echo '<BR>';
$k[$roleid] = Array();
- //print_r($k);
//Reversing the Array
$rev_temp_list=array_reverse($temp_list);
@@ -82,75 +71,89 @@
else
{
$k[$rev_temp_list[$j+1]][$value]=$k[$value];
- //print_r($k);
}
$j++;
}
}
-
- //echo '<BR> Final Array is <BR>';
- //print_r($hrarray);
- //echo '<BR>';
-
}
-//print_r($hrarray);
//Constructing the Roledetails array
$role_det = getAllRoleDetails();
$query = "select * from role";
$result = $adb->query($query);
$num_rows=$adb->num_rows($result);
-$roleout='';
-indent($hrarray,$roleout,$role_det);
+$roleout ='';
+$roleout .= indent($hrarray,$roleout,$role_det);
function indent($hrarray,$roleout,$role_det)
{
global $theme;
$theme_path="themes/".$theme."/";
$image_path=$theme_path."images/";
-
foreach($hrarray as $roleid => $value)
{
+
//retreiving the role details
$role_det_arr=$role_det[$roleid];
$roleid_arr=$role_det_arr[2];
$rolename = $role_det_arr[0];
$roledepth = $role_det_arr[1];
- echo '<ul class="uil" id="'.$roleid.'" style="display:block">';
- echo '<li>';
- //echo '<li><a href="#" onClick="showhide(\''.$roleid_arr.'\')">'.$rolename.'</a>';
- //echo '<table onMouseOver="showx(\''.$roleid.'tools\')" onMouseOut="hidex(\''.$roleid.'tools\')" onMouseDown="startDrag(\''.$roleid.'\',\''.$rolename.'\')" border=0 cellspacing=0 cellpadding=2 class=small >';
-
- echo '<table border=0 cellspacing=0 cellpadding=2 class=small >';
- echo '<tr style="height:20px">';
- echo '<td style="width:20px"><a href=\'#\' onClick="showhide(\''.$roleid_arr.'\')"><img src="'.$image_path.'/plus.gif" border="0" width="16" height="16" alt="Expand/Collapse" title="Expand/Collapse"></a></td>';
- echo '<td id="li_'.$roleid.'" valign=top onMouseDown="startDrag(\'li_'.$roleid.'\',\''.$rolename.'\')" onMouseMove="doItemMove(event)" onMouseUp="endItemMove(event)"><a href="#" style="width:100%" onClick="showhide(\''.$roleid_arr.'\')" ><b>'.$rolename.'</b></a></td>';
- echo '<td style="width:5px"></td>';
- if(! $roledepth == 0)
- {
- echo '<td valign=top><span id="'.$roleid.'tools" style="display:block"> <a href="index.php?module=Users&action=createrole&parenttab=Settings&parent='.$roleid.'">Add</a> | <a href="index.php?module=Users&action=createrole&roleid='.$roleid.'&parenttab=Settings&mode=edit">Edit</a> | <a href="index.php?module=Users&action=RoleDeleteStep1&roleid='.$roleid.'&parenttab=Settings">Delete</a> | <a href="index.php?module=Users&action=RoleDetailView&parenttab=Settings&roleid='.$roleid.'">View</a></span></td>';
+ $roleout .= '<ul class="uil" id="'.$roleid.'" style="display:block;list-style-type:none;">';
+ $roleout .= '<li ><table border="0" cellpadding="0" cellspacing="0" onMouseOver="fnVisible(\'layer_'.$roleid.'\')" onMouseOut="fnInVisible(\'layer_'.$roleid.'\')">';
+ $roleout.= '<tr><td nowrap>';
+ if(sizeof($value) >0 && $roledepth != 0)
+ {
+ $roleout.='<b style="font-weight:bold;margin:0;padding:0;cursor:pointer;">';
+ $roleout .= '<img src="'.$image_path.'/minus.gif" id="img_'.$roleid.'" border="0" alt="Expand/Collapse" title="Expand/Collapse" align="absmiddle" onClick="showhide(\''.$roleid_arr.'\',\'img_'.$roleid.'\')" style="cursor:pointer;">';
}
- else
- {
-
- echo '<td valign=top><span id="'.$roleid.'tools" style="display:block"> <a href="index.php?module=Users&action=createrole&parent='.$roleid.'">Add</a></span></td>';
+ else if($roledepth != 0){
+ $roleout .= '<img src="'.$image_path.'/vtigerDevDocs.gif" id="img_'.$roleid.'" border="0" alt="Expand/Collapse" title="Expand/Collapse" align="absmiddle">';
}
-
- echo '</tr>';
- echo '</table>';
- echo '</li>';
+ else{
+ $roleout .= '<img src="'.$image_path.'/menu_root.gif" id="img_'.$roleid.'" border="0" alt="Root" title="Root" align="absmiddle">';
+ }
+ if($roledepth == 0 ){
+ $roleout .= ' <b class="genHeaderGray">'.$rolename.'</b></td>';
+ $roleout .= '<td nowrap><div id="layer_'.$roleid.'" class="drag_Element"><a href="index.php?module=Users&action=createrole&parenttab=Settings&parent='.$roleid.'"><img src="'.$image_path.'/Rolesadd.gif" align="absmiddle" border="0" alt="Add Role" title="Add Role"></a></div></td></tr></table>';
+ }
+ else{
+ $roleout .= ' <a href="javascript:put_child_ID(\'user_'.$roleid.'\');" class="x" id="user_'.$roleid.'">'.$rolename.'</a></td>';
+
+ $roleout.='<td nowrap><div id="layer_'.$roleid.'" class="drag_Element">
+ <a href="index.php?module=Users&action=createrole&parenttab=Settings&parent='.$roleid.'"><img src="'.$image_path.'/Rolesadd.gif" align="absmiddle" border="0" alt="Add Role" title="Add Role"></a>
+ <a href="index.php?module=Users&action=createrole&roleid='.$roleid.'&parenttab=Settings&mode=edit"><img src="'.$image_path.'/RolesEdit.gif" align="absmiddle" border="0" alt="Edit Role" title="Edit Role"></a>
+ <a href="index.php?module=Users&action=RoleDeleteStep1&roleid='.$roleid.'&parenttab=Settings"><img src="'.$image_path.'/RolesDelete.gif" align="absmiddle" border="0" alt="Delete Role" title="Delete Role"></a>
+ <a href="#" class="small" onClick="get_parent_ID(this,\'user_'.$roleid.'\')"><img src="'.$image_path.'/RolesMove.gif" align="absmiddle" border="0" alt="Move Role" title="Move Role"></a>
+ </div></td></tr></table>';
+// $roleout .= ' <a href="index.php?module=Users&action=createrole&parenttab=Settings&parent='.$roleid.'">Add</a> | <a href="index.php?module=Users&action=createrole&roleid='.$roleid.'&parenttab=Settings&mode=edit">Edit</a> | <a href="index.php?module=Users&action=RoleDeleteStep1&roleid='.$roleid.'&parenttab=Settings">Delete</a> | <a href="index.php?module=Users&action=RoleDetailView&parenttab=Settings&roleid='.$roleid.'">View</a>';
+
+
+ }
+ $roleout .= '</li>';
if(sizeof($value) > 0 )
{
- indent($value,$roleout,$role_det);
+ $roleout = indent($value,$roleout,$role_det);
}
- echo '</ul>';
+ $roleout .= '</ul>';
+
}
-
+ return $roleout;
}
-$xtpl->assign("HR", $roleout);
-$xtpl->parse("main");
-$xtpl->out("main");
+$smarty->assign("THEME",$theme_path);
+$smarty->assign("IMAGE_PATH",$image_path);
+$smarty->assign("APP", $app_strings);
+$smarty->assign("MOD", return_module_language($current_language,'Settings'));
+$smarty->assign("CMOD", $mod_strings);
+$smarty->assign("ROLETREE", $roleout);
+if($_REQUEST['ajax'] == 'true')
+{
+ $smarty->display("RoleTree.tpl");
+}
+else
+{
+ $smarty->display("ListRoles.tpl");
+}
?>
More information about the vtigercrm-commits
mailing list