mirror of
				https://github.com/Mibew/design.git
				synced 2025-10-31 10:31:05 +03:00 
			
		
		
		
	Added ability to select group in leavemessage form.
This commit is contained in:
		
							parent
							
								
									e07756c59f
								
							
						
					
					
						commit
						f9d39a8257
					
				
							
								
								
									
										30
									
								
								src/messenger/webim/js/164/common.js
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							
							
						
						
									
										30
									
								
								src/messenger/webim/js/164/common.js
									
									
									
									
									
										
										
										Normal file → Executable file
									
								
							| @ -6,20 +6,22 @@ | ||||
|  License: http://mibew.org/license.php
 | ||||
| */ | ||||
| var Class={create:function(){return function(){this.initialize.apply(this,arguments)}},inherit:function(a,b,c){Object.extend(Object.extend(a.prototype,b.prototype),c)}};Object.extend=function(a,b){for(property in b)a[property]=b[property];return a};Object.prototype.extend=function(a){return Object.extend.apply(this,[this,a])};Function.prototype.bind=function(a){var b=this;return function(){return b.apply(a,arguments)}}; | ||||
| Function.prototype.bindAsEventListener=function(a){var b=this;return function(c){b.call(a,c||window.event)}};Number.prototype.toColorPart=function(){var a=this.toString(16);if(this<16)return"0"+a;return a};var Try={these:function(){for(var a,b=0;b<arguments.length;b++){var c=arguments[b];try{a=c();break}catch(d){}}return a}},PeriodicalExecuter=Class.create(); | ||||
| PeriodicalExecuter.prototype={initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=!1;this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),this.frequency*1E3)},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=!0,this.callback()}finally{this.currentlyExecuting=!1}}}; | ||||
| function findObj(a){var b;if(!(b=document[a])&&document.all)b=document.all[a];!b&&document.getElementById&&(b=document.getElementById(a));if(!b&&!document.all&&document.getElementsByName){b=document.getElementsByName(a);if(b.length==0)return null;if(b.length==1)return b[0]}return b}if(!Array.prototype.push)Array.prototype.push=function(){for(var a=this.length,b=0;b<arguments.length;b++)this[a+b]=arguments[b];return this.length}; | ||||
| Function.prototype.bindAsEventListener=function(a){var b=this;return function(c){b.call(a,c||window.event)}};Number.prototype.toColorPart=function(){var a=this.toString(16);return 16>this?"0"+a:a};var Try={these:function(){for(var a,b=0;b<arguments.length;b++){var c=arguments[b];try{a=c();break}catch(d){}}return a}},PeriodicalExecuter=Class.create(); | ||||
| PeriodicalExecuter.prototype={initialize:function(a,b){this.callback=a;this.frequency=b;this.currentlyExecuting=!1;this.registerCallback()},registerCallback:function(){setInterval(this.onTimerEvent.bind(this),1E3*this.frequency)},onTimerEvent:function(){if(!this.currentlyExecuting)try{this.currentlyExecuting=!0,this.callback()}finally{this.currentlyExecuting=!1}}}; | ||||
| function findObj(a){var b;if(!(b=document[a])&&document.all)b=document.all[a];!b&&document.getElementById&&(b=document.getElementById(a));if(!b&&!document.all&&document.getElementsByName){b=document.getElementsByName(a);if(0==b.length)return null;if(1==b.length)return b[0]}return b}Array.prototype.push||(Array.prototype.push=function(){for(var a=this.length,b=0;b<arguments.length;b++)this[a+b]=arguments[b];return this.length}); | ||||
| function $(){for(var a=[],b=0;b<arguments.length;b++){var c=arguments[b];typeof c=="string"&&(c=findObj(c));if(arguments.length==1)return c;a.push(c)}return a} | ||||
| var Ajax={getTransport:function(){return Try.these(function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest})||!1},getXml:function(a){if(a&&a.status>=200&&a.status<300&&(a=a.responseXML)&&a.documentElement)return a.documentElement;return null},getError:function(a){return a.statusText||"connection error N"+a.status},emptyFunction:function(){},Base:function(){}}; | ||||
| Ajax.Base.prototype={setOptions:function(a){this._options={_method:"post",asynchronous:!0,parameters:""}.extend(a||{})},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},responseIsSuccess:function(){var a=this.getStatus();return!a||a>=200&&a<300},responseIsFailure:function(){return!this.responseIsSuccess()}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"]; | ||||
| Class.inherit(Ajax.Request,Ajax.Base,{initialize:function(a,b){this.transport=Ajax.getTransport();this.setOptions(b);this.transportTimer={};this.finished=!1;this.request(a)},request:function(a){var b=this._options.parameters||"";b.length>0&&(b+="&_=");try{this._options._method=="get"&&b.length>0&&(a+="?"+b);this.transport.open(this._options._method.toUpperCase(),a,this._options.asynchronous);if(this._options.asynchronous&&(this.transport.onreadystatechange=this.onStateChange.bind(this),this._options.timeout))this.transportTimer= | ||||
| setTimeout(this.handleTimeout.bind(this),this._options.timeout);this.setRequestHeaders();var c=this._options.postBody?this._options.postBody:b;this.transport.send(this._options._method=="post"?c:null)}catch(d){this.dispatchException(d)}},setRequestHeaders:function(){var a=["X-Requested-With","XMLHttpRequest"];this._options._method=="post"&&(a.push("Content-type","application/x-www-form-urlencoded"),this.transport.overrideMimeType&&(navigator.userAgent.match("/Gecko/(d{4})/")||[0,2005])[1]<2005&&a.push("Connection", | ||||
| "close"));this._options.requestHeaders&&a.push.apply(a,this._options.requestHeaders);for(var b=0;b<a.length;b+=2)this.transport.setRequestHeader(a[b],a[b+1])},onStateChange:function(){this.transport.readyState!=1&&this.respondToReadyState(this.transport.readyState)},handleTimeout:function(){if(!this.finished)this.finished=!0,(this._options.onTimeout||Ajax.emptyFunction)(this)},respondToReadyState:function(a){if(Ajax.Request.Events[a]=="Complete"){try{if(!this.finished)this.finished=!0,this._options.timeout&& | ||||
| clearTimeout(this.transportTimer),(this._options.onComplete||Ajax.emptyFunction)(this.transport)}catch(b){this.dispatchException(b)}this.transport.onreadystatechange=Ajax.emptyFunction}},dispatchException:function(a){(this._options.onException||Ajax.emptyFunction)(this,a)}}); | ||||
| var Ajax={getTransport:function(){return Try.these(function(){return new ActiveXObject("Msxml2.XMLHTTP")},function(){return new ActiveXObject("Microsoft.XMLHTTP")},function(){return new XMLHttpRequest})||false},getXml:function(a){if(a&&a.status>=200&&a.status<300)if((a=a.responseXML)&&a.documentElement)return a.documentElement;return null},getError:function(a){return a.statusText||"connection error N"+a.status},emptyFunction:function(){},Base:function(){}}; | ||||
| Ajax.Base.prototype={setOptions:function(a){this._options={_method:"post",asynchronous:true,parameters:""}.extend(a||{})},getStatus:function(){try{return this.transport.status||0}catch(a){return 0}},responseIsSuccess:function(){var a=this.getStatus();return!a||a>=200&&a<300},responseIsFailure:function(){return!this.responseIsSuccess()}};Ajax.Request=Class.create();Ajax.Request.Events=["Uninitialized","Loading","Loaded","Interactive","Complete"]; | ||||
| Class.inherit(Ajax.Request,Ajax.Base,{initialize:function(a,b){this.transport=Ajax.getTransport();this.setOptions(b);this.transportTimer={};this.finished=false;this.request(a)},request:function(a){var b=this._options.parameters||"";b.length>0&&(b=b+"&_=");try{this._options._method=="get"&&b.length>0&&(a=a+("?"+b));this.transport.open(this._options._method.toUpperCase(),a,this._options.asynchronous);if(this._options.asynchronous){this.transport.onreadystatechange=this.onStateChange.bind(this);if(this._options.timeout)this.transportTimer= | ||||
| setTimeout(this.handleTimeout.bind(this),this._options.timeout)}this.setRequestHeaders();var c=this._options.postBody?this._options.postBody:b;this.transport.send(this._options._method=="post"?c:null)}catch(d){this.dispatchException(d)}},setRequestHeaders:function(){var a=["X-Requested-With","XMLHttpRequest"];if(this._options._method=="post"){a.push("Content-type","application/x-www-form-urlencoded");this.transport.overrideMimeType&&(navigator.userAgent.match("/Gecko/(d{4})/")||[0,2005])[1]<2005&& | ||||
| a.push("Connection","close")}this._options.requestHeaders&&a.push.apply(a,this._options.requestHeaders);for(var b=0;b<a.length;b=b+2)this.transport.setRequestHeader(a[b],a[b+1])},onStateChange:function(){this.transport.readyState!=1&&this.respondToReadyState(this.transport.readyState)},handleTimeout:function(){if(!this.finished){this.finished=true;(this._options.onTimeout||Ajax.emptyFunction)(this)}},respondToReadyState:function(a){if(Ajax.Request.Events[a]=="Complete"){try{if(!this.finished){this.finished= | ||||
| true;this._options.timeout&&clearTimeout(this.transportTimer);(this._options.onComplete||Ajax.emptyFunction)(this.transport)}}catch(b){this.dispatchException(b)}this.transport.onreadystatechange=Ajax.emptyFunction}},dispatchException:function(a){(this._options.onException||Ajax.emptyFunction)(this,a)}}); | ||||
| var EventHelper={register:function(a,b,c){var d=a[b];a[b]=typeof d!="function"?c:function(){d();c()}}},Behaviour={list:[],register:function(a){Behaviour.list.push(a)},init:function(){EventHelper.register(window,"onload",function(){Behaviour.apply()})},apply:function(){for(h=0;sheet=Behaviour.list[h];h++)for(selector in sheet)if(list=document.getElementsBySelector(selector))for(i=0;element=list[i];i++)sheet[selector](element)}};Behaviour.init(); | ||||
| function getAllChildren(a){return a.all?a.all:a.getElementsByTagName("*")} | ||||
| document.getElementsBySelector=function(a){if(!document.getElementsByTagName)return[];for(var a=a.split(" "),b=Array(document),c=0;c<a.length;c++)if(token=a[c].replace(/^\s+/,"").replace(/\s+$/,""),token.indexOf("#")>-1){var d=token.split("#"),f=d[0],b=document.getElementById(d[1]);if(b==null||f&&b.nodeName.toLowerCase()!=f)return[];b=Array(b)}else if(token.indexOf(".")>-1){d=token.split(".");f=d[0];d=d[1];f||(f="*");for(var g=[],j=0,n=0;n<b.length;n++){var m;m=f=="*"?getAllChildren(b[n]):b[n].getElementsByTagName(f); | ||||
| if(m!=null)for(var o=0;o<m.length;o++)g[j++]=m[o]}b=[];for(j=f=0;j<g.length;j++)g[j].className&&g[j].className.match(RegExp("\\b"+d+"\\b"))&&(b[f++]=g[j])}else{if(!b[0])return;f=token;g=[];for(n=j=0;n<b.length;n++){m=b[n].getElementsByTagName(f);for(o=0;o<m.length;o++)g[j++]=m[o]}b=g}return b}; | ||||
| var NodeUtils={getNodeValue:function(a,b){var c=a.getElementsByTagName(b);if(c.length==0)return"";var c=c[0].childNodes,d="";for(i=0;i<c.length;i++)d+=c[i].nodeValue;return d},getNodeText:function(a){var a=a.childNodes,b="";for(i=0;i<a.length;i++)b+=a[i].nodeValue;return b},getAttrValue:function(a,b){for(k=0;k<a.attributes.length;k++)if(a.attributes[k].nodeName==b)return a.attributes[k].nodeValue;return null}},CommonUtils={getRow:function(a,b){var c=b.rows[a];if(c!=null)return c;if(b.rows.head!=null)return null; | ||||
| for(k=0;k<b.rows.length;k++)if(b.rows[k].id==a)return b.rows[k];return null},getCell:function(a,b,c){var d=b.cells[a];if(d!=null)return d;if(c.rows.head!=null)return null;for(k=0;k<b.cells.length;k++)if(b.cells[k].id==a)return b.cells[k];return null},insertCell:function(a,b,c,d,f,g){a=a.insertCell(-1);a.id=b;if(d)a.align=d;a.className=c;if(f)a.height=f;a.innerHTML=g}}; | ||||
| function playSound(a){var b=document.createElement("div");if(navigator.userAgent.toLowerCase().indexOf("opera")!=-1)b.style="position: absolute; left: 0px; top: -200px;";document.body.appendChild(b);b.innerHTML='<audio autoplay src="'+a+'"><embed src="'+a+'" hidden="true" autostart="true" loop="false"></audio>'}function htmlescape(a){return a.replace("&","&").replace("<","<").replace(">",">").replace('"',""")}; | ||||
| document.getElementsBySelector=function(a){if(!document.getElementsByTagName)return[];for(var a=a.split(" "),b=Array(document),c=0;c<a.length;c++){token=a[c].replace(/^\s+/,"").replace(/\s+$/,"");if(token.indexOf("#")>-1){var d=token.split("#"),e=d[0],b=document.getElementById(d[1]);if(b==null||e&&b.nodeName.toLowerCase()!=e)return[];b=Array(b)}else if(token.indexOf(".")>-1){d=token.split(".");e=d[0];d=d[1];e||(e="*");for(var f=[],g=0,j=0;j<b.length;j++){var l;l=e=="*"?getAllChildren(b[j]):b[j].getElementsByTagName(e); | ||||
| if(l!=null)for(var m=0;m<l.length;m++)f[g++]=l[m]}b=[];for(g=e=0;g<f.length;g++)f[g].className&&f[g].className.match(RegExp("\\b"+d+"\\b"))&&(b[e++]=f[g])}else{if(!b[0])return;e=token;f=[];for(j=g=0;j<b.length;j++){l=b[j].getElementsByTagName(e);for(m=0;m<l.length;m++)f[g++]=l[m]}b=f}}return b}; | ||||
| var NodeUtils={getNodeValue:function(a,b){var c=a.getElementsByTagName(b);if(c.length==0)return"";var c=c[0].childNodes,d="";for(i=0;i<c.length;i++)d=d+c[i].nodeValue;return d},getNodeText:function(a){var a=a.childNodes,b="";for(i=0;i<a.length;i++)b=b+a[i].nodeValue;return b},getAttrValue:function(a,b){for(k=0;k<a.attributes.length;k++)if(a.attributes[k].nodeName==b)return a.attributes[k].nodeValue;return null}},CommonUtils={getRow:function(a,b){var c=b.rows[a];if(c!=null)return c;if(b.rows.head!= | ||||
| null)return null;for(k=0;k<b.rows.length;k++)if(b.rows[k].id==a)return b.rows[k];return null},getCell:function(a,b,c){var d=b.cells[a];if(d!=null)return d;if(c.rows.head!=null)return null;for(k=0;k<b.cells.length;k++)if(b.cells[k].id==a)return b.cells[k];return null},insertCell:function(a,b,c,d,e,f){a=a.insertCell(-1);a.id=b;if(d)a.align=d;a.className=c;if(e)a.height=e;a.innerHTML=f}}; | ||||
| function playSound(a){var b=document.createElement("div");if(navigator.userAgent.toLowerCase().indexOf("opera")!=-1)b.style="position: absolute; left: 0px; top: -200px;";document.body.appendChild(b);b.innerHTML='<audio autoplay src="'+a+'"><embed src="'+a+'" hidden="true" autostart="true" loop="false"></audio>'}function htmlescape(a){return a.replace("&","&").replace("<","<").replace(">",">").replace('"',""")}var ClientForm=Class.create(); | ||||
| ClientForm.prototype={initialize:function(a){this.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,}))$/;this.form=a;this.localizedStrings=null},emailIsValid:function(a){return a!=null&&a.value.search(this.emailPattern)==-1?false:true},changeGroup:function(a,b,c){document.getElementById(b).innerHTML=c[a.selectedIndex]},checkFields:function(){return null},localize:function(a){this.localizedStrings= | ||||
| a},submit:function(){var a=this.checkFields();a===null?this.form.submit():a!=""&&alert(a)}}; | ||||
							
								
								
									
										8
									
								
								src/messenger/webim/js/164/leavemessage.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								src/messenger/webim/js/164/leavemessage.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
 | ||||
| */ | ||||
| EventHelper.register(window,"onload",function(){MessageForm=new ClientForm(document.leaveMessageForm)}); | ||||
| @ -5,5 +5,4 @@ | ||||
|  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},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)}); | ||||
| var SurveyForm=Class.create();Class.inherit(SurveyForm,ClientForm,{checkFields:function(){return null==this.form.email||"hidden"==this.form.email.getAttribute("type")?null:!this.emailIsValid(this.form.email)?this.localizedStrings.wrongEmail||"":null}});EventHelper.register(window,"onload",function(){Survey=new SurveyForm(document.surveyForm);Survey.localize(localizedStrings)}); | ||||
| @ -518,4 +518,43 @@ function playSound(wav_file) { | ||||
| 
 | ||||
| function htmlescape(str) { | ||||
| 	return str.replace('&','&').replace('<','<').replace('>','>').replace('"','"'); | ||||
| } | ||||
| 
 | ||||
| var ClientForm = Class.create(); | ||||
| ClientForm.prototype = { | ||||
|   initialize: function(form) { | ||||
|     this.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,}))$/; | ||||
|     this.form = form; | ||||
|     this.localizedStrings = null; | ||||
|   }, | ||||
| 
 | ||||
|   emailIsValid: function(emailField) { | ||||
|     if( emailField != null && emailField.value.search(this.emailPattern) == -1 ) { | ||||
|       return false; | ||||
|     } | ||||
|     return true; | ||||
|   }, | ||||
| 
 | ||||
|   changeGroup: function(groupField, descriptionFieldId, descriptions) { | ||||
|     document.getElementById(descriptionFieldId).innerHTML = descriptions[groupField.selectedIndex]; | ||||
|   }, | ||||
| 
 | ||||
|   checkFields: function() { | ||||
|     return null; | ||||
|   }, | ||||
| 
 | ||||
|   localize: function(localizedStrings) { | ||||
|     this.localizedStrings = localizedStrings; | ||||
|   }, | ||||
| 
 | ||||
|   submit: function() { | ||||
|     var error = this.checkFields(); | ||||
|     if(error === null){ | ||||
|       this.form.submit(); | ||||
|     }else{ | ||||
|       if(error != '') { | ||||
|         alert(error); | ||||
|       } | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										11
									
								
								src/messenger/webim/js/source/leavemessage.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/messenger/webim/js/source/leavemessage.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,11 @@ | ||||
| /** | ||||
|  * @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
 | ||||
|  */ | ||||
| 
 | ||||
| EventHelper.register(window, 'onload', function(){ | ||||
|   MessageForm = new ClientForm(document.leaveMessageForm); | ||||
| }); | ||||
| @ -6,33 +6,20 @@ | ||||
|  * 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; | ||||
| 	}, | ||||
| 
 | ||||
| 	changeGroup: function(){ | ||||
| 		document.getElementById('departmentDescription').childNodes.item(0).data = this.groupDescriptions[document.surveyForm.group.selectedIndex]; | ||||
| 	}, | ||||
| 
 | ||||
| 	submit: function(){ | ||||
| 		var error = this.checkFields(); | ||||
| 		if(error == null){ | ||||
| 			document.surveyForm.submit(); | ||||
| 		}else{ | ||||
| 			alert(error); | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| var SurveyForm = Class.create(); | ||||
| Class.inherit(SurveyForm, ClientForm, { | ||||
|   checkFields: function() { | ||||
|     if(this.form.email == null || this.form.email.getAttribute('type') == 'hidden') { | ||||
|       return null; | ||||
|     } | ||||
|     if(! this.emailIsValid(this.form.email)){ | ||||
|       return this.localizedStrings.wrongEmail || ''; | ||||
|     } | ||||
|     return null; | ||||
|   } | ||||
| }); | ||||
| 
 | ||||
| EventHelper.register(window, 'onload', function(){ | ||||
|   Survey.localizedStrings = localizedStrings; | ||||
|   if( typeof groupDescriptions != 'undefined' ){ | ||||
| 	Survey.groupDescriptions = groupDescriptions; | ||||
|   } | ||||
|   Survey = new SurveyForm(document.surveyForm); | ||||
|   Survey.localize(localizedStrings); | ||||
| }); | ||||
| @ -112,6 +112,15 @@ $body = getstring2_("leavemail.body", array($visitor_name,$email,$message,$info | ||||
| if (isset($group) && !empty($group['vcemail'])) { | ||||
| 	$inbox_mail = $group['vcemail']; | ||||
| } else { | ||||
| 	if (! is_null($group['parent'])) { | ||||
| 		$parentgroup = group_by_id($group['parent']); | ||||
| 		if ($parentgroup && !empty($parentgroup['vcemail'])) { | ||||
| 			$inbox_mail = $parentgroup['vcemail']; | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
| 
 | ||||
| if (empty($inbox_mail)) { | ||||
| 	$inbox_mail = $settings['email']; | ||||
| } | ||||
| 
 | ||||
|  | ||||
| @ -319,6 +319,16 @@ function setup_leavemessage($name, $email, $message, $groupid, $groupname, $info | ||||
| 	$page['formgroupname'] = $groupname; | ||||
| 	$page['forminfo'] = topage($info); | ||||
| 	$page['referrer'] = urlencode(topage($referrer)); | ||||
| 
 | ||||
| 	if ($settings['enablegroups'] == '1') { | ||||
| 		$groups = setup_groups_select($groupid, false); | ||||
| 		if ($groups) { | ||||
| 			$page['groups'] = $groups['select']; | ||||
| 			$page['group.descriptions'] = json_encode($groups['descriptions']); | ||||
| 			$page['default.department.description'] = $groups['defaultdescription']; | ||||
| 		} | ||||
| 	} | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| function setup_survey($name, $email, $groupid, $info, $referrer) | ||||
| @ -331,40 +341,13 @@ function setup_survey($name, $email, $groupid, $info, $referrer) | ||||
| 	$page['forminfo'] = topage($info); | ||||
| 	$page['referrer'] = urlencode(topage($referrer)); | ||||
| 
 | ||||
| 	$selectedgroupid = $groupid; | ||||
| 
 | ||||
| 	if ($settings['enablegroups'] == '1' && $settings["surveyaskgroup"] == "1") { | ||||
| 		$link = connect(); | ||||
| 		$showgroups = ($groupid == '')?true:group_has_children($groupid, $link); | ||||
| 		if ($showgroups) { | ||||
| 			$allgroups = get_groups($link, false); | ||||
| 			close_connection($link); | ||||
| 			$val = ""; | ||||
| 			$groupdescriptions = array(); | ||||
| 			foreach ($allgroups as $k) { | ||||
| 				$groupname = $k['vclocalname']; | ||||
| 				if ($k['inumofagents'] == 0 || ($groupid && $k['parent'] != $groupid && $k['groupid'] != $groupid )) { | ||||
| 					continue; | ||||
| 				} | ||||
| 				if ($k['ilastseen'] !== NULL && $k['ilastseen'] < $settings['online_timeout']) { | ||||
| 					if (!$selectedgroupid) { | ||||
| 						$selectedgroupid = $k['groupid']; // select first online group
 | ||||
| 					} | ||||
| 				} else { | ||||
| 					$groupname .= " (offline)"; | ||||
| 				} | ||||
| 				$isselected = $k['groupid'] == $selectedgroupid; | ||||
| 				if ($isselected) { | ||||
| 					$defaultdescription = $k['vclocaldescription']; | ||||
| 				} | ||||
| 				$val .= "<option value=\"" . $k['groupid'] . "\"" . ($isselected ? " selected=\"selected\"" : "") . ">$groupname</option>"; | ||||
| 				$groupdescriptions[] = $k['vclocaldescription']; | ||||
| 			} | ||||
| 			$page['groups'] = $val; | ||||
| 			$page['group.descriptions'] = json_encode($groupdescriptions); | ||||
| 			$page['default.department.description'] = empty($defaultdescription)?' ':$defaultdescription; | ||||
| 		$groups = setup_groups_select($groupid, true); | ||||
| 		if ($groups) { | ||||
| 			$page['groups'] = $groups['select']; | ||||
| 			$page['group.descriptions'] = json_encode($groups['descriptions']); | ||||
| 			$page['default.department.description'] = $groups['defaultdescription']; | ||||
| 		} | ||||
| 		close_connection($link); | ||||
| 	} | ||||
| 
 | ||||
| 	$page['showemail'] = $settings["surveyaskmail"] == "1" ? "1" : ""; | ||||
| @ -372,6 +355,54 @@ function setup_survey($name, $email, $groupid, $info, $referrer) | ||||
| 	$page['showname'] = $settings['usercanchangename'] == "1" ? "1" : ""; | ||||
| } | ||||
| 
 | ||||
| function setup_groups_select($groupid, $markoffline) | ||||
| { | ||||
| 	global $settings; | ||||
| 
 | ||||
| 	$link = connect(); | ||||
| 	$showgroups = ($groupid == '')?true:group_has_children($groupid, $link); | ||||
| 	if (!$showgroups) { | ||||
| 		close_connection($link); | ||||
| 		return false; | ||||
| 	} | ||||
| 
 | ||||
| 	$allgroups = get_groups($link, false); | ||||
| 	close_connection($link); | ||||
| 
 | ||||
| 	if (empty($allgroups)) { | ||||
| 		return false; | ||||
| 	} | ||||
| 
 | ||||
| 	$val = ""; | ||||
| 	$selectedgroupid = $groupid; | ||||
| 	$groupdescriptions = array(); | ||||
| 	foreach ($allgroups as $k) { | ||||
| 		$groupname = $k['vclocalname']; | ||||
| 		if ($k['inumofagents'] == 0 || ($groupid && $k['parent'] != $groupid && $k['groupid'] != $groupid )) { | ||||
| 			continue; | ||||
| 		} | ||||
| 		if ($k['ilastseen'] !== NULL && $k['ilastseen'] < $settings['online_timeout']) { | ||||
| 			if (!$selectedgroupid) { | ||||
| 				$selectedgroupid = $k['groupid']; // select first online group
 | ||||
| 			} | ||||
| 		} else { | ||||
| 			$groupname .= $markoffline?" (offline)":""; | ||||
| 		} | ||||
| 		$isselected = $k['groupid'] == $selectedgroupid; | ||||
| 		if ($isselected) { | ||||
| 			$defaultdescription = $k['vclocaldescription']; | ||||
| 		} | ||||
| 		$val .= "<option value=\"" . $k['groupid'] . "\"" . ($isselected ? " selected=\"selected\"" : "") . ">$groupname</option>"; | ||||
| 		$groupdescriptions[] = $k['vclocaldescription']; | ||||
| 	} | ||||
| 
 | ||||
| 	return array( | ||||
| 		'select' => $val, | ||||
| 		'descriptions' => $groupdescriptions, | ||||
| 		'defaultdescription' => $defaultdescription | ||||
| 	); | ||||
| } | ||||
| 
 | ||||
| function setup_chatview_for_user($thread, $level) | ||||
| { | ||||
| 	global $page, $webimroot, $settings; | ||||
|  | ||||
| @ -144,6 +144,8 @@ form.field.ban_comment.description=Reason for block | ||||
| form.field.ban_comment=Comment | ||||
| form.field.ban_days.description=Numbers of days this address is blocked  | ||||
| form.field.ban_days=Days | ||||
| form.field.department=Choose Department: | ||||
| form.field.department.description=Department description: | ||||
| form.field.email=Your email | ||||
| form.field.groupcommondesc.description=Description in English. | ||||
| form.field.groupcommondesc=International description | ||||
| @ -423,8 +425,6 @@ permission.takeover=Take over chat thread | ||||
| permission.viewthreads=View another operator's chat thread | ||||
| 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: | ||||
|  | ||||
| @ -142,6 +142,8 @@ form.field.ban_comment.description= | ||||
| form.field.ban_comment=Комментарий | ||||
| form.field.ban_days.description=Количество дней, <br/> на которое будет запрещен адрес | ||||
| form.field.ban_days=Дни | ||||
| form.field.department=Âûáåðèòå îòäåë: | ||||
| form.field.department.description=Îïèñàíèå îòäåëà: | ||||
| form.field.email=Ваш email | ||||
| form.field.groupcommondesc.description=Описание для посетителей из других стран. | ||||
| form.field.groupcommondesc=Интернациональное описание | ||||
| @ -421,8 +423,6 @@ permission.takeover= | ||||
| permission.viewthreads=Просматривать диалоги других операторов в режиме реального времени | ||||
| permissions.intro=Здесь вы можете управлять возможностями оператора. | ||||
| permissions.title=Возможности оператора | ||||
| presurvey.department=Âûáåðèòå îòäåë: | ||||
| presurvey.department.description=Îïèñàíèå îòäåëà: | ||||
| presurvey.error.wrong_email=Неверный адрес электронной почты. | ||||
| presurvey.intro=Спасибо, что связались с нами! Заполните, пожалуйста, небольшую форму и нажмите "Начать диалог". | ||||
| presurvey.mail=E-mail: | ||||
|  | ||||
| @ -33,6 +33,13 @@ | ||||
| 	position:relative;top:1px; | ||||
| } | ||||
| </style> | ||||
| <script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/common.js"></script> | ||||
| <script type="text/javascript" language="javascript" src="${webimroot}/js/${jsver}/leavemessage.js"></script> | ||||
| <script type="text/javascript"> | ||||
| ${if:groups} | ||||
|     var groupDescriptions = ${page:group.descriptions}; | ||||
| ${endif:groups} | ||||
| </script> | ||||
| </head> | ||||
| 
 | ||||
| <body bgcolor="#FFFFFF" text="#000000" link="#C28400" vlink="#C28400" alink="#C28400" style="margin:0px;"> | ||||
| @ -45,7 +52,7 @@ | ||||
| <input type="hidden" name="style" value="${styleid}"/> | ||||
| <input type="hidden" name="info" value="${form:info}"/> | ||||
| <input type="hidden" name="referrer" value="${page:referrer}"/> | ||||
| ${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid} | ||||
| ${ifnot:groups}${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid}${endif:groups} | ||||
| <table width="100%" cellspacing="0" cellpadding="0" border="0"> | ||||
| <tr> | ||||
| 	<td valign="top" height="150" style="padding:5px"> | ||||
| @ -113,6 +120,20 @@ ${endif:errors} | ||||
| 				<td class="text">${msg:form.field.name}:</td> | ||||
| 				<td><input type="text" name="name" size="50" value="${form:name}" class="username"/></td> | ||||
| 			</tr> | ||||
| 
 | ||||
| ${if:groups} | ||||
| 			<tr> | ||||
| 				<td class="text">${msg:form.field.department}</td> | ||||
| 				<td> | ||||
| 				<select name="group" style="min-width:200px;" onchange="MessageForm.changeGroup(this, 'departmentDescription', groupDescriptions)">${page:groups}</select> | ||||
| 				</td> | ||||
| 			</tr> | ||||
| 			<tr> | ||||
| 				<td class="text">${msg:form.field.department.description}</td> | ||||
| 				<td class="text" id="departmentDescription">${page:default.department.description}</td> | ||||
| 			</tr> | ||||
| ${endif:groups} | ||||
| 
 | ||||
| 			<tr> | ||||
| 				<td class="text">${msg:form.field.message}:</td> | ||||
| 				<td valign="top"> | ||||
|  | ||||
| @ -123,13 +123,13 @@ ${endif:errors} | ||||
| 
 | ||||
| ${if:groups} | ||||
| 			<tr> | ||||
| 				<td class="text">${msg:presurvey.department}</td> | ||||
| 				<td class="text">${msg:form.field.department}</td> | ||||
| 				<td> | ||||
| 				<select name="group" style="min-width:200px;" onchange="Survey.changeGroup()">${page:groups}</select> | ||||
| 				<select name="group" style="min-width:200px;" onchange="Survey.changeGroup(this, 'departmentDescription', groupDescriptions)">${page:groups}</select> | ||||
| 				</td> | ||||
| 			</tr> | ||||
| 			<tr> | ||||
| 				<td class="text">${msg:presurvey.department.description}</td> | ||||
| 				<td class="text">${msg:form.field.department.description}</td> | ||||
| 				<td class="text" id="departmentDescription">${page:default.department.description}</td> | ||||
| 			</tr> | ||||
| ${endif:groups} | ||||
|  | ||||
| @ -20,6 +20,13 @@ | ||||
| .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}/leavemessage.js"></script> | ||||
| <script type="text/javascript"> | ||||
| ${if:groups} | ||||
|     var groupDescriptions = ${page:group.descriptions}; | ||||
| ${endif:groups} | ||||
| </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"> | ||||
| @ -30,7 +37,7 @@ | ||||
| <input type="hidden" name="style" value="${styleid}"/> | ||||
| <input type="hidden" name="info" value="${form:info}"/> | ||||
| <input type="hidden" name="referrer" value="${page:referrer}"/> | ||||
| ${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid} | ||||
| ${ifnot:groups}${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid}${endif:groups} | ||||
| <table width="100%" style="height:100%;" cellspacing="0" cellpadding="0" border="0"> | ||||
| <tr><td colspan="3" height="15"></td></tr> | ||||
| <tr> | ||||
| @ -76,6 +83,24 @@ ${endif:errors} | ||||
| 		    <td width="20"></td> | ||||
| 		    <td><input type="text" name="name" size="50" value="${form:name}" class="field"/></td> | ||||
| 		</tr> | ||||
| 
 | ||||
| ${if:groups} | ||||
| 		<tr><td height="7" colspan="3"></td></tr> | ||||
| 		<tr> | ||||
| 			<td class="text">${msg:form.field.department}</td> | ||||
| 			<td width="20"></td> | ||||
| 			<td> | ||||
| 				<select name="group" style="min-width:200px;" onchange="MessageForm.changeGroup(this, 'departmentDescription', groupDescriptions)">${page:groups}</select> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<tr><td height="7" colspan="3"></td></tr> | ||||
| 		<tr> | ||||
| 			<td class="text">${msg:form.field.department.description}</td> | ||||
| 			<td width="20"></td> | ||||
| 			<td class="text" id="departmentDescription">${page:default.department.description}</td> | ||||
| 		</tr> | ||||
| ${endif:groups} | ||||
| 
 | ||||
| 		<tr><td height="7" colspan="3"></td></tr> | ||||
| 		<tr> | ||||
| 		    <td class="text">${msg:form.field.message}:</td> | ||||
|  | ||||
| @ -84,15 +84,15 @@ ${endif:errors} | ||||
| 
 | ||||
| ${if:groups} | ||||
| 		<tr> | ||||
| 			<td class="text">${msg:presurvey.department}</td> | ||||
| 			<td class="text">${msg:form.field.department}</td> | ||||
| 			<td width="20"></td> | ||||
| 			<td> | ||||
| 			<select name="group" style="min-width:200px;" onchange="Survey.changeGroup()">${page:groups}</select> | ||||
| 			<select name="group" style="min-width:200px;" onchange="Survey.changeGroup(this, 'departmentDescription', groupDescriptions)">${page:groups}</select> | ||||
| 			</td> | ||||
| 		</tr> | ||||
| 		<tr><td height="7" colspan="3"></td></tr> | ||||
| 		<tr> | ||||
| 			<td class="text">${msg:presurvey.department.description}</td> | ||||
| 			<td class="text">${msg:form.field.department.description}</td> | ||||
| 			<td width="20"></td> | ||||
| 			<td class="text" id="departmentDescription">${page:default.department.description}</td> | ||||
| 		</tr> | ||||
|  | ||||
| @ -4,6 +4,13 @@ | ||||
| 	<title>${msg:leavemessage.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}/leavemessage.js"></script> | ||||
| 	<script type="text/javascript"> | ||||
| ${if:groups} | ||||
| 	    var groupDescriptions = ${page:group.descriptions}; | ||||
| ${endif:groups} | ||||
| 	</script> | ||||
| </head> | ||||
| <body class="bgbody"> | ||||
| 
 | ||||
| @ -11,7 +18,7 @@ | ||||
| 	<input type="hidden" name="style" value="${styleid}"/> | ||||
| 	<input type="hidden" name="info" value="${form:info}"/> | ||||
| 	<input type="hidden" name="referrer" value="${page:referrer}"/> | ||||
| 	${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid} | ||||
| 	${ifnot:groups}${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid}${endif:groups} | ||||
| 
 | ||||
| 	<div id="top2"> | ||||
| 		<div id="logo"> | ||||
| @ -58,6 +65,18 @@ | ||||
| 				<td><strong>${msg:form.field.name}:</strong></td> | ||||
| 				<td><input type="text" name="name" size="50" value="${form:name}" class="username"/></td> | ||||
| 			</tr> | ||||
| 		${if:groups} | ||||
| 			<tr> | ||||
| 				<td class="text">${msg:form.field.department}</td> | ||||
| 				<td> | ||||
| 				<select name="group" style="min-width:200px;" onchange="MessageForm.changeGroup(this, 'departmentDescription', groupDescriptions)">${page:groups}</select> | ||||
| 				</td> | ||||
| 			</tr> | ||||
| 			<tr> | ||||
| 				<td class="text">${msg:form.field.department.description}</td> | ||||
| 				<td class="text" id="departmentDescription">${page:default.department.description}</td> | ||||
| 			</tr> | ||||
| 		${endif:groups} | ||||
| 			<tr> | ||||
| 				<td><strong>${msg:form.field.message}:</strong></td> | ||||
| 				<td valign="top"> | ||||
|  | ||||
| @ -64,11 +64,11 @@ | ||||
| 		<table class="form"> | ||||
| 		${if:groups} | ||||
| 			<tr> | ||||
| 				<td><strong>${msg:presurvey.department}</strong></td> | ||||
| 				<td><select name="group" onchange="Survey.changeGroup()">${page:groups}</select></td> | ||||
| 				<td><strong>${msg:form.field.department}</strong></td> | ||||
| 				<td><select name="group" onchange="Survey.changeGroup(this, 'departmentDescription', groupDescriptions)">${page:groups}</select></td> | ||||
| 			</tr> | ||||
| 			<tr> | ||||
| 				<td><strong>${msg:presurvey.department.description}</strong></td> | ||||
| 				<td><strong>${msg:form.field.department.description}</strong></td> | ||||
| 				<td id="departmentDescription">${page:default.department.description}</td> | ||||
| 			</tr> | ||||
| 		${endif:groups} | ||||
|  | ||||
| @ -4,6 +4,13 @@ | ||||
| <title>${msg:leavemessage.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}/leavemessage.js"></script> | ||||
| <script type="text/javascript"> | ||||
| ${if:groups} | ||||
|     var groupDescriptions = ${page:group.descriptions}; | ||||
| ${endif:groups} | ||||
| </script> | ||||
| </head> | ||||
| <body> | ||||
| <div id="whitebg"> | ||||
| @ -11,7 +18,7 @@ | ||||
| 		<input type="hidden" name="style" value="${styleid}"/> | ||||
| 		<input type="hidden" name="info" value="${form:info}"/> | ||||
| 		<input type="hidden" name="referrer" value="${page:referrer}"/> | ||||
| 		${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid} | ||||
| 		${ifnot:groups}${if:formgroupid}<input type="hidden" name="group" value="${form:groupid}"/>${endif:formgroupid}${endif:groups} | ||||
| 		<table cellpadding="0" cellspacing="5" border="0" width="100%"> | ||||
| 			<tr> | ||||
| 				<td colspan="2"> | ||||
| @ -46,6 +53,18 @@ | ||||
| 							<td class="text">${msg:form.field.name}:</td> | ||||
| 							<td><input type="text" name="name" size="50" value="${form:name}" class="field"/></td> | ||||
| 						</tr> | ||||
| ${if:groups} | ||||
| 						<tr> | ||||
| 							<td class="text">${msg:form.field.department}</td> | ||||
| 							<td> | ||||
| 								<select name="group" style="min-width:200px;" onchange="MessageForm.changeGroup(this, 'departmentDescription', groupDescriptions)">${page:groups}</select> | ||||
| 							</td> | ||||
| 						</tr> | ||||
| 						<tr> | ||||
| 							<td class="text">${msg:form.field.department.description}</td> | ||||
| 							<td class="text" id="departmentDescription">${page:default.department.description}</td> | ||||
| 						</tr> | ||||
| ${endif:groups} | ||||
| 						<tr> | ||||
| 							<td class="text" valign="top">${msg:form.field.message}:</td> | ||||
| 							<td><textarea name="message" cols="45" rows="8"  class="field" tabindex="0">${form:message}</textarea></td> | ||||
|  | ||||
| @ -55,11 +55,11 @@ ${endif:showemail} | ||||
| 						${endif:errors} | ||||
| 						${if:groups} | ||||
| 							<tr> | ||||
| 								<td class="text">${msg:presurvey.department}</td> | ||||
| 								<td><select name="group" style="min-width:200px;" onchange="Survey.changeGroup()">${page:groups}</select></td> | ||||
| 								<td class="text">${msg:form.field.department}</td> | ||||
| 								<td><select name="group" style="min-width:200px;" onchange="Survey.changeGroup(this, 'departmentDescription', groupDescriptions)">${page:groups}</select></td> | ||||
| 							</tr> | ||||
| 							<tr> | ||||
| 								<td class="text">${msg:presurvey.department.description}</td> | ||||
| 								<td class="text">${msg:form.field.department.description}</td> | ||||
| 								<td class="text" id="departmentDescription">${page:default.department.description}</td> | ||||
| 							</tr> | ||||
| 						${endif:groups} | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user