/* This file is part of Mibew Messenger project. http://mibew.org Copyright (c) 2005-2011 Mibew Messenger Community License: http://mibew.org/license.php */ (function(a){a.Regions={};a.Popup={};a.Popup.open=function(b,a,c){b=window.open(b,a,c);b.focus();b.opener=window}})(Mibew); (function(){var a=Handlebars.template,b=Handlebars.templates=Handlebars.templates||{};b.agent=a(function(a,b,c,d,e){function m(a,b){return"away"}function n(a,b){return"online"}function o(a,b){var d,e;return e=c.L10n,d=e?e.call(a,"pending.status.away",{hash:{}}):i.call(a,"L10n","pending.status.away",{hash:{}}),j(d)}function p(a,b){var d,e;return e=c.L10n,d=e?e.call(a,"pending.status.online",{hash:{}}):i.call(a,"L10n","pending.status.online",{hash:{}}),j(d)}function q(a,b){return","}c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression,k=this,l="function";f+='',h=c.name,h?g=h.call(b,{hash:{}}):(g=b.name,g=typeof g===l?g():g),f+=j(g),g=b.isLast,g=c.unless.call(b,g,{hash:{},inverse:k.noop,fn:k.program(9,q,e)});if(g||g===0)f+=g;return f}),b.threads_collection=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='\n\n\n \n \n \n \n \n \n \n \n\n\n\n\n\n
',h=c.L10n,g=h?h.call(b,"pending.table.head.name",{hash:{}}):i.call(b,"L10n","pending.table.head.name",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"pending.table.head.actions",{hash:{}}):i.call(b,"L10n","pending.table.head.actions",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"pending.table.head.contactid",{hash:{}}):i.call(b,"L10n","pending.table.head.contactid",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"pending.table.head.state",{hash:{}}):i.call(b,"L10n","pending.table.head.state",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"pending.table.head.operator",{hash:{}}):i.call(b,"L10n","pending.table.head.operator",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"pending.table.head.total",{hash:{}}):i.call(b,"L10n","pending.table.head.total",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"pending.table.head.waittime",{hash:{}}):i.call(b,"L10n","pending.table.head.waittime",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"pending.table.head.etc",{hash:{}}):i.call(b,"L10n","pending.table.head.etc",{hash:{}}),f+=j(g)+'
',f}),b.no_visitors=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='',h=c.L10n,g=h?h.call(b,"visitors.no_visitors",{hash:{}}):i.call(b,"L10n","visitors.no_visitors",{hash:{}}),f+=j(g)+"",f}),b.visitor=a(function(a,b,c,d,e){function m(a,b){var d="",e,f;return d+='',f=c.userName,f?e=f.call(a,{hash:{}}):(e=a.userName,e=typeof e===k?e():e),d+=j(e)+"",d}function n(a,b){var d,e;return e=c.userName,e?d=e.call(a,{hash:{}}):(d=a.userName,d=typeof d===k?d():d),j(d)}function o(a,b){var d="",e,f;return d+='',f=c.remote,f?e=f.call(a,{hash:{}}):(e=a.remote,e=typeof e===k?e():e),d+=j(e)+"",d}function p(a,b){var d,e;return e=c.remote,e?d=e.call(a,{hash:{}}):(d=a.remote,d=typeof d===k?d():d),j(d)}function q(a,b){var c;return c=a.invitationInfo,c=c==null||c===!1?c:c.agentName,c=typeof c===k?c():c,j(c)}function r(a,b){return"-"}function s(a,b){var d,e;return d=a.invitationInfo,d=d==null||d===!1?d:d.time,e=c.formatTimeSince,d=e?e.call(a,d,{hash:{}}):i.call(a,"formatTimeSince",d,{hash:{}}),j(d)}function t(a,b){return"-"}c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression,k="function",l=this;f+='\n ',g=b.invitationInfo,g=c.unless.call(b,g,{hash:{},inverse:l.program(3,n,e),fn:l.program(1,m,e)});if(g||g===0)f+=g;f+='\n\n\n
\n
\n
\n
\n\n',g=b.userIp,g=c["if"].call(b,g,{hash:{},inverse:l.program(7,p,e),fn:l.program(5,o,e)});if(g||g===0)f+=g;f+='\n',g=b.firstTime,h=c.formatTimeSince,g=h?h.call(b,g,{hash:{}}):i.call(b,"formatTimeSince",g,{hash:{}}),f+=j(g)+'\n',g=b.lastTime,h=c.formatTimeSince,g=h?h.call(b,g,{hash:{}}):i.call(b,"formatTimeSince",g,{hash:{}}),f+=j(g)+'\n',g=b.invitationInfo,g=c["if"].call(b,g,{hash:{},inverse:l.program(11,r,e),fn:l.program(9,q,e)});if(g||g===0)f+=g;f+='\n',g=b.invitationInfo,g=c["if"].call(b,g,{hash:{},inverse:l.program(15,t,e),fn:l.program(13,s,e)});if(g||g===0)f+=g;return f+='\n',h=c.invitations,h?g=h.call(b,{hash:{}}):(g=b.invitations,g=typeof g===k?g():g),f+=j(g)+" / ",h=c.chats,h?g=h.call(b,{hash:{}}):(g=b.chats,g=typeof g===k?g():g),f+=j(g)+'\n',h=c.userAgent,h?g=h.call(b,{hash:{}}):(g=b.userAgent,g=typeof g===k?g():g),f+=j(g)+"",f}),b.status_panel=a(function(a,b,c,d,e){function m(a,b){var d,e;return e=c.L10n,d=e?e.call(a,"pending.status.away",{hash:{}}):i.call(a,"L10n","pending.status.away",{hash:{}}),j(d)}function n(a,b){var d,e;return e=c.L10n,d=e?e.call(a,"pending.status.online",{hash:{}}):i.call(a,"L10n","pending.status.online",{hash:{}}),j(d)}function o(a,b){var d,e;return e=c.L10n,d=e?e.call(a,"pending.status.setonline",{hash:{}}):i.call(a,"L10n","pending.status.setonline",{hash:{}}),j(d)}function p(a,b){var d,e;return e=c.L10n,d=e?e.call(a,"pending.status.setaway",{hash:{}}):i.call(a,"L10n","pending.status.setaway",{hash:{}}),j(d)}c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression,k="function",l=this;f+='
',h=c.message,h?g=h.call(b,{hash:{}}):(g=b.message,g=typeof g===k?g():g),f+=j(g),g=b.agent,g=g==null||g===!1?g:g.away,g=c["if"].call(b,g,{hash:{},inverse:l.program(3,n,e),fn:l.program(1,m,e)});if(g||g===0)f+=g;f+='
",f}),b.queued_thread=a(function(a,b,c,d,e){function m(a,b){var d,e;return e=c.L10n,d=e?e.call(a,"pending.table.speak",{hash:{}}):i.call(a,"L10n","pending.table.speak",{hash:{}}),j(d)}function n(a,b){var d,e;return e=c.L10n,d=e?e.call(a,"pending.table.view",{hash:{}}):i.call(a,"L10n","pending.table.view",{hash:{}}),j(d)}function o(a,b){var d="",e,f;return f=c.L10n,e=f?f.call(a,"chat.client.spam.prefix",{hash:{}}):i.call(a,"L10n","chat.client.spam.prefix",{hash:{}}),d+=j(e)+" ",d}function p(a,b){var d="",e,f;return d+='
',f=c.firstMessagePreview,f?e=f.call(a,{hash:{}}):(e=a.firstMessagePreview,e=typeof e===k?e():e),d+=j(e)+"
",d}function q(a,b){var d="",e,f;return d+='\n
\n ',d}function r(a,b){var d="",e,f;return d+='\n
\n ',d}function s(a,b){var d="",e,f;return d+='\n
\n ',d}function t(a,b){var d="",e,f;return d+='\n
\n ',d}function u(a,b){var d="",e,f;return d+='',f=c.remote,f?e=f.call(a,{hash:{}}):(e=a.remote,e=typeof e===k?e():e),d+=j(e)+"",d}function v(a,b){var d,e;return e=c.remote,e?d=e.call(a,{hash:{}}):(d=a.remote,d=typeof d===k?d():d),j(d)}function w(a,b){var d,e;return d=a.waitingTime,e=c.formatTimeSince,d=e?e.call(a,d,{hash:{}}):i.call(a,"formatTimeSince",d,{hash:{}}),j(d)}function x(a,b){return"-"}function y(a,b){var c;return c=a.ban,c=c==null||c===!1?c:c.reason,c=typeof c===k?c():c,j(c)}function z(a,b){var d,e;return e=c.userAgent,e?d=e.call(a,{hash:{}}):(d=a.userAgent,d=typeof d===k?d():d),j(d)}c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression,k="function",l=this;f+='\n
',g=b.ban,g=c["if"].call(b,g,{hash:{},inverse:l.noop,fn:l.program(5,o,e)});if(g||g===0)f+=g;h=c.userName,h?g=h.call(b,{hash:{}}):(g=b.userName,g=typeof g===k?g():g),f+=j(g)+"
\n ",g=b.firstMessage,g=c["if"].call(b,g,{hash:{},inverse:l.noop,fn:l.program(7,p,e)});if(g||g===0)f+=g;f+='\n\n\n
\n ',g=b.canOpen,g=c["if"].call(b,g,{hash:{},inverse:l.noop,fn:l.program(9,q,e)});if(g||g===0)f+=g;f+="\n ",g=b.canView,g=c["if"].call(b,g,{hash:{},inverse:l.noop,fn:l.program(11,r,e)});if(g||g===0)f+=g;f+="\n ",g=b.tracked,g=c["if"].call(b,g,{hash:{},inverse:l.noop,fn:l.program(13,s,e)});if(g||g===0)f+=g;f+="\n ",g=b.canBan,g=c["if"].call(b,g,{hash:{},inverse:l.noop,fn:l.program(15,t,e)});if(g||g===0)f+=g;f+='\n
\n
\n\n',g=b.userIp,g=c["if"].call(b,g,{hash:{},inverse:l.program(19,v,e),fn:l.program(17,u,e)});if(g||g===0)f+=g;f+='\n',h=c.stateDesc,h?g=h.call(b,{hash:{}}):(g=b.stateDesc,g=typeof g===k?g():g),f+=j(g)+'\n',h=c.agentName,h?g=h.call(b,{hash:{}}):(g=b.agentName,g=typeof g===k?g():g),f+=j(g)+'\n',g=b.totalTime,h=c.formatTimeSince,g=h?h.call(b,g,{hash:{}}):i.call(b,"formatTimeSince",g,{hash:{}}),f+=j(g)+'\n',g=b.chatting,g=c.unless.call(b,g,{hash:{},inverse:l.program(23,x,e),fn:l.program(21,w,e)});if(g||g===0)f+=g;f+='\n',g=b.ban,g=c["if"].call(b,g,{hash:{},inverse:l.program(27,z,e),fn:l.program(25,y,e)});if(g||g===0)f+=g;return f+="",f}),b.no_threads=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='',h=c.L10n,g=h?h.call(b,"clients.no_clients",{hash:{}}):i.call(b,"L10n","clients.no_clients",{hash:{}}),f+=j(g)+"",f}),b.visitors_collection=a(function(a,b,c,d,e){c=c||a.helpers;var f="",g,h,i=c.helperMissing,j=this.escapeExpression;return f+='\n\n\n \n \n \n \n \n \n \n \n \n\n\n\n\n
',h=c.L10n,g=h?h.call(b,"visitors.table.head.name",{hash:{}}):i.call(b,"L10n","visitors.table.head.name",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"visitors.table.head.actions",{hash:{}}):i.call(b,"L10n","visitors.table.head.actions",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"visitors.table.head.contactid",{hash:{}}):i.call(b,"L10n","visitors.table.head.contactid",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"visitors.table.head.firsttimeonsite",{hash:{}}):i.call(b,"L10n","visitors.table.head.firsttimeonsite",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"visitors.table.head.lasttimeonsite",{hash:{}}):i.call(b,"L10n","visitors.table.head.lasttimeonsite",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"visitors.table.head.invited.by",{hash:{}}):i.call(b,"L10n","visitors.table.head.invited.by",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"visitors.table.head.invitationtime",{hash:{}}):i.call(b,"L10n","visitors.table.head.invitationtime",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"visitors.table.head.invitations",{hash:{}}):i.call(b,"L10n","visitors.table.head.invitations",{hash:{}}),f+=j(g)+"",h=c.L10n,g=h?h.call(b,"visitors.table.head.etc",{hash:{}}):i.call(b,"L10n","visitors.table.head.etc",{hash:{}}),f+=j(g)+'
',f})})();(function(e){e.registerHelper("formatTimeSince",function(b){var a=Math.round((new Date).getTime()/1E3)-b;b=a%60;var d=Math.floor(a/60)%60,a=Math.floor(a/3600),c=[];0d?"0"+d:d);c.push(10>b?"0"+b:b);return c.join(":")})})(Handlebars); MibewAPIUsersInteraction=function(){this.obligatoryArguments={"*":{agentId:null,"return":{},references:{}},result:{errorCode:0}};this.reservedFunctionNames=["result"]};MibewAPIUsersInteraction.prototype=new MibewAPIInteraction; (function(a,b){a.Models.Agent=a.Models.User.extend({defaults:b.extend({},a.Models.User.prototype.defaults,{id:null,isAgent:!0,away:!1}),away:function(){this.setAvailability(!1)},available:function(){this.setAvailability(!0)},setAvailability:function(c){var b=this;a.Objects.server.callFunctions([{"function":c?"available":"away",arguments:{agentId:this.id,references:{},"return":{}}}],function(a){0==a.errorCode&&b.set({away:!c})},!0)}})})(Mibew,_); (function(a,c){var b=[],f=a.Models.QueuedThread=a.Models.Thread.extend({defaults:c.extend({},a.Models.Thread.prototype.defaults,{controls:null,userName:"",userIp:"",remote:"",userAgent:"",agentName:"",canOpen:!1,canView:!1,canBan:!1,ban:!1,totalTime:0,waitingTime:0,firstMessage:null}),initialize:function(){for(var e=[],b=f.getControls(),d=0,c=b.length;d