mirror of
				https://github.com/Mibew/design.git
				synced 2025-10-31 10:31:05 +03:00 
			
		
		
		
	Added email validation in prechat survey.
This commit is contained in:
		
							parent
							
								
									7df57f5506
								
							
						
					
					
						commit
						96c4727be2
					
				
							
								
								
									
										8
									
								
								src/messenger/webim/js/164/survey.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/messenger/webim/js/164/survey.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,8 @@ | ||||
| /* | ||||
|  This file is part of Mibew Messenger project. | ||||
|  http://mibew.org
 | ||||
| 
 | ||||
|  Copyright (c) 2005-2011 Mibew Messenger Community | ||||
|  License: http://mibew.org/license.php
 | ||||
| */ | ||||
| var Survey={checkFields:function(){var a=document.surveyForm.email,b=/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;return null!=a&&-1==a.value.search(b)?this.localizedStrings.wrongEmail:null},submit:function(){var a=this.checkFields();null==a?document.surveyForm.submit():alert(a)}};EventHelper.register(window,"onload",function(){Survey.localizedStrings=localizedStrings}); | ||||
| @ -28,6 +28,10 @@ | ||||
| 		<arg value="soundcheck:1:common"/> | ||||
| 		  <arg value="--js"/> | ||||
| 		  <arg value="soundcheck.js"/> | ||||
| 	  <arg value="--module"/> | ||||
| 		<arg value="survey:1:common"/> | ||||
| 		  <arg value="--js"/> | ||||
| 		  <arg value="survey.js"/> | ||||
| 		  <arg value="--module"/> | ||||
| 			<arg value="invite_op:1:common"/> | ||||
| 			  <arg value="--js"/> | ||||
|  | ||||
							
								
								
									
										31
									
								
								src/messenger/webim/js/source/survey.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										31
									
								
								src/messenger/webim/js/source/survey.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,31 @@ | ||||
| /** | ||||
|  * @preserve This file is part of Mibew Messenger project. | ||||
|  * http://mibew.org
 | ||||
|  *  | ||||
|  * Copyright (c) 2005-2011 Mibew Messenger Community | ||||
|  * License: http://mibew.org/license.php
 | ||||
|  */ | ||||
| 
 | ||||
| var Survey = { | ||||
| 	checkFields: function(){ | ||||
| 		var emailField = document.surveyForm.email; | ||||
| 		var emailPattern = /^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; | ||||
| 		if( emailField != null && emailField.value.search(emailPattern) == -1 ){ | ||||
| 			return this.localizedStrings.wrongEmail; | ||||
| 		} | ||||
| 		return null; | ||||
| 	}, | ||||
| 
 | ||||
| 	submit: function(){ | ||||
| 		var error = this.checkFields(); | ||||
| 		if(error == null){ | ||||
| 			document.surveyForm.submit(); | ||||
| 		}else{ | ||||
| 			alert(error); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| EventHelper.register(window, 'onload', function(){ | ||||
|   Survey.localizedStrings = localizedStrings; | ||||
| }); | ||||
| @ -407,6 +407,7 @@ permissions.intro=Change restrictions and available features for this operator. | ||||
| permissions.title=Permissions | ||||
| presurvey.department=Choose Department: | ||||
| presurvey.department.description=Department description: | ||||
| presurvey.error.wrong_email=Wrong email address. | ||||
| presurvey.intro=Thank you for contacting us. Please fill out the form below and click the Start Chat button. | ||||
| presurvey.mail=Email: | ||||
| presurvey.name=Name: | ||||
|  | ||||
| @ -405,6 +405,7 @@ permissions.intro= | ||||
| permissions.title=Возможности оператора | ||||
| presurvey.department=Выберите отдел: | ||||
| presurvey.department.description=Описание отдела: | ||||
| presurvey.error.wrong_email=Íåâåðíûé àäðåñ ýëåêòðîííîé ïî÷òû. | ||||
| presurvey.intro=Спасибо, что связались с нами! Заполните, пожалуйста, небольшую форму и нажмите "Начать диалог". | ||||
| presurvey.mail=E-mail: | ||||
| presurvey.name=Ваше имя: | ||||
|  | ||||
| @ -34,9 +34,18 @@ | ||||
| 	text-decoration:none; | ||||
| } | ||||
| </style> | ||||
| <script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/common.js"></script> | ||||
| <script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/survey.js"></script> | ||||
| <script type="text/javascript"> | ||||
| ${if:groups} | ||||
| <script type="text/javascript">groupDescriptions = ${page:group.descriptions};</script> | ||||
|     var groupDescriptions = ${page:group.descriptions}; | ||||
| ${endif:groups} | ||||
|     var localizedStrings = { | ||||
| ${if:showemail} | ||||
| 	wrongEmail: '${msg:presurvey.error.wrong_email}', | ||||
| ${endif:showemail} | ||||
|     } | ||||
| </script> | ||||
| </head> | ||||
| <body bgcolor="#FFFFFF" text="#000000" link="#C28400" vlink="#C28400" alink="#C28400" style="margin:0px;"> | ||||
| <table width="100%" cellspacing="0" cellpadding="0" border="0"> | ||||
| @ -149,7 +158,7 @@ ${endif:showmessage} | ||||
| 				<td colspan="2" align="right"> | ||||
| 					<table cellspacing="0" cellpadding="0" border="0"> | ||||
| 					<tr> | ||||
| 					<td><a href="javascript:document.surveyForm.submit();" class="but" id="sndmessagelnk">${msg:presurvey.submit}</a></td> | ||||
| 					<td><a href="javascript:Survey.submit();" class="but" id="sndmessagelnk">${msg:presurvey.submit}</a></td> | ||||
| 					</tr> | ||||
| 					</table> | ||||
| 				</td> | ||||
|  | ||||
| @ -20,9 +20,18 @@ | ||||
| .isubmit { background-position:0px -39px; width: 40px; height: 35px; } | ||||
| .isubmitrest { background-position:-31px -39px; width: 10px; height: 35px;} | ||||
| </style> | ||||
| <script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/common.js"></script> | ||||
| <script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/survey.js"></script> | ||||
| <script type="text/javascript"> | ||||
| ${if:groups} | ||||
| <script type="text/javascript">groupDescriptions = ${page:group.descriptions};</script> | ||||
|     var groupDescriptions = ${page:group.descriptions}; | ||||
| ${endif:groups} | ||||
|     var localizedStrings = { | ||||
| ${if:showemail} | ||||
| 	wrongEmail: '${msg:presurvey.error.wrong_email}', | ||||
| ${endif:showemail} | ||||
|     } | ||||
| </script> | ||||
| </head> | ||||
| <body bgcolor="#FFFFFF" style="background-image: url(${tplroot}/images/bg.gif); margin: 0px;" text="#000000" link="#C28400" vlink="#C28400" alink="#C28400"> | ||||
| <table width="100%" style="height: 100%;" cellspacing="0" cellpadding="0" border="0"> | ||||
| @ -132,12 +141,12 @@ ${endif:showmessage} | ||||
|     <td width="33%"> | ||||
| 		<table cellspacing="0" cellpadding="0" border="0"> | ||||
| 		<tr> | ||||
| 	    <td><a href="javascript:document.surveyForm.submit();" title="${msg:presurvey.submit}"><img class="tplimage isubmit" src="${webimroot}/images/free.gif" border="0" alt=""/></a></td> | ||||
| 	    <td><a href="javascript:Survey.submit();" title="${msg:presurvey.submit}"><img class="tplimage isubmit" src="${webimroot}/images/free.gif" border="0" alt=""/></a></td> | ||||
| 	    <td style="background-image: url(${webimroot}/images/submitbg.gif)" valign="top" class="submit"> | ||||
| 			<img src='${webimroot}/images/free.gif' width="1" height="10" border="0" alt="" /><br/> | ||||
| 			<a href="javascript:document.surveyForm.submit();" title="${msg:presurvey.submit}">${msg:presurvey.submit}</a><br/> | ||||
| 			<a href="javascript:Survey.submit();" title="${msg:presurvey.submit}">${msg:presurvey.submit}</a><br/> | ||||
| 		</td> | ||||
| 	    <td width="10"><a href="javascript:document.surveyForm.submit();" title="${msg:presurvey.submit}"><img class="tplimage isubmitrest" src="${webimroot}/images/free.gif" border="0" alt=""/></a></td> | ||||
| 	    <td width="10"><a href="javascript:Survey.submit();" title="${msg:presurvey.submit}"><img class="tplimage isubmitrest" src="${webimroot}/images/free.gif" border="0" alt=""/></a></td> | ||||
| 		</tr> | ||||
| 		</table> | ||||
| 	</td> | ||||
|  | ||||
| @ -4,9 +4,18 @@ | ||||
| 	<title>${msg:presurvey.title}</title> | ||||
| 	<link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon"/> | ||||
| 	<link rel="stylesheet" type="text/css" href="${tplroot}/chat.css" /> | ||||
| 	<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/common.js"></script> | ||||
| 	<script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/survey.js"></script> | ||||
| 	<script type="text/javascript"> | ||||
| 	${if:groups} | ||||
| 	<script type="text/javascript">groupDescriptions = ${page:group.descriptions};</script> | ||||
| 	    var groupDescriptions = ${page:group.descriptions}; | ||||
| 	${endif:groups} | ||||
| 	    var localizedStrings = { | ||||
| 	${if:showemail} | ||||
| 		wrongEmail: '${msg:presurvey.error.wrong_email}', | ||||
| 	${endif:showemail} | ||||
| 	    } | ||||
| 	</script> | ||||
| </head> | ||||
| <body class="bgbody"> | ||||
| 	<div id="top2"> | ||||
| @ -80,7 +89,7 @@ | ||||
| 			</tr> | ||||
| 		${endif:showmessage}			 | ||||
| 		</table>		 | ||||
| 		<a href="javascript:document.surveyForm.submit();" class="but" id="sndmessagelnk">${msg:presurvey.submit}</a> | ||||
| 		<a href="javascript:Survey.submit();" class="but" id="sndmessagelnk">${msg:presurvey.submit}</a> | ||||
| 		<div class="clear"> </div> | ||||
| 	</div> | ||||
| </body> | ||||
|  | ||||
| @ -4,9 +4,18 @@ | ||||
| <title>${msg:presurvey.title}</title> | ||||
| <link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon"/> | ||||
| <link rel="stylesheet" type="text/css" href="${tplroot}/chat.css" /> | ||||
| <script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/common.js"></script> | ||||
| <script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/survey.js"></script> | ||||
| <script type="text/javascript"> | ||||
| ${if:groups} | ||||
| <script type="text/javascript">groupDescriptions = ${page:group.descriptions};</script> | ||||
|     var groupDescriptions = ${page:group.descriptions}; | ||||
| ${endif:groups} | ||||
|     var localizedStrings = { | ||||
| ${if:showemail} | ||||
| 	wrongEmail: '${msg:presurvey.error.wrong_email}', | ||||
| ${endif:showemail} | ||||
|     } | ||||
| </script> | ||||
| </head> | ||||
| <body> | ||||
| <div id="whitebg"> | ||||
| @ -77,8 +86,8 @@ ${endif:groups} | ||||
| 				<td> | ||||
| 					<table cellspacing="3" cellpadding="0" border="0"> | ||||
| 						<tr> | ||||
| 							<td><a href="javascript:document.surveyForm.submit();" title="${msg:presurvey.submit}"><img src="${tplroot}/images/buttons/exec.gif" border="0" alt="${msg:presurvey.submit}"/></a></td> | ||||
| 							<td class="button"><a href="javascript:document.surveyForm.submit();" title="${msg:presurvey.submit}">${msg:presurvey.submit}</a></td> | ||||
| 							<td><a href="javascript:Survey.submit();" title="${msg:presurvey.submit}"><img src="${tplroot}/images/buttons/exec.gif" border="0" alt="${msg:presurvey.submit}"/></a></td> | ||||
| 							<td class="button"><a href="javascript:Survey.submit();" title="${msg:presurvey.submit}">${msg:presurvey.submit}</a></td> | ||||
| 						</tr> | ||||
| 					</table> | ||||
| 				</td> | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user