Ignore:
Timestamp:
06/28/10 12:13:37 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #1116 - Melhorar a visualizacao/avisos de novos contatos e pedidos de autorizacao no modulo.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/jmessenger/js/jscode/loadIM.js

    r2969 r2975  
    5757                        var _element    = ( e.target ) ? e.target : e.srcElement; 
    5858                        var jid         = arguments[1]; 
    59                         var index       = arguments[2]; 
    6059                        var coord       = null; 
    6160 
     
    7978                        { 
    8079                                if( e.button > 1 ) 
    81                                         optionsItensContact( jid, index, coord ); 
     80                                        optionsItensContact( jid, coord ); 
    8281                                else 
    8382                                        TrophyIM.rosterClick(jid); 
     
    8685                        { 
    8786                                if( e.which > 1 ) 
    88                                         optionsItensContact( jid, index, coord ); 
     87                                        optionsItensContact( jid, coord ); 
    8988                                else 
    9089                                        if( e.target.id ) 
     
    281280                } 
    282281        } 
    283          
     282 
     283        function disabledNotificationNewUsers() 
     284        { 
     285                var _notification       = getElement('notification_new_users_jabber') ; 
     286                var _statusJabber       = getElement('status_jabber_expresso'); 
     287 
     288                _notification.style.display = 'none'; 
     289                 
     290                _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 
     291                 
     292                if( _timeOutNotification ) 
     293                        clearTimeout(_timeOutNotification ); 
     294                 
     295                TrophyIM.controll.notificationNewUsers = 0; 
     296        } 
     297         
     298        function enabledNotificationNewUsers() 
     299        { 
     300                var _notification       = getElement('notification_new_users_jabber') ; 
     301                var _statusJabber       = getElement('status_jabber_expresso'); 
     302         
     303                if( _notification && _statusJabber ) 
     304                {        
     305                        if ( _notification.style.display == 'none' ) 
     306                        { 
     307                                _notification.style.display = 'block'; 
     308                                 
     309                                _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/alert_mini.png') no-repeat"; 
     310                                 
     311                                if( _timeOutNotification ) 
     312                                        clearTimeout(_timeOutNotification ); 
     313 
     314                                _timeOutNotification = setTimeout( function(){ enabledNotificationNewUsers(); }, 2000 ); 
     315                        } 
     316                        else 
     317                        { 
     318                                _notification.style.display = 'none'; 
     319                                 
     320                                _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 
     321                                 
     322                                if( _timeOutNotification ) 
     323                                        clearTimeout(_timeOutNotification ); 
     324 
     325                                _timeOutNotification = setTimeout( function(){ enabledNotificationNewUsers(); }, 800 ); 
     326                        } 
     327                } 
     328        } 
     329 
    284330        function fastMenu() 
    285331        { 
     
    579625                { 
    580626                        var jid         = arguments[0]; 
    581                         var index       = arguments[1]; 
    582                         var coord       = arguments[2]; 
    583                         var element = getElement('itenContact_' + jid + '_' + index ); 
     627                        var coord       = arguments[1]; 
     628                        var element = getElement('itenContact_' + jid ); 
    584629                        var action      = ( element.getAttribute("subscription") === "not-in-roster" ) ? "Adicionar" : "Autorizar";      
    585630                         
     
    588633 
    589634                        var _options = [ 
    590                                                 [ action , 'loadscript.setAutorization(\''+jid+'\',\''+index+'\')'], 
    591                                                 ['Remover' , 'loadscript.removeContact(\''+jid+'\',\''+index+'\')'], 
    592                                                 ['Renomear' , 'loadscript.renameContact(\''+jid+'\',\''+index+'\')'], 
    593                                                 ['Trocar grupo' , 'loadscript.renameGroup(\''+jid+'\',\''+index+'\')'] 
     635                                                [ action , 'loadscript.setAutorization(\''+jid+'\')'], 
     636                                                ['Remover' , 'loadscript.removeContact(\''+jid+'\')'], 
     637                                                ['Renomear' , 'loadscript.renameContact(\''+jid+'\')'], 
     638                                                ['Trocar grupo' , 'loadscript.renameGroup(\''+jid+'\')'] 
    594639                                                   ]; 
    595640 
     
    709754        } 
    710755         
    711         function removeContact(jid, index) 
    712         { 
    713                 setTimeout(function() 
    714                 { 
    715                         TrophyIM.removeContact(jid, index); 
    716                          
    717                 },300); 
     756        function removeContact( jid ) 
     757        { 
     758                TrophyIM.removeContact( jid ); 
    718759        } 
    719760         
     
    742783                { 
    743784                        var _jid        = arguments[0]; 
    744                         var _index      = arguments[1]; 
    745                          
    746                         TrophyIM.renameContact( _jid, _index ); 
     785                         
     786                        TrophyIM.renameContact( _jid ); 
    747787                } 
    748788        } 
     
    753793                { 
    754794                        var _jid        = arguments[0]; 
    755                         var _index      = arguments[1]; 
    756                          
    757                         TrophyIM.renameGroup( _jid , _index ); 
     795                         
     796                        TrophyIM.renameGroup( _jid ); 
    758797                } 
    759798        } 
     
    815854        } 
    816855         
    817         function setAutorization(jidTo, indexTo) 
    818         { 
    819         var divItenContact = null; 
    820          
    821         if( ( divItenContact = getElement('itenContact_' + jidTo + '_' + indexTo ))) 
     856        function setAutorization() 
     857        { 
     858                var divItenContact = null; 
     859                 
     860                if( arguments.length > 0 ) 
     861                { 
     862                        var jidTo = arguments[0]; 
     863                 
     864                        if( getElement('itenContact_' + jidTo) ) 
     865                                divItenContact = getElement('itenContact_' + jidTo ); 
     866                } 
     867                 
     868        if( divItenContact ) 
    822869        {        
    823870                var subscription = divItenContact.getAttribute('subscription'); 
    824                  
     871 
    825872                switch(subscription) 
    826873                { 
     
    845892                                        if( ( _add = confirm("Deseja adicionar o usuario!")) )           
    846893                                        { 
    847                                                 addUser.add( jidTo, indexTo ); 
     894                                                addUser.add( jidTo ); 
    848895                                        } 
    849896                                         
     
    863910                                         
    864911                                default : 
     912                                        alert( "SEM PARAMETRO DEFINIDO : " + subscription ); 
    865913                                         
    866                                         alert( "DEFAULT : " + subscription ); 
    867914                } 
    868         }        
     915        } 
     916         
     917        setTimeout(function() 
     918        { 
     919                        if( getElement('itenContactNotification_' + jidTo ) ) 
     920                                loadscript.removeElement( getElement('itenContactNotification_' + jidTo ) ); 
     921        },500); 
     922     
    869923        } 
    870924         
     
    11701224                                        var _user       = _users.createElement('user'); 
    11711225                                        var _jid        = _users.createElement('jid'); 
    1172                                         var _index      = _users.createElement('index'); 
     1226                                        var _status     = _users.createElement('status'); 
    11731227                                        _jid.appendChild( _users.createTextNode(TrophyIM.rosterObj.roster[user].contact.jid) ); 
    1174                                         _index.appendChild( _users.createTextNode("0")); 
     1228                                        _status.appendChild( _users.createTextNode( _subscription ) ); 
    11751229                                        _user.appendChild( _jid ); 
    1176                                         _user.appendChild( _index ); 
     1230                                        _user.appendChild( _status ); 
    11771231                                        _users.documentElement.appendChild( _user ); 
    11781232                                } 
     
    12061260                _winBuild( winNotification ); 
    12071261        } 
    1208          
    1209         function teste_new() 
    1210         { 
    1211                 var _notification       = getElement('notification_new_users_jabber') ; 
    1212                 var _statusJabber       = getElement('status_jabber_expresso'); 
    1213          
    1214                 if( _notification && _statusJabber ) 
    1215                 {        
    1216                         if ( _notification.style.display == 'none' ) 
    1217                         { 
    1218                                 _notification.style.display = 'block'; 
    1219                                  
    1220                                 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/alert_mini.png') no-repeat"; 
    1221                                  
    1222                                 if( _timeOutNotification ) 
    1223                                         clearTimeout(_timeOutNotification ); 
    1224  
    1225                                 _timeOutNotification = setTimeout( function(){ teste_new(); }, 2000 ); 
    1226                         } 
    1227                         else 
    1228                         { 
    1229                                 _notification.style.display = 'none'; 
    1230                                  
    1231                                 _statusJabber.style.background = "url('"+path_jabberit+"templates/default/images/" + statusUserIM + ".gif') no-repeat"; 
    1232                                  
    1233                                 if( _timeOutNotification ) 
    1234                                         clearTimeout(_timeOutNotification ); 
    1235  
    1236                                 _timeOutNotification = setTimeout( function(){ teste_new(); }, 800 ); 
    1237                         } 
    1238                 } 
    1239         } 
    1240          
    1241          
    1242         loadIM.prototype.teste_new = teste_new; 
    1243          
    1244          
     1262 
    12451263        function loadIM() 
    12461264        { 
     
    13201338        loadIM.prototype.clrAllContacts         = clrAllContacts; 
    13211339        loadIM.prototype.configEvents           = configEvents; 
     1340        loadIM.prototype.disabledNotificationNewUsers   = disabledNotificationNewUsers; 
     1341        loadIM.prototype.enabledNotificationNewUsers    = enabledNotificationNewUsers;   
    13221342        loadIM.prototype.getIsIE                        = getIsIE; 
    13231343        loadIM.prototype.getPhotoUser           = getPhotoUser; 
Note: See TracChangeset for help on using the changeset viewer.