From 5595bd0f6e345edf2470a45100265ac69f214362 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Sun, 27 Feb 2011 01:54:27 +0100 Subject: [PATCH] install page: links to check the sound --- src/messenger/compile_js | 2 +- src/messenger/webim/default.css | 10 +++++++ src/messenger/webim/install/index.php | 13 +++++++++ src/messenger/webim/js/164/brws.js | 2 +- src/messenger/webim/js/164/chat.js | 30 ++++++++++----------- src/messenger/webim/js/164/common.js | 30 ++++++++++----------- src/messenger/webim/js/164/soundcheck.js | 1 + src/messenger/webim/js/164/users.js | 30 ++++++++++----------- src/messenger/webim/js/source/build.xml | 5 +++- src/messenger/webim/js/source/soundcheck.js | 12 +++++++++ src/messenger/webim/locales/en/properties | 5 +++- src/messenger/webim/view/install_index.php | 12 +++++++++ 12 files changed, 103 insertions(+), 49 deletions(-) create mode 100644 src/messenger/webim/js/164/soundcheck.js create mode 100644 src/messenger/webim/js/source/soundcheck.js diff --git a/src/messenger/compile_js b/src/messenger/compile_js index 459de7d1..79b63a56 100755 --- a/src/messenger/compile_js +++ b/src/messenger/compile_js @@ -1,5 +1,5 @@ #!/bin/sh cd webim/js/source -/usr/local/ant/bin/ant +ant rm -rf bin diff --git a/src/messenger/webim/default.css b/src/messenger/webim/default.css index 993f7af0..f944f3bf 100644 --- a/src/messenger/webim/default.css +++ b/src/messenger/webim/default.css @@ -804,6 +804,16 @@ table.awaiting td.visitor { margin-left: 2em; } +#check-nv, #check-nm { + color: #2f7599; + text-decoration: none; +} + +#check-nv:hover, #check-nm:hover { + text-decoration: underline; +} + + /* chat */ .message { diff --git a/src/messenger/webim/install/index.php b/src/messenger/webim/install/index.php index 4d403ac3..1c53d872 100644 --- a/src/messenger/webim/install/index.php +++ b/src/messenger/webim/install/index.php @@ -31,6 +31,7 @@ $page = array( $page['done'] = array(); $page['nextstep'] = false; $page['nextnotice'] = false; +$page['soundcheck'] = false; $errors = array(); function check_webimroot() @@ -143,6 +144,16 @@ function check_columns($link) return true; } +function check_sound() { + global $page; + + $page['soundcheck'] = true; + $page['done'][] = getlocal2("install.5.text", array( + "".getlocal("install.5.newvisitor")."", + "".getlocal("install.5.newmessage")."" + )); +} + function check_status() { global $page, $webimroot, $settings, $dbversion; @@ -171,6 +182,8 @@ function check_status() return; } + check_sound(); + $page['done'][] = getlocal("installed.message"); $page['nextstep'] = getlocal("installed.login_link"); diff --git a/src/messenger/webim/js/164/brws.js b/src/messenger/webim/js/164/brws.js index 5826b50a..34b72c55 100644 --- a/src/messenger/webim/js/164/brws.js +++ b/src/messenger/webim/js/164/brws.js @@ -1 +1 @@ -var myAgent="",myVer=0,myRealAgent="";function detectAgent(){for(var a=["opera","msie","safari","firefox","netscape","mozilla"],b=navigator.userAgent.toLowerCase(),c=0;c");b.write('');b.write("");b.write("
"); -b.write("");b.close();a.onload=function(){if(a.myHtml){FrameUtils.getDocument(a).getElementById("content").innerHTML+=a.myHtml;FrameUtils.scrollDown(a)}}},insertIntoFrame:function(a,b){var c=this.getDocument(a).getElementById("content");if(c==null){if(!a.myHtml)a.myHtml="";a.myHtml+=b}else c.innerHTML+=b},scrollDown:function(a){var b=this.getDocument(a).getElementById("bottom");if(myAgent=="opera")try{a.contentWindow.scrollTo(0,this.getDocument(a).getElementById("content").clientHeight)}catch(c){}b&& -b.scrollIntoView(false)}};Ajax.ChatThreadUpdater=Class.create(); -Class.inherit(Ajax.ChatThreadUpdater,Ajax.Base,{initialize:function(a){this.setOptions(a);this._options.onComplete=this.requestComplete.bind(this);this._options.onException=this.handleException.bind(this);this._options.onTimeout=this.handleTimeout.bind(this);this._options.timeout=5E3;this.updater={};this.frequency=this._options.frequency||2;this.lastupdate=0;this.focused=this.skipNextsound=this.cansend=true;this.ownThread=this._options.message!=null;FrameUtils.initFrame(this._options.container);if(this._options.message){this._options.message.onkeydown= -this.handleKeyDown.bind(this);this._options.message.onfocus=function(){this.focused=true}.bind(this);this._options.message.onblur=function(){this.focused=false}.bind(this)}this.update()},handleException:function(){this.setStatus("offline, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},handleTimeout:function(){this.setStatus("timeout, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},updateOptions:function(a){this._options.parameters= -"act="+a+"&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0)+"&lastid="+(this._options.lastid||0);if(this._options.user)this._options.parameters+="&user=true";if(a=="refresh"&&this._options.message&&this._options.message.value!="")this._options.parameters+="&typed=1"},enableInput:function(a){if(this._options.message)this._options.message.disabled=!a},stopUpdate:function(){this.enableInput(true);if(this.updater._options)this.updater._options.onComplete=undefined;clearTimeout(this.timer)}, -update:function(){this.updateOptions("refresh");this.updater=new Ajax.Request(this._options.servl,this._options)},requestComplete:function(a){try{this.enableInput(true);this.cansend=true;var b=Ajax.getXml(a);b&&b.tagName=="thread"?this.updateContent(b):this.handleError(a,b,"refresh messages failed")}catch(c){}this.skipNextsound=false;this.timer=setTimeout(this.update.bind(this),this.frequency*1E3)},postMessage:function(a){if(!(a==""||!this.cansend)){this.cansend=false;this.stopUpdate();this.skipNextsound= -true;this.updateOptions("post");var b={}.extend(this._options);b.parameters+="&message="+encodeURIComponent(a);b.onComplete=function(c){this.requestComplete(c);if(this._options.message){this._options.message.value="";this._options.message.focus()}}.bind(this);myRealAgent!="opera"&&this.enableInput(false);this.updater=new Ajax.Request(this._options.servl,b)}},changeName:function(a){this.skipNextsound=true;new Ajax.Request(this._options.servl,{parameters:"act=rename&thread="+(this._options.threadid|| -0)+"&token="+(this._options.token||0)+"&name="+encodeURIComponent(a)})},onThreadClosed:function(a){var b=Ajax.getXml(a);b&&b.tagName=="closed"?setTimeout("window.close()",2E3):this.handleError(a,b,"cannot close")},closeThread:function(){var a="act=close&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0);if(this._options.user)a+="&user=true";new Ajax.Request(this._options.servl,{parameters:a,onComplete:this.onThreadClosed.bind(this)})},processMessage:function(a,b){b=NodeUtils.getNodeText(b); -FrameUtils.insertIntoFrame(a,b)},showTyping:function(a){if($("typingdiv"))$("typingdiv").style.display=a?"inline":"none"},setupAvatar:function(a){a=NodeUtils.getNodeText(a);if(this._options.avatar&&this._options.user)this._options.avatar.innerHTML=a!=""?'':""},updateContent:function(a){var b=false,c=this._options.container,d=NodeUtils.getAttrValue(a,"lastid");if(d)this._options.lastid= -d;(d=NodeUtils.getAttrValue(a,"typing"))&&this.showTyping(d=="1");if(d=NodeUtils.getAttrValue(a,"canpost"))if(d=="1"&&!this.ownThread||this.ownThread&&d!="1")window.location.href=window.location.href;for(d=0;d=0){a="updated";if(this.lastupdate>0){c=((new Date).getTime()-this.lastupdate)/1E3;a=a+", "+c+" secs"; -c>10&&alert(a)}this.lastupdate=(new Date).getTime();this.setStatus(a)}else this.clearStatus();if(b){FrameUtils.scrollDown(this._options.container);if(!this.skipNextsound){b=$("soundimg");if(b==null||b.className.match(/\bisound\b/))playSound(Chat.webimRoot+"/sounds/new_message.wav")}this.focused||window.focus()}},isSendkey:function(a,b){return b==13&&(a||this._options.ignorectrl)||b==10},handleKeyDown:function(a){if(a){ctrl=a.ctrlKey;a=a.which}else{a=event.keyCode;ctrl=event.ctrlKey}if(this._options.message&& -this.isSendkey(ctrl,a)){a=this._options.message.value;if(this._options.ignorectrl)a=a.replace(/[\r\n]+$/,"");this.postMessage(a);return false}return true},handleError:function(a,b){b&&b.tagName=="error"?this.setStatus(NodeUtils.getNodeValue(b,"descr")):this.setStatus("reconnecting")},showStatusDiv:function(a){if($("engineinfo")){$("engineinfo").style.display="inline";$("engineinfo").innerHTML=a}},setStatus:function(a){this.statusTimeout&&clearTimeout(this.statusTimeout);this.showStatusDiv(a);this.statusTimeout= -setTimeout(this.clearStatus.bind(this),4E3)},clearStatus:function(){$("engineinfo").style.display="none"}});var Chat={threadUpdater:{},applyName:function(){Chat.threadUpdater.changeName($("uname").value);$("changename1").style.display="none";$("changename2").style.display="inline";$("unamelink").innerHTML=htmlescape($("uname").value)},showNameField:function(){$("changename1").style.display="inline";$("changename2").style.display="none"}}; -Behaviour.register({"#postmessage a":function(a){a.onclick=function(){var b=$("msgwnd");b&&Chat.threadUpdater.postMessage(b.value)}},"select#predefined":function(a){a.onchange=function(){var b=$("msgwnd");if(this.selectedIndex!=0)b.value=this.options[this.selectedIndex].innerText||this.options[this.selectedIndex].innerHTML;this.selectedIndex=0;b.focus()}},"div#changename2 a":function(a){a.onclick=function(){Chat.showNameField();return false}},"div#changename1 a":function(a){a.onclick=function(){Chat.applyName(); -return false}},"div#changename1 input#uname":function(a){a.onkeydown=function(b){(b||event).keyCode==13&&Chat.applyName()}},"a#refresh":function(a){a.onclick=function(){Chat.threadUpdater.stopUpdate();Chat.threadUpdater.update()}},"a#togglesound":function(a){a.onclick=function(){var b=$("soundimg");if(b){b.className=b.className.match(/\bisound\b/)?"tplimage inosound":"tplimage isound";(b=$("msgwnd"))&&b.focus()}}},"a.closethread":function(a){a.onclick=function(){Chat.threadUpdater.closeThread()}}}); +b.write("");b.close();a.onload=function(){a.myHtml&&(FrameUtils.getDocument(a).getElementById("content").innerHTML+=a.myHtml,FrameUtils.scrollDown(a))}},insertIntoFrame:function(a,b){var c=this.getDocument(a).getElementById("content");if(c==null){if(!a.myHtml)a.myHtml="";a.myHtml+=b}else c.innerHTML+=b},scrollDown:function(a){var b=this.getDocument(a).getElementById("bottom");if(myAgent=="opera")try{a.contentWindow.scrollTo(0,this.getDocument(a).getElementById("content").clientHeight)}catch(c){}b&& +b.scrollIntoView(!1)}};Ajax.ChatThreadUpdater=Class.create(); +Class.inherit(Ajax.ChatThreadUpdater,Ajax.Base,{initialize:function(a){this.setOptions(a);this._options.onComplete=this.requestComplete.bind(this);this._options.onException=this.handleException.bind(this);this._options.onTimeout=this.handleTimeout.bind(this);this._options.timeout=5E3;this.updater={};this.frequency=this._options.frequency||2;this.lastupdate=0;this.focused=this.skipNextsound=this.cansend=!0;this.ownThread=this._options.message!=null;FrameUtils.initFrame(this._options.container);if(this._options.message)this._options.message.onkeydown= +this.handleKeyDown.bind(this),this._options.message.onfocus=function(){this.focused=!0}.bind(this),this._options.message.onblur=function(){this.focused=!1}.bind(this);this.update()},handleException:function(){this.setStatus("offline, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},handleTimeout:function(){this.setStatus("timeout, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},updateOptions:function(a){this._options.parameters= +"act="+a+"&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0)+"&lastid="+(this._options.lastid||0);this._options.user&&(this._options.parameters+="&user=true");a=="refresh"&&this._options.message&&this._options.message.value!=""&&(this._options.parameters+="&typed=1")},enableInput:function(a){if(this._options.message)this._options.message.disabled=!a},stopUpdate:function(){this.enableInput(!0);if(this.updater._options)this.updater._options.onComplete=void 0;clearTimeout(this.timer)}, +update:function(){this.updateOptions("refresh");this.updater=new Ajax.Request(this._options.servl,this._options)},requestComplete:function(a){try{this.enableInput(!0);this.cansend=!0;var b=Ajax.getXml(a);b&&b.tagName=="thread"?this.updateContent(b):this.handleError(a,b,"refresh messages failed")}catch(c){}this.skipNextsound=!1;this.timer=setTimeout(this.update.bind(this),this.frequency*1E3)},postMessage:function(a){if(a!=""&&this.cansend){this.cansend=!1;this.stopUpdate();this.skipNextsound=!0;this.updateOptions("post"); +var b={}.extend(this._options);b.parameters+="&message="+encodeURIComponent(a);b.onComplete=function(a){this.requestComplete(a);if(this._options.message)this._options.message.value="",this._options.message.focus()}.bind(this);myRealAgent!="opera"&&this.enableInput(!1);this.updater=new Ajax.Request(this._options.servl,b)}},changeName:function(a){this.skipNextsound=!0;new Ajax.Request(this._options.servl,{parameters:"act=rename&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0)+ +"&name="+encodeURIComponent(a)})},onThreadClosed:function(a){var b=Ajax.getXml(a);b&&b.tagName=="closed"?setTimeout("window.close()",2E3):this.handleError(a,b,"cannot close")},closeThread:function(){var a="act=close&thread="+(this._options.threadid||0)+"&token="+(this._options.token||0);this._options.user&&(a+="&user=true");new Ajax.Request(this._options.servl,{parameters:a,onComplete:this.onThreadClosed.bind(this)})},processMessage:function(a,b){var c=NodeUtils.getNodeText(b);FrameUtils.insertIntoFrame(a, +c)},showTyping:function(a){if($("typingdiv"))$("typingdiv").style.display=a?"inline":"none"},setupAvatar:function(a){a=NodeUtils.getNodeText(a);if(this._options.avatar&&this._options.user)this._options.avatar.innerHTML=a!=""?'':""},updateContent:function(a){var b=!1,c=this._options.container,d=NodeUtils.getAttrValue(a,"lastid");if(d)this._options.lastid=d;(d=NodeUtils.getAttrValue(a, +"typing"))&&this.showTyping(d=="1");if((d=NodeUtils.getAttrValue(a,"canpost"))&&(d=="1"&&!this.ownThread||this.ownThread&&d!="1"))window.location.href=window.location.href;for(d=0;d=0?(a="updated",this.lastupdate>0&&(c=((new Date).getTime()-this.lastupdate)/1E3,a=a+", "+c+" secs",c>10&&alert(a)),this.lastupdate=(new Date).getTime(), +this.setStatus(a)):this.clearStatus();b&&(FrameUtils.scrollDown(this._options.container),this.skipNextsound||(b=$("soundimg"),(b==null||b.className.match(/\bisound\b/))&&playSound(Chat.webimRoot+"/sounds/new_message.wav")),this.focused||window.focus())},isSendkey:function(a,b){return b==13&&(a||this._options.ignorectrl)||b==10},handleKeyDown:function(a){a?(ctrl=a.ctrlKey,a=a.which):(a=event.keyCode,ctrl=event.ctrlKey);if(this._options.message&&this.isSendkey(ctrl,a))return a=this._options.message.value, +this._options.ignorectrl&&(a=a.replace(/[\r\n]+$/,"")),this.postMessage(a),!1;return!0},handleError:function(a,b){b&&b.tagName=="error"?this.setStatus(NodeUtils.getNodeValue(b,"descr")):this.setStatus("reconnecting")},showStatusDiv:function(a){if($("engineinfo"))$("engineinfo").style.display="inline",$("engineinfo").innerHTML=a},setStatus:function(a){this.statusTimeout&&clearTimeout(this.statusTimeout);this.showStatusDiv(a);this.statusTimeout=setTimeout(this.clearStatus.bind(this),4E3)},clearStatus:function(){$("engineinfo").style.display= +"none"}});var Chat={threadUpdater:{},applyName:function(){Chat.threadUpdater.changeName($("uname").value);$("changename1").style.display="none";$("changename2").style.display="inline";$("unamelink").innerHTML=htmlescape($("uname").value)},showNameField:function(){$("changename1").style.display="inline";$("changename2").style.display="none"}}; +Behaviour.register({"#postmessage a":function(a){a.onclick=function(){var a=$("msgwnd");a&&Chat.threadUpdater.postMessage(a.value)}},"select#predefined":function(a){a.onchange=function(){var a=$("msgwnd");if(this.selectedIndex!=0)a.value=this.options[this.selectedIndex].innerText||this.options[this.selectedIndex].innerHTML;this.selectedIndex=0;a.focus()}},"div#changename2 a":function(a){a.onclick=function(){Chat.showNameField();return!1}},"div#changename1 a":function(a){a.onclick=function(){Chat.applyName(); +return!1}},"div#changename1 input#uname":function(a){a.onkeydown=function(a){(a||event).keyCode==13&&Chat.applyName()}},"a#refresh":function(a){a.onclick=function(){Chat.threadUpdater.stopUpdate();Chat.threadUpdater.update()}},"a#togglesound":function(a){a.onclick=function(){var a=$("soundimg");if(a)a.className=a.className.match(/\bisound\b/)?"tplimage inosound":"tplimage isound",(a=$("msgwnd"))&&a.focus()}},"a.closethread":function(a){a.onclick=function(){Chat.threadUpdater.closeThread()}}}); EventHelper.register(window,"onload",function(){Chat.webimRoot=threadParams.wroot;Chat.cssfile=threadParams.cssfile;Chat.threadUpdater=new Ajax.ChatThreadUpdater({ignorectrl:-1,container:myRealAgent=="safari"?self.frames[0]:$("chatwnd"),avatar:$("avatarwnd"),message:$("msgwnd")}.extend(threadParams||{}))}); diff --git a/src/messenger/webim/js/164/common.js b/src/messenger/webim/js/164/common.js index a6aad357..786e50a1 100644 --- a/src/messenger/webim/js/164/common.js +++ b/src/messenger/webim/js/164/common.js @@ -7,21 +7,21 @@ */ 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=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(){}};Ajax.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||"";if(b.length>0)b+="&_=";try{if(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);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");if(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=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-1){var d=token.split("#"),e=d[0];b=document.getElementById(d[1]);if(b==null||e&&b.nodeName.toLowerCase()!=e)return[];b=new Array(b)}else if(token.indexOf(".")>-1){d=token.split(".");e=d[0];d=d[1];e||(e="*");for(var j=[],l=0,m=0;m=0)a="audio/mpeg";return a} -function playSound(a){var b=document.getElementById("player");b&&b.parentNode.removeChild(b);b=document.body.appendChild(document.createElement("div"));var c=navigator.userAgent.toLowerCase();b.innerHTML=c.indexOf("safari")==-1&&c.indexOf("windows")!=-1?'':'
'} +document.getElementsBySelector=function(a){if(!document.getElementsByTagName)return[];for(var a=a.split(" "),b=Array(document),c=0;c-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 l=[],j=0,n=0;n=0))a="audio/mpeg";return a} +function playSound(a){var b=document.getElementById("player");b&&b.parentNode.removeChild(b);var b=document.body.appendChild(document.createElement("div")),c=navigator.userAgent.toLowerCase();b.innerHTML=c.indexOf("safari")==-1&&c.indexOf("windows")!=-1?'':'
'} function htmlescape(a){return a.replace("&","&").replace("<","<").replace(">",">").replace('"',""")}; diff --git a/src/messenger/webim/js/164/soundcheck.js b/src/messenger/webim/js/164/soundcheck.js new file mode 100644 index 00000000..8a487619 --- /dev/null +++ b/src/messenger/webim/js/164/soundcheck.js @@ -0,0 +1 @@ +Behaviour.register({"a#check-nv":function(a){a.onclick=function(){playSound(wroot+"/sounds/new_user.wav")}},"a#check-nm":function(a){a.onclick=function(){playSound(wroot+"/sounds/new_message.wav")}}}); diff --git a/src/messenger/webim/js/164/users.js b/src/messenger/webim/js/164/users.js index 5e3d50c5..b7546c7f 100644 --- a/src/messenger/webim/js/164/users.js +++ b/src/messenger/webim/js/164/users.js @@ -7,21 +7,21 @@ */ Ajax.PeriodicalUpdater=Class.create(); Class.inherit(Ajax.PeriodicalUpdater,Ajax.Base,{initialize:function(a){this.setOptions(a);this._options.onComplete=this.requestComplete.bind(this);this._options.onException=this.handleException.bind(this);this._options.onTimeout=this.handleTimeout.bind(this);this._options.timeout=5E3;this.frequency=this._options.frequency||2;this.updater={};this.update()},handleException:function(){this._options.handleError&&this._options.handleError("offline, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this), -1E3)},handleTimeout:function(){this._options.handleError&&this._options.handleError("timeout, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},stopUpdate:function(){if(this.updater._options)this.updater._options.onComplete=undefined;clearTimeout(this.timer)},update:function(){if(this._options.updateParams)this._options.parameters=this._options.updateParams();this.updater=new Ajax.Request(this._options.url,this._options)},requestComplete:function(a){try{var b=Ajax.getXml(a); -if(b)(this._options.updateContent||Ajax.emptyFunction)(b);else this._options.handleError&&this._options.handleError("reconnecting")}catch(c){}this.timer=setTimeout(this.update.bind(this),this.frequency*1E3)}}); -var HtmlGenerationUtils={popupLink:function(a,b,c,d,e,j,l){return'"+d+""},generateOneRowTable:function(a){return''+a+"
"},viewOpenCell:function(a,b,c,d,e,j,l,m){j= -2;b=b+"?thread="+c;var g="";g+=e||d?HtmlGenerationUtils.popupLink(m||!d?b:b+"&viewonly=true",localized[e?0:1],"ImCenter"+c,a,640,480,null):''+a+"";g+="";if(e){g+='';g+=HtmlGenerationUtils.popupLink(b,localized[0],"ImCenter"+c,''+localized[0]+'',640,480,null);g+="";j++}if(d){g+='';g+=HtmlGenerationUtils.popupLink(b+"&viewonly=true",localized[1],"ImCenter"+ -c,''+localized[1]+'',640,480,null);g+="";j++}if(l!=""){g+='';g+=l.length>30?l.substring(0,30)+"...":l;g+=""}return HtmlGenerationUtils.generateOneRowTable(g)},banCell:function(a,b){return''+HtmlGenerationUtils.popupLink(webimRoot+"/operator/ban.php?"+ +1E3)},handleTimeout:function(){this._options.handleError&&this._options.handleError("timeout, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},stopUpdate:function(){if(this.updater._options)this.updater._options.onComplete=void 0;clearTimeout(this.timer)},update:function(){if(this._options.updateParams)this._options.parameters=this._options.updateParams();this.updater=new Ajax.Request(this._options.url,this._options)},requestComplete:function(a){try{var b=Ajax.getXml(a); +b?(this._options.updateContent||Ajax.emptyFunction)(b):this._options.handleError&&this._options.handleError("reconnecting")}catch(c){}this.timer=setTimeout(this.update.bind(this),this.frequency*1E3)}}); +var HtmlGenerationUtils={popupLink:function(a,b,c,d,e,l,j){return'"+d+""},generateOneRowTable:function(a){return''+a+"
"},viewOpenCell:function(a,b,c,d,e,l,j,n){var l= +2,b=b+"?thread="+c,g="";g+=e||d?HtmlGenerationUtils.popupLink(n||!d?b:b+"&viewonly=true",localized[e?0:1],"ImCenter"+c,a,640,480,null):''+a+"";g+="";e&&(g+='',g+=HtmlGenerationUtils.popupLink(b,localized[0],"ImCenter"+c,''+localized[0]+'',640,480,null),g+="",l++);d&&(g+='',g+=HtmlGenerationUtils.popupLink(b+"&viewonly=true",localized[1],"ImCenter"+ +c,''+localized[1]+'',640,480,null),g+="",l++);j!=""&&(g+='',g+=j.length>30?j.substring(0,30)+"...":j,g+="");return HtmlGenerationUtils.generateOneRowTable(g)},banCell:function(a,b){return''+HtmlGenerationUtils.popupLink(webimRoot+"/operator/ban.php?"+ (b?"id="+b:"thread="+a),localized[2],"ban"+a,''+localized[2]+'',720,480,null)+""}};Ajax.ThreadListUpdater=Class.create(); Class.inherit(Ajax.ThreadListUpdater,Ajax.Base,{initialize:function(a){this.setOptions(a);this._options.updateParams=this.updateParams.bind(this);this._options.handleError=this.handleError.bind(this);this._options.updateContent=this.updateContent.bind(this);this._options.lastrevision=0;this.threadTimers={};this.delta=0;this.t=this._options.table;this.periodicalUpdater=new Ajax.PeriodicalUpdater(this._options)},updateParams:function(){return"since="+this._options.lastrevision+"&status="+this._options.istatus+ -(this._options.showonline?"&showonline=1":"")},setStatus:function(a){this._options.status.innerHTML=a},handleError:function(a){this.setStatus(a)},updateThread:function(a){function b(s,w,x,y){if(s=CommonUtils.getCell(x,w,s))s.innerHTML=y}for(var c,d,e,j=false,l=false,m=false,g=null,o=null,f=0;f"+NodeUtils.getNodeValue(a, -"useragent")+"";if(g!=null)p=""+NodeUtils.getNodeValue(a,"reason")+"";if(m)p+=HtmlGenerationUtils.banCell(c,o);p=HtmlGenerationUtils.generateOneRowTable(p);a=CommonUtils.getRow("t"+d,this.t);m=CommonUtils.getRow("t"+d+"end",this.t);if(f!=null&&(f.rowIndex<=a.rowIndex||f.rowIndex>=m.rowIndex)){this.t.deleteRow(f.rowIndex);f=this.threadTimers[c]=null}if(f==null){f=this.t.insertRow(a.rowIndex+1);f.className=g=="blocked"&&d!="chat"?"ban":"in"+d;f.id="thr"+c;this.threadTimers[c]=new Array(q, -r,d);CommonUtils.insertCell(f,"name","visitor",null,null,HtmlGenerationUtils.viewOpenCell(n,this._options.agentservl,c,j,l,g,v,d!="chat"));CommonUtils.insertCell(f,"contid","visitor","center",null,t);CommonUtils.insertCell(f,"state","visitor","center",null,e);CommonUtils.insertCell(f,"op","visitor","center",null,u);CommonUtils.insertCell(f,"time","visitor","center",null,this.getTimeSince(q));CommonUtils.insertCell(f,"wait","visitor","center",null,d!="chat"?this.getTimeSince(r):"-");CommonUtils.insertCell(f, -"etc","visitor","center",null,p);if(d=="wait"||d=="prio")return true}else{this.threadTimers[c]=new Array(q,r,d);f.className=g=="blocked"&&d!="chat"?"ban":"in"+d;b(this.t,f,"name",HtmlGenerationUtils.viewOpenCell(n,this._options.agentservl,c,j,l,g,v,d!="chat"));b(this.t,f,"contid",t);b(this.t,f,"state",e);b(this.t,f,"op",u);b(this.t,f,"time",this.getTimeSince(q));b(this.t,f,"wait",d!="chat"?this.getTimeSince(r):"-");b(this.t,f,"etc",p)}return false}},updateQueueMessages:function(){function a(d,e){d= -$(e);e=$(e+"end");if(d==null||e==null)return false;return d.rowIndex+1=60){c=Math.floor(b/60);b%=60;if(b<10)b="0"+b;c=c+":"}return c+b+":"+a},updateTimers:function(){for(var a in this.threadTimers)if(this.threadTimers[a]!= -null){var b=this.threadTimers[a],c=CommonUtils.getRow("thr"+a,this.t);if(c!=null){function d(e,j,l,m){if(e=CommonUtils.getCell(l,j,e))e.innerHTML=m}d(this.t,c,"time",this.getTimeSince(b[0]));d(this.t,c,"wait",b[2]!="chat"?this.getTimeSince(b[1]):"-")}}},updateThreads:function(a){var b=false,c=NodeUtils.getAttrValue(a,"time"),d=NodeUtils.getAttrValue(a,"revision");if(c)this.delta=(new Date).getTime()-c;if(d)this._options.lastrevision=d;for(c=0;c '+j}}b.innerHTML=c.join(", ")}},updateContent:function(a){if(a.tagName=="update")for(var b=0;b"+NodeUtils.getNodeValue(a, +"useragent")+"";g!=null&&(p=""+NodeUtils.getNodeValue(a,"reason")+"");n&&(p+=HtmlGenerationUtils.banCell(c,o));p=HtmlGenerationUtils.generateOneRowTable(p);a=CommonUtils.getRow("t"+d,this.t);n=CommonUtils.getRow("t"+d+"end",this.t);if(f!=null&&(f.rowIndex<=a.rowIndex||f.rowIndex>=n.rowIndex))this.t.deleteRow(f.rowIndex),f=this.threadTimers[c]=null;if(f==null){if(f=this.t.insertRow(a.rowIndex+1),f.className=g=="blocked"&&d!="chat"?"ban":"in"+d,f.id="thr"+c,this.threadTimers[c]=[q,r,d], +CommonUtils.insertCell(f,"name","visitor",null,null,HtmlGenerationUtils.viewOpenCell(m,this._options.agentservl,c,l,j,g,u,d!="chat")),CommonUtils.insertCell(f,"contid","visitor","center",null,s),CommonUtils.insertCell(f,"state","visitor","center",null,e),CommonUtils.insertCell(f,"op","visitor","center",null,t),CommonUtils.insertCell(f,"time","visitor","center",null,this.getTimeSince(q)),CommonUtils.insertCell(f,"wait","visitor","center",null,d!="chat"?this.getTimeSince(r):"-"),CommonUtils.insertCell(f, +"etc","visitor","center",null,p),d=="wait"||d=="prio")return!0}else this.threadTimers[c]=[q,r,d],f.className=g=="blocked"&&d!="chat"?"ban":"in"+d,b(this.t,f,"name",HtmlGenerationUtils.viewOpenCell(m,this._options.agentservl,c,l,j,g,u,d!="chat")),b(this.t,f,"contid",s),b(this.t,f,"state",e),b(this.t,f,"op",t),b(this.t,f,"time",this.getTimeSince(q)),b(this.t,f,"wait",d!="chat"?this.getTimeSince(r):"-"),b(this.t,f,"etc",p);return!1}},updateQueueMessages:function(){function a(a,b){var c=$(b),j=$(b+"end"); +if(c==null||j==null)return!1;return c.rowIndex+1=60&&(c=Math.floor(b/60),b%=60,b<10&&(b="0"+b),c+=":");return c+b+":"+a},updateTimers:function(){for(var a in this.threadTimers)if(this.threadTimers[a]!=null){var b= +this.threadTimers[a],c=CommonUtils.getRow("thr"+a,this.t);if(c!=null){var d=function(a,b,c,d){if(a=CommonUtils.getCell(c,b,a))a.innerHTML=d};d(this.t,c,"time",this.getTimeSince(b[0]));d(this.t,c,"wait",b[2]!="chat"?this.getTimeSince(b[1]):"-")}}},updateThreads:function(a){var b=!1,c=NodeUtils.getAttrValue(a,"time"),d=NodeUtils.getAttrValue(a,"revision");if(c)this.delta=(new Date).getTime()-c;if(d)this._options.lastrevision=d;for(c=0;c '+l}}b.innerHTML=c.join(", ")}},updateContent:function(a){if(a.tagName=="update")for(var b=0;b -]> @@ -25,6 +24,10 @@ + + + + diff --git a/src/messenger/webim/js/source/soundcheck.js b/src/messenger/webim/js/source/soundcheck.js new file mode 100644 index 00000000..34c41582 --- /dev/null +++ b/src/messenger/webim/js/source/soundcheck.js @@ -0,0 +1,12 @@ +Behaviour.register({ + 'a#check-nv' : function(el) { + el.onclick = function() { + playSound(wroot + '/sounds/new_user.wav'); + }; + }, + 'a#check-nm' : function(el) { + el.onclick = function() { + playSound(wroot + '/sounds/new_message.wav') + }; + } +}); diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index 1753d617..ceae655d 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -177,7 +177,10 @@ install.3.create=Create required tables. install.3.tables_exist=Requred tables are created. install.4.create=Update tables install.4.done=Tables structure is up to date. -install.4.notice=Structure of your tables should be adjusted for new version of Messenger. +install.4.notice=Structure of your tables should be adjusted for new version of Messenger. +install.5.text=Click to check the sound: {0} and {1} +install.5.newmessage=New Message +install.5.newvisitor=New Visitor install.connection.error=Could not connect, please check server settings in config.php. Error: {0} install.done=Completed: install.err.back=Resvole problem and try again. Press back to return to wizard. diff --git a/src/messenger/webim/view/install_index.php b/src/messenger/webim/view/install_index.php index 20c739b8..f988eb1e 100644 --- a/src/messenger/webim/view/install_index.php +++ b/src/messenger/webim/view/install_index.php @@ -25,6 +25,18 @@ if(isset($page) && isset($page['localeLinks'])) { $page['title'] = getlocal("install.title"); $page['fixedwrap'] = true; +function tpl_header() { global $page, $webimroot, $jsver; + if($page['soundcheck']) { +?> + + + +