Changeset 2491


Ignore:
Timestamp:
04/12/10 15:50:03 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Implementado a parte de autorização ( to, from, both ). Ainda em teste.

Location:
sandbox/jabberit_messenger/trophy_expresso
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy_expresso/js/loadIM.js

    r2471 r2491  
    3232                                var e = window.event; 
    3333                         
    34                         ( ( e.target ) ? e.target : e.srcElement ).oncontextmenu = function(e) 
     34                        ( ( e.target ) ? e.target : e.srcElement ).parentNode.oncontextmenu = function(e) 
    3535                        { 
    3636                                return false; 
     
    4040                                optionsItensContact(jid, index); 
    4141                        else 
    42                                 TrophyIM.rosterClick(jid); 
     42                        { 
     43                                if ( e.target.id ) 
     44                                        TrophyIM.rosterClick(jid); 
     45                        } 
    4346                } 
    4447        } 
     
    299302        } 
    300303 
    301          
    302304        function optionsItensContact() 
    303305        { 
     
    312314 
    313315                        var _options = [ 
    314                                                 ['Autorizar', 'TrophyIM.setAutorization(\''+jid+'\')'], 
    315                                                 ['Remover', 'loadIM.removeContact(\''+jid+'\')'], 
     316                                                ['Autorizar', 'loadIM.setAutorization(\''+jid+'\',\''+index+'\')'], 
     317                                                ['Remover', 'loadIM.removeContact(\''+jid+'\',\''+index+'\')'], 
    316318                                                ['Renomear', 'Renomear : ' + jid], 
    317319                                                ['Trocar grupo', 'Trocar grupo : ' + jid], 
     
    323325                        { 
    324326                                _itens += '<img src="'+arrow_right.src+'"/>'; 
    325                                 _itens += '<span style="cursor:pointer; margin:3px; font-weight:normal;" onclick='+_options[i][1]+'>'; 
     327                                _itens += '<span style="cursor:pointer;margin:3px;font-weight:normal;" onclick='+_options[i][1]+'>'; 
    326328                                _itens += _options[i][0] + '</span><br/>'; 
    327329                        } 
    328330                         
    329331                        var _optionsItens = document.createElement("div"); 
    330                                 _optionsItens.setAttribute("style", "margin: -5px 0px 0px 20px;"); 
     332                                _optionsItens.setAttribute("style", "margin: -10px 0px 0px 20px;"); 
    331333                                _optionsItens.className         = "x-menu"; 
    332334                                _optionsItens.style.zIndex      = '99999'; 
    333335                                _optionsItens.innerHTML         = _itens;   
    334                                 _optionsItens.onclick           = function(){ showhidden.hiddenObject(false); };                                           
     336                                _optionsItens.onmouseout        = function(){ showhidden.hiddenObject(false); };         
     337                                _optionsItens.onmouseover       = function(){ showhidden.hiddenObject(true); }; 
    335338                                 
    336339                                showhidden.action('onmouseover', 'onmouseout', _optionsItens); 
    337340                                 
    338                         element.onmouseout      = function(){ showhidden.hiddenObject(false); }; 
    339                         element.onmouseover     = function(){ showhidden.hiddenObject(true); }; 
    340                         element.appendChild( _optionsItens ); 
    341                 } 
    342                  
     341                        element.appendChild(_optionsItens); 
     342                } 
    343343        } 
    344344 
     
    352352        } 
    353353         
    354         function removeContact(jid) 
     354        function removeContact(jid, index) 
    355355        { 
    356356                setTimeout(function() 
    357357                { 
    358                         TrophyIM.removeContact(jid); 
    359                          
    360                 }, 500); 
     358                        TrophyIM.removeContact(jid, index); 
     359                         
     360                },300); 
    361361        } 
    362362         
     
    367367                if( _parent.childNodes.length <= 2 ) 
    368368                        _parent.parentNode.removeChild(_parent); 
    369                  
    370369        } 
    371370         
     
    407406        } 
    408407         
    409         function setSelectEditable(element) 
    410         { 
    411                 if( document.getElementById('selectBox0') == null ) 
    412                         selectEditable.create(element); 
     408        function setAutorization(jidTo, indexTo) 
     409        { 
     410        var divItenContact = null; 
     411         
     412        if( ( divItenContact = document.getElementById('itenContact_' + jidTo + '_' + indexTo ))) 
     413        {        
     414                var subscription = divItenContact.getAttribute('subscription'); 
     415                 
     416                switch(subscription) 
     417                { 
     418                        case 'from': 
     419                        case 'not-in-roster': 
     420                                        TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribe'); 
     421                                        break; 
     422                        case 'to' : 
     423                                        TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribed'); 
     424                                break; 
     425                } 
     426        }        
    413427        } 
    414428         
     
    452466                } 
    453467        } 
    454          
     468 
     469        function setSelectEditable(element) 
     470        { 
     471                if( document.getElementById('selectBox0') == null ) 
     472                        selectEditable.create(element); 
     473        } 
     474 
    455475        function setStatusJabber() 
    456476        { 
     
    538558        loadIM.prototype.parse                          = parse; 
    539559        loadIM.prototype.searchUser                     = searchUser 
     560        loadIM.prototype.setAutorization        = setAutorization; 
    540561        loadIM.prototype.setPresence            = setPresence; 
    541562        loadIM.prototype.setStatusJabber        = setStatusJabber; 
  • sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js

    r2471 r2491  
    615615            var jid_lower       = barejid.toLowerCase(); 
    616616            var contact         = ""; 
    617                  
     617            contact                     = barejid.toLowerCase(); 
     618                contact                 = contact.substring(0, contact.indexOf('@')); 
     619             
    618620            if( TrophyIM.rosterObj.roster[barejid] ) 
    619621            { 
     
    623625                    } 
    624626            } 
    625             else 
    626             { 
    627                 contact = barejid.toLowerCase(); 
    628                 contact = contact.substring(0, contact.indexOf('@')); 
    629             }    
    630              
     627 
    631628            var message =  
    632629            {  
     
    670667        { 
    671668                titleWindow = barejid.toLowerCase(); 
    672                 titleWindow = contact.substring(0, contact.indexOf('@')); 
     669                titleWindow = titleWindow.substring(0, titleWindow.indexOf('@')); 
    673670        }        
    674671 
     
    721718         
    722719        // Add Contact 
    723         var _id = TrophyIM.connection.getUniqueId();  
     720        var _id = TrophyIM.connection.getUniqueId('add');  
    724721                var newContact = $iq({type: 'set', id: _id }); 
    725722                        newContact = newContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); 
     
    755752     */ 
    756753     
    757     removeContact : function(jidTo) 
     754    removeContact : function(jidTo, indexTo) 
    758755    { 
    759         var divItenContact = null; 
     756        var divItenContact       = null; 
     757        var spanShow             = null; 
    760758         
    761         if( ( divItenContact = document.getElementById('itenContact_' + jidTo))) 
     759        if( ( divItenContact = document.getElementById('itenContact_' + jidTo + '_' + indexTo ))) 
    762760        {        
     761                spanShow = document.getElementById('span_show_itenContact_' + jidTo + '_' + indexTo ) 
     762                 
     763                spanShow.parentNode.removeChild(spanShow); 
     764                 
    763765                loadIM.removeGroup( divItenContact.parentNode ); 
    764766                 
     
    766768                 
    767769                // Remove Contact 
    768                         var _id = TrophyIM.connection.getUniqueId();     
     770                        var _id = TrophyIM.connection.getUniqueId('del');        
    769771                var delContact  = $iq({type: 'set', id: _id}) 
    770772                        delContact      = delContact.c('query').attrs({xmlns : 'jabber:iq:roster'}); 
     
    808810            } 
    809811             
    810                         if( !flagGeral ) 
     812                        if( !flagGeral && users.length > 0 ) 
    811813                                groups[groups.length] = "Geral"; 
    812814                                 
     
    889891                                var element             = arguments[2]; 
    890892                                var index               = arguments[3]; 
    891                                  
     893 
    892894                                var itensJid    = document.getElementById( 'itenContact_' + objContact.contact.jid + '_' + index ); 
    893895                                 
     
    934936                                                'presence'              : presence, 
    935937                                                'status'                : status, 
    936                                                 'statusDisplay' : statusDisplay 
     938                                                'statusDisplay' : statusDisplay, 
     939                                                'subscription'  : objContact.contact.subscription 
    937940                                        } 
    938941                                         
     
    966969                                                for ( var resource in objContact.presence ) 
    967970                                                { 
    968                                                         presence = objContact.presence[resource].show; 
    969                                                          
     971                                                        if( objContact.presence[resource].show != 'invisible' ) 
     972                                                                presence = objContact.presence[resource].show; 
     973 
    970974                                                        if( objContact.presence[resource].status ) 
    971975                                                        { 
     
    990994                                        itensJid.style.background       = "url('"+path_jabberit+"templates/default/images/" + presence + ".gif')no-repeat center left"; 
    991995                                } 
    992                                  
    993996                        } 
    994997                } 
     
    10321035         */ 
    10331036 
    1034         setAutorization : function( jid ) 
    1035         { 
    1036            TrophyIM.connection.send($pres( ).attrs( {to: jid, from: loadIM.getUserCurrent().jid, type:'subscribed'}).tree()); 
     1037        setAutorization : function( jidTo, jidFrom, _typeSubscription ) 
     1038        { 
     1039        var _id = TrophyIM.connection.getUniqueId(); 
     1040         
     1041        TrophyIM.connection.send($pres( ).attrs( {to: jidTo, from: jidFrom, type: _typeSubscription, id: _id}).tree()); 
    10371042        }, 
    10381043     
     
    12681273                var groups = this.roster[ jid ].contact.groups; 
    12691274                 
    1270                 for ( var i = 0; i < groups.length; i++ ) 
    1271                 { 
    1272                         delete this.groups[ groups[ i ] ][ jid ]; 
    1273                 } 
    1274  
    1275                 for ( var i = 0; i < groups.length; i++ ) 
    1276                 { 
    1277                         var contacts = 0; 
    1278                         for ( var contact in this.groups[ groups[ i ] ] ) 
    1279                                 contacts++; 
    1280  
    1281                         if ( ! contacts ) 
    1282                                 delete this.groups[ groups[ i ] ]; 
     1275                if( groups ) 
     1276                { 
     1277                         
     1278                        for ( var i = 0; i < groups.length; i++ ) 
     1279                        { 
     1280                                delete this.groups[ groups[ i ] ][ jid ]; 
     1281                        } 
     1282 
     1283                        for ( var i = 0; i < groups.length; i++ ) 
     1284                        { 
     1285                                var contacts = 0; 
     1286                                for ( var contact in this.groups[ groups[ i ] ] ) 
     1287                                        contacts++; 
     1288         
     1289                                if ( ! contacts ) 
     1290                                        delete this.groups[ groups[ i ] ]; 
     1291                        } 
    12831292                } 
    12841293 
  • sandbox/jabberit_messenger/trophy_expresso/xsl/contactsList.xsl

    r2471 r2491  
    2525                </fieldset> 
    2626                                 
    27                 <div id="JabberIMRoster" style="margin-top:3px; overflow-y: auto;"></div> 
     27                <div id="JabberIMRoster" style="margin-top:3px;overflow-y: auto; height: 267px;"></div> 
    2828                  
    2929        </xsl:template> 
  • sandbox/jabberit_messenger/trophy_expresso/xsl/itensGroup.xsl

    r2471 r2491  
    1111        <xsl:param name="status"/> 
    1212        <xsl:param name="statusDisplay"/> 
     13        <xsl:param name="subscription" /> 
    1314         
    1415        <xsl:template match="itens_group"> 
    1516 
    16                         <div id="{$id}" onmousedown="loadIM.actionButton(event,'{$jid}','{$index}');" style="background: url('{$path_jabberit}templates/default/images/{$presence}.gif')no-repeat center left; padding-left: 20px; margin:2px 0px 0px 10px; cursor:pointer; font-weight:normal;"> 
     17                        <div id="{$id}" subscription="{$subscription}" onmousedown="loadIM.actionButton(event,'{$jid}','{$index}');" style="background: url('{$path_jabberit}templates/default/images/{$presence}.gif')no-repeat center left; padding-left: 20px; margin:2px 0px 0px 10px; cursor:pointer; font-weight:normal;"> 
    1718                                <xsl:value-of select="$nameContact"/> 
    1819                        </div> 
    1920                        <span id="span_show_{$id}" style="margin:2px 0px 0px 10px; font-size: 8pt; font-style:italic; display:{$statusDisplay};"><xsl:value-of select="$status"/></span> 
     21                         
    2022        </xsl:template> 
    2123         
Note: See TracChangeset for help on using the changeset viewer.