function emInfoContact() { this.email = ""; this.timeout = null; this.timeout_hide = null; this._mousemove = document.onmousemove; this.td; this.createCard(); } emInfoContact.prototype.createCard = function(){ var pic= new Image(); pic.src="./templates/"+template+"/images/card.gif"; card = document.createElement("DIV"); card.id = "card_cc"; card.style.display = "none"; card.style.width = "244px"; card.style.backgroundImage = "url("+pic.src+")"; card.style.height = "134px"; card.style.position = "absolute"; card.innerHTML = "
"; document.body.appendChild(card); } emInfoContact.prototype.begin = function(td, email){ var card = Element("card_cc"); if(this.td != td){ this.email = email; this.td = td; clearTimeout(this.timeout); } this.timeout = setTimeout("InfoContact.search('"+email+"')",1000); } emInfoContact.prototype.label = function (text){ InfoContact.hide(); var div_label = Element("div_label"); if(!div_label) { div_label = document.createElement("DIV"); div_label.id = "div_label"; div_label.style.padding = "2px"; div_label.style.display = "none"; div_label.style.position = "absolute"; div_label.style.border = "1px solid black"; div_label.style.backgroundColor="#FFFFDC"; document.body.appendChild(div_label); } div_label.innerHTML = text; div_label.style.top = findPosY(this.td) + 20 - Element("divScrollMain_"+numBox).scrollTop; div_label.style.left = findPosX(this.td) + 20; div_label.style.display = ''; setTimeout("InfoContact.hide()",1000); } emInfoContact.prototype.connectVoip = function (phoneUser, typePhone){ var handler_connectVoip = function(data){ if(!data) { alert(get_lang("Error contacting VoIP server.")); } else{ alert(get_lang("Requesting a VoIP call")+":\n"+data); } } cExecute ("$this.functions.callVoipConnect&to="+phoneUser+"&typePhone="+typePhone, handler_connectVoip); } emInfoContact.prototype.show = function (data){ var _this = this; var card = Element("card_cc"); card.style.left = findPosX(this.td) + 20; var y = findPosY(this.td) + 20 - Element("divScrollMain_"+numBox).scrollTop; var w_height = is_ie ? document.body.clientHeight + document.body.scrollTop : window.innerHeight + window.pageYOffset; if(y + 160 > w_height) card.style.top = y - 160; else card.style.top = y; card.style.display = ''; var cn = data.cn; if(cn && cn.toString().length > 35) cn = cn.toString().substring(0,30) + "..."; var phoneUser; data.telefone ? phoneUser = data.telefone : phoneUser ="
"; data.mobile ? phoneUser += "
 "+data.mobile : phoneUser += "
"; data.employeeNumber ? employeeNumber = data.employeeNumber : employeeNumber =""; data.ou ? ou = data.ou : ou = ""; if(preferences.voip_enabled && phoneUser) { phoneUser = ""+phoneUser+""; if(data.mobile){ phoneUser += " / "+data.mobile+""; } } Element("card_cc_td").innerHTML = ""+ ""+ ""+ ""+ "
 "+get_lang("Sender's Information")+""+_this.verifyIM(data.uid,data.email)+"
"+ ""+ "
 "+(phoneUser ? phoneUser : get_lang("None") )+"
"+ ""+employeeNumber+"
"+cn+"
"+ "
"+ou+"
"+data.email+""+ "
"; this.timeout_hide = setTimeout("InfoContact.hide()",1000); } emInfoContact.prototype.search = function (email){ var _this = this; var trustedDomain = false; // If "preferences.notification_domains" was setted, then verify if "mail" has a trusted domain. if (preferences.notification_domains != undefined && preferences.notification_domains != "") { var domains = preferences.notification_domains.split(','); for (var i = 0; i < domains.length; i++) { if (email.toString().match(domains[i])) trustedDomain = true; } } else trustedDomain = true; var handler_search = function(data){ if(data != null){ _this.show(data); } else _this.label(email); } if (trustedDomain) cExecute ("$this.ldap_functions.getUserByEmail&email="+email, handler_search); else _this.label(email); } emInfoContact.prototype.hide = function(){ this.email = ""; if(Element("div_label")) Element("div_label").style.display = 'none'; if(Element("card_cc")) Element("card_cc").style.display = "none"; } emInfoContact.prototype.sendMail = function(name, email){ Element("msg_number").value = "\""+ name+"\" <"+email+">"; InfoContact.hide(); new_message("new","null"); } emInfoContact.prototype.openChat = function(event, email){ IM.action_button(event, '1', email ,false); } emInfoContact.prototype.verifyIM = function(uid, email){ if ( !window.IM || !document.getElementById('myStatus') ) return ""; var status = IM.infoContact(uid); var _return = '
'; if ( status ) { _return += ''; _return += ''+get_lang("User connected")+""; else _return += '"BLACK">'+get_lang("User not connected"); _return += "
"; } return _return; } /* Build the Object */ var emInfoContact; InfoContact = new emInfoContact();