Move all controls to one cell at user waiting page

This commit is contained in:
Dmitriy Simushev 2013-01-10 19:02:14 +00:00
parent 72e58f0959
commit 2695ef98b6
5 changed files with 61 additions and 53 deletions

View File

@ -7,29 +7,29 @@
*/
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=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 c=Ajax.getXml(a);
c?(this._options.updateContent||Ajax.emptyFunction)(c):this._options.handleError&&this._options.handleError("reconnecting")}catch(b){}this.timer=setTimeout(this.update.bind(this),1E3*this.frequency)}});
var HtmlGenerationUtils={popupLink:function(a,c,b,d,g,h,i){return'<a href="'+a+'"'+(null!=i?' class="'+i+'"':"")+' target="_blank" title="'+c+'" onclick="this.newWindow = window.open(\''+a+"', '"+b+"', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width="+g+",height="+h+",resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;\">"+d+"</a>"},generateOneRowTable:function(a){return'<table class="inner"><tr>'+a+"</tr></table>"},viewOpenCell:function(a,c,b,d,g,h,i,l,k,n){var h=
2,c=c+"?thread="+b,e="<td>",e=g||d?e+HtmlGenerationUtils.popupLink(l||!d?c:c+"&viewonly=true",localized[g?0:1],"ImCenter"+b,a,640,480,null):e+('<a href="#">'+a+"</a>"),e=e+"</td>";g&&(e=e+'<td class="icon">'+HtmlGenerationUtils.popupLink(c,localized[0],"ImCenter"+b,'<img src="'+webimRoot+'/images/tbliclspeak.gif" width="15" height="15" border="0" alt="'+localized[0]+'">',640,480,null),e+="</td>",h++);d&&(e=e+'<td class="icon">'+HtmlGenerationUtils.popupLink(c+"&viewonly=true",localized[1],"ImCenter"+
b,'<img src="'+webimRoot+'/images/tbliclread.gif" width="15" height="15" border="0" alt="'+localized[1]+'">',640,480,null),e+="</td>",h++);k&&(e=e+'<td class="icon">'+HtmlGenerationUtils.popupLink(n+"?thread="+b,localized[6],"ImTracked"+b,'<img src="'+webimRoot+'/images/tblictrack.gif" width="15" height="15" border="0" alt="'+localized[6]+'">',640,480,null),e+="</td>",h++);""!=i&&(e=e+('</tr><tr><td class="firstmessage" colspan="'+h+'"><a href="javascript:void(0)" title="'+i+'" onclick="alert(this.title);return false;">')+
(30<i.length?i.substring(0,30)+"...":i),e+="</a></td>");return HtmlGenerationUtils.generateOneRowTable(e)},banCell:function(a,c){return'<td class="icon">'+HtmlGenerationUtils.popupLink(webimRoot+"/operator/ban.php?"+(c?"id="+c:"thread="+a),localized[2],"ban"+a,'<img src="'+webimRoot+'/images/ban.gif" width="15" height="15" border="0" alt="'+localized[2]+'">',720,480,null)+"</td>"},viewVisOpenCell:function(a,c,b,d,g){var h="<td>",h=g?h+HtmlGenerationUtils.popupLink(c+"?visitor="+b,localized[7],"ImCenter"+
b,a,640,480,null):h+('<a href="#">'+a+"</a>"),h=h+'</td><td class="icon">',a=HtmlGenerationUtils.popupLink(d+"?visitor="+b,localized[6],"ImTracked"+b,'<img src="'+webimRoot+'/images/tblictrack.gif" width="15" height="15" border="0" alt="'+localized[6]+'">',640,480,null),a=a.replace("scrollbars=0","scrollbars=1");return HtmlGenerationUtils.generateOneRowTable(h+a+"</td>")}};Ajax.ThreadListUpdater=Class.create();
1E3)},handleTimeout:function(){this._options.handleError&&this._options.handleError("timeout, reconnecting");this.stopUpdate();this.timer=setTimeout(this.update.bind(this),1E3)},stopUpdate:function(){this.updater._options&&(this.updater._options.onComplete=void 0);clearTimeout(this.timer)},update:function(){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),1E3*this.frequency)}});
var HtmlGenerationUtils={popupLink:function(a,b,c,d,h,f,e){return'<a href="'+a+'"'+(null!=e?' class="'+e+'"':"")+' target="_blank" title="'+b+'" onclick="this.newWindow = window.open(\''+a+"', '"+c+"', 'toolbar=0,scrollbars=0,location=0,status=1,menubar=0,width="+h+",height="+f+",resizable=1');this.newWindow.focus();this.newWindow.opener=window;return false;\">"+d+"</a>"},generateOneRowTable:function(a){return'<table class="inner"><tr>'+a+"</tr></table>"},viewOpenCell:function(a,b,c,d,h,f,e,m){b=
b+"?thread="+c;f="<td>";f=h||d?f+HtmlGenerationUtils.popupLink(m||!d?b:b+"&viewonly=true",localized[h?0:1],"ImCenter"+c,a,640,480,null):f+('<a href="#">'+a+"</a>");f+="</td>";""!=e&&(f=f+('</tr><tr><td class="firstmessage" colspan="2"><a href="javascript:void(0)" title="'+e+'" onclick="alert(this.title);return false;">')+(30<e.length?e.substring(0,30)+"...":e),f+="</a></td>");return HtmlGenerationUtils.generateOneRowTable(f)},viewActionsCell:function(a,b,c,d,h,f){a=a+"?thread="+b;var e="";d&&(e=e+
'<td class="icon">'+HtmlGenerationUtils.popupLink(a,localized[0],"ImCenter"+b,'<img src="'+webimRoot+'/images/tbliclspeak.gif" width="15" height="15" border="0" alt="'+localized[0]+'">',640,480,null),e+="</td>");c&&(e+='<td class="icon">',e+=HtmlGenerationUtils.popupLink(a+"&viewonly=true",localized[1],"ImCenter"+b,'<img src="'+webimRoot+'/images/tbliclread.gif" width="15" height="15" border="0" alt="'+localized[1]+'">',640,480,null),e+="</td>");h&&(e+='<td class="icon">',e+=HtmlGenerationUtils.popupLink(f+
"?thread="+b,localized[6],"ImTracked"+b,'<img src="'+webimRoot+'/images/tblictrack.gif" width="15" height="15" border="0" alt="'+localized[6]+'">',640,480,null),e+="</td>");return e},banCell:function(a,b){return'<td class="icon">'+HtmlGenerationUtils.popupLink(webimRoot+"/operator/ban.php?"+(b?"id="+b:"thread="+a),localized[2],"ban"+a,'<img src="'+webimRoot+'/images/ban.gif" width="15" height="15" border="0" alt="'+localized[2]+'">',720,480,null)+"</td>"},viewVisOpenCell:function(a,b,c,d,h){var f=
"<td>",f=h?f+HtmlGenerationUtils.popupLink(b+"?visitor="+c,localized[7],"ImCenter"+c,a,640,480,null):f+('<a href="#">'+a+"</a>"),f=f+'</td><td class="icon">';a=HtmlGenerationUtils.popupLink(d+"?visitor="+c,localized[6],"ImTracked"+c,'<img src="'+webimRoot+'/images/tblictrack.gif" width="15" height="15" border="0" alt="'+localized[6]+'">',640,480,null);a=a.replace("scrollbars=0","scrollbars=1");f+=a;f+="</td>";return HtmlGenerationUtils.generateOneRowTable(f)}};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.t2=this._options.visitors_table;this.periodicalUpdater=new Ajax.PeriodicalUpdater(this._options);this.old_visitors={};this.visitors={};this.visitorTimers=
{}},updateParams:function(){return"since="+this._options.lastrevision+"&status="+this._options.istatus+(this._options.showonline?"&showonline=1":"")+(this._options.showvisitors?"&showvisitors=1":"")},setStatus:function(a){this._options.status.innerHTML=a},handleError:function(a){this.setStatus(a)},updateThread:function(a){function c(a,d,b,c){if(a=CommonUtils.getCell(b,d,a))a.innerHTML=c}for(var b,d,g,h=!1,i=!1,l=!1,k=null,n=null,e=0;e<a.attributes.length;e++){var f=a.attributes[e];if("id"==f.nodeName)b=
f.nodeValue;else if("stateid"==f.nodeName)d=f.nodeValue;else if("state"==f.nodeName)g=f.nodeValue;else if("canopen"==f.nodeName)i=!0;else if("canview"==f.nodeName)h=!0;else if("canban"==f.nodeName)l=!0;else if("ban"==f.nodeName)k=f.nodeValue;else if("banid"==f.nodeName)n=f.nodeValue}e=CommonUtils.getRow("thr"+b,this.t);if("closed"==d)e&&this.t.deleteRow(e.rowIndex),this.threadTimers[b]=null;else{var f=NodeUtils.getNodeValue(a,"name"),m=NodeUtils.getNodeValue(a,"addr"),j=NodeUtils.getNodeValue(a,"time"),
q=NodeUtils.getNodeValue(a,"agent"),p=NodeUtils.getNodeValue(a,"modified"),r=NodeUtils.getNodeValue(a,"message"),o="<td>"+NodeUtils.getNodeValue(a,"useragent")+"</td>";null!=k&&(o="<td>"+NodeUtils.getNodeValue(a,"reason")+"</td>");l&&(o+=HtmlGenerationUtils.banCell(b,n));o=HtmlGenerationUtils.generateOneRowTable(o);a=CommonUtils.getRow("t"+d,this.t);l=CommonUtils.getRow("t"+d+"end",this.t);if(null!=e&&(e.rowIndex<=a.rowIndex||e.rowIndex>=l.rowIndex))this.t.deleteRow(e.rowIndex),e=this.threadTimers[b]=
null;if(null==e){if(e=this.t.insertRow(a.rowIndex+1),e.className="blocked"==k&&"chat"!=d?"ban":"in"+d,e.id="thr"+b,this.threadTimers[b]=[j,p,d],CommonUtils.insertCell(e,"name","visitor",null,null,HtmlGenerationUtils.viewOpenCell(f,this._options.agentservl,b,h,i,k,r,"chat"!=d,this._options.showvisitors,this._options.trackedservl)),CommonUtils.insertCell(e,"contid","visitor","center",null,m),CommonUtils.insertCell(e,"state","visitor","center",null,g),CommonUtils.insertCell(e,"op","visitor","center",
null,q),CommonUtils.insertCell(e,"time","visitor","center",null,this.getTimeSince(j)),CommonUtils.insertCell(e,"wait","visitor","center",null,"chat"!=d?this.getTimeSince(p):"-"),CommonUtils.insertCell(e,"etc","visitor","center",null,o),"wait"==d||"prio"==d)return!0}else this.threadTimers[b]=[j,p,d],e.className="blocked"==k&&"chat"!=d?"ban":"in"+d,c(this.t,e,"name",HtmlGenerationUtils.viewOpenCell(f,this._options.agentservl,b,h,i,k,r,"chat"!=d,this._options.showvisitors,this._options.trackedservl)),
c(this.t,e,"contid",m),c(this.t,e,"state",g),c(this.t,e,"op",q),c(this.t,e,"time",this.getTimeSince(j)),c(this.t,e,"wait","chat"!=d?this.getTimeSince(p):"-"),c(this.t,e,"etc",o);return!1}},updateQueueMessages:function(){function a(a,b){var c=$(b),i=$(b+"end");return null==c||null==i?!1:c.rowIndex+1<i.rowIndex}var c=$("statustd");if(c){var b=a(this.t,"twait")||a(this.t,"tprio")||a(this.t,"tchat");c.innerHTML=b?"":this._options.noclients;c.height=b?5:30}},getTimeSince:function(a){var a=Math.floor(((new Date).getTime()-
a-this.delta)/1E3),c=Math.floor(a/60),b="",a=a%60;10>a&&(a="0"+a);60<=c&&(b=Math.floor(c/60),c%=60,10>c&&(c="0"+c),b+=":");return b+c+":"+a},updateTimers:function(){for(var a in this.threadTimers)if(null!=this.threadTimers[a]){var c=this.threadTimers[a],b=CommonUtils.getRow("thr"+a,this.t);if(null!=b){var d=this.getTimeSince(c[0]),g=CommonUtils.getCell("time",b,this.t);if(g)g.innerHTML=d;c="chat"!=c[2]?this.getTimeSince(c[1]):"-";if(b=CommonUtils.getCell("wait",b,this.t))b.innerHTML=c}}},updateThreads:function(a){var c=
!1,b=NodeUtils.getAttrValue(a,"time"),d=NodeUtils.getAttrValue(a,"revision");if(b)this.delta=(new Date).getTime()-b;if(d)this._options.lastrevision=d;for(b=0;b<a.childNodes.length;b++)d=a.childNodes[b],"thread"==d.tagName&&this.updateThread(d)&&(c=!0);this.updateQueueMessages();this.updateTimers();this.setStatus(this._options.istatus?localized[8]:localized[9]);c&&(playSound(webimRoot+"/sounds/new_user.wav"),window.focus(),updaterOptions.showpopup&&alert(localized[5]))},updateOperators:function(a){var c=
$("onlineoperators");if(c){for(var b=[],d=0;d<a.childNodes.length;d++){var g=a.childNodes[d];if("operator"==g.tagName){var h=NodeUtils.getAttrValue(g,"name"),g=null!=NodeUtils.getAttrValue(g,"away");b[b.length]='<img src="'+webimRoot+"/images/op"+(g?"away":"online")+'.gif" width="12" height="12" border="0" alt="'+localized[1]+'"> '+h}}c.innerHTML=b.join(", ")}},updateVisitorsTimers:function(){for(var a in this.visitorTimers)if(null!=this.visitorTimers[a]){var c=this.visitorTimers[a],b=CommonUtils.getRow("vis"+
a,this.t2);if(null!=b){var d=function(a,b,c,d){if(a=CommonUtils.getCell(c,b,a))a.innerHTML=d};d(this.t2,b,"time",this.getTimeSince(c[0]));d(this.t2,b,"modified",this.getTimeSince(c[1]));null!=c[2]&&d(this.t2,b,"invitationtime",this.getTimeSince(c[2]))}}},updateVisitor:function(a){function c(a,b,c,d){if(a=CommonUtils.getCell(c,b,a))a.innerHTML=d}for(var b,d=0;d<a.attributes.length;d++){var g=a.attributes[d];if("id"==g.nodeName)b=g.nodeValue}for(var g=NodeUtils.getNodeValue(a,"addr"),h=NodeUtils.getNodeValue(a,
"username"),i=NodeUtils.getNodeValue(a,"useragent"),l=NodeUtils.getNodeValue(a,"time"),k=NodeUtils.getNodeValue(a,"modified"),n=NodeUtils.getNodeValue(a,"invitations"),e=NodeUtils.getNodeValue(a,"chats"),f=null,m=null,a=a.getElementsByTagName("invitation")[0],d=0;d<a.childNodes.length;d++){var j=a.childNodes[d];if("operator"==j.tagName)f=j.firstChild.nodeValue;else if("invitationtime"==j.tagName)m=j.firstChild.nodeValue}j=null==f?"free":"invited";d=CommonUtils.getRow("vis"+b,this.t2);a=CommonUtils.getRow("vis"+
j,this.t2);j=CommonUtils.getRow("vis"+j+"end",this.t2);if(null!=d&&(d.rowIndex<=a.rowIndex||d.rowIndex>=j.rowIndex))this.t2.deleteRow(d.rowIndex),d=this.visitorTimers[b]=null;null==d?(d=this.t2.insertRow(a.rowIndex+1),d.id="vis"+b,this.visitorTimers[b]=[l,k,m],CommonUtils.insertCell(d,"username","visitor",null,null,HtmlGenerationUtils.viewVisOpenCell(h,this._options.inviteservl,b,this._options.trackedservl,null==f)),CommonUtils.insertCell(d,"addr","visitor","center",null,g),CommonUtils.insertCell(d,
"time","visitor","center",null,this.getTimeSince(l)),CommonUtils.insertCell(d,"modified","visitor","center",null,this.getTimeSince(k)),CommonUtils.insertCell(d,"operator","visitor","center",null,null!=f?f:"-"),CommonUtils.insertCell(d,"invitationtime","visitor","center",null,null!=f?this.getTimeSince(m):"-"),CommonUtils.insertCell(d,"invitations","visitor","center",null,n+" / "+e),CommonUtils.insertCell(d,"useragent","visitor","center",null,i)):(this.visitorTimers[b]=[l,k,m],c(this.t2,d,"username",
HtmlGenerationUtils.viewVisOpenCell(h,this._options.inviteservl,b,this._options.trackedservl,null==f)),c(this.t2,d,"addr",g),c(this.t2,d,"operator",null!=f?f:"-"),c(this.t2,d,"time",this.getTimeSince(l)),c(this.t2,d,"modified",this.getTimeSince(k)),c(this.t2,d,"invitationtime",null!=f?this.getTimeSince(m):"-"),c(this.t2,d,"invitations",n+" / "+e),c(this.t2,d,"useragent",i));this.visitors[b]=1;return!1},removeOldVisitors:function(){for(id in this.old_visitors)if(void 0===this.visitors[id]){var a=CommonUtils.getRow("vis"+
id,this.t2);a&&this.t2.deleteRow(a.rowIndex);this.visitorTimers[id]=null}},updateVisitorsList:function(a){var c=$("visstatustd");if(c)c.innerHTML=0<a?"":this._options.novisitors,c.height=0<a?5:30},updateVisitors:function(a){this.old_visitors=this.visitors;this.visitors={};for(var c=0,b=0;b<a.childNodes.length;b++){var d=a.childNodes[b];"visitor"==d.tagName&&(c++,this.updateVisitor(d))}this.updateVisitorsTimers();this.removeOldVisitors();this.updateVisitorsList(c)},updateContent:function(a){if("update"==
a.tagName)for(var c=0;c<a.childNodes.length;c++){var b=a.childNodes[c];"threads"==b.tagName?this.updateThreads(b):"operators"==b.tagName?this.updateOperators(b):"visitors"==b.tagName&&this.updateVisitors(b)}else"error"==a.tagName?this.setStatus(NodeUtils.getNodeValue(a,"descr")):this.setStatus("reconnecting")}});
function togglemenu(){if($("sidebar")&&$("wcontent")&&$("togglemenu"))"contentnomenu"==$("wcontent").className?($("sidebar").style.display="block",$("wcontent").className="contentinner",$("togglemenu").innerHTML=localized[4]):($("sidebar").style.display="none",$("wcontent").className="contentnomenu",$("togglemenu").innerHTML=localized[3])}var webimRoot="";Behaviour.register({"#togglemenu":function(a){a.onclick=function(){togglemenu()}}});
EventHelper.register(window,"onload",function(){webimRoot=updaterOptions.wroot;new Ajax.ThreadListUpdater({table:$("threadlist"),status:$("connstatus"),istatus:0,visitors_table:$("visitorslist")}.extend(updaterOptions||{}));updaterOptions.havemenu||togglemenu()});
{}},updateParams:function(){return"since="+this._options.lastrevision+"&status="+this._options.istatus+(this._options.showonline?"&showonline=1":"")+(this._options.showvisitors?"&showvisitors=1":"")},setStatus:function(a){this._options.status.innerHTML=a},handleError:function(a){this.setStatus(a)},updateThread:function(a){function b(a,b,d,c){if(a=CommonUtils.getCell(d,b,a))a.innerHTML=c}for(var c,d,h,f=!1,e=!1,m=!1,n=null,p=null,g=0;g<a.attributes.length;g++){var j=a.attributes[g];"id"==j.nodeName?
c=j.nodeValue:"stateid"==j.nodeName?d=j.nodeValue:"state"==j.nodeName?h=j.nodeValue:"canopen"==j.nodeName?e=!0:"canview"==j.nodeName?f=!0:"canban"==j.nodeName?m=!0:"ban"==j.nodeName?n=j.nodeValue:"banid"==j.nodeName&&(p=j.nodeValue)}g=CommonUtils.getRow("thr"+c,this.t);if("closed"==d)g&&this.t.deleteRow(g.rowIndex),this.threadTimers[c]=null;else{var j=NodeUtils.getNodeValue(a,"name"),k=HtmlGenerationUtils.viewActionsCell(this._options.agentservl,c,f,e,this._options.showvisitors,this._options.trackedservl),
l=NodeUtils.getNodeValue(a,"addr"),r=NodeUtils.getNodeValue(a,"time"),t=NodeUtils.getNodeValue(a,"agent"),s=NodeUtils.getNodeValue(a,"modified"),u=NodeUtils.getNodeValue(a,"message"),q="<td>"+NodeUtils.getNodeValue(a,"useragent")+"</td>";null!=n&&(q="<td>"+NodeUtils.getNodeValue(a,"reason")+"</td>");m&&(k+=HtmlGenerationUtils.banCell(c,p));k=HtmlGenerationUtils.generateOneRowTable(k);q=HtmlGenerationUtils.generateOneRowTable(q);a=CommonUtils.getRow("t"+d,this.t);m=CommonUtils.getRow("t"+d+"end",this.t);
if(null!=g&&(g.rowIndex<=a.rowIndex||g.rowIndex>=m.rowIndex))this.t.deleteRow(g.rowIndex),g=this.threadTimers[c]=null;if(null==g){if(g=this.t.insertRow(a.rowIndex+1),g.className="blocked"==n&&"chat"!=d?"ban":"in"+d,g.id="thr"+c,this.threadTimers[c]=[r,s,d],CommonUtils.insertCell(g,"name","visitor",null,null,HtmlGenerationUtils.viewOpenCell(j,this._options.agentservl,c,f,e,n,u,"chat"!=d,this._options.showvisitors,this._options.trackedservl)),CommonUtils.insertCell(g,"actions","visitor","center",null,
k),CommonUtils.insertCell(g,"contid","visitor","center",null,l),CommonUtils.insertCell(g,"state","visitor","center",null,h),CommonUtils.insertCell(g,"op","visitor","center",null,t),CommonUtils.insertCell(g,"time","visitor","center",null,this.getTimeSince(r)),CommonUtils.insertCell(g,"wait","visitor","center",null,"chat"!=d?this.getTimeSince(s):"-"),CommonUtils.insertCell(g,"etc","visitor","center",null,q),"wait"==d||"prio"==d)return!0}else this.threadTimers[c]=[r,s,d],g.className="blocked"==n&&"chat"!=
d?"ban":"in"+d,b(this.t,g,"name",HtmlGenerationUtils.viewOpenCell(j,this._options.agentservl,c,f,e,n,u,"chat"!=d,this._options.showvisitors,this._options.trackedservl)),b(this.t,g,"actions",k),b(this.t,g,"contid",l),b(this.t,g,"state",h),b(this.t,g,"op",t),b(this.t,g,"time",this.getTimeSince(r)),b(this.t,g,"wait","chat"!=d?this.getTimeSince(s):"-"),b(this.t,g,"etc",q);return!1}},updateQueueMessages:function(){function a(a,b){var c=$(b),e=$(b+"end");return null==c||null==e?!1:c.rowIndex+1<e.rowIndex}
var b=$("statustd");if(b){var c=a(this.t,"twait")||a(this.t,"tprio")||a(this.t,"tchat");b.innerHTML=c?"":this._options.noclients;b.height=c?5:30}},getTimeSince:function(a){a=Math.floor(((new Date).getTime()-a-this.delta)/1E3);var b=Math.floor(a/60),c="";a%=60;10>a&&(a="0"+a);60<=b&&(c=Math.floor(b/60),b%=60,10>b&&(b="0"+b),c+=":");return c+b+":"+a},updateTimers:function(){for(var a in this.threadTimers)if(null!=this.threadTimers[a]){var b=this.threadTimers[a],c=CommonUtils.getRow("thr"+a,this.t);
if(null!=c){var d=this.getTimeSince(b[0]),h=CommonUtils.getCell("time",c,this.t);h&&(h.innerHTML=d);b="chat"!=b[2]?this.getTimeSince(b[1]):"-";if(c=CommonUtils.getCell("wait",c,this.t))c.innerHTML=b}}},updateThreads:function(a){var b=!1,c=NodeUtils.getAttrValue(a,"time"),d=NodeUtils.getAttrValue(a,"revision");c&&(this.delta=(new Date).getTime()-c);d&&(this._options.lastrevision=d);for(c=0;c<a.childNodes.length;c++)d=a.childNodes[c],"thread"==d.tagName&&this.updateThread(d)&&(b=!0);this.updateQueueMessages();
this.updateTimers();this.setStatus(this._options.istatus?localized[8]:localized[9]);b&&(playSound(webimRoot+"/sounds/new_user.wav"),window.focus(),updaterOptions.showpopup&&alert(localized[5]))},updateOperators:function(a){var b=$("onlineoperators");if(b){for(var c=[],d=0;d<a.childNodes.length;d++){var h=a.childNodes[d];if("operator"==h.tagName){var f=NodeUtils.getAttrValue(h,"name"),h=null!=NodeUtils.getAttrValue(h,"away");c[c.length]='<img src="'+webimRoot+"/images/op"+(h?"away":"online")+'.gif" width="12" height="12" border="0" alt="'+
localized[1]+'"> '+f}}b.innerHTML=c.join(", ")}},updateVisitorsTimers:function(){for(var a in this.visitorTimers)if(null!=this.visitorTimers[a]){var b=this.visitorTimers[a],c=CommonUtils.getRow("vis"+a,this.t2);if(null!=c){var d=function(a,b,c,d){if(a=CommonUtils.getCell(c,b,a))a.innerHTML=d};d(this.t2,c,"time",this.getTimeSince(b[0]));d(this.t2,c,"modified",this.getTimeSince(b[1]));null!=b[2]&&d(this.t2,c,"invitationtime",this.getTimeSince(b[2]))}}},updateVisitor:function(a){function b(a,b,c,d){if(a=
CommonUtils.getCell(c,b,a))a.innerHTML=d}for(var c,d=0;d<a.attributes.length;d++){var h=a.attributes[d];"id"==h.nodeName&&(c=h.nodeValue)}var h=NodeUtils.getNodeValue(a,"addr"),f=NodeUtils.getNodeValue(a,"username"),e=NodeUtils.getNodeValue(a,"useragent"),m=NodeUtils.getNodeValue(a,"time"),n=NodeUtils.getNodeValue(a,"modified"),p=NodeUtils.getNodeValue(a,"invitations"),g=NodeUtils.getNodeValue(a,"chats"),j=null,k=null;a=a.getElementsByTagName("invitation")[0];for(d=0;d<a.childNodes.length;d++){var l=
a.childNodes[d];"operator"==l.tagName?j=l.firstChild.nodeValue:"invitationtime"==l.tagName&&(k=l.firstChild.nodeValue)}l=null==j?"free":"invited";d=CommonUtils.getRow("vis"+c,this.t2);a=CommonUtils.getRow("vis"+l,this.t2);l=CommonUtils.getRow("vis"+l+"end",this.t2);if(null!=d&&(d.rowIndex<=a.rowIndex||d.rowIndex>=l.rowIndex))this.t2.deleteRow(d.rowIndex),d=this.visitorTimers[c]=null;null==d?(d=this.t2.insertRow(a.rowIndex+1),d.id="vis"+c,this.visitorTimers[c]=[m,n,k],CommonUtils.insertCell(d,"username",
"visitor",null,null,HtmlGenerationUtils.viewVisOpenCell(f,this._options.inviteservl,c,this._options.trackedservl,null==j)),CommonUtils.insertCell(d,"addr","visitor","center",null,h),CommonUtils.insertCell(d,"time","visitor","center",null,this.getTimeSince(m)),CommonUtils.insertCell(d,"modified","visitor","center",null,this.getTimeSince(n)),CommonUtils.insertCell(d,"operator","visitor","center",null,null!=j?j:"-"),CommonUtils.insertCell(d,"invitationtime","visitor","center",null,null!=j?this.getTimeSince(k):
"-"),CommonUtils.insertCell(d,"invitations","visitor","center",null,p+" / "+g),CommonUtils.insertCell(d,"useragent","visitor","center",null,e)):(this.visitorTimers[c]=[m,n,k],b(this.t2,d,"username",HtmlGenerationUtils.viewVisOpenCell(f,this._options.inviteservl,c,this._options.trackedservl,null==j)),b(this.t2,d,"addr",h),b(this.t2,d,"operator",null!=j?j:"-"),b(this.t2,d,"time",this.getTimeSince(m)),b(this.t2,d,"modified",this.getTimeSince(n)),b(this.t2,d,"invitationtime",null!=j?this.getTimeSince(k):
"-"),b(this.t2,d,"invitations",p+" / "+g),b(this.t2,d,"useragent",e));this.visitors[c]=1;return!1},removeOldVisitors:function(){for(id in this.old_visitors)if(void 0===this.visitors[id]){var a=CommonUtils.getRow("vis"+id,this.t2);a&&this.t2.deleteRow(a.rowIndex);this.visitorTimers[id]=null}},updateVisitorsList:function(a){var b=$("visstatustd");b&&(b.innerHTML=0<a?"":this._options.novisitors,b.height=0<a?5:30)},updateVisitors:function(a){this.old_visitors=this.visitors;this.visitors={};for(var b=
0,c=0;c<a.childNodes.length;c++){var d=a.childNodes[c];"visitor"==d.tagName&&(b++,this.updateVisitor(d))}this.updateVisitorsTimers();this.removeOldVisitors();this.updateVisitorsList(b)},updateContent:function(a){if("update"==a.tagName)for(var b=0;b<a.childNodes.length;b++){var c=a.childNodes[b];"threads"==c.tagName?this.updateThreads(c):"operators"==c.tagName?this.updateOperators(c):"visitors"==c.tagName&&this.updateVisitors(c)}else"error"==a.tagName?this.setStatus(NodeUtils.getNodeValue(a,"descr")):
this.setStatus("reconnecting")}});function togglemenu(){$("sidebar")&&($("wcontent")&&$("togglemenu"))&&("contentnomenu"==$("wcontent").className?($("sidebar").style.display="block",$("wcontent").className="contentinner",$("togglemenu").innerHTML=localized[4]):($("sidebar").style.display="none",$("wcontent").className="contentnomenu",$("togglemenu").innerHTML=localized[3]))}var webimRoot="";Behaviour.register({"#togglemenu":function(a){a.onclick=function(){togglemenu()}}});
EventHelper.register(window,"onload",function(){webimRoot=updaterOptions.wroot;new Ajax.ThreadListUpdater({table:$("threadlist"),status:$("connstatus"),istatus:0,visitors_table:$("visitorslist")}.extend(updaterOptions||{}));updaterOptions.havemenu||togglemenu()});

View File

@ -74,7 +74,6 @@ var HtmlGenerationUtils = {
},
viewOpenCell: function(username,servlet,id,canview,canopen,ban,message,cantakenow,tracked,trackedlink) {
var cellsCount = 2;
var link = servlet+"?thread="+id;
var gen = '<td>';
if(canopen || canview ) {
@ -83,32 +82,34 @@ var HtmlGenerationUtils = {
gen += '<a href="#">' + username + '</a>';
}
gen += '</td>';
if( canopen ) {
gen += '<td class="icon">';
gen += HtmlGenerationUtils.popupLink( link, localized[0], "ImCenter"+id, '<img src="'+webimRoot+'/images/tbliclspeak.gif" width="15" height="15" border="0" alt="'+localized[0]+'">', 640, 480, null);
gen += '</td>';
cellsCount++;
}
if( canview ) {
gen += '<td class="icon">';
gen += HtmlGenerationUtils.popupLink( link+"&viewonly=true", localized[1], "ImCenter"+id, '<img src="'+webimRoot+'/images/tbliclread.gif" width="15" height="15" border="0" alt="'+localized[1]+'">', 640, 480, null);
gen += '</td>';
cellsCount++;
}
if ( tracked ) {
gen += '<td class="icon">';
gen += HtmlGenerationUtils.popupLink( trackedlink+"?thread="+id, localized[6], "ImTracked"+id, '<img src="'+webimRoot+'/images/tblictrack.gif" width="15" height="15" border="0" alt="'+localized[6]+'">', 640, 480, null);
gen += '</td>';
cellsCount++;
}
if( message != "" ) {
gen += '</tr><tr><td class="firstmessage" colspan="'+cellsCount+'"><a href="javascript:void(0)" title="'+message+'" onclick="alert(this.title);return false;">';
gen += '</tr><tr><td class="firstmessage" colspan="2"><a href="javascript:void(0)" title="'+message+'" onclick="alert(this.title);return false;">';
gen += message.length > 30 ? message.substring(0,30) + '...' : message;
gen += '</a></td>';
}
return HtmlGenerationUtils.generateOneRowTable(gen);
},
viewActionsCell: function(servlet,id,canview,canopen,tracked,trackedlink) {
var link = servlet+"?thread="+id;
var gen = '';
if( canopen ) {
gen += '<td class="icon">';
gen += HtmlGenerationUtils.popupLink( link, localized[0], "ImCenter"+id, '<img src="'+webimRoot+'/images/tbliclspeak.gif" width="15" height="15" border="0" alt="'+localized[0]+'">', 640, 480, null);
gen += '</td>';
}
if( canview ) {
gen += '<td class="icon">';
gen += HtmlGenerationUtils.popupLink( link+"&viewonly=true", localized[1], "ImCenter"+id, '<img src="'+webimRoot+'/images/tbliclread.gif" width="15" height="15" border="0" alt="'+localized[1]+'">', 640, 480, null);
gen += '</td>';
}
if ( tracked ) {
gen += '<td class="icon">';
gen += HtmlGenerationUtils.popupLink( trackedlink+"?thread="+id, localized[6], "ImTracked"+id, '<img src="'+webimRoot+'/images/tblictrack.gif" width="15" height="15" border="0" alt="'+localized[6]+'">', 640, 480, null);
gen += '</td>';
}
return gen;
},
banCell: function(id,banid){
return '<td class="icon">'+
HtmlGenerationUtils.popupLink( webimRoot+'/operator/ban.php?'+(banid ? 'id='+banid : 'thread='+id), localized[2], "ban"+id, '<img src="'+webimRoot+'/images/ban.gif" width="15" height="15" border="0" alt="'+localized[2]+'">', 720, 480, null)+
@ -202,6 +203,7 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
}
var vname = NodeUtils.getNodeValue(node,"name");
var actions = HtmlGenerationUtils.viewActionsCell(this._options.agentservl,id,canview,canopen,this._options.showvisitors, this._options.trackedservl);
var vaddr = NodeUtils.getNodeValue(node,"addr");
var vtime = NodeUtils.getNodeValue(node,"time");
var agent = NodeUtils.getNodeValue(node,"agent");
@ -214,8 +216,9 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
}
if(canban) {
etc += HtmlGenerationUtils.banCell(id,banid);
actions += HtmlGenerationUtils.banCell(id,banid);
}
actions = HtmlGenerationUtils.generateOneRowTable(actions);
etc = HtmlGenerationUtils.generateOneRowTable(etc);
var startRow = CommonUtils.getRow("t"+stateid, this.t);
@ -232,6 +235,7 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
row.id = "thr"+id;
this.threadTimers[id] = new Array(vtime,modified,stateid);
CommonUtils.insertCell(row, "name", "visitor", null, null, HtmlGenerationUtils.viewOpenCell(vname,this._options.agentservl,id,canview,canopen,ban,message,stateid!='chat',this._options.showvisitors, this._options.trackedservl));
CommonUtils.insertCell(row, "actions", "visitor", "center", null, actions);
CommonUtils.insertCell(row, "contid", "visitor", "center", null, vaddr );
CommonUtils.insertCell(row, "state", "visitor", "center", null, vstate );
CommonUtils.insertCell(row, "op", "visitor", "center", null, agent );
@ -245,6 +249,7 @@ Class.inherit( Ajax.ThreadListUpdater, Ajax.Base, {
this.threadTimers[id] = new Array(vtime,modified,stateid);
row.className = (ban == "blocked" && stateid != "chat") ? "ban" : "in"+stateid;
setcell(this.t, row,"name",HtmlGenerationUtils.viewOpenCell(vname,this._options.agentservl,id,canview,canopen,ban,message,stateid!='chat',this._options.showvisitors, this._options.trackedservl));
setcell(this.t, row, "actions", actions);
setcell(this.t, row,"contid",vaddr);
setcell(this.t, row,"state",vstate);
setcell(this.t, row,"op",agent);

View File

@ -416,6 +416,7 @@ pending.status.online=Up to date
pending.status.setaway=Set status as "Away"
pending.status.setonline=Set status as "Available"
pending.table.ban=Ban this visitor
pending.table.head.actions=Actions
pending.table.head.contactid=Visitor's address
pending.table.head.etc=Misc
pending.table.head.name=Name

View File

@ -416,6 +416,7 @@ pending.status.online=
pending.status.setaway=Выставить статус "Отошел"
pending.status.setonline=Выставить статус "Доступен"
pending.table.ban=Пометить посетителя как нежелательного
pending.table.head.actions=Äåéñòâèÿ
pending.table.head.contactid=Адрес посетителя
pending.table.head.etc=Разное
pending.table.head.name=Имя

View File

@ -64,6 +64,7 @@ function tpl_content() { global $page, $webimroot;
<thead>
<tr>
<th class="first"><?php echo getlocal("pending.table.head.name") ?></th>
<th><?php echo getlocal("pending.table.head.actions") ?></th>
<th><?php echo getlocal("pending.table.head.contactid") ?></th>
<th><?php echo getlocal("pending.table.head.state") ?></th>
<th><?php echo getlocal("pending.table.head.operator") ?></th>
@ -73,16 +74,16 @@ function tpl_content() { global $page, $webimroot;
</tr>
</thead>
<tbody>
<tr id="tprio"><td colspan="7"></td></tr>
<tr id="tprioend"><td colspan="7"></td></tr>
<tr id="tprio"><td colspan="8"></td></tr>
<tr id="tprioend"><td colspan="8"></td></tr>
<tr id="twait"><td colspan="7"></td></tr>
<tr id="twaitend"><td colspan="7"></td></tr>
<tr id="twait"><td colspan="8"></td></tr>
<tr id="twaitend"><td colspan="8"></td></tr>
<tr id="tchat"><td colspan="7"></td></tr>
<tr id="tchatend"><td colspan="7"></td></tr>
<tr id="tchat"><td colspan="8"></td></tr>
<tr id="tchatend"><td colspan="8"></td></tr>
<tr><td id="statustd" colspan="7" height="30">Loading....</td></tr>
<tr><td id="statustd" colspan="8" height="30">Loading....</td></tr>
</tbody>
</table>