From 3866f37f2242bd8714a86e5556789d528b1cf362 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Fri, 10 Apr 2009 15:41:05 +0000 Subject: [PATCH] optional popup notification of the new visitor git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@468 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/compile_js | 2 +- src/messenger/webim/js/source/common.js | 2 +- src/messenger/webim/js/source/users.js | 3 +++ src/messenger/webim/js/users.js | 2 +- src/messenger/webim/libs/common.php | 1 + src/messenger/webim/locales/en/properties | 3 +++ src/messenger/webim/locales/ru/properties | 3 +++ src/messenger/webim/operator/features.php | 6 +++++- src/messenger/webim/operator/users.php | 1 + src/messenger/webim/view/features.php | 9 +++++++++ src/messenger/webim/view/pending_users.php | 5 +++-- 11 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/messenger/compile_js b/src/messenger/compile_js index d80e1dbe..459de7d1 100755 --- a/src/messenger/compile_js +++ b/src/messenger/compile_js @@ -1,5 +1,5 @@ #!/bin/sh cd webim/js/source -~/distrib/apache-ant-1.7.0/bin/ant +/usr/local/ant/bin/ant rm -rf bin diff --git a/src/messenger/webim/js/source/common.js b/src/messenger/webim/js/source/common.js index 0ce99df4..ea2e5e39 100644 --- a/src/messenger/webim/js/source/common.js +++ b/src/messenger/webim/js/source/common.js @@ -12,7 +12,7 @@ //- onComplete, obj, params, $apply$ //- threadParams, servl, frequency, user, threadid, token, cssfile -//- updaterOptions, url, company, agentservl, noclients, wroot, havemenu +//- updaterOptions, url, company, agentservl, noclients, wroot, havemenu, showpopup var Class = { diff --git a/src/messenger/webim/js/source/users.js b/src/messenger/webim/js/source/users.js index cbc759f2..2eedc04f 100644 --- a/src/messenger/webim/js/source/users.js +++ b/src/messenger/webim/js/source/users.js @@ -296,6 +296,9 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, { if( newAdded ) { playSound(webimRoot+'/sounds/new_user.wav'); window.focus(); + if(updaterOptions.showpopup) { + alert(localized[5]); + } } } else if( root.tagName == 'error' ) { this.setStatus(NodeUtils.getNodeValue(root,"descr") ); diff --git a/src/messenger/webim/js/users.js b/src/messenger/webim/js/users.js index 27e147f1..a03cadfd 100644 --- a/src/messenger/webim/js/users.js +++ b/src/messenger/webim/js/users.js @@ -1 +1 @@ -sq.ji=mn.nn();mn.sn(sq.ji,sq.lq,{qn:function(pq){this.oq(pq);this.pq.onComplete=this.ft.on(this);this.pq.jr=this.gt.on(this);this.pq.hr=this._q.on(this);this.pq.timeout=(4094+906);this.frequency=(this.pq.frequency||2);this.at={} ;this._t();} ,gt:function(mu,nu){if(this.pq.ou)this.pq.ou("offline, reconnecting");this.ru();this.su=setTimeout(this._t.on(this),(621+379));} ,_q:function(mu){if(this.pq.ou)this.pq.ou("timeout, reconnecting");this.ru();this.su=setTimeout(this._t.on(this),(724+276));} ,ru:function(){if(this.at.pq)this.at.pq.onComplete=undefined;clearTimeout(this.su);} ,_t:function(){if(this.pq.ki)this.pq.fq=(this.pq.ki)();this.at=new sq.vq(this.pq.url,this.pq);} ,ft:function(fu){try{var ku=sq.uq(fu);if(ku){(this.pq.lu||sq.kq)(ku);} else{if(this.pq.ou)this.pq.ou("reconnecting");} } catch(e){} this.su=setTimeout(this._t.on(this),this.frequency*0x3e8);} } );var li={oi:function(link,title,pi,di,width,height,ei){return''+di+'';} ,fi:function(content){return''+content+'
';} ,gi:function(ai,bi,id,ci,vi,wi,yt,xi){var yi=2;var link=bi+"?thread="+id;var zi='';if(vi||ci){zi+=li.oi((xi||!ci)?link:link+"&viewonly=true",localized[vi?0:1],"ImCenter"+id,ai,01200,(340+140),null);} else{zi+=''+ai+'';} zi+='';if(vi){zi+='';zi+=li.oi(link,localized[0],"ImCenter"+id,''+localized[0]+'',(544+96),0x1e0,null);zi+='';yi++;} if(ci){zi+='';zi+=li.oi(link+"&viewonly=true",localized[1],"ImCenter"+id,''+localized[1]+'',0x280,0x1e0,null);zi+='';yi++;} if(yt!=""){zi+='';zi+=yt.length>036?yt.substring(0,0x1e)+'...':yt;zi+='';} return li.fi(zi);} ,$i:function(id,_i){return''+li.oi(qh+'/operator/ban.php?'+(_i?'id='+_i:'thread='+id),localized[2],"ban"+id,''+localized[2]+'',(645+75),(343+137),null)+'';} } ;sq.mj=mn.nn();mn.sn(sq.mj,sq.lq,{qn:function(pq){this.oq(pq);this.pq.ki=this.ki.on(this);this.pq.ou=this.ou.on(this);this.pq.lu=this.lu.on(this);this.pq.nj=0;this.qj=new Object();this.rj=0;this.t=this.pq.sj;this.tj=new sq.ji(this.pq);} ,ki:function(){return"company="+this.pq.company+"&since="+this.pq.nj;} ,qu:function(du){this.pq.status.innerHTML=du;} ,ou:function(s){this.qu(s);} ,uj:function(ih){var id,hj,ij,ci=false,vi=false,jj=false,wi=null,_i=null;for(var i=0;i';if(wi!=null){bj=''+qs.rs(ih,"reason")+'';} if(jj){bj+=li.$i(id,_i);} bj=li.fi(bj);var cj=ls.os("t"+hj,this.t);var vj=ls.os("t"+hj+"end",this.t);if(oj!=null&&(oj.rowIndex<=cj.rowIndex||oj.rowIndex>=vj.rowIndex)){this.t.deleteRow(oj.rowIndex);this.qj[id]=null;oj=null;} if(oj==null){oj=this.t.insertRow(cj.rowIndex+1);oj.className=(wi=="blocked"&&hj!="chat")?"ban":"in"+hj;oj.id="thr"+id;this.qj[id]=new Array(fj,aj,hj);ls.insertCell(oj,"name","visitor",null,null,li.gi(dj,this.pq.agentservl,id,ci,vi,wi,yt,hj!='chat'));ls.insertCell(oj,"contid","visitor","center",null,ej);ls.insertCell(oj,"state","visitor","center",null,ij);ls.insertCell(oj,"op","visitor","center",null,gj);ls.insertCell(oj,"time","visitor","center",null,this.wj(fj));ls.insertCell(oj,"wait","visitor","center",null,(hj!='chat'?this.wj(aj):'-'));ls.insertCell(oj,"etc","visitor","center",null,bj);if(hj=='wait'||hj=='prio')return true;} else{this.qj[id]=new Array(fj,aj,hj);oj.className=(wi=="blocked"&&hj!="chat")?"ban":"in"+hj;lj(this.t,oj,"name",li.gi(dj,this.pq.agentservl,id,ci,vi,wi,yt,hj!='chat'));lj(this.t,oj,"contid",ej);lj(this.t,oj,"state",ij);lj(this.t,oj,"op",gj);lj(this.t,oj,"time",this.wj(fj));lj(this.t,oj,"wait",(hj!='chat'?this.wj(aj):'-'));lj(this.t,oj,"etc",bj);} return false;} ,xj:function(){function yj(t,id){var cj=$(id);var vj=$(id+"end");if(cj==null||vj==null){return false;} return cj.rowIndex+1=(55+5)){var rk=Math.floor(nk/074);nk=nk%(40+20);if(nk<012)nk="0"+nk;qk=rk+":";} return qk+nk+":"+mk;} ,sk:function(){for(var i in this.qj){if(this.qj[i]!=null){var value=this.qj[i];var oj=ls.os("thr"+i,this.t);if(oj!=null){function lj(ds,oj,id,pj){var ws=ls.fs(id,oj,ds);if(ws)ws.innerHTML=pj;} lj(this.t,oj,"time",this.wj(value[0]));lj(this.t,oj,"wait",(value[2]!='chat'?this.wj(value[1]):'-'));} } } } ,lu:function(tk){var uk=false;if(tk.tagName=='threads'){var hk=qs.ks(tk,"time");var ik=qs.ks(tk,"revision");if(hk)this.rj=(new Date()).getTime()-hk;if(ik)this.pq.nj=ik;for(var i=0;i'+di+'';} ,fi:function(content){return''+content+'
';} ,gi:function(ai,bi,id,ci,vi,wi,yt,xi){var yi=2;var link=bi+"?thread="+id;var zi='';if(vi||ci){zi+=li.oi((xi||!ci)?link:link+"&viewonly=true",localized[vi?0:1],"ImCenter"+id,ai,01200,(340+140),null);} else{zi+=''+ai+'';} zi+='';if(vi){zi+='';zi+=li.oi(link,localized[0],"ImCenter"+id,''+localized[0]+'',(544+96),0x1e0,null);zi+='';yi++;} if(ci){zi+='';zi+=li.oi(link+"&viewonly=true",localized[1],"ImCenter"+id,''+localized[1]+'',0x280,0x1e0,null);zi+='';yi++;} if(yt!=""){zi+='';zi+=yt.length>036?yt.substring(0,0x1e)+'...':yt;zi+='';} return li.fi(zi);} ,$i:function(id,_i){return''+li.oi(qh+'/operator/ban.php?'+(_i?'id='+_i:'thread='+id),localized[2],"ban"+id,''+localized[2]+'',(645+75),(343+137),null)+'';} } ;sq.mj=mn.nn();mn.sn(sq.mj,sq.lq,{qn:function(pq){this.oq(pq);this.pq.ki=this.ki.on(this);this.pq.ou=this.ou.on(this);this.pq.lu=this.lu.on(this);this.pq.nj=0;this.qj=new Object();this.rj=0;this.t=this.pq.sj;this.tj=new sq.ji(this.pq);} ,ki:function(){return"company="+this.pq.company+"&since="+this.pq.nj;} ,qu:function(du){this.pq.status.innerHTML=du;} ,ou:function(s){this.qu(s);} ,uj:function(ih){var id,hj,ij,ci=false,vi=false,jj=false,wi=null,_i=null;for(var i=0;i';if(wi!=null){bj=''+qs.rs(ih,"reason")+'';} if(jj){bj+=li.$i(id,_i);} bj=li.fi(bj);var cj=ls.os("t"+hj,this.t);var vj=ls.os("t"+hj+"end",this.t);if(oj!=null&&(oj.rowIndex<=cj.rowIndex||oj.rowIndex>=vj.rowIndex)){this.t.deleteRow(oj.rowIndex);this.qj[id]=null;oj=null;} if(oj==null){oj=this.t.insertRow(cj.rowIndex+1);oj.className=(wi=="blocked"&&hj!="chat")?"ban":"in"+hj;oj.id="thr"+id;this.qj[id]=new Array(fj,aj,hj);ls.insertCell(oj,"name","visitor",null,null,li.gi(dj,this.pq.agentservl,id,ci,vi,wi,yt,hj!='chat'));ls.insertCell(oj,"contid","visitor","center",null,ej);ls.insertCell(oj,"state","visitor","center",null,ij);ls.insertCell(oj,"op","visitor","center",null,gj);ls.insertCell(oj,"time","visitor","center",null,this.wj(fj));ls.insertCell(oj,"wait","visitor","center",null,(hj!='chat'?this.wj(aj):'-'));ls.insertCell(oj,"etc","visitor","center",null,bj);if(hj=='wait'||hj=='prio')return true;} else{this.qj[id]=new Array(fj,aj,hj);oj.className=(wi=="blocked"&&hj!="chat")?"ban":"in"+hj;lj(this.t,oj,"name",li.gi(dj,this.pq.agentservl,id,ci,vi,wi,yt,hj!='chat'));lj(this.t,oj,"contid",ej);lj(this.t,oj,"state",ij);lj(this.t,oj,"op",gj);lj(this.t,oj,"time",this.wj(fj));lj(this.t,oj,"wait",(hj!='chat'?this.wj(aj):'-'));lj(this.t,oj,"etc",bj);} return false;} ,xj:function(){function yj(t,id){var cj=$(id);var vj=$(id+"end");if(cj==null||vj==null){return false;} return cj.rowIndex+1=(55+5)){var rk=Math.floor(nk/074);nk=nk%(40+20);if(nk<012)nk="0"+nk;qk=rk+":";} return qk+nk+":"+mk;} ,sk:function(){for(var i in this.qj){if(this.qj[i]!=null){var value=this.qj[i];var oj=ls.os("thr"+i,this.t);if(oj!=null){function lj(ds,oj,id,pj){var ws=ls.fs(id,oj,ds);if(ws)ws.innerHTML=pj;} lj(this.t,oj,"time",this.wj(value[0]));lj(this.t,oj,"wait",(value[2]!='chat'?this.wj(value[1]):'-'));} } } } ,lu:function(tk){var uk=false;if(tk.tagName=='threads'){var hk=qs.ks(tk,"time");var ik=qs.ks(tk,"revision");if(hk)this.rj=(new Date()).getTime()-hk;if(ik)this.pq.nj=ik;for(var i=0;i '0', 'surveyaskgroup' => '1', 'surveyaskmessage' => '0', + 'enablepopupnotification' => '0', ); $settingsloaded = false; $settings_in_db = array(); diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index 5862fb26..fd001ac7 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -319,6 +319,7 @@ page_settings.tab.main=General page_settings.tab.themes=Themes preview pending.menu.hide=Hide menu >> pending.menu.show=Show menu >> +pending.popup_notification=New visitor is waiting for an answer. pending.table.ban=Ban the visitor pending.table.head.contactid=Visitor's address pending.table.head.etc=Misc @@ -384,6 +385,8 @@ settings.host.description=Destination for you company name or logo link settings.host=URL of your website settings.logo.description=Enter http address of your company logo settings.logo=Your company logo +settings.popup_notification.description=Small dialog appears to attract your attention. +settings.popup_notification=Enable "Popup dialog notification of the new visitor" settings.no.title=Please enter your company title settings.onehostconnections.description=0 allows any number of connections settings.onehostconnections=Max number of threads from one address diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties index feec1ebe..76005570 100644 --- a/src/messenger/webim/locales/ru/properties +++ b/src/messenger/webim/locales/ru/properties @@ -319,6 +319,7 @@ page_settings.tab.main= page_settings.tab.themes=Просмотр стилей pending.menu.hide=Спрятать меню >> pending.menu.show=Показать меню >> +pending.popup_notification=Новый посетитель ожидает ответа. pending.table.ban=Пометить посетителя как нежелательного pending.table.head.contactid=Адрес посетителя pending.table.head.etc=Разное @@ -384,6 +385,8 @@ settings.host.description= settings.host=Ссылка на ваш веб сайт settings.logo.description=Введите ссылку на логотип компании settings.logo=Лого компании +settings.popup_notification.description=Позволяет привлечь ваше внимание, если звукового и визуального оповещения недостаточно. +settings.popup_notification=Показывать небольшой диалог при появлении новых посетителей в очереди. settings.no.title=Введите имя Вашей компании settings.onehostconnections.description=0 разрешает любое количество соединений settings.onehostconnections=Максимальное количество диалогов с одного адреса diff --git a/src/messenger/webim/operator/features.php b/src/messenger/webim/operator/features.php index 995cb498..94c2693b 100644 --- a/src/messenger/webim/operator/features.php +++ b/src/messenger/webim/operator/features.php @@ -21,7 +21,11 @@ $operator = check_login(); $page = array('agentId' => ''); $errors = array(); -$options = array('enableban', 'usercanchangename', 'enablessl', 'enablegroups', 'enablestatistics', 'enablepresurvey', 'surveyaskmail', 'surveyaskgroup', 'surveyaskmessage', 'forcessl'); +$options = array( + 'enableban', 'usercanchangename', 'enablegroups', 'enablestatistics', + 'enablessl', 'forcessl', + 'enablepresurvey', 'surveyaskmail', 'surveyaskgroup', 'surveyaskmessage', + 'enablepopupnotification'); loadsettings(); $params = array(); diff --git a/src/messenger/webim/operator/users.php b/src/messenger/webim/operator/users.php index f16ab3d0..7b55fb4a 100644 --- a/src/messenger/webim/operator/users.php +++ b/src/messenger/webim/operator/users.php @@ -35,6 +35,7 @@ if($settings['enablegroups'] == '1') { $page = array(); $page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1"; +$page['showpopup'] = $settings['enablepopupnotification'] == '1' ? "1" : "0"; prepare_menu($operator); start_html_output(); diff --git a/src/messenger/webim/view/features.php b/src/messenger/webim/view/features.php index 2aa525be..1428fbcc 100644 --- a/src/messenger/webim/view/features.php +++ b/src/messenger/webim/view/features.php @@ -168,6 +168,15 @@ require_once('inc_errors.php'); +
+
+
+ /> +
+
+
+
+
diff --git a/src/messenger/webim/view/pending_users.php b/src/messenger/webim/view/pending_users.php index 44551af8..d8622871 100644 --- a/src/messenger/webim/view/pending_users.php +++ b/src/messenger/webim/view/pending_users.php @@ -26,12 +26,13 @@ var localized = new Array( "", "", "", - "" + "", + "" ); var updaterOptions = { url:"/operator/update.php",wroot:"", agentservl:"/operator/agent.php", - noclients:"", havemenu: , }; + noclients:"", havemenu: , showpopup: }; //-->