[Vtigercrm-commits] [vtiger-commits] r6414 - in /vtigercrm/trunk/Smarty/templates: Header.tpl QuickCreate.tpl QuickCreateHidden.tpl
vtigercrm-commits at vtiger.fosslabs.com
vtigercrm-commits at vtiger.fosslabs.com
Thu May 25 09:58:38 EDT 2006
Author: saraj
Date: Thu May 25 07:58:33 2006
New Revision: 6414
Log:
Quick Create Module made functional - ahmed
Modified:
vtigercrm/trunk/Smarty/templates/Header.tpl
vtigercrm/trunk/Smarty/templates/QuickCreate.tpl
vtigercrm/trunk/Smarty/templates/QuickCreateHidden.tpl
Modified: vtigercrm/trunk/Smarty/templates/Header.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/Header.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/Header.tpl Thu May 25 07:58:33 2006
@@ -28,6 +28,7 @@
<script language="JavaScript" type="text/javascript" src="include/calculator/calc.js"></script>
<script language="JavaScript" type="text/javascript" src="modules/Calendar/script.js"></script>
<script language="javascript" type="text/javascript" src="include/scriptaculous/dom-drag.js"></script>
+
<TABLE border=0 cellspacing=0 cellpadding=0 width=100% class="hdrNameBg">
<tr>
<td><img src="{$IMAGEPATH}/vtiger-crm.gif" alt="vtiger CRM" title="vtiger CRM" border=0></td>
@@ -174,6 +175,7 @@
</script>
<script>
+
function QCreate(qcoptions)
{ldelim}
show("status");
@@ -183,33 +185,204 @@
var urlstring = "module=Activities&action=ActivitiesAjax&ajaxmode=qcreate&activity_mode=Events";
else
var urlstring = "module="+module+"&action="+module+"Ajax&ajaxmode=qcreate";
- ajaxObj.process("index.php?",urlstring);
-{rdelim}
+ ajaxObj.process("index.php?",urlstring);
+{rdelim}
+
function ajaxQCreateResponse(response)
{ldelim}
hide("status");
show("qcform");
document.getElementById('qcform').innerHTML = response.responseText;
+ eval(document.getElementById('qcform'));
{rdelim}
</script>
-
-{* Begining of Slide Menu
-
-<div id="mnuSlide">
-<table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td width="112" id="slidemenu">
- <div id="slide" style="display:none;">
- {foreach item=modulename from=$MODULELISTS}
- <a href="index.php?module={$modulename}&action=index" class="submenu">{$modulename}</a>
- {/foreach}
- </div>
- </td>
- <td width="8" valign="top">
- <div id="mnuKey" onclick="fnSlide1('slidemenu','slide')" ><img src="{$IMAGEPATH}/jump.gif" style="opacity:.7;"></div>
- </td>
- </tr>*}
+{literal}
+<SCRIPT>
+function getFormValidate(divValidate)
+{
+ var st = document.getElementById('qcvalidate');
+ eval(st.innerHTML);
+ for (var i=0; i<fieldname.length; i++) {
+ if(getObj(fieldname[i]) != null)
+ {
+ var type=fielddatatype[i].split("~")
+ if (type[1]=="M") {
+ if (!emptyCheck(fieldname[i],fieldlabel[i],getObj(fieldname[i]).type))
+ return false
+ }
+
+ switch (type[0]) {
+ case "O" : break;
+ case "V" : break;
+ case "C" : break;
+ case "DT" :
+ if (getObj(fieldname[i]) != null && getObj(fieldname[i]).value.replace(/^\s+/g, '').replace(/\s+$/g, '').length!=0)
+ {
+ if (type[1]=="M")
+ if (!emptyCheck(type[2],fieldlabel[i],getObj(type[2]).type))
+ return false
+
+ if(typeof(type[3])=="undefined") var currdatechk="OTH"
+ else var currdatechk=type[3]
+
+ if (!dateTimeValidate(fieldname[i],type[2],fieldlabel[i],currdatechk))
+ return false
+ if (type[4]) {
+ if (!dateTimeComparison(fieldname[i],type[2],fieldlabel[i],type[5],type[6],type[4]))
+ return false
+
+ }
+ }
+ break;
+ case "D" :
+ if (getObj(fieldname[i]) != null && getObj(fieldname[i]).value.replace(/^\s+/g, '').replace(/\s+$/g, '').length!=0)
+ {
+ if(typeof(type[2])=="undefined") var currdatechk="OTH"
+ else var currdatechk=type[2]
+
+ if (!dateValidate(fieldname[i],fieldlabel[i],currdatechk))
+ return false
+ if (type[3]) {
+ if (!dateComparison(fieldname[i],fieldlabel[i],type[4],type[5],type[3]))
+ return false
+ }
+ }
+ break;
+ case "T" :
+ if (getObj(fieldname[i]) != null && getObj(fieldname[i]).value.replace(/^\s+/g, '').replace(/\s+$/g, '').length!=0)
+ {
+ if(typeof(type[2])=="undefined") var currtimechk="OTH"
+ else var currtimechk=type[2]
+
+ if (!timeValidate(fieldname[i],fieldlabel[i],currtimechk))
+ return false
+ if (type[3]) {
+ if (!timeComparison(fieldname[i],fieldlabel[i],type[4],type[5],type[3]))
+ return false
+ }
+ }
+ break;
+ case "I" :
+ if (getObj(fieldname[i]) != null && getObj(fieldname[i]).value.replace(/^\s+/g, '').replace(/\s+$/g, '').length!=0)
+ {
+ if (getObj(fieldname[i]).value.length!=0)
+ {
+ if (!intValidate(fieldname[i],fieldlabel[i]))
+ return false
+ if (type[2]) {
+ if (!numConstComp(fieldname[i],fieldlabel[i],type[2],type[3]))
+ return false
+ }
+ }
+ }
+ break;
+ case "N" :
+ case "NN" :
+ if (getObj(fieldname[i]) != null && getObj(fieldname[i]).value.replace(/^\s+/g, '').replace(/\s+$/g, '').length!=0)
+ {
+ if (getObj(fieldname[i]).value.length!=0)
+ {
+ if (typeof(type[2])=="undefined") var numformat="any"
+ else var numformat=type[2]
+
+ if (type[0]=="NN") {
+
+ if (!numValidate(fieldname[i],fieldlabel[i],numformat,true))
+ return false
+ } else {
+ if (!numValidate(fieldname[i],fieldlabel[i],numformat))
+ return false
+ }
+ if (type[3]) {
+ if (!numConstComp(fieldname[i],fieldlabel[i],type[3],type[4]))
+ return false
+ }
+ }
+ }
+ break;
+ case "E" :
+ if (getObj(fieldname[i]) != null && getObj(fieldname[i]).value.replace(/^\s+/g, '').replace(/\s+$/g, '').length!=0)
+ {
+ if (getObj(fieldname[i]).value.length!=0)
+ {
+ var etype = "EMAIL"
+ if (!patternValidate(fieldname[i],fieldlabel[i],etype))
+ return false
+ }
+ }
+ break;
+ }
+ }
+ }
+ //added to check Start Date & Time,if Activity Status is Planned.//start
+ for (var j=0; j<fieldname.length; j++)
+ {
+
+ if(getObj(fieldname[i]) != null)
+ {
+ if(fieldname[j] == "date_start")
+ {
+ var datelabel = fieldlabel[j]
+ var datefield = fieldname[j]
+ var startdatevalue = getObj(datefield).value.replace(/^\s+/g, '').replace(/\s+$/g, '')
+ }
+ if(fieldname[j] == "time_start")
+ {
+ var timelabel = fieldlabel[j]
+ var timefield = fieldname[j]
+ var timeval=getObj(timefield).value.replace(/^\s+/g, '').replace(/\s+$/g, '')
+ }
+ if(fieldname[j] == "eventstatus" || fieldname[j] == "taskstatus")
+ {
+ var statusvalue = getObj(fieldname[j]).value.replace(/^\s+/g, '').replace(/\s+$/g, '')
+ var statuslabel = fieldlabel[j++]
+ }
+ }
+ }
+ if(statusvalue == "Planned")
+ {
+ var dateelements=splitDateVal(startdatevalue)
+
+ var hourval=parseInt(timeval.substring(0,timeval.indexOf(":")))
+ var minval=parseInt(timeval.substring(timeval.indexOf(":")+1,timeval.length))
+
+
+ dd=dateelements[0]
+ mm=dateelements[1]
+ yyyy=dateelements[2]
+
+ var currdate=new Date()
+ var chkdate=new Date()
+ chkdate.setYear(yyyy)
+ chkdate.setMonth(mm-1)
+ chkdate.setDate(dd)
+
+ chktime = new Date()
+
+ chktime.setYear(yyyy)
+ chktime.setMonth(mm-1)
+ chktime.setDate(dd)
+ chktime.setHours(hourval)
+ chktime.setMinutes(minval)
+ //chkdate.setHours(hourval)
+ //chkdate.setMinutes(minval)
+ if (!compareDates(chkdate,datelabel,currdate,"Current date & time for Activities with status as Planned","GE")) {
+ getObj(datefield).focus()
+ return false
+ }
+ else if(!compareDates(chktime,timelabel,currdate,"Current Time for Activities with status as Planned","GE"))
+ {
+ getObj(timefield).focus()
+ return false
+ }
+ else return true
+
+ }//end
+ return true;
+}
+</SCRIPT>
+{/literal}
{* Quick Access Functionality *}
<div id="allMenu" onmouseout="fninvsh('allMenu');" onmouseover="fnvshNrm('allMenu');">
Modified: vtigercrm/trunk/Smarty/templates/QuickCreate.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/QuickCreate.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/QuickCreate.tpl Thu May 25 07:58:33 2006
@@ -9,13 +9,6 @@
*
********************************************************************************/
-->*}
-<script language="javascript">
- var fieldname = new Array({$VALIDATION_DATA_FIELDNAME})
- var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL})
- var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE})
-</script>
-
-
<body class=small>
{include file='QuickCreateHidden.tpl'}
<table border=0 align="center" cellspacing=0 cellpadding=0 width="90%" class=qcWindow>
@@ -388,5 +381,10 @@
</td>
</tr>
</table>
+<SCRIPT id="qcvalidate">
+ var fieldname = new Array({$VALIDATION_DATA_FIELDNAME});
+ var fieldlabel = new Array({$VALIDATION_DATA_FIELDLABEL});
+ var fielddatatype = new Array({$VALIDATION_DATA_FIELDDATATYPE});
+</SCRIPT>
</form>
</body>
Modified: vtigercrm/trunk/Smarty/templates/QuickCreateHidden.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/QuickCreateHidden.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/QuickCreateHidden.tpl Thu May 25 07:58:33 2006
@@ -12,7 +12,7 @@
-->*}
{if $MODULE eq 'Accounts'}
- <form name="AccountSave" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="AccountSave" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="{$MODULE}">
<input type="hidden" name="record" value="">
<input type="hidden" name="email1" value="">
@@ -20,44 +20,37 @@
<input type="hidden" name="assigned_user_id" value="{$USERID}">
<input type="hidden" name="action" value="Save">
{elseif $MODULE eq 'Leads'}
- <form name="LeadSave" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="LeadSave" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="{$MODULE}">
<input type="hidden" name="record" value="">
<input type="hidden" name="assigned_user_id" value="{$USERID}">
<input type="hidden" name="email2" value="">
<input type="hidden" name="action" value="Save">
{elseif $MODULE eq 'Contacts'}
- <form name="EditView" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="EditView" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="{$MODULE}">
<input type="hidden" name="record" value="">
<input type="hidden" name="assigned_user_id" value="{$USERID}">
<input type="hidden" name="email2" value="">
<input type="hidden" name="action" value="Save">
{elseif $MODULE eq 'Activities'}
- <form name="ActivitySave" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="ActivitySave" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="Activities">
<input type="hidden" name="record" value="">
- <input type="hidden" name="activity_mode" value="{$ACTIVITYMODE}">
+ <input type="hidden" name="activity_mode" value="Task">
<input type="hidden" name="assigned_user_id" value="{$USERID}">
<input type="hidden" name="action" value="Save">
<input type="hidden" name="due_date" value="">
{elseif $MODULE eq 'Events'}
- <form name="EventSave" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="EventSave" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="Activities">
<input type="hidden" name="record" value="">
<input type="hidden" name="activity_mode" value="Events">
<input type="hidden" name="assigned_user_id" value="{$USERID}">
<input type="hidden" name="action" value="Save">
<input type="hidden" name="due_date" value="">
-{elseif $MODULE eq 'Emails'}
- <form name="EmailSave" onSubmit="return qcformValidate()" method="POST" action="index.php">
- <input type="hidden" name="module" value="Emails">
- <input type="hidden" name="record" value="">
- <input type="hidden" name="action" value="Save">
- <input type="hidden" name="parent_type" value="{$APP.record_type_default_key}">
- <input type="hidden" name="assigned_user_id" value="{$USERID}">
{elseif $MODULE eq 'HelpDesk'}
- <form name="TicketSave" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="TicketSave" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="{$MODULE}">
<input type="hidden" name="return_module" value="HelpDesk">
<input type="hidden" name="record" value="">
@@ -66,40 +59,31 @@
<input type="hidden" name="action" value="Save">
<input type="hidden" name="return_action" value="DetailView">
{elseif $MODULE eq 'Notes'}
- <form name="NoteSave" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="NoteSave" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="{$MODULE}">
<input type="hidden" name="record" value="">
<input type="hidden" name="parent_type" value="{$APP.record_type_default_key}">
<input type="hidden" name="action" value="Save">
{elseif $MODULE eq 'Potentials'}
- <form name="EditView" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="EditView" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="Potentials">
<input type="hidden" name="record" value="">
<input type="hidden" name="assigned_user_id" value="{$USERID}">
<input type="hidden" name="action" value="Save">
{elseif $MODULE eq 'Campaigns'}
- <form name="EditView" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="EditView" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="{$MODULE}">
<input type="hidden" name="record" value="">
<input type="hidden" name="assigned_user_id" value="{$USERID}">
<input type="hidden" name="action" value="Save">
-{elseif $MODULE eq 'Products'}
- <form name="ProductSave" onSubmit="return qcformValidate()" method="POST" action="index.php">
- <input type="hidden" name="module" value="Products">
- <input type="hidden" name="record" value="">
- <input type="hidden" name="assigned_user_id" value="'.$user_id.'">
- <input type="hidden" name="action" value="Save">
- {*<input type="hidden" name="start_date" value="'.$start_date.'">
- <input type="hidden" name="expiry_date" value="'.$start_date.'">
- <input type="hidden" name="purchase_date" value="'.$start_date.'">*}
{elseif $MODULE eq 'PriceBooks'}
- <form name="PBookSave" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="PBookSave" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="PriceBooks">
<input type="hidden" name="record" value="">
<input type="hidden" name="assigned_user_id" value="{$USERID}">
<input type="hidden" name="action" value="Save">
{elseif $MODULE eq 'Vendors'}
- <form name="PBookSave" onSubmit="return qcformValidate()" method="POST" action="index.php">
+ <form name="PBookSave" onSubmit="return getFormValidate('qcform');" method="POST" action="index.php">
<input type="hidden" name="module" value="Vendors">
<input type="hidden" name="record" value="">
<input type="hidden" name="assigned_user_id" value="{$USERID}">
More information about the vtigercrm-commits
mailing list