mirror of
				https://github.com/Mibew/design.git
				synced 2025-10-31 10:31:05 +03:00 
			
		
		
		
	Cleaned up code related to departments' descriptions
This commit is contained in:
		
							parent
							
								
									eaaaff85c2
								
							
						
					
					
						commit
						87676a5cee
					
				| @ -5,4 +5,5 @@ | |||||||
|  Copyright (c) 2005-2011 Mibew Messenger Community |  Copyright (c) 2005-2011 Mibew Messenger Community | ||||||
|  License: http://mibew.org/license.php
 |  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}); | 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},changeGroup:function(){document.getElementById("departmentDescription").childNodes.item(0).data=this.groupDescriptions[document.surveyForm.group.selectedIndex]},submit:function(){var a=this.checkFields(); | ||||||
|  | null==a?document.surveyForm.submit():alert(a)}};EventHelper.register(window,"onload",function(){Survey.localizedStrings=localizedStrings;"undefined"!=typeof groupDescriptions&&(Survey.groupDescriptions=groupDescriptions)}); | ||||||
| @ -16,6 +16,10 @@ var Survey = { | |||||||
| 		return null; | 		return null; | ||||||
| 	}, | 	}, | ||||||
| 
 | 
 | ||||||
|  | 	changeGroup: function(){ | ||||||
|  | 		document.getElementById('departmentDescription').childNodes.item(0).data = this.groupDescriptions[document.surveyForm.group.selectedIndex]; | ||||||
|  | 	}, | ||||||
|  | 
 | ||||||
| 	submit: function(){ | 	submit: function(){ | ||||||
| 		var error = this.checkFields(); | 		var error = this.checkFields(); | ||||||
| 		if(error == null){ | 		if(error == null){ | ||||||
| @ -28,4 +32,7 @@ var Survey = { | |||||||
| 
 | 
 | ||||||
| EventHelper.register(window, 'onload', function(){ | EventHelper.register(window, 'onload', function(){ | ||||||
|   Survey.localizedStrings = localizedStrings; |   Survey.localizedStrings = localizedStrings; | ||||||
|  |   if( typeof groupDescriptions != 'undefined' ){ | ||||||
|  | 	Survey.groupDescriptions = groupDescriptions; | ||||||
|  |   } | ||||||
| }); | }); | ||||||
| @ -125,7 +125,7 @@ ${if:groups} | |||||||
| 			<tr> | 			<tr> | ||||||
| 				<td class="text">${msg:presurvey.department}</td> | 				<td class="text">${msg:presurvey.department}</td> | ||||||
| 				<td> | 				<td> | ||||||
| 				<select name="group" style="min-width:200px;" onchange="document.getElementById('departmentDescription').childNodes.item(0).data = groupDescriptions[this.selectedIndex];">${page:groups}</select> | 				<select name="group" style="min-width:200px;" onchange="Survey.changeGroup()">${page:groups}</select> | ||||||
| 				</td> | 				</td> | ||||||
| 			</tr> | 			</tr> | ||||||
| 			<tr> | 			<tr> | ||||||
|  | |||||||
| @ -87,7 +87,7 @@ ${if:groups} | |||||||
| 			<td class="text">${msg:presurvey.department}</td> | 			<td class="text">${msg:presurvey.department}</td> | ||||||
| 			<td width="20"></td> | 			<td width="20"></td> | ||||||
| 			<td> | 			<td> | ||||||
| 			<select name="group" style="min-width:200px;" onchange="document.getElementById('departmentDescription').childNodes.item(0).data = groupDescriptions[this.selectedIndex];">${page:groups}</select> | 			<select name="group" style="min-width:200px;" onchange="Survey.changeGroup()">${page:groups}</select> | ||||||
| 			</td> | 			</td> | ||||||
| 		</tr> | 		</tr> | ||||||
| 		<tr><td height="7" colspan="3"></td></tr> | 		<tr><td height="7" colspan="3"></td></tr> | ||||||
|  | |||||||
| @ -65,7 +65,7 @@ | |||||||
| 		${if:groups} | 		${if:groups} | ||||||
| 			<tr> | 			<tr> | ||||||
| 				<td><strong>${msg:presurvey.department}</strong></td> | 				<td><strong>${msg:presurvey.department}</strong></td> | ||||||
| 				<td><select name="group" onchange="document.getElementById('departmentDescription').childNodes.item(0).data = groupDescriptions[this.selectedIndex];">${page:groups}</select></td> | 				<td><select name="group" onchange="Survey.changeGroup()">${page:groups}</select></td> | ||||||
| 			</tr> | 			</tr> | ||||||
| 			<tr> | 			<tr> | ||||||
| 				<td><strong>${msg:presurvey.department.description}</strong></td> | 				<td><strong>${msg:presurvey.department.description}</strong></td> | ||||||
|  | |||||||
| @ -56,7 +56,7 @@ ${endif:showemail} | |||||||
| 						${if:groups} | 						${if:groups} | ||||||
| 							<tr> | 							<tr> | ||||||
| 								<td class="text">${msg:presurvey.department}</td> | 								<td class="text">${msg:presurvey.department}</td> | ||||||
| 								<td><select name="group" style="min-width:200px;" onchange="document.getElementById('departmentDescription').childNodes.item(0).data = groupDescriptions[this.selectedIndex];">${page:groups}</select></td> | 								<td><select name="group" style="min-width:200px;" onchange="Survey.changeGroup()">${page:groups}</select></td> | ||||||
| 							</tr> | 							</tr> | ||||||
| 							<tr> | 							<tr> | ||||||
| 								<td class="text">${msg:presurvey.department.description}</td> | 								<td class="text">${msg:presurvey.department.description}</td> | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user