[Vtigercrm-commits] [vtiger-commits] r7338 - in /vtigercrm/trunk: Smarty/templates/DetailViewHidden.tpl Smarty/templates/DetailViewUI.tpl Smarty/templates/Inventory/InventoryDetailView.tpl include/js/dtlviewajax.js

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Wed Jun 21 05:34:53 EDT 2006


Author: saraj
Date: Wed Jun 21 03:34:46 2006
New Revision: 7338

Log:
Ajax edit has been fixed to retain values

Modified:
    vtigercrm/trunk/Smarty/templates/DetailViewHidden.tpl
    vtigercrm/trunk/Smarty/templates/DetailViewUI.tpl
    vtigercrm/trunk/Smarty/templates/Inventory/InventoryDetailView.tpl
    vtigercrm/trunk/include/js/dtlviewajax.js

Modified: vtigercrm/trunk/Smarty/templates/DetailViewHidden.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/DetailViewHidden.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/DetailViewHidden.tpl Wed Jun 21 03:34:46 2006
@@ -149,7 +149,6 @@
         <input type="hidden" name="return_module">
         <input type="hidden" name="return_action">
         <input type="hidden" name="return_id">
-        <input type="hidden" name="contact_id">
         <input type="hidden" name="member_id">
         <input type="hidden" name="opportunity_id">
         <input type="hidden" name="case_id">
@@ -168,7 +167,6 @@
         <input type="hidden" name="return_module">
         <input type="hidden" name="return_action">
         <input type="hidden" name="return_id">
-        <input type="hidden" name="contact_id">
         <input type="hidden" name="member_id">
         <input type="hidden" name="opportunity_id">
         <input type="hidden" name="case_id">

Modified: vtigercrm/trunk/Smarty/templates/DetailViewUI.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/DetailViewUI.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/DetailViewUI.tpl Wed Jun 21 03:34:46 2006
@@ -22,7 +22,7 @@
                                                         {/if}
                                                        <span id="dtlview_{$label}">{$keyval}</span>
                                               		<div id="editarea_{$label}" style="display:none;">
-                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="textbox_{$label}" maxlength='100' value="{$keyval}"></input>
+                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
                                               		  <br><input name="button_{$label}" type="button" class="small" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> or
                                               		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
                                                        </div>
@@ -30,7 +30,7 @@
                                              {elseif $keyid eq '13'} <!--Email-->
                                                   <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');"><span id="dtlview_{$label}"><a href="mailto:{$keyval}" target="_blank">{$keyval}</a></span>
                                               		<div id="editarea_{$label}" style="display:none;">
-                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="textbox_{$label}" maxlength='100' value="{$keyval}"></input>
+                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
                                               		  <br><input name="button_{$label}" type="button" class="small" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> or
                                               		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
                                                        </div>
@@ -52,7 +52,7 @@
                                              {elseif $keyid eq '17'} <!--WebSite-->
                                                   <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');"><span id="dtlview_{$label}"><a href="http://{$keyval}" target="_blank">{$keyval}</a></span>
                                               		<div id="editarea_{$label}" style="display:none;">
-                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="textbox_{$label}" maxlength='100' value="{$keyval}"></input>
+                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval}"></input>
                                               		  <br><input name="button_{$label}" type="button" class="small" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> or
                                               		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
                                                        </div>
@@ -60,7 +60,7 @@
                                              {elseif $keyid eq '19' || $keyid eq '20'} <!--TextArea/Description-->
                                                   <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');"><span id="dtlview_{$label}">{$keyval}</span>
                                               		<div id="editarea_{$label}" style="display:none;">
-                                              		  <textarea id="txtbox_{$label}" name="txtbox_{$label}"  class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" cols="90" rows="8">{$keyval}</textarea>                                            		  
+                                              		  <textarea id="txtbox_{$label}" name="{$keyfldname}"  class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" cols="90" rows="8">{$keyval}</textarea>                                            		  
                                               		  <br><input name="button_{$label}" type="button" class="small" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> or
                                               		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
                                                        </div>
@@ -68,7 +68,7 @@
                                              {elseif $keyid eq '21' || $keyid eq '24' || $keyid eq '22'} <!--TextArea/Street-->
                                                   <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');"><span id="dtlview_{$label}">{$keyval}</span>
                                               		<div id="editarea_{$label}" style="display:none;">
-                                              		  <textarea id="txtbox_{$label}" name="txtbox_{$label}"  class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" rows=2>{$keyval}</textarea>                                            		  
+                                              		  <textarea id="txtbox_{$label}" name="{$keyfldname}"  class=detailedViewTextBox onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" rows=2>{$keyval}</textarea>                                            		  
                                               		  <br><input name="button_{$label}" type="button" class="small" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> or
                                               		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
                                                        </div>
@@ -136,6 +136,7 @@
                                                   </td>
 					{elseif $keyid eq '53'} <!--Assigned To-->
                     <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');">
+				
                     <span id="dtlview_{$label}">
                     {if $keyseclink eq ''}
                         {$keyval}
@@ -162,9 +163,9 @@
                       <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onMouseOver="hndMouseOver({$keyid},'{$label}');" onmouseout="fnhide('crmspanid');"><span id="dtlview_{$label}">{$keyval}&nbsp;</span>
                     	<div id="editarea_{$label}" style="display:none;">
                         {if $keyval eq 'yes'}                                              		  
-                            <input id="txtbox_{$label}" type="checkbox" style="border:1px solid #bababa;" checked value="1">
+                            <input id="txtbox_{$label}" name="{$keyfldname}" type="checkbox" style="border:1px solid #bababa;" checked value="1">
                         {else}
-                          <input id="txtbox_{$label}" type="checkbox" style="border:1px solid #bababa;" value="0">
+                          <input id="txtbox_{$label}" type="checkbox" name="{$keyfldname}" style="border:1px solid #bababa;" value="0">
                        	{/if}
                          <br><input name="button_{$label}" type="button" class="small" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');"/> or
                           <a href="javascript:;" onclick="hndCancel('dtlview_{$label}','editarea_{$label}','{$label}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>

Modified: vtigercrm/trunk/Smarty/templates/Inventory/InventoryDetailView.tpl
==============================================================================
--- vtigercrm/trunk/Smarty/templates/Inventory/InventoryDetailView.tpl (original)
+++ vtigercrm/trunk/Smarty/templates/Inventory/InventoryDetailView.tpl Wed Jun 21 03:34:46 2006
@@ -14,6 +14,9 @@
 <script type="text/javascript" src="modules/{$MODULE}/{$SINGLE_MOD}.js"></script>
 <script language="JavaScript" type="text/javascript" src="include/js/dtlviewajax.js"></script>
 <div id="convertleaddiv" style="display:block;position:absolute;left:225px;top:150px;"></div>
+<span id="crmspanid" style="display:none;position:absolute;"  onmouseover="show('crmspanid');">
+   <a class="link"  align="right" href="javascript:;">{$APP.LBL_EDIT_BUTTON}</a>
+</span>
 <script>
 function tagvalidate()
 {ldelim}

Modified: vtigercrm/trunk/include/js/dtlviewajax.js
==============================================================================
--- vtigercrm/trunk/include/js/dtlviewajax.js (original)
+++ vtigercrm/trunk/include/js/dtlviewajax.js Wed Jun 21 03:34:46 2006
@@ -11,7 +11,9 @@
 var globaleditareaspanid = ""; 
 var globaltxtboxid = "";
 var itsonview=false;
-
+// to retain the old value if we cancel the ajax edit
+var globaltempvalue = '';
+var globaluitype = '';
 function showHide(showId, hideId)
 {
 	show(showId);
@@ -22,6 +24,16 @@
 {
 
   showHide(valuespanid,textareapanid);
+  if(globaluitype == '56')
+  {	  
+	  if(globaltempvalue == 1)
+	  	getObj(globaltxtboxid).checked = true; 
+	  else		
+	  	getObj(globaltxtboxid).checked = false; 
+  }
+  else		  
+	  getObj(globaltxtboxid).value = globaltempvalue; 
+  globaltempvalue = '';
   itsonview=false;
   return false;
 }
@@ -37,6 +49,7 @@
       }
       
       show("crmspanid");
+	  globaluitype = uitype;
       globaldtlviewspanid= "dtlview_"+ fieldLabel;//valuespanid;
       globaleditareaspanid="editarea_"+ fieldLabel;//textareapanid;
       globaltxtboxid="txtbox_"+ fieldLabel;//textboxpanid;
@@ -59,6 +72,7 @@
 {
      show(globaleditareaspanid) ;
      fnhide(globaldtlviewspanid);
+	 globaltempvalue = getObj(globaltxtboxid).value;
      getObj(globaltxtboxid).focus();
      fnhide('crmspanid');
      itsonview=true;
@@ -87,6 +101,7 @@
 	}
 
 
+	$("vtbusy_info").style.display="inline";
 	var isAdmin = document.getElementById("hdtxt_IsAdmin").value; 
 
 	var tagValue = trim(document.getElementById(txtBox).value);
@@ -105,7 +120,6 @@
 
 	var data = "file=DetailViewAjax&module=" + module + "&action=" + module + "Ajax&recordid=" + crmId ;
 	data = data + "&fldName=" + fieldName + "&fieldValue=" + escape(tagValue) + "&ajxaction=DETAILVIEW";
-	$("vtbusy_info").style.display="inline";
 	new Ajax.Request(
 		'index.php',
                 {queue: {position: 'end', scope: 'command'},
@@ -116,12 +130,12 @@
 				{
 					alert("Error while Editing");
 				}
-				else if(item.indexOf(":#:SUCCESS")>-1)
-     				{
+				else if(response.responseText.indexOf(":#:SUCCESS")>-1)
+    			{
 					$("vtbusy_info").style.display="none";
-     				}
-                       	}
-                }
+    			}
+           	}
+        }
         );
 	if(uitype == '13')
 	{





More information about the vtigercrm-commits mailing list