Changeset 287 for trunk/instant_messenger/js
- Timestamp:
- 05/26/08 11:45:16 (16 years ago)
- Location:
- trunk/instant_messenger/js
- Files:
-
- 1 added
- 13 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/instant_messenger/js/build_win.js
r260 r287 87 87 "window_focus" : function(pElement) 88 88 { 89 pElement.style.zIndex = ++this.focus; 89 if (! templates.dontFocus) 90 pElement.style.zIndex = ++this.focus; 91 else 92 templates.dontFocus = false; 90 93 }, 91 94 … … 103 106 this.elementM(pId).style.width = window.screen.availWidth - 24; 104 107 this.elementM(pId).style.height = window.screen.availHeight - 60; 108 105 109 106 110 // _window_body … … 110 114 // _window_body_content 111 115 this.elementC(pId).style.height = '100%'; 116 var windowType = this.elementC(pId).firstChild.firstChild.className; 117 118 if (windowType == 'history') // message window 119 { 120 this.elementC(pId).firstChild.childNodes[0].style.height = '60%'; 121 this.elementC(pId).firstChild.childNodes[0].style.width = '100%'; 122 this.elementC(pId).firstChild.childNodes[1].style.width = '100%'; 123 this.elementC(pId).firstChild.childNodes[2].firstChild.style.width = '100%'; 124 } 125 else if (windowType == 'font_menu') // contacts window 126 { 127 this.elementC(pId).childNodes[1].style.height = '70%'; 128 } 129 112 130 }, 113 131 -
trunk/instant_messenger/js/client.js
r275 r287 1 var con = new IMConnector;1 var conn_im = new IMConnector; 2 2 var disconnected = false; 3 var validate_data = false; 4 var buffer_im = ''; 5 var xtools_im = null; 6 var count_im = 0; 7 var activate_timeOut = ''; 8 9 function clientConnectionIm() 10 { 11 if( count_im < 2 ) 12 { 13 if( buffer_im.length > 0 ) 14 activate_timeOut = setTimeout('clientConnectionIm()', 5000); 15 16 count_im++; 17 } 18 else 19 { 20 count_im = 0; 21 buffer_im = 0; 22 clientDisconnectIm(); 23 clearTimeout(activate_timeOut); 24 killConnIm(); 25 } 26 } 27 28 function clientDisconnectIm() 29 { 30 if( xtools_im == null ) 31 xtools_im = new XTools; 32 33 disconnected = true; 34 var XmlDoc = "<disconnected>" + 35 "<path>" + path_im + "</path>" + 36 "</disconnected>"; 37 38 im_window.load('__contacts_im_','instant_messenger_content','<title>.::Expresso Messenger::.</title>','window.xsl','190',true,true,false); 39 im_window.elementC('__contacts_im_').innerHTML = xtools_im.parse(XmlDoc,'disconnected.xsl'); 40 func.byId('im_status_src').src = im_unavailable.src; 41 im.status = 'type=unavailable'; 42 im.statusFlag = 'unavailable'; 43 44 function handler_presence_disconnected() 45 { 46 } 47 conn_im.go('$this.Ujabber.setPresence', {'request' : handler_presence_disconnected }, im.status); 48 } 49 50 function killConnIm() 51 { 52 var i; 53 disconnected = true; 54 55 for ( i in conn_im.__HTTP__ ) 56 conn_im.__HTTP__[i].abort(); 57 } 3 58 4 59 function client() 5 60 { 6 var jabber = new Jabber; 7 var buffer = ''; 8 var xtools = new XTools; 61 if( jabber == null ) 62 var jabber = new Jabber; 63 64 if( xtools_im == null ) 65 xtools_im = new XTools; 9 66 10 67 function request(data) … … 12 69 if ( !disconnected ) 13 70 { 14 con.go('$this.Ujabber.listen', {'stream':stream, 'request':request}); 71 conn_im.go('$this.Ujabber.listen', {'stream':stream, 'request':request}, 'classConstructor=read'); 72 } 73 else 74 { 75 clientDisconnectIm(); 76 return false; 15 77 } 16 78 } … … 22 84 return pData.replace(/^ +| +$/g, ''); 23 85 } 86 87 function retrim(pData) 88 { 89 return pData.replace(/(_##_)+\b/g, ''); 90 } 91 24 92 data = trim(data); 25 if ( data == 'disconnected' || data == '</stream:stream>') 93 94 if ( data == 'disconnected' || data == '</stream:stream>' ) 26 95 { 27 disconnected = true; 28 var XmlDoc = "<disconnected>" + 29 "<path>" + path_im + "</path>" + 30 "</disconnected>"; 31 32 im_window.load('__contacts_im_','instant_messenger_content','<title>.::Expresso Messenger::.</title>','window.xsl','',true,true,false); 33 im_window.elementC('__contacts_im_').innerHTML = xtools.parse(XmlDoc,'disconnected.xsl'); 34 func.byId('img_status_im').src = im_unavailable.src; 35 im.status = 'type=unavailable'; 36 im.statusFlag = 'unavailable'; 37 96 clientDisconnectIm(); 97 return false; 38 98 } 39 else if ( data.lastIndexOf('>') == data.length - 1 )99 else if ( data.lastIndexOf('>') == data.length - 1 && data.length > 0 ) 40 100 { 41 if ( buffer .length )101 if ( buffer_im.length ) 42 102 { 43 data = buffer + data;44 buffer = '';103 data = buffer_im + data; 104 buffer_im = ""; 45 105 } 46 106 … … 62 122 63 123 var node = xmlDoc.documentElement.firstChild; 64 124 65 125 while ( node ) 66 126 { 67 127 try 68 128 { 69 with ( node ) 70 { 71 jabber.doIt(nodeName, node); 72 } 129 jabber.doIt(node.nodeName, node); 73 130 node = node.nextSibling; 74 131 } 75 132 catch(e) 76 133 { 134 alert('erro : ' + e + "\n\n" + e.description); 77 135 node = node.nextSibling; 78 136 } … … 81 139 else 82 140 { 83 buffer += data; 141 data = data.replace(/^ +| +$/g, ''); 142 buffer_im += data + " "; 84 143 } 85 144 } … … 87 146 function contacts(data) 88 147 { 148 setTimeout('clientConnectionIm()', 3000); 89 149 } 90 150 request(); 91 setTimeout("con .go('$this.Ujabber.getContacts', {'request':"+contacts+"})", 3000);151 setTimeout("conn_im.go('$this.Ujabber.getContacts', {'request':"+contacts+"})", 3000); 92 152 } 93 153 … … 99 159 _bkp_onbeforeunload(); 100 160 101 disconnected = true; 102 var i; 103 for ( i in con.__HTTP__ ) 104 con.__HTTP__[i].abort(); 161 killConnIm(); 105 162 }; -
trunk/instant_messenger/js/functions.js
r275 r287 27 27 var content = get_Element(pJid); 28 28 content.innerHTML += "" + this.insertEmoticons(pEmotion); 29 var smileWindow = document.getElementById(pJid+"__button_dest"); 30 if (smileWindow.firstChild) 31 smileWindow.removeChild(smileWindow.firstChild); 29 32 }, 30 33 … … 88 91 } 89 92 var content = get_Element(pJid); 90 93 94 var colorWindow = document.getElementById(pJid+"__button_dest"); 95 if (colorWindow.firstChild) 96 colorWindow.removeChild(colorWindow.firstChild); 97 91 98 if( _font_color = _document.contentWindow.document.getElementById('colors_'+pJid) ) 92 99 content.innerHTML = "<span id='colors_"+pJid+"'style='color:"+pColor+"'>"+_font_color.innerHTML+"</span>"; … … 346 353 { 347 354 var data = eval(XmlData); 355 348 356 if( data ) 349 357 { 350 358 if( document.getElementById(pAvatar) != null ) 351 359 { 352 var photo_img = document.getElementById(pAvatar); 353 photo_img.src = ( path_im + "inc/class.ldap_im.inc.php?user="+uid ) ? path_im + "inc/class.ldap_im.inc.php?user="+uid : im_photo.src ; 360 if( document.getElementById(pAvatar).src ) 361 { 362 var photo_img = document.getElementById(pAvatar); 363 photo_img.src = ( path_im + "inc/class.ldap_im.inc.php?user="+uid ) ? path_im + "inc/class.ldap_im.inc.php?user="+uid : im_photo.src ; 364 } 365 else 366 { 367 var photo_img = document.getElementById(pAvatar); 368 photo_img.style.backgroundImage = 'url(' + path_im + 'inc/class.ldap_im.inc.php?user='+uid+')'; 369 } 354 370 } 355 371 } … … 361 377 }, 362 378 363 364 379 "newMessageNotification" : function() 380 { 365 381 if ( !focusFlag ) 366 382 { … … 455 471 { 456 472 if(imgStatus != null) 457 func.byId('im_status_src').src = eval('im_' + imgStatus + '.src'); 473 { 474 var img_status = document.getElementById('im_status_src'); 475 img_status.src = eval('im_' + imgStatus + '.src'); 476 } 458 477 } 459 478 this.conn.go('$this.Ujabber.setPresence', {'request' : handler_presence}, this.status); … … 462 481 "remove" : function(pJid) 463 482 { 483 if (pJid == -1) 484 return false; 464 485 if(confirm('Deseja excluir o contato ' + pJid + ' ?')) 465 486 { … … 488 509 if( func.byId(pElement).options[i].selected == true ) 489 510 Jid = func.byId(pElement).options[i].value; 490 491 if(confirm('Deseja excluir o contato ' + Jid + ' ?')) 492 { 493 if( Jid && Jid != -1 ) 494 { 511 if (Jid == -1) 512 return false; 513 else 514 if(confirm('Deseja excluir o contato ' + Jid + ' ?')) 515 { 516 if( Jid && Jid != -1 ) 517 { 495 518 function handler_remove(XmlData) 496 519 { … … 535 558 { 536 559 if( XmlData != "OK" ) 537 alert(' Vcard não cadastrado/atualizado !');560 alert('Erro: Vcard não cadastrado/atualizado !'); 538 561 else 539 562 alert('Vcard cadastrado/atualizado !'); 563 im_window.window_close('vcard_user_im'); 540 564 } 541 565 this.conn.go('$this.Ujabber.newVcard',{'request':handler_savevcard},"vcard="+xmlVcard); … … 571 595 im.off_line(); 572 596 alert('Preferências Salvas !'); 597 im_window.window_close('my_settings_im'); 573 598 } 574 599 } -
trunk/instant_messenger/js/images.js
r260 r287 29 29 var im_group_open = new Image(); 30 30 im_group_open.src = path_im + 'templates/default/images/group_open.gif'; 31 31 32 32 // Smiles 33 33 -
trunk/instant_messenger/js/jabber.js
r280 r287 121 121 var iframe = func.byId('iframe_' + from); 122 122 123 //if(func.byId('iframe_' + from) != null)124 //func.byId('iframe_' + from).parentNode.removeChild(func.byId('iframe_' + from));125 126 123 var win; 127 124 … … 142 139 var iframe = document.createElement('iframe'); 143 140 iframe.id = 'iframe_' + from; 144 iframe.style.width = '2 90px';145 iframe.style.height = ' 46px';141 iframe.style.width = '240px'; 142 iframe.style.height = '65px'; 146 143 iframe.style.border = '0'; 147 144 iframe.style.margin = '0'; … … 154 151 iframe.contentWindow.document.close(); 155 152 iframe.contentWindow.document.designMode = "On"; 153 154 function getEnter(e) 155 { 156 if ( !(e.shiftKey) && (e.keyCode == 13) ) 157 { 158 if ( e.type.indexOf('keydown') != -1 ) 159 im.SendMessage(from); 160 else 161 iframe.contentWindow.document.body.innerHTML = ''; 162 return false; 163 } 164 } 165 166 func.attachEvent(iframe.contentWindow, 'onkeydown', getEnter); 167 func.attachEvent(iframe.contentWindow, 'onkeyup', getEnter); 156 168 157 169 } … … 327 339 function readVcard(pVcard) 328 340 { 341 329 342 switch(pVcard.getAttribute('id')) 330 343 { … … 338 351 { 339 352 if(cc.firstChild.nodeValue) 340 func.byId('im_layer_nickname').innerHTML = cc.firstChild.nodeValue; 353 func.byId('im_layer_nickname').innerHTML = cc.firstChild.nodeValue; 341 354 } 342 355 cc = cc.nextSibling; -
trunk/instant_messenger/js/templates.js
r275 r287 5 5 this.documentMousedown = null; 6 6 this.jabber = new Jabber; 7 this.dontFocus = false; 7 8 } 8 9 … … 73 74 document.getElementById('fast_menu_im').style.position = "absolute"; 74 75 } 75 else76 alert('Aguarde carregando lista de contatos ....');77 76 78 77 }, … … 123 122 124 123 "options_button_left" : function(pJid) 125 { 124 { 126 125 var _this = this; 127 126 128 127 if(!(im.nickname_contacts[pJid])) 129 128 im.request_vcard(pJid, false); … … 133 132 im_window.load(pJid, 'instant_messenger_content', '<title>.:: Expresso Messenger ::.</title>', 'chat.xsl','310',true,true,true); 134 133 135 func.byId(pJid + '__avatar').src = path_im + "/templates/default/images/photo.png";136 134 137 135 if(func.byId('iframe_' + pJid) != null) … … 142 140 var iframe = document.createElement('iframe'); 143 141 iframe.id = 'iframe_' + pJid; 144 iframe.style.width = '2 90px';145 iframe.style.height = ' 46px';142 iframe.style.width = '240px'; 143 iframe.style.height = '65px'; 146 144 iframe.style.border = '0'; 147 145 iframe.style.margin = '0'; … … 153 151 iframe.contentWindow.document.write('<html><body id="' + pJid + '" style="margin:0px;padding:0px"></body></html>'); 154 152 iframe.contentWindow.document.close(); 153 155 154 iframe.contentWindow.document.designMode = "On"; 156 155 iframe.contentWindow.focus(); 156 this.dontFocus = true; 157 158 function getEnter(e) 159 { 160 if ( !(e.shiftKey) && (e.keyCode == 13) ) 161 { 162 if ( e.type.indexOf('keydown') != -1 ) 163 im.SendMessage(pJid); 164 else 165 iframe.contentWindow.document.body.innerHTML = ''; 166 return false; 167 } 168 } 169 func.attachEvent(iframe.contentWindow, 'onkeydown', getEnter); 170 func.attachEvent(iframe.contentWindow, 'onkeyup', getEnter); 157 171 158 172 im.ldap_photo(pJid + "__avatar");
Note: See TracChangeset
for help on using the changeset viewer.