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="soundcheck:1:common"/> | ||||||
| 		  <arg value="--js"/> | 		  <arg value="--js"/> | ||||||
| 		  <arg value="soundcheck.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="--module"/> | ||||||
| 			<arg value="invite_op:1:common"/> | 			<arg value="invite_op:1:common"/> | ||||||
| 			  <arg value="--js"/> | 			  <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 | permissions.title=Permissions | ||||||
| presurvey.department=Choose Department: | presurvey.department=Choose Department: | ||||||
| presurvey.department.description=Department description: | 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.intro=Thank you for contacting us. Please fill out the form below and click the Start Chat button. | ||||||
| presurvey.mail=Email: | presurvey.mail=Email: | ||||||
| presurvey.name=Name: | presurvey.name=Name: | ||||||
|  | |||||||
| @ -405,6 +405,7 @@ permissions.intro= | |||||||
| permissions.title=Возможности оператора | permissions.title=Возможности оператора | ||||||
| presurvey.department=Выберите отдел: | presurvey.department=Выберите отдел: | ||||||
| presurvey.department.description=Описание отдела: | presurvey.department.description=Описание отдела: | ||||||
|  | presurvey.error.wrong_email=Íåâåðíûé àäðåñ ýëåêòðîííîé ïî÷òû. | ||||||
| presurvey.intro=Спасибо, что связались с нами! Заполните, пожалуйста, небольшую форму и нажмите "Начать диалог". | presurvey.intro=Спасибо, что связались с нами! Заполните, пожалуйста, небольшую форму и нажмите "Начать диалог". | ||||||
| presurvey.mail=E-mail: | presurvey.mail=E-mail: | ||||||
| presurvey.name=Ваше имя: | presurvey.name=Ваше имя: | ||||||
|  | |||||||
| @ -34,9 +34,18 @@ | |||||||
| 	text-decoration:none; | 	text-decoration:none; | ||||||
| } | } | ||||||
| </style> | </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} | ${if:groups} | ||||||
| <script type="text/javascript">groupDescriptions = ${page:group.descriptions};</script> |     var groupDescriptions = ${page:group.descriptions}; | ||||||
| ${endif:groups} | ${endif:groups} | ||||||
|  |     var localizedStrings = { | ||||||
|  | ${if:showemail} | ||||||
|  | 	wrongEmail: '${msg:presurvey.error.wrong_email}', | ||||||
|  | ${endif:showemail} | ||||||
|  |     } | ||||||
|  | </script> | ||||||
| </head> | </head> | ||||||
| <body bgcolor="#FFFFFF" text="#000000" link="#C28400" vlink="#C28400" alink="#C28400" style="margin:0px;"> | <body bgcolor="#FFFFFF" text="#000000" link="#C28400" vlink="#C28400" alink="#C28400" style="margin:0px;"> | ||||||
| <table width="100%" cellspacing="0" cellpadding="0" border="0"> | <table width="100%" cellspacing="0" cellpadding="0" border="0"> | ||||||
| @ -149,7 +158,7 @@ ${endif:showmessage} | |||||||
| 				<td colspan="2" align="right"> | 				<td colspan="2" align="right"> | ||||||
| 					<table cellspacing="0" cellpadding="0" border="0"> | 					<table cellspacing="0" cellpadding="0" border="0"> | ||||||
| 					<tr> | 					<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> | 					</tr> | ||||||
| 					</table> | 					</table> | ||||||
| 				</td> | 				</td> | ||||||
|  | |||||||
| @ -20,9 +20,18 @@ | |||||||
| .isubmit { background-position:0px -39px; width: 40px; height: 35px; } | .isubmit { background-position:0px -39px; width: 40px; height: 35px; } | ||||||
| .isubmitrest { background-position:-31px -39px; width: 10px; height: 35px;} | .isubmitrest { background-position:-31px -39px; width: 10px; height: 35px;} | ||||||
| </style> | </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} | ${if:groups} | ||||||
| <script type="text/javascript">groupDescriptions = ${page:group.descriptions};</script> |     var groupDescriptions = ${page:group.descriptions}; | ||||||
| ${endif:groups} | ${endif:groups} | ||||||
|  |     var localizedStrings = { | ||||||
|  | ${if:showemail} | ||||||
|  | 	wrongEmail: '${msg:presurvey.error.wrong_email}', | ||||||
|  | ${endif:showemail} | ||||||
|  |     } | ||||||
|  | </script> | ||||||
| </head> | </head> | ||||||
| <body bgcolor="#FFFFFF" style="background-image: url(${tplroot}/images/bg.gif); margin: 0px;" text="#000000" link="#C28400" vlink="#C28400" alink="#C28400"> | <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"> | <table width="100%" style="height: 100%;" cellspacing="0" cellpadding="0" border="0"> | ||||||
| @ -132,12 +141,12 @@ ${endif:showmessage} | |||||||
|     <td width="33%"> |     <td width="33%"> | ||||||
| 		<table cellspacing="0" cellpadding="0" border="0"> | 		<table cellspacing="0" cellpadding="0" border="0"> | ||||||
| 		<tr> | 		<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"> | 	    <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/> | 			<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> | ||||||
| 	    <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> | 		</tr> | ||||||
| 		</table> | 		</table> | ||||||
| 	</td> | 	</td> | ||||||
|  | |||||||
| @ -4,9 +4,18 @@ | |||||||
| 	<title>${msg:presurvey.title}</title> | 	<title>${msg:presurvey.title}</title> | ||||||
| 	<link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon"/> | 	<link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon"/> | ||||||
| 	<link rel="stylesheet" type="text/css" href="${tplroot}/chat.css" /> | 	<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} | 	${if:groups} | ||||||
| 	<script type="text/javascript">groupDescriptions = ${page:group.descriptions};</script> | 	    var groupDescriptions = ${page:group.descriptions}; | ||||||
| 	${endif:groups} | 	${endif:groups} | ||||||
|  | 	    var localizedStrings = { | ||||||
|  | 	${if:showemail} | ||||||
|  | 		wrongEmail: '${msg:presurvey.error.wrong_email}', | ||||||
|  | 	${endif:showemail} | ||||||
|  | 	    } | ||||||
|  | 	</script> | ||||||
| </head> | </head> | ||||||
| <body class="bgbody"> | <body class="bgbody"> | ||||||
| 	<div id="top2"> | 	<div id="top2"> | ||||||
| @ -80,7 +89,7 @@ | |||||||
| 			</tr> | 			</tr> | ||||||
| 		${endif:showmessage}			 | 		${endif:showmessage}			 | ||||||
| 		</table>		 | 		</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 class="clear"> </div> | ||||||
| 	</div> | 	</div> | ||||||
| </body> | </body> | ||||||
|  | |||||||
| @ -4,9 +4,18 @@ | |||||||
| <title>${msg:presurvey.title}</title> | <title>${msg:presurvey.title}</title> | ||||||
| <link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon"/> | <link rel="shortcut icon" href="${webimroot}/images/favicon.ico" type="image/x-icon"/> | ||||||
| <link rel="stylesheet" type="text/css" href="${tplroot}/chat.css" /> | <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} | ${if:groups} | ||||||
| <script type="text/javascript">groupDescriptions = ${page:group.descriptions};</script> |     var groupDescriptions = ${page:group.descriptions}; | ||||||
| ${endif:groups} | ${endif:groups} | ||||||
|  |     var localizedStrings = { | ||||||
|  | ${if:showemail} | ||||||
|  | 	wrongEmail: '${msg:presurvey.error.wrong_email}', | ||||||
|  | ${endif:showemail} | ||||||
|  |     } | ||||||
|  | </script> | ||||||
| </head> | </head> | ||||||
| <body> | <body> | ||||||
| <div id="whitebg"> | <div id="whitebg"> | ||||||
| @ -77,8 +86,8 @@ ${endif:groups} | |||||||
| 				<td> | 				<td> | ||||||
| 					<table cellspacing="3" cellpadding="0" border="0"> | 					<table cellspacing="3" cellpadding="0" border="0"> | ||||||
| 						<tr> | 						<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><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:document.surveyForm.submit();" title="${msg:presurvey.submit}">${msg:presurvey.submit}</a></td> | 							<td class="button"><a href="javascript:Survey.submit();" title="${msg:presurvey.submit}">${msg:presurvey.submit}</a></td> | ||||||
| 						</tr> | 						</tr> | ||||||
| 					</table> | 					</table> | ||||||
| 				</td> | 				</td> | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user