Ignore:
Timestamp:
03/30/10 17:28:36 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Lista de contatos refeita e mudanças nos carregamentos dos layouts(xsl).

Location:
sandbox/jabberit_messenger/trophy
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy/index.html

    r2271 r2390  
    22<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"> 
    33        <head> 
    4                 <title>.: Modificado :.</title> 
     4                <title>.: IM - Expresso :.</title> 
    55                <script type='text/javascript' src='js/loadIM.js'></script> 
    6  
    76        </head> 
    87        <body> 
    9                 <div id='trophyimclient' /> 
    10                 <script type='text/javascript' src='js/trophyim.js'></script> 
     8                <span onclick="TrophyIM.load();" style="cursor:pointer;">Clique Aqui - Carregar IM</span> 
    119        </body> 
    1210</html> 
  • sandbox/jabberit_messenger/trophy/js/loadIM.js

    r2345 r2390  
    11(function() 
    22{ 
     3        var jid                         = ""; 
    34        var path                        = "/jmessenger/"; 
    45        var _showhidden         = null; 
    56        var _xtools                     = null; 
     7        var userCurrent         = null; 
    68        var zIndex                      = 9001; 
    7  
    89         
    910        function actionButton() 
     
    3132        function addContacts() 
    3233        { 
    33                 /* 
    34                 var jid         = 'contact@servidor_jabber'; 
    35                 var name        = 'Nome Contato'; 
    36                 var group       = 'CONTATOS'; 
    37                  
    38                 TrophyIM.addContacts( jid, name, group ); 
    39                 */ 
     34                if( arguments.length > 0 ) 
     35                { 
     36                        var jidFrom             = getUserCurrent().jid; 
     37                        var jidTo               = arguments[0]; 
     38                        var name                = arguments[1]; 
     39                        var group               = arguments[2]; 
     40                         
     41                        TrophyIM.addContacts( jidFrom, jidTo, name, group ); 
     42                } 
    4043        } 
    4144         
     
    5457        } 
    5558         
    56         function TrophyIMLoggingDiv() 
    57         { 
    58                 return '<div id="trophyimlog"/>'; 
    59         } 
    60          
    61         function TrophyIMLoginPage() 
     59        function loginPage() 
    6260        { 
    6361                setXTools(); 
     
    8280        } 
    8381         
    84         function TrophyIMRosterDiv() 
     82        function rosterDiv() 
    8583        { 
    8684                setXTools();                     
     
    109107                return new ( function( ) 
    110108                { 
    111                         this.loggingDiv         = TrophyIMLoggingDiv; 
    112                  
    113                         this.loginPage          = TrophyIMLoginPage; 
    114                                  
    115                         this.rosterDiv          = TrophyIMRosterDiv; 
    116                 } ); 
    117         } 
    118          
     109                        this.loginPage          = loginPage; 
     110                        this.rosterDiv          = rosterDiv; 
     111                }); 
     112        } 
     113         
     114        function getUserCurrent() 
     115        { 
     116                return userCurrent; 
     117        } 
    119118         
    120119        function getZindex() 
     
    215214 
    216215                        var _options = [ 
    217                                                 ['Autorizar', 'Autorizar : ' + jid ], 
     216                                                ['Autorizar', 'TrophyIM.setAutorization(\''+jid+'\')' ], 
    218217                                                ['Remover', 'Remover : ' + jid ], 
    219218                                                ['Renomear', 'Renomear : ' + jid], 
     
    225224                        for( var i in _options ) 
    226225                        { 
    227                                 _itens += '<img src="images/arrow_right.gif"/><span style="cursor:pointer; margin:3px;" onclick="alert(\'' +_options[i][1] + '\');">'; 
     226                                _itens += '<img src="images/arrow_right.gif"/><span style="cursor:pointer; margin:3px;" onclick='+_options[i][1]+'>'; 
    228227                                _itens += _options[i][0] + '</span><br/>'; 
    229228                        } 
     
    295294        } 
    296295         
     296        function setUserCurrent( _jid , _password ) 
     297        { 
     298                userCurrent =  
     299                { 
     300                        'jid'           : _jid, 
     301                        'password'      : _password 
     302                } 
     303        } 
     304         
    297305        function setXTools() 
    298306        { 
     
    308316                                 'js/makeW.js', 
    309317                                 'js/show_hidden.js', 
    310                                  'css/trophyim.css', 
     318                                 'js/trophyim.js', 
     319                                 //'css/trophyim.css', 
    311320                                 //'css/window_azul.css' 
    312321                                 //'css/window_cataratas.css' 
     
    320329                 
    321330                loadScripts(files); 
    322                  
    323331        } 
    324332         
     
    326334        loadIM.prototype.addContacts            = addContacts; 
    327335        loadIM.prototype.configEvents           = configEvents; 
     336        loadIM.prototype.getUserCurrent         = getUserCurrent; 
    328337        loadIM.prototype.getZIndex                      = getZindex; 
    329338        loadIM.prototype.groupsHidden           = groupsHidden; 
     
    332341        loadIM.prototype.setPresence            = setPresence; 
    333342        loadIM.prototype.setStatusJabber        = setStatusJabber; 
     343        loadIM.prototype.setUserCurrent         = setUserCurrent; 
    334344         
    335345        loadIM.prototype.HTMLSnippets           = new HTMLSnippets; 
  • sandbox/jabberit_messenger/trophy/js/makeW.js

    r2290 r2390  
    33        var _xtools             = null; 
    44        var dragDrop    = null; 
    5         var path                = "/teste_interno/trophyNew/"; 
     5        var path                = "/jmessenger/"; 
    66         
    77        function build(pObj) 
  • sandbox/jabberit_messenger/trophy/js/trophyim.js

    r2345 r2390  
    3030*/ 
    3131 
    32 var TROPHYIM_BOSH_SERVICE       = '/proxy/xmpp-httpbind';  //Change to suit 
     32var TROPHYIM_BOSH_SERVICE       = "/proxy/xmpp-httpbind";  //Change to suit 
     33 
    3334var TROPHYIM_LOG_LINES          = 200; 
    3435 
    35 //0=debug, 1=info, 2=warn, 3=error, 4=fatal 
    36 var TROPHYIM_LOGLEVEL           = 0;  
     36var TROPHYIM_LOGLEVEL           = 0; //0=debug, 1=info, 2=warn, 3=error, 4=fatal  
    3737 
    3838var TROPHYIM_VERSION            = "0.3"; 
     
    5555 *  auto-included by the client. 
    5656 */ 
    57  
    58 /** Object: HTMLSnippets 
    59  * 
    60  *  This is the repository for all the html snippets that TrophyIM uses 
    61  * 
    62  */ 
    63  
    64 HTMLSnippets = { 
    65  
    66         //chatBox               : loadIM.HTMLSnippets.chatBox( ), 
    67  
    68         //chatTab               : loadIM.HTMLSnippets.chatTab( ), 
    69  
    70         loggingDiv      : loadIM.HTMLSnippets.loggingDiv( ), 
    71      
    72         rosterDiv       : loadIM.HTMLSnippets.rosterDiv( ), 
    73 }; 
    7457 
    7558/** Object: DOMObjects 
     
    262245        { 
    263246                TrophyIM.cookies        = TrophyIM.getCookies(); 
    264  
    265                 TrophyIM.client_div = document.getElementById('trophyimclient'); 
     247                //TrophyIM.client_div = document.getElementById('trophyimclient'); 
    266248 
    267249        //Load other .js scripts needed 
     
    274256                //Wait a second to give scripts time to load 
    275257                setTimeout("TrophyIM.showLogin()", 500); 
    276  
    277258   }, 
    278259    
     
    283264   storeData : function() 
    284265   { 
    285         if (TrophyIM.connection && TrophyIM.connection.connected) 
     266        if ( TrophyIM.connection && TrophyIM.connection.connected ) 
    286267                { 
    287268            TrophyIM.setCookie('trophyim_bosh_xid', TrophyIM.connection.jid + "|" + 
     
    296277     *   exists, or creating a new one of we are re-attaching. 
    297278     */ 
    298     showLogin : function() { 
     279    showLogin : function() 
     280        { 
    299281        //JSON is the last script to load, so we wait on it 
    300282        //Added Strophe check too because of bug where it's sometimes missing 
     
    308290                TrophyIM.delCookie('trophyim_bosh_xid'); 
    309291                TrophyIM.constants.stale_roster = true; 
    310                 if (TrophyIM.cookies['trophyimloglevel']) 
    311                 { 
    312                     TrophyIM.client_div.appendChild(DOMObjects.getHTML('loggingDiv')); 
    313                     TrophyIM.logging_div = document.getElementById('trophyimlog'); 
    314                 } 
    315                 TrophyIM.connection = new Strophe.Connection(TROPHYIM_BOSH_SERVICE); 
    316                 TrophyIM.connection.rawInput = TrophyIM.rawInput; 
    317                 TrophyIM.connection.rawOutput = TrophyIM.rawOutput; 
     292                         
     293                                TrophyIM.connection                             = new Strophe.Connection(TROPHYIM_BOSH_SERVICE); 
     294                TrophyIM.connection.rawInput    = TrophyIM.rawInput; 
     295                TrophyIM.connection.rawOutput   = TrophyIM.rawOutput; 
    318296                Strophe.log = TrophyIM.log; 
    319297                Strophe.info('Attempting Strophe attach.'); 
     
    323301            else 
    324302            { 
    325                 var logging_div = TrophyIM.clearClient(); 
    326                 loadIM.HTMLSnippets.loginPage(); 
     303                                // List Contact 
     304                                loadIM.HTMLSnippets.rosterDiv(); 
     305                                 
     306                                if ( loadIM.getUserCurrent() != null ) 
     307                                { 
     308                                        TrophyIM.login( loadIM.getUserCurrent().jid, loadIM.getUserCurrent().password ); 
     309                                } 
     310                                else 
     311                                { 
     312                                        loadIM.HTMLSnippets.loginPage(); 
     313                                } 
    327314            } 
    328315        } 
     
    353340        } 
    354341    }, 
     342         
    355343    /** Function: rawInput 
    356344     * 
    357345     *  This logs the packets actually recieved by strophe at the debug level 
    358346     */ 
    359     rawInput : function (data) { 
     347    rawInput : function (data) 
     348        { 
    360349        Strophe.debug("RECV: " + data); 
    361350    }, 
     351         
    362352    /** Function: rawInput 
    363353     * 
    364354     *  This logs the packets actually recieved by strophe at the debug level 
    365355     */ 
    366     rawOutput : function (data) { 
     356    rawOutput : function (data) 
     357        { 
    367358        Strophe.debug("SEND: " + data); 
    368359    }, 
     360         
    369361    /** Function: login 
    370362     * 
     
    376368    login : function() 
    377369        { 
    378         if (document.getElementById('trophyimloglevel').checked) { 
    379             TrophyIM.setCookie('trophyimloglevel', 1); 
    380             if (!document.getElementById('trophyimlog')) { 
    381                 TrophyIM.client_div.appendChild(DOMObjects.getHTML('loggingDiv')); 
    382                 TrophyIM.logging_div = document.getElementById('trophyimlog'); 
    383             } 
    384         } else { 
    385             TrophyIM.delCookie('trophyimloglevel'); 
    386             if (document.getElementById('trophyimlog')) { 
    387                 TrophyIM.client_div.removeChild(document.getElementById( 
    388                 'trophyimlog')); 
    389                 TrophyIM.logging_div = null; 
    390             } 
    391         } 
    392         if (TrophyIM.JSONStore.store_working) { //In case they never logged out 
    393             TrophyIM.JSONStore.delData(['groups','roster', 'active_chat', 
    394             'chat_history']); 
    395         } 
    396         TrophyIM.connection = new Strophe.Connection(TROPHYIM_BOSH_SERVICE); 
    397         TrophyIM.connection.rawInput = TrophyIM.rawInput; 
    398         TrophyIM.connection.rawOutput = TrophyIM.rawOutput; 
     370                if (TrophyIM.JSONStore.store_working) 
     371                {  
     372                   //In case they never logged out 
     373            TrophyIM.JSONStore.delData(['groups','roster', 'active_chat', 'chat_history']); 
     374        } 
     375         
     376                TrophyIM.connection                             = new Strophe.Connection(TROPHYIM_BOSH_SERVICE); 
     377        TrophyIM.connection.rawInput    = TrophyIM.rawInput; 
     378        TrophyIM.connection.rawOutput   = TrophyIM.rawOutput; 
    399379        Strophe.log = TrophyIM.log; 
    400         var barejid  = document.getElementById('trophyimjid').value 
    401         var fulljid = barejid + TROPHYIM_RESOURCE; 
    402         TrophyIM.setCookie('trophyimjid', barejid); 
    403         var password = document.getElementById('trophyimpass').value; 
    404         var button = document.getElementById('trophyimconnect'); 
    405         if (button.value == 'connect') { 
    406             button.value = 'disconnect'; 
    407             TrophyIM.connection.connect(fulljid, password, TrophyIM.onConnect); 
    408         } else { 
    409             button.value = 'connect'; 
    410             TrophyIM.connection.disconnect(); 
    411         } 
    412  
    413     }, 
    414     /** Function: login 
     380         
     381                if ( arguments.length > 0 ) 
     382                { 
     383                        var barejid = arguments[0]; 
     384                        var password = arguments[1]; 
     385                         
     386                        TrophyIM.connection.connect(barejid + TROPHYIM_RESOURCE, password, TrophyIM.onConnect); 
     387                } 
     388                else 
     389                { 
     390                        var barejid             = document.getElementById('trophyimjid').value 
     391                        var fulljid             = barejid + TROPHYIM_RESOURCE; 
     392                        var password    = document.getElementById('trophyimpass').value; 
     393                        var button              = document.getElementById('trophyimconnect'); 
     394                         
     395                        loadIM.setUserCurrent( barejid, password); 
     396                         
     397                        if ( button.value == 'connect' ) 
     398                        { 
     399                                button.value = 'disconnect'; 
     400                                TrophyIM.connection.connect(fulljid, password, TrophyIM.onConnect); 
     401                        } 
     402                        else 
     403                        { 
     404                                button.value = 'connect'; 
     405                                TrophyIM.connection.disconnect(); 
     406                        } 
     407                } 
     408 
     409                TrophyIM.setCookie('trophyimjid', barejid); 
     410 
     411    }, 
     412         
     413    /** Function: logout 
    415414     * 
    416415     *  Logs into fresh session through Strophe, purging any old data. 
     
    420419        TrophyIM.delCookie('trophyim_bosh_xid'); 
    421420        delete TrophyIM['cookies']['trophyim_bosh_xid']; 
    422         if (TrophyIM.JSONStore.store_working) 
     421         
     422                if (TrophyIM.JSONStore.store_working) 
    423423                { 
    424424            TrophyIM.JSONStore.delData(['groups','roster', 'active_chat', 'chat_history']); 
     
    435435                 
    436436    }, 
     437         
    437438    /** Function onConnect 
    438439     * 
     
    468469        TrophyIM.setCookie('trophyim_bosh_xid', TrophyIM.connection.jid + "|" + 
    469470        TrophyIM.connection.sid + "|" +  TrophyIM.connection.rid); 
    470         var logging_div = TrophyIM.clearClient(); 
     471        //var logging_div = TrophyIM.clearClient(); 
    471472         
    472         if( logging_div ) 
     473        /*if( logging_div ) 
    473474                { 
    474475            TrophyIM.client_div.appendChild(logging_div); 
    475476            TrophyIM.logging_div = document.getElementById('trophyimlog'); 
    476         } 
     477        }*/ 
    477478                 
    478479        TrophyIM.rosterObj = new TrophyIMRoster(); 
     
    528529    onRoster : function(msg) 
    529530        { 
    530         Strophe.debug("Roster handler"); 
     531                //Strophe.debug("Roster handler"); 
     532                 
    531533        var roster_items = msg.firstChild.getElementsByTagName('item'); 
    532                 for (var i = 0; i < roster_items.length; i++) { 
    533             var groups = roster_items[i].getElementsByTagName('group'); 
     534                 
     535                for (var i = 0; i < roster_items.length; i++) 
     536                { 
     537                        var groups = roster_items[i].getElementsByTagName('group'); 
    534538            var group_array = new Array(); 
    535             for (var g = 0; g < groups.length; g++) { 
    536                 group_array[group_array.length] = 
    537                 groups[g].firstChild.nodeValue; 
    538             } 
    539             TrophyIM.rosterObj.addContact(roster_items[i].getAttribute('jid'), 
    540             roster_items[i].getAttribute('subscription'), 
    541             roster_items[i].getAttribute('name'), group_array); 
    542         } 
    543         if (msg.getAttribute('type') == 'set') { 
    544             TrophyIM.connection.send($iq({type: 'reply', id: 
     539             
     540                        for (var g = 0; g < groups.length; g++) 
     541                        { 
     542                                group_array[group_array.length] = groups[g].firstChild.nodeValue; 
     543            } 
     544                        with ( roster_items[i] ) 
     545                        { 
     546                                TrophyIM.rosterObj.addContact(getAttribute('jid'), getAttribute('subscription'), getAttribute('name'), group_array); 
     547                        } 
     548        } 
     549         
     550                if ( msg.getAttribute('type') == 'set' ) 
     551                { 
     552                        TrophyIM.connection.send($iq({type: 'reply', id: 
    545553            msg.getAttribute('id'), to: msg.getAttribute('from')}).tree()); 
    546554        } 
    547         return true; 
     555         
     556                return true; 
    548557    }, 
    549558    /** Function: onPresence 
     
    657666         */ 
    658667         
    659         addContacts : function( jid, name, group ) 
    660         { 
    661                 var newPresence = $pres({from:'alexandrecorreia@ecelepar10612.celepar.parana', to: jid, type: 'subscribe'}).tree(); 
     668        addContacts : function( jidFrom, jidTo, name, group ) 
     669        { 
     670                var newPresence = $pres({from: jidFrom, to: jidTo, type: 'subscribe'}).tree(); 
    662671                 
    663672                TrophyIM.connection.send(newPresence); 
     
    700709                if( TrophyIM.rosterObj.changes.length > 0 ) 
    701710                { 
    702                         var roster_div = document.getElementById('trophyimroster'); 
     711                        var roster_div = document.getElementById('JabberIMRoster'); 
    703712                         
    704713                        if( roster_div ) 
    705714                        { 
     715                                var users = new Array(); 
     716                                 
     717                                for( var user in TrophyIM.rosterObj.roster ) 
     718                                { 
     719                                        users[users.length] = TrophyIM.rosterObj.roster[user].contact.jid; 
     720                                } 
     721                                 
     722                                users.sort(); 
     723                                 
    706724                                var groups = new Array(); 
    707725                                 
    708                 for (var group in TrophyIM.rosterObj.groups) 
     726                                for (var group in TrophyIM.rosterObj.groups) 
    709727                                { 
    710                                         groups[groups.length] = ( group ) ? group : "SEM GRUPO"; 
     728                                        if( group ) 
     729                                                groups[groups.length] = group; 
    711730                } 
    712731                 
    713732                                groups.sort(); 
    714  
     733                                 
    715734                                for ( var i = 0; i < groups.length; i++ ) 
    716735                                { 
    717                                          
    718                                         TrophyIM.renderGroups( groups[i] , roster_div );         
     736                                        TrophyIM.renderGroups( groups[i] , roster_div.lastChild );       
    719737                                } 
    720738                                 
    721                                 TrophyIM.renderItensGroup( roster_div ); 
     739                                TrophyIM.renderItensGroup(users, roster_div); 
    722740                        } 
    723741                } 
    724742                         
    725                 setTimeout("TrophyIM.renderRoster()", 1000 );            
     743                //setTimeout("TrophyIM.renderRoster()", 1000 );          
     744                setTimeout("TrophyIM.renderRoster()", 2000 ); 
    726745        }, 
    727  
     746         
    728747    /** Function: renderGroups 
    729748     * 
     
    731750     */ 
    732751         
    733         renderGroups: function( nameGroup, elementParent ) 
     752        renderGroups: function( nameGroup, element ) 
    734753        { 
    735754                var _addGroup = function() 
     
    738757                        { 
    739758                                'nameGroup' : arguments[0], 
    740                                 'id'            : (( arguments[0] == "SEM GRUPO" ) ? "sem_grupo_jabber" : "" ) 
    741759                        } 
    742760                         
    743                         elementParent.innerHTML += loadIM.parse("group","groups.xsl", paramsGroup); 
     761                        element.innerHTML += loadIM.parse("group","groups.xsl", paramsGroup); 
     762                         
    744763                } 
    745                  
    746                 if( !elementParent.hasChildNodes() ) 
     764 
     765                if( !element.hasChildNodes() ) 
    747766                { 
    748767                        _addGroup(nameGroup);    
     
    750769                else 
    751770                { 
    752                         var elementChild = elementParent.firstChild; 
     771                        var elementChild = element; 
    753772                        var flag = false; 
    754773                         
    755774                        while ( elementChild ) 
    756775                        { 
    757                                 if ( elementChild.childNodes[0].childNodes[0].nodeValue === nameGroup ) 
     776                                if ( elementChild.childNodes[0].childNodes[0].firstChild.nodeValue === nameGroup ) 
    758777                                { 
    759                                         flag = true;     
     778                                        flag = true; 
    760779                                } 
     780                                 
    761781                                elementChild = elementChild.nextSibling; 
    762782                        } 
    763783                         
    764784                        if( !flag ) 
    765                                 _addGroup(nameGroup); 
     785                                _addGroup( nameGroup ); 
    766786                } 
    767                          
     787                 
    768788        }, 
    769789 
     
    773793     */ 
    774794 
    775         renderItensGroup : function( elementParent ) 
    776         { 
    777                 var _addItensGroup = function() 
     795        renderItensGroup : function( users, element ) 
     796        { 
     797                var addItemGroup = function() 
    778798                { 
    779799                        if( arguments.length > 0 ) 
     
    781801                                var objContact  = arguments[0]; 
    782802                                var element             = arguments[1]; 
    783                                 var itensGroup  = document.getElementById('itenContact_' + objContact.contact.jid); 
    784  
    785                                 if ( itensGroup == null ) 
     803                                var itensJid    = document.getElementById( 'itenContact_' + objContact.contact.jid ); 
     804                                 
     805                                if( itensJid == null ) 
    786806                                { 
    787807                                        // Name 
    788808                                        var nameContact = "";                                    
    789809                                         
    790                                         if (objContact.contact.name)  
     810                                        if ( objContact.contact.name )  
    791811                                                nameContact = objContact.contact.name; 
    792812                                        else 
     
    825845                                        } 
    826846                                         
    827                                         element.innerHTML += loadIM.parse("itens_group", "itensGroup.xsl", paramsContact); 
     847                                        if( element.id == "rosterIM_with_groups" ) 
     848                                        { 
     849                                                var elementChild = element; 
     850                                 
     851                                                while ( elementChild ) 
     852                                                { 
     853                                                        if( elementChild.childNodes[0].childNodes[0].firstChild.nodeValue == objContact.contact.groups[0] ) 
     854                                                                elementChild.childNodes[0].innerHTML += loadIM.parse("itens_group", "itensGroup.xsl", paramsContact); 
     855 
     856                                                        elementChild = elementChild.nextSibling; 
     857                                                } 
     858                                        } 
     859                                        else 
     860                                        { 
     861                                                element.innerHTML += loadIM.parse("itens_group", "itensGroup.xsl", paramsContact);                                                       
     862                                        } 
    828863                                } 
    829864                                else 
    830865                                { 
     866                                         
    831867                                        // Presence e Status 
    832868                                        var presence            = "unavailable"; 
     
    848884                                        } 
    849885 
    850                                         itensGroup.style.background                     = "url('images/" + presence + ".gif')no-repeat center left"; 
    851                                         itensGroup.lastChild.style.display      = statusDisplay; 
    852                                         itensGroup.lastChild.innerHTML          = " ( " + status + " ) "; 
     886                                        itensJid.style.background                       = "url('images/" + presence + ".gif')no-repeat center left"; 
     887                                        itensJid.lastChild.style.display        = statusDisplay; 
     888                                        itensJid.lastChild.innerHTML            = " ( " + status + " ) "; 
    853889                                } 
    854890                        } 
    855891                } 
    856892                 
    857                 for ( var userItem in TrophyIM.rosterObj.roster) 
    858                 { 
    859                         if ( TrophyIM.rosterObj.roster[userItem].contact.groups ) 
    860                         { 
    861                                 var elementChild = elementParent.firstChild 
    862                                  
    863                                 while ( elementChild ) 
    864                                 { 
    865                                         if( elementChild.childNodes[0].childNodes[0].nodeValue == TrophyIM.rosterObj.roster[userItem].contact.groups ) 
    866                                                 _addItensGroup( TrophyIM.rosterObj.roster[userItem], elementChild ); 
    867                                                  
    868                                         elementChild = elementChild.nextSibling; 
    869                                 } 
    870                         } 
     893                for( var i = 0 ; i < users.length; i++ ) 
     894                { 
     895                        if( TrophyIM.rosterObj.roster[users[i]].contact.groups ) 
     896                                if( TrophyIM.rosterObj.roster[users[i]].contact.groups[0] ) 
     897                                        addItemGroup(TrophyIM.rosterObj.roster[users[i]], element.lastChild ); 
     898                                else 
     899                                        addItemGroup(TrophyIM.rosterObj.roster[users[i]], element.firstChild ); 
    871900                        else 
    872                         { 
    873                                 var elementChild = document.getElementById("sem_grupo_jabber"); 
    874                                  
    875                                 _addItensGroup( TrophyIM.rosterObj.roster[userItem], elementChild ); 
    876                         } 
    877                 } 
     901                                addItemGroup(TrophyIM.rosterObj.roster[users[i]], element.firstChild ); 
     902                }        
    878903        }, 
    879          
     904 
    880905    /** Function: rosterClick 
    881906     * 
     
    888913    }, 
    889914 
    890         setPresence : function() 
    891         { 
    892                 if( arguments.length > 0 ) 
    893                 { 
    894                         TrophyIM.connection.send($pres( ).c('show').t(arguments[0]).tree()); 
    895                 } 
     915 
     916        /** Function SetAutorization 
     917         *  
     918         */ 
     919 
     920        setAutorization : function( jid ) 
     921        { 
     922           //<presence to='user@example.com' from='contact@example.org' type='subscribed'/> 
     923           //var _autorization = $pres( ).attrs( {to: jid, from: loadIM.getUserCurrent(), type:'subscribed'}).tree(); 
     924                 
     925           TrophyIM.connection.send($pres( ).attrs( {to: jid, from: loadIM.getUserCurrent().jid, type:'subscribed'}).tree()); 
     926        }, 
     927     
     928        /** Function: setPresence 
     929     * 
     930     */ 
     931 
     932        setPresence : function( show ) 
     933        { 
     934                TrophyIM.connection.send($pres( ).c('show').t(show).tree()); 
    896935        }, 
    897936         
     
    9761015     */ 
    9771016     
    978         this.addContact = function(jid, subscription, name, groups) { 
    979         var contact = {jid:jid, subscription:subscription, name:name, groups:groups} 
     1017        this.addContact = function(jid, subscription, name, groups) 
     1018        { 
     1019        var contact = { jid:jid, subscription:subscription, name:name, groups:groups } 
    9801020        var jid_lower = jid.toLowerCase(); 
    981         if (this.roster[jid_lower]) { 
     1021 
     1022                if ( this.roster[jid_lower] ) 
     1023                { 
    9821024            this.roster[jid_lower]['contact'] = contact; 
    983         } else { 
     1025        } 
     1026                else 
     1027                { 
    9841028            this.roster[jid_lower] = {contact:contact}; 
    9851029        } 
    986         groups = groups ? groups : ['']; 
    987         for (var g = 0; g < groups.length; g++) { 
    988             if (!this.groups[groups[g]]) { 
     1030 
     1031                groups = groups ? groups : ['']; 
     1032         
     1033                for ( var g = 0; g < groups.length; g++ ) 
     1034                { 
     1035                        if ( !this.groups[groups[g]] ) 
     1036                        { 
    9891037                this.groups[groups[g]] = {}; 
    9901038            } 
    991             this.groups[groups[g]][jid_lower] = jid_lower; 
     1039             
     1040                        this.groups[groups[g]][jid_lower] = jid_lower; 
    9921041        } 
    9931042    } 
     
    9981047     *  Parameter: (String) jid - jid to return 
    9991048     */ 
    1000     this.getContact = function(jid) { 
    1001         if (this.roster[jid.toLowerCase()]) { 
     1049    this.getContact = function(jid) 
     1050        { 
     1051        if (this.roster[jid.toLowerCase()]) 
     1052                { 
    10021053            return this.roster[jid.toLowerCase()]['contact']; 
    10031054        } 
     
    10131064     *    (String) status: status attribute from presence 
    10141065     */ 
    1015     this.setPresence = function(fulljid, priority, show, status) 
     1066     
     1067        this.setPresence = function(fulljid, priority, show, status) 
    10161068        { 
    10171069                var barejid = Strophe.getBareJidFromJid(fulljid); 
     
    13441396 * Bootstrap self into window.onload and window.onunload 
    13451397 */ 
     1398 
     1399/* 
    13461400var oldonload = window.onload; 
    1347 window.onload = function() { 
    1348     if(oldonload) { 
     1401window.onload = function() 
     1402{ 
     1403    if(oldonload) 
     1404        { 
    13491405        oldonload(); 
    13501406    } 
    1351     TrophyIM.load(); 
     1407     
     1408        TrophyIM.load(); 
    13521409}; 
     1410*/ 
     1411 
    13531412var oldonunload = window.onunload; 
    1354 window.onunload = function() { 
    1355     if(oldonunload) { 
     1413window.onunload = function() 
     1414{ 
     1415    if(oldonunload) 
     1416        { 
    13561417        oldonunload(); 
    13571418    } 
    1358     TrophyIM.storeData(); 
     1419     
     1420        TrophyIM.storeData(); 
    13591421} 
  • sandbox/jabberit_messenger/trophy/xsl/contactsList.xsl

    r2345 r2390  
    2121                        <div style="positon: absolute; margin-top: -75px; margin-left: 75px;"> Fulano da Silva </div> 
    2222                </fieldset> 
    23                                  
    24                 <div id="trophyimroster" style="margin-top:3px;"/> 
     23 
     24                <div id="JabberIMRoster" style="margin-top:3px; overflow-y: auto;">                              
     25                        <div id="rosterIM_without_groups" />     
     26                        <div id="rosterIM_with_groups" /> 
     27                </div> 
    2528                  
    2629        </xsl:template> 
  • sandbox/jabberit_messenger/trophy/xsl/groups.xsl

    r2339 r2390  
    88        <xsl:template match="group"> 
    99 
    10                         <div id="{$id}" style="margin-bottom: 3px;"> 
     10                        <div style="margin-bottom: 3px;"> 
    1111                                <span  onclick="loadIM.groupsHidden(this);" style="background: url('images/arrow_down.gif')no-repeat center left;font-weight:bold; padding-left: 16px; cursor: pointer;"> 
    1212                                        <xsl:value-of select="$nameGroup"/> 
  • sandbox/jabberit_messenger/trophy/xsl/itensGroup.xsl

    r2345 r2390  
    1313 
    1414                        <div id="{$id}" onmousedown="loadIM.actionButton(event,'{$jid}');" style="background: url('images/{$presence}.gif')no-repeat center left; padding-left: 18px; margin:2px 0px 5px 10px; cursor:pointer;"> 
    15                                 <xsl:value-of select="$nameContact"/> <br/> 
     15                                <xsl:value-of select="$nameContact"/><br/> 
    1616                                <span style="font-size: 8pt; font-style:italic; display:{$statusDisplay};"><xsl:value-of select="$status"/></span> 
    1717                        </div> 
  • sandbox/jabberit_messenger/trophy/xsl/loginPage.xsl

    r2271 r2390  
    1919                                        <tr> 
    2020                                                <td colspan="2" align="center"> 
    21                                                         <input type='checkbox' id='trophyimloglevel' alt="Logging" title="Logging"/> 
    2221                                                        <input type="button" id="trophyimconnect" value="connect" onclick="TrophyIM.login()"/> 
    2322                                                </td> 
Note: See TracChangeset for help on using the changeset viewer.