From 3903449edc86113ecb0e76387e131b691dac6ec1 Mon Sep 17 00:00:00 2001 From: Evgeny Gryaznov Date: Sun, 25 Apr 2010 23:28:05 +0000 Subject: [PATCH] apply patch by Andrew Armstrong: available operators list (revised); remove odd eval code in common.js git-svn-id: https://webim.svn.sourceforge.net/svnroot/webim/trunk@767 c66351dc-e62f-0410-b875-e3a5c0b9693f --- src/messenger/webim/default.css | 7 ++ src/messenger/webim/images/opaway.gif | Bin 0 -> 3480 bytes src/messenger/webim/images/oponline.gif | Bin 0 -> 3481 bytes src/messenger/webim/js/164/common.js | 8 +-- src/messenger/webim/js/164/users.js | 25 +++---- src/messenger/webim/js/source/common.js | 20 +----- src/messenger/webim/js/source/users.js | 77 +++++++++++++++------ src/messenger/webim/libs/common.php | 1 + src/messenger/webim/libs/operator.php | 25 +++++++ src/messenger/webim/locales/en/properties | 2 + src/messenger/webim/locales/ru/properties | 2 + src/messenger/webim/operator/features.php | 2 +- src/messenger/webim/operator/operators.php | 22 +----- src/messenger/webim/operator/update.php | 26 ++++++- src/messenger/webim/operator/users.php | 1 + src/messenger/webim/view/agents.php | 4 +- src/messenger/webim/view/features.php | 9 +++ src/messenger/webim/view/pending_users.php | 7 +- 18 files changed, 156 insertions(+), 82 deletions(-) create mode 100644 src/messenger/webim/images/opaway.gif create mode 100644 src/messenger/webim/images/oponline.gif diff --git a/src/messenger/webim/default.css b/src/messenger/webim/default.css index 20f54fd3..fd60c802 100644 --- a/src/messenger/webim/default.css +++ b/src/messenger/webim/default.css @@ -594,6 +594,13 @@ table.awaiting td.visitor { text-decoration: underline; } +/* online operators */ + +#onlineoperators { + padding-right: 10px; + float: right; +} + /* search */ #searchtext { diff --git a/src/messenger/webim/images/opaway.gif b/src/messenger/webim/images/opaway.gif new file mode 100644 index 0000000000000000000000000000000000000000..e905691806859ad59efecf5a67cf5141a20fcaaf GIT binary patch literal 3480 zcmbW42UHVT7l7YP8Y$F--a>EE1p9jh>PPTB;+O~<)*Om^71wd<4e;+O9fF)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ho zirYbZX8ZGFF~@En_c`8kf^nktq|V9Rr>LijI-ri+j+xGc&atkDuHn<(r+d2XyHEXO z^3$O+8fR+H%APGdM>>~(4mrQ_{OpCa3okFmU!3S!(et2pY45GRz`mhNK9{ascE8-) z@7#a>io=yNSM9EzzQ(xLIbc1|F=#b->SwE;PYqcQbzHZ(-gU$FM)&Zd;d3L7BNuPF z-n@Lv>(;>NlF{MYp||heiMlg(mvi^oz2tkZ?`Pegdyw}K_ps=Z)T7GBDvuj}G5Doz z%zEtXxa;`fli(*0CfE}%{+02s&#{yFPsN{BPN`2dJ+pXrX4-xF#`9&*Ctsw!n0s09 ztMsqCU+KR(`J2;kgELEKCSMC)BfpotQG9dg?ZUS`vjMY@-=(~pdtdZH@x$SdjF0`F z!aq&TWq&4ouKL5^kM4P&`G-gf`pY3YjiWzJ==m8RbYXA1jm)ff&CP(E`^nx%RVdmj zG0~P$M>Y){$j24p<9eGIb~Q6;?d=Skd(C)dIZZ|R=1fClc`VJ_#|I}VpPx^J3w=oB Qtv*EJc9$I$OlM&KZ%3Vs00000 literal 0 HcmV?d00001 diff --git a/src/messenger/webim/images/oponline.gif b/src/messenger/webim/images/oponline.gif new file mode 100644 index 0000000000000000000000000000000000000000..ea245356e451d1cece0a1ebcca6452606544de94 GIT binary patch literal 3481 zcmbW4XH-+!7J$#aX#^5l0@4Y+NmU>;DWM8TuYwSg5JCwMx)l*oih_tp69usV3YMXW z4G~0?K~Vt}bwC~>>Nq%x4K?pZ)>7VEYi8bh`^R42*=O&2_TBrOyUulSbEaC*34j1b zz;`JEpcH@_0QkVVT;KYnvgcXzHK(lt5NQesYo9rsBkO zUEAyCzJ&|dK3u&1=`x?sU(9+@t9(M^0k8%t{4Z`any-t4i?NZh2>=9F4-PjG76%}K zo61A%l;Dt13T_C%01vRh7yvpWCCSsz*o&4eT_rMo)chTjo z&-boD(t|&3KZAeT66*n=&LhPs`Du%)1fXL(05T7M+SCsLAeIY2`>iD}BrVu6F{!CZ zmWGBI85sr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PEVXwo!QRK&T}rNE*o6BT`{iiu6ta^ z+!WmyZjEkptIbz$THWhTaOeBESGhm+(DmSXba}#_t3CI6K3b!(hP$T23wXJC?e%)> zt>vBUeclJ_i zQy%k*L*rC&-o(1b9*q4E=M{G>jvpTs-cx=3tg?R({sZdgt{= zHlQ~!HuP*%*|>G%c3dybb%l&&wG+UvQuy^K;;Q1)(L#J+*@mE{Nb3-3?cKT+XP z(OIcpSyK6>DyC|r+M&9&MxiFZ=EDKzfjhN!wJiq~4;CK$e28=Cew|BQd%b3T`C;tg z^ux~@0vq~|P>(bol{;E^l>hY@_t?a7-{ZZF=8cU_3Qfh$aC2Jo?1``ww@*5r>}=6* zscV&PEj$HIrJZ_lI`Z`B8TT_iXQ^jfe$n`)rj68A&@cT>pXk=#o8CsFOyy_ zyvqAs;`f@@+OL24!|sp4x!}3!H@r9eKa1YVzCHGC<-4AF@A)V16W%X;DEKJ*@%Sg| zr~c1DpJx^_zTm!8eAW5d_09d;BYpz%*CDu#BR@^Z{Tb_LS6k9=M3K|ESu%F0o4HHM zz)XBI1c?kTk{+vi{pto{wt)PMp2 literal 0 HcmV?d00001 diff --git a/src/messenger/webim/js/164/common.js b/src/messenger/webim/js/164/common.js index 28fa54cb..c7b06467 100644 --- a/src/messenger/webim/js/164/common.js +++ b/src/messenger/webim/js/164/common.js @@ -9,7 +9,7 @@ var Class={create:function(){return function(){this.initialize.apply(this,argume 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= @@ -18,10 +18,10 @@ setTimeout(this.handleTimeout.bind(this),this._options.timeout)}this.setRequestH 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[];a=a.split(" ");for(var b=new 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=new Array(b)}else if(token.indexOf(".")>-1){d=token.split(".");e=d[0];d=d[1];e||(e="*");for(var l=[],j=0,m=0;m-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?'':'
'} function htmlescape(a){return a.replace("&","&").replace("<","<").replace(">",">").replace('"',""")}; diff --git a/src/messenger/webim/js/164/users.js b/src/messenger/webim/js/164/users.js index 52944c3c..abe867e8 100644 --- a/src/messenger/webim/js/164/users.js +++ b/src/messenger/webim/js/164/users.js @@ -9,18 +9,19 @@ 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,l,j){return'"+d+""},generateOneRowTable:function(a){return''+a+"
"},viewOpenCell:function(a,b,c,d,e,l,j,m){l= -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+="";l++}if(d){g+='';g+=HtmlGenerationUtils.popupLink(b+"&viewonly=true",localized[1],"ImCenter"+ -c,''+localized[1]+'',640,480,null);g+="";l++}if(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?"+ +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?"+ (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}, -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,l=false,j=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,l,j,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,l,j,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,l,j,m){if(e=CommonUtils.getCell(j,l,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]):"-")}}},updateContent:function(a){var b=false;if(a.tagName=="threads"){var 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"+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 '+ name; + } + div.innerHTML = names.join(', '); + }, + + updateContent: function(root) { + if( root.tagName == 'update' ) { for( var i = 0; i < root.childNodes.length; i++ ) { var node = root.childNodes[i]; - if( node.tagName == 'thread' ) - if( this.updateThread(node) ) - newAdded = true; - } - this.updateQueueMessages(); - this.updateTimers(); - this.setStatus(this._options.istatus ? "Away" : "Up to date"); - if( newAdded ) { - playSound(webimRoot+'/sounds/new_user.wav'); - window.focus(); - if(updaterOptions.showpopup) { - alert(localized[5]); + + if (node.tagName == 'threads') { + this.updateThreads(node); + } else if (node.tagName == 'operators') { + this.updateOperators(node); } } } else if( root.tagName == 'error' ) { diff --git a/src/messenger/webim/libs/common.php b/src/messenger/webim/libs/common.php index 5c9b3929..7d9961fc 100644 --- a/src/messenger/webim/libs/common.php +++ b/src/messenger/webim/libs/common.php @@ -582,6 +582,7 @@ $settings = array( 'surveyaskgroup' => '1', 'surveyaskmessage' => '0', 'enablepopupnotification' => '0', + 'showonlineoperators' => '0', 'enablecaptcha' => '0', 'online_timeout' => 30, /* Timeout (in seconds) when online operator becomes offline */ diff --git a/src/messenger/webim/libs/operator.php b/src/messenger/webim/libs/operator.php index 7ad85973..0bdeaa20 100644 --- a/src/messenger/webim/libs/operator.php +++ b/src/messenger/webim/libs/operator.php @@ -61,6 +61,31 @@ function operator_by_id($id) { return $operator; } +function operator_get_all() { + $link = connect(); + + $query = "select operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ". + "from chatoperator order by vclogin"; + $operators = select_multi_assoc($query, $link); + mysql_close($link); + return $operators; +} + +function operator_is_online($operator) { + global $settings; + return $operator['time'] < $settings['online_timeout']; +} + +function operator_is_available($operator) { + global $settings; + return $operator['istatus'] == 0 && $operator['time'] < $settings['online_timeout'] ? "1" : ""; +} + +function operator_is_away($operator) { + global $settings; + return $operator['istatus'] != 0 && $operator['time'] < $settings['online_timeout'] ? "1" : ""; +} + function update_operator($operatorid,$login,$email,$jabber,$password,$localename,$commonname,$notify) { $link = connect(); $query = sprintf( diff --git a/src/messenger/webim/locales/en/properties b/src/messenger/webim/locales/en/properties index 93ca2042..e87634fc 100644 --- a/src/messenger/webim/locales/en/properties +++ b/src/messenger/webim/locales/en/properties @@ -473,6 +473,8 @@ settings.popup_notification.description=Small dialog appears to attract your att settings.popup_notification=Enable "Popup dialog notification of the new visitor". settings.saved=Changes saved settings.sendmessagekey=Send messages with: +settings.show_online_operators.description=Can slow down the update rate of the list +settings.show_online_operators=Show online operators on "List of awaiting visitors" page settings.survey.askgroup.description=Show/hide department selection field in the survey settings.survey.askgroup=Allows visitor to choose department/group settings.survey.askmail.description=Show/hide email field in the survey diff --git a/src/messenger/webim/locales/ru/properties b/src/messenger/webim/locales/ru/properties index 768563d3..60ace934 100644 --- a/src/messenger/webim/locales/ru/properties +++ b/src/messenger/webim/locales/ru/properties @@ -463,6 +463,8 @@ settings.popup_notification.description= settings.popup_notification=Показывать небольшой диалог при появлении новых посетителей в очереди. settings.saved=Изменения сохранены settings.sendmessagekey=Посылать сообщение по: +settings.show_online_operators.description=Может замедлить обновление списка +settings.show_online_operators=Показывать доступных операторов на странице ожидающих посетителей settings.survey.askgroup.description=Показать/спрятать выбор группы в диалоге перед началом чата settings.survey.askgroup=Позволять посетителю выбирать группу операторов settings.survey.askmail.description=Показать/спрятать поле ввода адреса электронной почты diff --git a/src/messenger/webim/operator/features.php b/src/messenger/webim/operator/features.php index 5a358621..1893bd06 100644 --- a/src/messenger/webim/operator/features.php +++ b/src/messenger/webim/operator/features.php @@ -32,7 +32,7 @@ $options = array( 'enableban', 'usercanchangename', 'enablegroups', 'enablestatistics', 'enablejabber', 'enablessl', 'forcessl', 'enablepresurvey', 'surveyaskmail', 'surveyaskgroup', 'surveyaskmessage', - 'enablepopupnotification', + 'enablepopupnotification', 'showonlineoperators', 'enablecaptcha'); loadsettings(); diff --git a/src/messenger/webim/operator/operators.php b/src/messenger/webim/operator/operators.php index f18894d6..a4ea0b47 100644 --- a/src/messenger/webim/operator/operators.php +++ b/src/messenger/webim/operator/operators.php @@ -59,28 +59,8 @@ if( isset($_GET['act']) && $_GET['act'] == 'del' ) { } } -function is_online($operator) { - global $settings; - return $operator['istatus'] == 0 && $operator['time'] < $settings['online_timeout'] ? "1" : ""; -} - -function is_away($operator) { - global $settings; - return $operator['istatus'] != 0 && $operator['time'] < $settings['online_timeout'] ? "1" : ""; -} - -function get_operators() { - $link = connect(); - - $query = "select operatorid, vclogin, vclocalename, vccommonname, istatus, (unix_timestamp(CURRENT_TIMESTAMP)-unix_timestamp(dtmlastvisited)) as time ". - "from chatoperator order by vclogin"; - $operators = select_multi_assoc($query, $link); - mysql_close($link); - return $operators; -} - $page = array(); -$page['allowedAgents'] = get_operators(); +$page['allowedAgents'] = operator_get_all(); $page['canmodify'] = is_capable($can_administrate, $operator); setlocale(LC_TIME, getstring("time.locale")); diff --git a/src/messenger/webim/operator/update.php b/src/messenger/webim/operator/update.php index 7b1cc484..0803d9e3 100644 --- a/src/messenger/webim/operator/update.php +++ b/src/messenger/webim/operator/update.php @@ -141,7 +141,6 @@ function print_pending_threads($groupids,$since) { mysql_close($link); - start_xml_output(); echo ""; foreach( $output as $thr ) { print myiconv($webim_encoding,"utf-8",$thr); @@ -149,8 +148,26 @@ function print_pending_threads($groupids,$since) { echo ""; } +function print_operators() { + echo ""; + $operators = operator_get_all(); + $names = array(); + + foreach($operators as $operator) { + if (!operator_is_online($operator)) + continue; + + $name = htmlspecialchars(htmlspecialchars($operator['vclocalename'])); + $away = operator_is_away($operator) ? " away=\"1\"" : ""; + + echo ""; + } + echo ""; +} + $since = verifyparam( "since", "/^\d{1,9}$/", 0); $status = verifyparam( "status", "/^\d{1,2}$/", 0); +$showonline = verifyparam( "showonline", "/^1$/", 0); $link = connect(); loadsettings_($link); @@ -159,7 +176,14 @@ if(!isset($_SESSION['operatorgroups'])) { } mysql_close($link); $groupids = $_SESSION['operatorgroups']; + +start_xml_output(); +echo ''; +if($showonline) { + print_operators(); +} print_pending_threads($groupids,$since); +echo ''; notify_operator_alive($operator['operatorid'], $status); exit; diff --git a/src/messenger/webim/operator/users.php b/src/messenger/webim/operator/users.php index 3e42fa31..6b39bace 100644 --- a/src/messenger/webim/operator/users.php +++ b/src/messenger/webim/operator/users.php @@ -38,6 +38,7 @@ $page['havemenu'] = isset($_GET['nomenu']) ? "0" : "1"; $page['showpopup'] = $settings['enablepopupnotification'] == '1' ? "1" : "0"; $page['frequency'] = $settings['updatefrequency_operator']; $page['istatus'] = $status; +$page['showonline'] = $settings['showonlineoperators'] == '1' ? "1" : "0"; prepare_menu($operator); start_html_output(); diff --git a/src/messenger/webim/view/agents.php b/src/messenger/webim/view/agents.php index c5664692..8ccc206f 100644 --- a/src/messenger/webim/view/agents.php +++ b/src/messenger/webim/view/agents.php @@ -76,9 +76,9 @@ require_once('inc_errors.php'); / - + - + diff --git a/src/messenger/webim/view/features.php b/src/messenger/webim/view/features.php index 2f6f8867..4cfe7ce0 100644 --- a/src/messenger/webim/view/features.php +++ b/src/messenger/webim/view/features.php @@ -186,6 +186,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 ff5becb5..3c6a1c33 100644 --- a/src/messenger/webim/view/pending_users.php +++ b/src/messenger/webim/view/pending_users.php @@ -39,7 +39,7 @@ var localized = new Array( var updaterOptions = { url:"/operator/update.php",wroot:"", agentservl:"/operator/agent.php", frequency:, istatus:, - noclients:"", havemenu: , showpopup: }; + noclients:"", havemenu: , showpopup: , showonline: }; //-->
+ +
+
+ +