[Vtigercrm-commits] [vtiger-commits] r10698 - in /vtigercrm/branches/5.0.3: Smarty/templates/DetailViewUI.tpl Smarty/templates/DisplayFields.tpl include/js/general.js

vtigercrm-commits at vtiger.fosslabs.com vtigercrm-commits at vtiger.fosslabs.com
Tue Apr 17 00:57:37 EDT 2007


Author: richie
Date: Mon Apr 16 22:57:29 2007
New Revision: 10698

Log:
fix for The URL goes like http://http//vtiger.com. Fixes #3372 --minnie

Modified:
    vtigercrm/branches/5.0.3/Smarty/templates/DetailViewUI.tpl
    vtigercrm/branches/5.0.3/Smarty/templates/DisplayFields.tpl
    vtigercrm/branches/5.0.3/include/js/general.js

Modified: vtigercrm/branches/5.0.3/Smarty/templates/DetailViewUI.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/DetailViewUI.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/DetailViewUI.tpl Mon Apr 16 22:57:29 2007
@@ -119,7 +119,7 @@
                                              {elseif $keyid eq '17'} <!--WebSite-->
                                                   <td width=25% class="dvtCellInfo" align="left" id="mouseArea_{$label}" onmouseover="hndMouseOver({$keyid},'{$label|escape:'quotes'}');" onmouseout="fnhide('crmspanid');">&nbsp;<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="{$keyfldname}" maxlength='100' value="{$keyval|escape}"></input>
+                                              		  <input class="detailedViewTextBox" onFocus="this.className='detailedViewTextBoxOn'" onBlur="this.className='detailedViewTextBox'" onkeyup="validateUrl('website');" type="text" id="txtbox_{$label}" name="{$keyfldname}" maxlength='100' value="{$keyval|escape}"></input>
                                               		  <br><input name="button_{$label}" type="button" class="crmbutton small save" value="{$APP.LBL_SAVE_LABEL}" onclick="dtlViewAjaxSave('{$label|escape:'quotes'}','{$MODULE}',{$keyid},'{$keytblname}','{$keyfldname}','{$ID}');fnhide('crmspanid');"/> {$APP.LBL_OR}
                                               		  <a href="javascript:;" onclick="hndCancel('dtlview_{$label|escape:'quotes'}','editarea_{$label|escape:'quotes'}','{$label|escape:'quotes'}')" class="link">{$APP.LBL_CANCEL_BUTTON_LABEL}</a>
                                                        </div>

Modified: vtigercrm/branches/5.0.3/Smarty/templates/DisplayFields.tpl
==============================================================================
--- vtigercrm/branches/5.0.3/Smarty/templates/DisplayFields.tpl (original)
+++ vtigercrm/branches/5.0.3/Smarty/templates/DisplayFields.tpl Mon Apr 16 22:57:29 2007
@@ -280,7 +280,7 @@
 			</td>
 			<td width="30%" align=left class="dvtCellInfo">
 				&nbsp;&nbsp;http://
-			<input style="width:74%;" class = 'detailedViewTextBoxOn' type="text" tabindex="{$vt_tab}" name="{$fldname}" style="border:1px solid #bababa;" size="27" onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'"  value="{$fldvalue|escape}">
+			<input style="width:74%;" class = 'detailedViewTextBoxOn' type="text" tabindex="{$vt_tab}" name="{$fldname}" style="border:1px solid #bababa;" size="27" onFocus="this.className='detailedViewTextBoxOn'"onBlur="this.className='detailedViewTextBox'" onkeyup="validateUrl('website');" value="{$fldvalue|escape}">
 			</td>
 
 		{elseif $uitype eq 85}

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 Mon Apr 16 22:57:29 2007
@@ -2076,3 +2076,23 @@
 	
 }
 
+function validateUrl(name)
+{
+	var Url = getObj(name);
+	var wProtocol;
+
+	var oRegex = new Object();
+	oRegex.UriProtocol = new RegExp('');
+	oRegex.UriProtocol.compile( '^(((http|https|ftp|news):\/\/)|mailto:)', 'gi' );
+	oRegex.UrlOnChangeProtocol = new RegExp('') ;
+	oRegex.UrlOnChangeProtocol.compile( '^(http|https|ftp|news)://(?=.)', 'gi' );
+
+	wUrl = Url.value;
+	wProtocol=oRegex.UrlOnChangeProtocol.exec( wUrl ) ;
+	if ( wProtocol )
+	{
+		wUrl = wUrl.substr( wProtocol[0].length );
+		Url.value = wUrl;
+	}
+}
+





More information about the vtigercrm-commits mailing list