Ignore:
Timestamp:
09/05/07 11:18:58 (17 years ago)
Author:
niltonneto
Message:

* empty log message *

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/instant_messenger/js/im_functions.js

    r63 r64  
    99           this.im_time_        = false; 
    1010        } 
    11          
     11 
    1212        IM.prototype.load_im = function() 
    1313        { 
    1414                IM.listen(); 
    1515            IM.requireContacts(); 
    16              
     16 
    1717            var handler_Status = function(XmlData) 
    1818            { 
     
    2727            XMLTools.request('$this.Ujabber.MyPresence', 'GET', handler_Status); 
    2828        }; 
    29          
     29 
    3030        IM.prototype.listen = function() 
    3131        { 
    3232           if ( !this._listen ) 
    3333              return false; 
    34          
     34 
    3535           var _this = this; 
    3636           var handler = function(data) 
     
    4343                                                IM_Preferences.GetYourPreferences(); 
    4444                                } 
    45                                  
     45 
    4646                    _this.getContacts(data); 
    4747                    _this.getPresence(data); 
     
    4949                    _this.getMessages(data); 
    5050                                _this.getVcard(data); 
    51                                  
     51 
    5252                if(!_this.vcards) 
    5353                { 
     
    6868        }; 
    6969 
    70    /*    
     70   /* 
    7171        *  Contacts 
    7272        */ 
    73          
     73 
    7474        IM.prototype.requireContacts = function() 
    7575        { 
     
    9999                 var a = document.createElement('div'); 
    100100                 a.innerHTML = XMLTools.transform(node, xsl); 
    101          
     101 
    102102                 div.innerHTML = ''; 
    103103                 div.appendChild(img); 
    104104                 div.appendChild(document.createTextNode(this.get_lang('List of Contacts'))); 
    105105                 div.appendChild(a); 
    106          
     106 
    107107                         var group = func.byId("all_groups").firstChild; 
    108108                         while ( group ) 
     
    123123                                                img.id = "img_" + group.id; 
    124124                                                var el_parent = group; 
    125                                                  
     125 
    126126                                                el_parent.insertBefore(img,el_parent.firstChild); 
    127          
     127 
    128128                                        } catch(e){} 
    129129                                        group = group.nextSibling; 
     
    136136              //alert('getContacts()' + e); 
    137137           } 
    138                  
    139         }; 
    140  
    141    /*    
     138 
     139        }; 
     140 
     141   /* 
    142142        *  Visible / Unvisible 
    143143        */ 
     
    152152                img.src = img_group_close.src; 
    153153        } 
    154          
     154 
    155155        IM.prototype.unvisible_group = function(el) 
    156156        { 
     
    162162                img.src = img_group_open.src; 
    163163        } 
    164          
     164 
    165165        /* 
    166166         * Presence 
    167167         */ 
    168          
     168 
    169169        IM.prototype.getPresence = function(data) 
    170170        { 
     
    187187                                else 
    188188                                        var status_message = false; 
    189                                          
    190  
    191189 
    192190                                if( from ) 
     
    203201                                                        } 
    204202                                                break; 
    205                          
    206203                                        case 'subscribed' : 
    207204                                                // 
    208205                                        break; 
    209                                          
    210                                         case 'unsubscribe' :  
     206                                        case 'unsubscribe' : 
    211207                                                Subscription.unsubscribe(from); 
    212208                                                type = 'unavailable'; 
    213209                                                func.byId(from).firstChild.src = eval('img_' + type + '.src'); 
    214210                                                break; 
    215                                         case 'unsubscribed' :  
     211                                        case 'unsubscribed' : 
    216212                                                Subscription.unsubscribed(from); 
    217213                                                type = 'unavailable'; 
     
    232228                                                                else 
    233229                                                                        status.innerHTML = ''; 
    234                                                                  
    235230                                                        } 
    236231 
     
    244239                                                                        if( status_message != "available" ) 
    245240                                                                                lbl.innerHTML = "<span style='margin-left:10px'><br/> ( " + status_message + " )</span>"; 
    246                                                                         func.byId(from).appendChild(lbl);                                                                        
     241                                                                        func.byId(from).appendChild(lbl); 
    247242                                                        }else{ 
    248243                                                                        var lbl = document.getElementById('status_message_' + from); 
     
    266261           } 
    267262        }; 
    268          
     263 
    269264        /* 
    270265         * Contatos - Offline 
    271266         */ 
    272          
     267 
    273268        IM.prototype.Contacts_Offline = function() 
    274269        { 
     
    296291         } 
    297292        } 
    298          
     293 
    299294        /* 
    300295         * Get / Send - Messages 
    301296         */ 
    302          
     297 
    303298        IM.prototype.getMessages = function(data) 
    304299        { 
     
    325320                                                    nickname = func.trim(nickname); 
    326321                                   } 
    327                                                          
     322 
    328323                       var win = document.getElementById(from + '_chatMessages'); 
    329324                       if ( !win ) 
     
    332327                          win = document.getElementById(from + '_chatMessages'); 
    333328                       } 
    334          
     329 
    335330                       var el = message.firstChild; 
    336331                       while ( el ) 
     
    338333                          var xsl = XMLTools.load(im_path + 'xsl/message.xsl?' + Date.parse(new Date)); 
    339334                          var next = el.nextSibling; 
    340          
     335 
    341336                          var label = document.createElement('strong'); 
    342337                              if(nickname) 
    343338                                  label.appendChild(document.createTextNode(nickname)); 
    344339                                          else 
    345                                   label.appendChild(document.createTextNode(from));                                
     340                                  label.appendChild(document.createTextNode(from)); 
    346341                          win.appendChild(label); 
    347342                          win.appendChild(document.createElement('br')); 
     
    352347                          win.scrollTop = win.scrollHeight; 
    353348                                          im_win.newMessageNotification(); 
    354                                                                  
     349 
    355350                          el = next; 
    356351                       } 
     
    370365           } 
    371366        } 
    372          
     367 
    373368        IM.prototype.sendMessage = function (pJID) 
    374369        { 
     
    391386 
    392387              envio.innerHTML = ''; 
    393          
     388 
    394389              var message_element = document.getElementById(pJID + '_chatMessages'); 
    395390              var nickname = "me "; 
     
    401396                          nickname = nickname.substr(nickname.indexOf(':') + 1 , nickname.length); 
    402397                  } 
    403                          
     398 
    404399              message_element.innerHTML += '<strong>' + nickname + ' '; 
    405400              message_element.innerHTML += ' ' + _this.get_lang('speak') + ':</strong><br/>'; 
    406401                  message_element.innerHTML += message_text + '<br/>'; 
    407402              message_element.scrollTop = message_element.scrollHeight; 
    408                  
     403 
    409404              var handler_sendMessage = function(data) 
    410405              { 
     
    416411           } 
    417412        }; 
    418          
     413 
    419414        IM.prototype.getComposing = function(data) 
    420415        { 
     
    429424                                                if ( composing.style.display = 'none' ) 
    430425                                                        composing.style.display = 'block'; 
    431                                                  
     426 
    432427                                if ( node.nodeName == 'paused' ) 
    433428                                        if ( (composing = func.byId(node.getAttribute('from') + '_composing')) ) 
     
    439434                } 
    440435        }; 
    441          
     436 
    442437        /* 
    443438         * Get_lang 
    444439         */ 
    445          
     440 
    446441        IM.prototype.get_lang = function(_key, _arg1, _arg2, _arg3, _arg4) 
    447442        { 
    448443           var _value = ""; 
    449          
     444 
    450445           if ( !lang_im[_key.toLowerCase()] ) 
    451446              return _key + "*"; 
    452          
     447 
    453448           _value = lang_im[_key.toLowerCase()]; 
    454          
     449 
    455450           if ( _arg1 || _arg2 ||_arg3 || _arg4 ) 
    456451           { 
     
    462457                 } 
    463458           } 
    464          
     459 
    465460           return _value; 
    466461        }; 
    467          
     462 
    468463        IM.prototype.getWinContactsState = function() 
    469464        { 
     
    474469                  win_state = ( win_state ) ? win_state : ( windowItems['contacts'].state == WINDOW_STATE_MAXIMIZED ) ? true : false; 
    475470              return win_state; 
    476                
     471 
    477472           }catch(e){} 
    478473        }; 
    479          
     474 
    480475        IM.prototype.showContacts = function() 
    481476        { 
     
    488483           } 
    489484        }; 
    490          
     485 
    491486   /* 
    492487        *  Smiles 
     
    503498       return pEmotion; 
    504499    } 
    505                  
     500 
    506501        IM.prototype.atalho = function() 
    507502        { 
     
    548543         * Vcard 
    549544         */ 
    550          
     545 
    551546        IM.prototype.requireVcard = function() 
    552547        { 
     
    561556                XMLTools.request('$this.Ujabber.requireVcard','GET',handler_getVcard); 
    562557        } 
    563          
     558 
    564559        IM.prototype.getVcard = function(data) 
    565560        { 
    566561                  var _this = this; 
    567562                  try 
    568                   {      
     563                  { 
    569564                             if ( data.getElementsByTagName('vcard').length > 0  && !_this.statusvcard ) 
    570565                             { 
     
    572567                                 var xsl = XMLTools.load(im_path + 'xsl/vcard_contacts.xsl?' + Date.parse(new Date)); 
    573568                                 _this.statusvcard = true; 
    574                                   
     569 
    575570                                 div.innerHTML = ""; 
    576571                                 div.innerHTML += XMLTools.transform(data, xsl); 
     
    580575                  }catch(e){} 
    581576 
    582                          
    583         }; 
    584          
     577 
     578        }; 
     579 
    585580        IM.prototype.open_chat = function(pJID) 
    586581        { 
    587582           im_win.open_chat(pJID); 
    588583        }; 
    589          
     584 
    590585        IM.prototype.action_button = function(pEv, pJid) 
    591586        { 
     
    618613                } 
    619614        }; 
    620          
     615 
    621616        IM.prototype.menu_button_right = function(pElement, pX, pY) 
    622617        { 
     
    637632        /* 
    638633         * Menu 
    639          */      
     634         */ 
    640635 
    641636        IM.prototype.menu_preferences = function() 
     
    644639                  var posy = 0; 
    645640                  var pEv = arguments[0]; 
    646                    
     641 
    647642                  if (pEv.pageX || pEv.pageY) 
    648643                  { 
     
    655650                          posy = pEv.clientY + document.body.scrollTop + document.documentElement.scrollTop; 
    656651                  } 
    657                          
     652 
    658653                  var p_element = document.getElementById(arguments[1]); 
    659                   var _xmlDoc = "";      
     654                  var _xmlDoc = ""; 
    660655                  var _this = this; 
    661656 
    662                   _xmlDoc = '<menu>' +   
    663                                                 '<item function="IM_Preferences.Add_userLoad()" lang="'+IM.get_lang('Add Contact')+'"/>' +       
     657                  _xmlDoc = '<menu>' + 
     658                                                '<item function="IM_Preferences.Add_userLoad()" lang="'+IM.get_lang('Add Contact')+'"/>' + 
    664659                                                '<item function="IM_Preferences.Remove_userLoad()" lang="'+IM.get_lang('Remove Contact')+'"/>' + 
    665660                                                '<item function="IM_Preferences.vCard()" lang="'+IM.get_lang('Information')+'"/>' + 
    666661                                                '<item function="IM_Preferences.yourPreferences()" lang="'+IM.get_lang('preferences')+'"/>' + 
    667662                                        '</menu>'; 
    668                    
     663 
    669664              im_menu_action.menu(p_element.id,parse_XmlXsl(_xmlDoc,'menu_preferences.xsl')); 
    670665              func.byId(p_element).style.top = posy; 
     
    674669              _this.Load_Images_menu(); 
    675670        } 
    676          
     671 
    677672        IM.prototype.Load_Images_menu = function(Element) 
    678673        { 
     
    681676                        var group = document.getElementById("dl_im_menu_preferences"); 
    682677                        var Child =  group.childNodes; 
    683                          
     678 
    684679                        for(var i = 0; i < Child.length; i++) 
    685680                        { 
     
    689684                        } 
    690685                }catch (e){} 
    691                        
    692686        } 
    693          
     687 
    694688   /* 
    695689        *  Função Provisória - By AlC 
     
    698692        function parse_XmlXsl(_xmlDoc, form_xsl) 
    699693        { 
    700                   var xslWin = false;      
    701                  
     694                  var xslWin = false; 
     695 
    702696                  if ( !xslWin ) xslWin = XMLTools.load(im_path + 'xsl/' + form_xsl + '?' + Date.parse(new Date)); 
    703          
     697 
    704698                  a = document.createElement('div'); 
    705699                  if (window.ActiveXObject) 
     
    715709                  } 
    716710                  a.innerHTML = XMLTools.transform(xmlDoc, xslWin); 
    717          
     711 
    718712                  return a; 
    719          
     713 
    720714        } 
    721715 
     
    724718                 var _dt = func.newEl('dt', 'dt', 'dt', 'dt', 'dt'); 
    725719                 var _a  = func.newEl('a', 'a', 'a', 'a', 'a'); 
    726                  
     720 
    727721                 for ( var i in _dt ) 
    728722                 { 
     
    732726                    eval('var option' + (parseInt(i)+1) + '_link = _a[' + i + '];'); 
    733727                 } 
    734                  
     728 
    735729                 var _img = func.newEl('img', 'img', 'img', 'img','img'); 
    736                  
     730 
    737731                 for ( var i in _img ) 
    738732                 { 
     
    741735                    eval('var option' + (parseInt(i)+1) + '_image = _img[' + i + '];'); 
    742736                 } 
    743                  
     737 
    744738                 option1_link.onclick = function(){statusFlag = 'available'; IM.setStatus('available');}; 
    745739                 option2_link.onclick = function(){statusFlag = 'xa'; IM.setStatus('xa');}; 
     
    747741                 option4_link.onclick = function(){statusFlag = 'unavailable'; IM.setStatus('unavailable');}; 
    748742                 option5_link.onclick = function(){IM.setStatus('custom')}; 
    749                  
     743 
    750744                 func.confEl(option1_image, 'src', img_available.src); 
    751745                 func.confEl(option1_image, 'style', 'width:16px;height:16px;cursor:pointer;'); 
     
    758752                 func.confEl(option5_image, 'src', img_edit.src); 
    759753                 func.confEl(option5_image, 'style', 'width:16px;height:16px;cursor:pointer;'); 
    760                  
     754 
    761755                 func.insEl(option1_image, IM.get_lang('online'), option1_link); 
    762756                 func.confEl(option1_link, 'style','cursor:pointer;'); 
     
    778772                 func.confEl(option5_link, 'style','cursor:pointer;'); 
    779773                 func.insEl(option5_link, option5); 
    780                  
     774 
    781775                 im_menu_action.menu('fast_menu_im', option1, option2, option3, option4, option5); 
    782776   }; 
     
    817811          catch(e){} 
    818812   }; 
    819     
     813 
    820814   IM.prototype.ImgStatus = function(pStatus) 
    821815   { 
     
    841835      } 
    842836   }; 
    843     
     837 
    844838   IM.prototype.infoContact = function(pUid) 
    845839   { 
Note: See TracChangeset for help on using the changeset viewer.