[Vtigercrm-commits] [vtiger-commits] r10709 - in /vtigercrm/branches/5.0.3: Smarty/templates/CreateProfile.tpl Smarty/templates/GroupEditView.tpl Smarty/templates/RoleEditView.tpl Smarty/templates/UserEditView.tpl include/js/general.js

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Apr 17 11:05:43 EDT 2007


Author: saraj
Date: Tue Apr 17 09:05:34 2007
New Revision: 10709

Log:
* Fixed the issue in name of Role/Profile and group, Fixed #3661

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/CreateProfile.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/GroupEditView.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/RoleEditView.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/UserEditView.tpl
    vtigercrm/branches/5.0.3/include/js/general.js

Modified: vtigercrm/branches/5.0.3/Smarty/templates/CreateProfile.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/CreateProfile.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/CreateProfile.tpl Tue Apr 17 09:05:34 2007
@@ -192,6 +192,9 @@
 
 function dup_validation(profilename)
 {ldelim}
+	var status = CharValidation(profilename,'namespace');
+	if(status)
+	{ldelim}
 	new Ajax.Request(
 		'index.php',
 		{ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
@@ -205,5 +208,8 @@
 				{rdelim}
 		{rdelim}
 	);
+	{rdelim}
+	else
+		alert(alert_arr.NO_SPECIAL+alert_arr.IN_PROFILENAME)
 {rdelim}
 </script>

Modified: vtigercrm/branches/5.0.3/Smarty/templates/GroupEditView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/GroupEditView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/GroupEditView.tpl Tue Apr 17 09:05:34 2007
@@ -21,7 +21,7 @@
 		var reminstr = '&mode='+mode+'&groupName='+groupname+'&groupid='+groupid;
 	else
 		var reminstr = '&groupName='+groupname;
-	var status = usernameValid(groupname);
+	var status = CharValidation(groupname,'namespace');
 	if(status)
 	{ldelim}
 	new Ajax.Request(
@@ -39,7 +39,7 @@
 		);
 	{rdelim}
 	else
-		alert(alert_arr.NO_SPECIAL+" in Group Name ")
+		alert(alert_arr.NO_SPECIAL+alert_arr.IN_GROUPNAME)
 {rdelim}
 var constructedOptionValue;
 var constructedOptionName;

Modified: vtigercrm/branches/5.0.3/Smarty/templates/RoleEditView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/RoleEditView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/RoleEditView.tpl Tue Apr 17 09:05:34 2007
@@ -20,6 +20,9 @@
 		var urlstring ="&mode="+mode+"&roleName="+rolename+"&roleid="+roleid;
 	else
 		var urlstring ="&roleName="+rolename;
+	var status = CharValidation(rolename,'namespace');
+	if(status)
+	{ldelim}
 	new Ajax.Request(
                 'index.php',
                 {ldelim}queue: {ldelim}position: 'end', scope: 'command'{rdelim},
@@ -33,6 +36,9 @@
                                 {rdelim}
                         {rdelim}
                 );
+	{rdelim}
+	else
+		alert(alert_arr.NO_SPECIAL+alert_arr.IN_ROLENAME)
 
 {rdelim}
 function validate()

Modified: vtigercrm/branches/5.0.3/Smarty/templates/UserEditView.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/UserEditView.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/UserEditView.tpl Tue Apr 17 09:05:34 2007
@@ -32,7 +32,7 @@
 function check_duplicate()
 {ldelim}
 	var user_name = window.document.EditView.user_name.value;
-	var status = usernameValid(user_name);
+	var status = CharValidation(user_name,'name');
         if(status)
 	{ldelim}
 	new Ajax.Request(

Modified: vtigercrm/branches/5.0.3/include/js/general.js
==============================================================================
--- vtigercrm/branches/5.0.3/include/js/general.js (original)
+++ vtigercrm/branches/5.0.3/include/js/general.js Tue Apr 17 09:05:34 2007
@@ -2034,20 +2034,31 @@
        }
 }
 
-function usernameCharValid(c) {
-  return ( ((c >= 'a') && (c <= 'z')) ||
-           ((c >= 'A') && (c <= 'Z')) ||
-           ((c >= '0') && (c <= '9')) ||
-           (c == '.') );
-}
-
-function usernameValid(s) {
-  for (var i = 0; i < s.length; i++) {
-    if (!usernameCharValid(s.charAt(i))){
-      return false;}
-  }
-  return true;
-}
+
+function valid(c,type)
+{
+	if(type == 'name')
+	{
+		return (((c >= 'a') && (c <= 'z')) ||((c >= 'A') && (c <= 'Z')) ||((c >= '0') && (c <= '9')) || (c == '.'));
+	}
+	else if(type == 'namespace')
+	{
+		return (((c >= 'a') && (c <= 'z')) ||((c >= 'A') && (c <= 'Z')) ||((c >= '0') && (c <= '9')) || (c == '.')||(c==' '));
+	}
+}
+
+function CharValidation(s,type)
+{
+	for (var i = 0; i < s.length; i++)
+	{
+		if (!valid(s.charAt(i),type))
+		{
+			return false;
+		}
+	}
+	return true;
+}
+
 
 /** Check Upload file is in specified format(extension).
   * @param fldname -- name of the file field





More information about the vtigercrm-commits mailing list