Ignore:
Timestamp:
05/26/08 11:45:16 (16 years ago)
Author:
niltonneto
Message:

Verificar Wiki/Trac? do módulo.

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  
    8787        "window_focus" :  function(pElement) 
    8888        { 
    89                 pElement.style.zIndex = ++this.focus; 
     89                if (! templates.dontFocus) 
     90                        pElement.style.zIndex = ++this.focus; 
     91                else 
     92                        templates.dontFocus = false; 
    9093        }, 
    9194 
     
    103106                this.elementM(pId).style.width = window.screen.availWidth - 24; 
    104107                this.elementM(pId).style.height = window.screen.availHeight - 60; 
     108                 
    105109 
    106110                // _window_body 
     
    110114                // _window_body_content 
    111115                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 
    112130        }, 
    113131 
  • trunk/instant_messenger/js/client.js

    r275 r287  
    1 var con = new IMConnector; 
     1var conn_im = new IMConnector; 
    22var disconnected = false; 
     3var validate_data = false; 
     4var buffer_im = ''; 
     5var xtools_im = null; 
     6var count_im = 0; 
     7var activate_timeOut = ''; 
     8 
     9function 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 
     28function 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 
     50function killConnIm() 
     51{ 
     52        var i; 
     53        disconnected = true; 
     54         
     55        for ( i in conn_im.__HTTP__ ) 
     56                conn_im.__HTTP__[i].abort(); 
     57} 
    358 
    459function client() 
    560{ 
    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; 
    966 
    1067        function request(data) 
     
    1269                if ( !disconnected ) 
    1370                { 
    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; 
    1577                } 
    1678        } 
     
    2284                        return pData.replace(/^ +| +$/g, ''); 
    2385                } 
     86 
     87                function retrim(pData) 
     88                { 
     89                        return pData.replace(/(_##_)+\b/g, ''); 
     90                } 
     91                 
    2492                data = trim(data); 
    25                 if ( data == 'disconnected' || data == '</stream:stream>') 
     93                 
     94                if ( data == 'disconnected' || data == '</stream:stream>' ) 
    2695                { 
    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; 
    3898                } 
    39                 else if ( data.lastIndexOf('>') == data.length - 1) 
     99                else if ( data.lastIndexOf('>') == data.length - 1 && data.length > 0 ) 
    40100                { 
    41                         if ( buffer.length ) 
     101                        if ( buffer_im.length ) 
    42102                        { 
    43                                 data = buffer + data; 
    44                                 buffer = ''; 
     103                                data = buffer_im + data; 
     104                                buffer_im = ""; 
    45105                        } 
    46106 
     
    62122 
    63123                        var node = xmlDoc.documentElement.firstChild; 
    64  
     124                         
    65125                        while ( node ) 
    66126                        { 
    67127                                try 
    68128                                { 
    69                                         with ( node ) 
    70                                         { 
    71                                                 jabber.doIt(nodeName, node); 
    72                                         } 
     129                                        jabber.doIt(node.nodeName, node); 
    73130                                        node = node.nextSibling; 
    74131                                } 
    75132                                catch(e) 
    76133                                { 
     134                                        alert('erro : ' + e + "\n\n" + e.description); 
    77135                                        node = node.nextSibling; 
    78136                                } 
     
    81139                else 
    82140                { 
    83                         buffer += data; 
     141                        data = data.replace(/^ +| +$/g, ''); 
     142                        buffer_im +=  data + " "; 
    84143                } 
    85144        } 
     
    87146        function contacts(data) 
    88147        { 
     148                setTimeout('clientConnectionIm()', 3000); 
    89149        } 
    90150        request(); 
    91         setTimeout("con.go('$this.Ujabber.getContacts', {'request':"+contacts+"})", 3000); 
     151        setTimeout("conn_im.go('$this.Ujabber.getContacts', {'request':"+contacts+"})", 3000); 
    92152} 
    93153 
     
    99159                _bkp_onbeforeunload(); 
    100160 
    101         disconnected = true; 
    102         var i; 
    103         for ( i in con.__HTTP__ ) 
    104                 con.__HTTP__[i].abort(); 
     161        killConnIm(); 
    105162}; 
  • trunk/instant_messenger/js/functions.js

    r275 r287  
    2727                var content = get_Element(pJid); 
    2828                content.innerHTML += "" + this.insertEmoticons(pEmotion); 
     29                var smileWindow = document.getElementById(pJid+"__button_dest"); 
     30                if (smileWindow.firstChild) 
     31                        smileWindow.removeChild(smileWindow.firstChild); 
    2932        }, 
    3033 
     
    8891                } 
    8992                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 
    9198                if( _font_color = _document.contentWindow.document.getElementById('colors_'+pJid) ) 
    9299                        content.innerHTML = "<span id='colors_"+pJid+"'style='color:"+pColor+"'>"+_font_color.innerHTML+"</span>"; 
     
    346353                        { 
    347354                                var data = eval(XmlData); 
     355 
    348356                                if( data ) 
    349357                                { 
    350358                                        if( document.getElementById(pAvatar) != null ) 
    351359                                        { 
    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                                                } 
    354370                                        }                
    355371                                } 
     
    361377        }, 
    362378         
    363         "newMessageNotification" : function() 
    364         { 
     379      "newMessageNotification" : function() 
     380      { 
    365381      if ( !focusFlag ) 
    366382      { 
     
    455471                { 
    456472                        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                        } 
    458477                } 
    459478                this.conn.go('$this.Ujabber.setPresence', {'request' : handler_presence}, this.status); 
     
    462481        "remove" : function(pJid) 
    463482        { 
     483                if (pJid == -1) 
     484                        return false; 
    464485                if(confirm('Deseja excluir o contato ' + pJid + ' ?')) 
    465486                { 
     
    488509                                if( func.byId(pElement).options[i].selected == true ) 
    489510                                         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                                { 
    495518                                function handler_remove(XmlData) 
    496519                                { 
     
    535558                { 
    536559                        if( XmlData != "OK" ) 
    537                                 alert('Vcard não cadastrado/atualizado !'); 
     560                                alert('Erro: Vcard não cadastrado/atualizado !'); 
    538561                        else 
    539562                                alert('Vcard cadastrado/atualizado !'); 
     563                        im_window.window_close('vcard_user_im'); 
    540564                } 
    541565                this.conn.go('$this.Ujabber.newVcard',{'request':handler_savevcard},"vcard="+xmlVcard); 
     
    571595                                im.off_line(); 
    572596                                alert('Preferências Salvas !'); 
     597                                im_window.window_close('my_settings_im'); 
    573598                        } 
    574599                } 
  • trunk/instant_messenger/js/images.js

    r260 r287  
    2929        var im_group_open = new Image(); 
    3030        im_group_open.src = path_im + 'templates/default/images/group_open.gif'; 
    31          
     31 
    3232// Smiles 
    3333 
  • trunk/instant_messenger/js/jabber.js

    r280 r287  
    121121                                var iframe = func.byId('iframe_' + from); 
    122122 
    123                                 //if(func.byId('iframe_' + from) != null) 
    124                                         //func.byId('iframe_' + from).parentNode.removeChild(func.byId('iframe_' + from)); 
    125  
    126123                                var win; 
    127124 
     
    142139                                        var iframe = document.createElement('iframe'); 
    143140                                        iframe.id = 'iframe_' + from; 
    144                                         iframe.style.width = '290px'; 
    145                                         iframe.style.height = '46px'; 
     141                                        iframe.style.width = '240px'; 
     142                                        iframe.style.height = '65px'; 
    146143                                        iframe.style.border = '0'; 
    147144                                        iframe.style.margin = '0'; 
     
    154151                                        iframe.contentWindow.document.close(); 
    155152                                        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); 
    156168 
    157169                                } 
     
    327339                function readVcard(pVcard) 
    328340                { 
     341                         
    329342                        switch(pVcard.getAttribute('id')) 
    330343                        { 
     
    338351                                                { 
    339352                                                        if(cc.firstChild.nodeValue) 
    340                                                                 func.byId('im_layer_nickname').innerHTML = cc.firstChild.nodeValue;                                                              
     353                                                                func.byId('im_layer_nickname').innerHTML = cc.firstChild.nodeValue; 
    341354                                                } 
    342355                                                cc = cc.nextSibling; 
  • trunk/instant_messenger/js/templates.js

    r275 r287  
    55        this.documentMousedown = null; 
    66        this.jabber     = new Jabber; 
     7        this.dontFocus = false; 
    78} 
    89 
     
    7374                        document.getElementById('fast_menu_im').style.position = "absolute"; 
    7475                } 
    75                 else 
    76                         alert('Aguarde carregando lista de contatos ....'); 
    7776                                         
    7877        }, 
     
    123122         
    124123        "options_button_left" : function(pJid) 
    125         {   
     124        {        
    126125                var _this = this; 
    127                  
     126         
    128127                if(!(im.nickname_contacts[pJid])) 
    129128                        im.request_vcard(pJid, false); 
     
    133132                        im_window.load(pJid, 'instant_messenger_content', '<title>.:: Expresso Messenger ::.</title>', 'chat.xsl','310',true,true,true); 
    134133                 
    135                         func.byId(pJid + '__avatar').src = path_im + "/templates/default/images/photo.png"; 
    136134 
    137135                        if(func.byId('iframe_' + pJid) != null) 
     
    142140                        var iframe = document.createElement('iframe'); 
    143141                        iframe.id = 'iframe_' + pJid; 
    144                         iframe.style.width = '290px'; 
    145                         iframe.style.height = '46px'; 
     142                        iframe.style.width = '240px'; 
     143                        iframe.style.height = '65px'; 
    146144                        iframe.style.border = '0'; 
    147145                        iframe.style.margin = '0'; 
     
    153151                        iframe.contentWindow.document.write('<html><body id="' + pJid + '" style="margin:0px;padding:0px"></body></html>'); 
    154152                        iframe.contentWindow.document.close(); 
     153 
    155154                        iframe.contentWindow.document.designMode = "On"; 
    156155                        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); 
    157171 
    158172                        im.ldap_photo(pJid + "__avatar"); 
Note: See TracChangeset for help on using the changeset viewer.