[Vtigercrm-commits] [vtiger-commits] r9743 - in /vtigercrm/branches/5.0.2: Smarty/templates/ProfileDetailView.tpl include/language/en_us.lang.php include/utils/UserInfoUtil.php modules/Users/RenameProfile.php modules/Users/profilePrivileges.php

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Mon Oct 30 08:19:38 EST 2006


Author: richie
Date: Mon Oct 30 06:19:21 2006
New Revision: 9743

Log:
* Modified to handle the profile name and description renaming

Added:
    vtigercrm/branches/5.0.2/modules/Users/RenameProfile.php
Modified:
    vtigercrm/branches/5.0.2/Smarty/templates/ProfileDetailView.tpl
    vtigercrm/branches/5.0.2/include/language/en_us.lang.php
    vtigercrm/branches/5.0.2/include/utils/UserInfoUtil.php
    vtigercrm/branches/5.0.2/modules/Users/profilePrivileges.php

Modified: vtigercrm/branches/5.0.2/Smarty/templates/ProfileDetailView.tpl
==============================================================================
--- vtigercrm/branches/5.0.2/Smarty/templates/ProfileDetailView.tpl (original)
+++ vtigercrm/branches/5.0.2/Smarty/templates/ProfileDetailView.tpl Mon Oct 30 06:19:21 2006
@@ -20,6 +20,45 @@
 </style>
 {/literal}
 <script language="JAVASCRIPT" type="text/javascript" src="include/js/smoothscroll.js"></script>
+<script language="JAVASCRIPT" type="text/javascript" src="include/js/general.js"></script>
+<script language="JAVASCRIPT" type="text/javascript">
+{literal}
+function UpdateProfile()
+{
+	var prof_name = $('profile_name').value;
+	var prof_desc = $('description').value;
+	if(prof_name == '')
+	{
+		
+		$('profile_name').focus();
+		alert("Profile Name Cannot be empty");
+	}
+	else
+	{
+		
+{/literal}
+		
+		var urlstring ="module=Users&action=UsersAjax&file=RenameProfile&profileid="+{$PROFILEID}+"&profilename="+prof_name+"&description="+prof_desc;
+{literal}
+	new Ajax.Request(
+                'index.php',
+                {queue: {position: 'end', scope: 'command'},
+                        method: 'post',
+                        postBody:urlstring,
+			onComplete: function(response)
+			{
+				$('renameProfile').style.display="none";
+				window.location.reload();
+				alert("Profile Details are updated");
+			}
+                }
+		);
+	}
+		
+	
+}
+</script>
+{/literal}
 
 <br>
 <table align="center" border="0" cellpadding="0" cellspacing="0" width="98%">
@@ -29,13 +68,15 @@
         <br>
 	<div align=center>
 			{include file='SetMenu.tpl'}
-				<form action="index.php" method="post" name="new" id="form">
+			
+				<form  method="post" name="new" id="form">
 			        <input type="hidden" name="module" value="Users">
 			        <input type="hidden" name="action" value="profilePrivileges">
 			        <input type="hidden" name="parenttab" value="Settings">
 			        <input type="hidden" name="return_action" value="profilePrivileges">
 			        <input type="hidden" name="mode" value="edit">
 			        <input type="hidden" name="profileid" value="{$PROFILEID}">
+				
 				<!-- DISPLAY -->
 				<table class="settingsSelUITopLine" border="0" cellpadding="5" cellspacing="0" width="100%">
 				<tbody><tr>
@@ -79,9 +120,47 @@
 
                                                     </tr>
                                                 </tbody></table></td>
-                                              <td align="right" valign="bottom">&nbsp;<input type="submit" value="{$APP.LBL_EDIT_BUTTON_LABEL}" class="crmButton small edit" name="edit">											  </td>
-                                            </tr>
-                                          </tbody></table>
+                                              <td align="right" valign="bottom">&nbsp;<input type="button" value="{$APP.LBL_RENAMEPROFILE_BUTTON_LABEL}" class="crmButton small edit" name="rename_profile"  onClick = "fnvshobj(this,'renameProfile');">&nbsp;<input type="submit" value="{$APP.LBL_EDIT_BUTTON_LABEL}" class="crmButton small edit" name="edit" >
+                              		     </td>
+					    	
+                                            </tr></tbody></table>
+					    <!-- RenameProfile Div start -->	 
+					    <div id="renameProfile" style="left: 49px; top: 152px; display: none; visibility: visible;position:absolute;" class="layerPopup">
+						<table class="layerHeadingULine" border="0" cellpadding="3" cellspacing="0" width="100%">
+						<tr style="cursor:move;">
+						<td class="layerPopupHeading" id = "renameUI" align="left" width="60%">{$APP.LBL_RENAME_PROFILE}</td>
+						<td align="right" width="40%"><a href="javascript:fninvsh('renameProfile');"><img src="themes/bluelagoon/images/close.gif" align="middle" border="0"></a></td>
+						</tr>
+						</table>
+					    <table align="center" border="0" cellpadding="5" cellspacing="0" width="95%">
+
+						<tr>
+						<td class="small">
+							<table celspacing="0" align="center" bgcolor="white" border="0" cellpadding="5" width="100%">
+								<tr>
+								<td align="right" width="25%" style="padding-right:10px;" nowrap><b>{$APP.LBL_PROFILE_NAME} :</b></td>
+								<td align="left" width="75%" style="padding-right:10px;"><input id = "profile_name" name="profile_name" class="txtBox" value="{$Profile_Name}" type="text"></td>
+								</tr>
+								<tr>
+                                                                <td align="right" width="25%" style="padding-right:10px;" nowrap><b>{$APP.LBL_DESCRIPTION} :</b></td>
+                                                                <td align="left" width="75%" style="padding-right:10px;"><textarea name="description" id = "description" class="txtBox">{$Profile_Description} </textarea></td>
+                                                                </tr>
+							</table>
+						</td>
+						</tr>
+					    </table>
+					    <table class="layerPopupTransport" border="0" cellpadding="5" cellspacing="0" width="100%">
+					    <tr>
+						<td align = "center">
+							<input name="save" value="Update" class="crmbutton small save" onclick="UpdateProfile();" type="button">&nbsp;&nbsp;
+							<input name="cancel" value="Cancel" class="crmbutton small save" onclick="fninvsh('renameProfile');" type="button">&nbsp;&nbsp;
+						</td>
+					    </tr>		
+					    </table>		
+					    </div>		
+				             <!- RenameProfile Div end -->		
+
+                                         
                                             <!-- privilege lists -->
                                             <table border="0" cellpadding="0" cellspacing="0" width="100%">
                                               <tbody><tr>
@@ -309,4 +388,11 @@
 		document.getElementById(obj).className = 'hideTable';
 }
 {/literal}
+{literal}
+        //for move RenameProfile
+        var theEventHandle = document.getElementById("renameUI");
+        var theEventRoot   = document.getElementById("renameProfile");
+        Drag.init(theEventHandle, theEventRoot);
+{/literal}
 </script>
+

Modified: vtigercrm/branches/5.0.2/include/language/en_us.lang.php
==============================================================================
--- vtigercrm/branches/5.0.2/include/language/en_us.lang.php (original)
+++ vtigercrm/branches/5.0.2/include/language/en_us.lang.php Mon Oct 30 06:19:21 2006
@@ -1042,6 +1042,9 @@
 'LBL_ADDRESS_INF'=>'Address Information',
 
 'yes'=>'yes',
+'LBL_RENAMEPROFILE_BUTTON_LABEL'=>'Rename',
+'LBL_RENAME_PROFILE'=>'Rename Profile',
+'LBL_PROFILE_NAME'=>'Profile Name',
 
 );
 

Modified: vtigercrm/branches/5.0.2/include/utils/UserInfoUtil.php
==============================================================================
--- vtigercrm/branches/5.0.2/include/utils/UserInfoUtil.php (original)
+++ vtigercrm/branches/5.0.2/include/utils/UserInfoUtil.php Mon Oct 30 06:19:21 2006
@@ -1346,6 +1346,23 @@
 	$log->debug("Exiting getProfileName method ...");
 	return $profilename;	
 }
+/** Function to get the vtiger_profile Description from the vtiger_profileid
+  * @param $profileid -- Profile Id:: Type integer
+  * @returns $rolename -- Role Name:: Type varchar
+  *
+ */
+function getProfileDescription($profileid)
+{
+        global $log;
+        $log->debug("Entering getProfileDescription(".$profileid.") method ...");
+        global $adb;
+        $sql1 = "select  description from vtiger_profile where profileid=".$profileid;
+        $result = $adb->query($sql1);
+        $profileDescription = $adb->query_result($result,0,"description");
+        $log->debug("Exiting getProfileName method ...");
+        return $profileDescription;
+}
+
 
 /** Function to check if the currently logged in user is permitted to perform the specified action  
   * @param $module -- Module Name:: Type varchar

Modified: vtigercrm/branches/5.0.2/modules/Users/profilePrivileges.php
==============================================================================
--- vtigercrm/branches/5.0.2/modules/Users/profilePrivileges.php (original)
+++ vtigercrm/branches/5.0.2/modules/Users/profilePrivileges.php Mon Oct 30 06:19:21 2006
@@ -59,16 +59,24 @@
 else
 {
 	$profileName=getProfileName($profileId);
+
 }
 
 $smarty->assign("PROFILE_NAME", $profileName);
 
 if(isset($_REQUEST['profile_description']) && $_REQUEST['profile_description'] != '' && $_REQUEST['mode'] == 'create')
+	
 	$smarty->assign("PROFILE_DESCRIPTION",$_REQUEST['profile_description']);
+else
+{
+	$profileDescription = getProfileDescription($profileId);
+}
+
+$smarty->assign("Profile_Name", $profileName);
+$smarty->assign("Profile_Description", $profileDescription);
+
 if(isset($_REQUEST['mode']) && $_REQUEST['mode'] != '')
 	$smarty->assign("MODE",$_REQUEST['mode']);
-
-
 
 
 //Initially setting the secondary selected vtiger_tab





More information about the vtigercrm-commits mailing list