Ignore:
Timestamp:
04/16/10 18:15:47 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Alterado a parte de autorizacao, informando se o usuario esta permitido ou nao na lista.

File:
1 edited

Legend:

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

    r2511 r2577  
    2828                        var jid         = arguments[1]; 
    2929                        var index       = arguments[2]; 
     30                        var coord       = null; 
    3031                 
    3132                        if ( !e ) 
    3233                                var e = window.event; 
    33                          
    34                         ( ( e.target ) ? e.target : e.srcElement ).parentNode.oncontextmenu = function(e) 
     34 
     35                        var _X = e.clientX + document.body.scrollLeft - document.body.clientLeft; 
     36                        var _Y = e.clientY + document.body.scrollTop  - document.body.clientTop; 
     37                                 
     38                        coord = { X : _X, Y : _Y }; 
     39                         
     40                        window.document.oncontextmenu = function() 
    3541                        { 
    3642                                return false; 
     
    3844         
    3945                        if ( ( e.which && e.which > 1 ) || ( e.button && e.button > 1 ) ) 
    40                                 optionsItensContact(jid, index); 
     46                        { 
     47                                optionsItensContact( jid, index, coord ); 
     48                        } 
    4149                        else 
    4250                        { 
     
    321329                        var jid         = arguments[0]; 
    322330                        var index       = arguments[1]; 
    323                         var element = document.getElementById('itenContact_' + jid + '_' + index ); 
     331                        var coord       = arguments[2]; 
     332                        var element = getElement('itenContact_' + jid + '_' + index ); 
     333 
    324334                         
    325335                        if( showhidden == null ) 
     
    329339                                                ['Autorizar', 'loadIM.setAutorization(\''+jid+'\',\''+index+'\')'], 
    330340                                                ['Remover', 'loadIM.removeContact(\''+jid+'\',\''+index+'\')'], 
    331                                                 ['Renomear', 'Renomear : ' + jid], 
    332                                                 ['Trocar grupo', 'Trocar grupo : ' + jid], 
     341                                                ['Renomear', 'loadIM.rename()'], 
     342                                                ['Trocar grupo', 'loadIM.rename()'], 
    333343                                                   ]; 
    334344 
     
    343353                         
    344354                        var _optionsItens = document.createElement("div"); 
    345                                 _optionsItens.setAttribute("style", "margin: -10px 0px 0px 20px;"); 
    346355                                _optionsItens.className         = "x-menu"; 
    347                                 _optionsItens.style.zIndex      = zIndex++; 
     356                                _optionsItens.style.top         = coord.Y; 
     357                                _optionsItens.style.left        = ( coord.X - element.offsetLeft ); 
     358                                _optionsItens.style.zIndex      = getZindex(); 
    348359                                _optionsItens.innerHTML         = _itens;   
     360                                _optionsItens.onclick           = function(){ showhidden.hiddenObject(false); }; 
    349361                                _optionsItens.onmouseout        = function(){ showhidden.hiddenObject(false); };         
    350362                                _optionsItens.onmouseover       = function(){ showhidden.hiddenObject(true); }; 
     
    352364                                showhidden.action('onmouseover', 'onmouseout', _optionsItens); 
    353365                                 
    354                         element.appendChild(_optionsItens); 
     366                        window.document.body.appendChild(_optionsItens); 
     367                         
     368                         
     369                        setTimeout(function() 
     370                        { 
     371                                window.document.oncontextmenu = function() 
     372                                { 
     373                                        return true; 
     374                                }; 
     375                                 
     376                        },500); 
    355377                } 
    356378        } 
     
    374396        } 
    375397         
     398        function removeElement( ) 
     399        { 
     400                if( arguments.length > 0 ) 
     401                { 
     402                        var _element = arguments[0]  
     403                        var _parent  = _element.parentNode; 
     404         
     405                        _parent.removeChild( _element ); 
     406                } 
     407        } 
     408         
    376409        function removeGroup() 
    377410        { 
     
    380413                if( _parent.childNodes.length <= 2 ) 
    381414                        _parent.parentNode.removeChild(_parent); 
     415        } 
     416         
     417        function rename() 
     418        { 
     419                alert("Rename"); 
    382420        } 
    383421         
     
    416454        function searchUser() 
    417455        { 
    418                 var _input      = document.getElementById('search_user_jabber'); 
     456                var _input      = getElement('search_user_jabber'); 
    419457                 
    420458                if( _input.value.length >= 3 ) 
     
    428466        var divItenContact = null; 
    429467         
    430         if( ( divItenContact = document.getElementById('itenContact_' + jidTo + '_' + indexTo ))) 
     468        if( ( divItenContact = getElement('itenContact_' + jidTo + '_' + indexTo ))) 
    431469        {        
    432470                var subscription = divItenContact.getAttribute('subscription'); 
     
    435473                { 
    436474                        case 'from': 
     475                                 
     476                                alert('SUBSCRIPTION FROM'); 
     477                                //TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribed'); 
     478                                //TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribe'); 
     479                                break; 
     480 
     481                        case 'none' : 
     482                         
     483                                TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribe'); 
     484                                TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribed'); 
     485                                 
     486                                break; 
     487 
    437488                        case 'not-in-roster': 
    438                                         TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribe'); 
     489                                         
     490                                setTimeout(function() 
     491                                        { 
     492                                        var _add = ""; 
     493                                 
     494                                        if( ( _add = confirm("Deseja adicionar o usuario!")) )           
     495                                        { 
     496                                                addUser.add( jidTo, indexTo ); 
     497                                        } 
     498                                         
     499                                        },100); 
     500                                 
    439501                                        break; 
     502                                         
    440503                        case 'to' : 
    441                                         TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribed'); 
    442                                 break; 
     504                                 
     505                                TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribed'); 
     506                                         
     507                        case 'subscribe' : 
     508                                 
     509                                TrophyIM.setAutorization( jidTo, this.getUserCurrent().jid, 'subscribe'); 
     510                                 
     511                                        break; 
    443512                } 
    444513        }        
     
    488557        function setSelectEditable(element) 
    489558        { 
    490                 if( document.getElementById('selectBox0') == null ) 
     559                if( getElement('selectBox0') == null ) 
    491560                        selectEditable.create(element); 
    492561        } 
     
    586655        loadIM.prototype.setSelectEditable      = setSelectEditable; 
    587656        loadIM.prototype.removeContact          = removeContact; 
     657        loadIM.prototype.removeElement          = removeElement; 
    588658        loadIM.prototype.removeGroup            = removeGroup; 
     659        loadIM.prototype.rename                         = rename; 
    589660        loadIM.prototype.rosterDiv                      = rosterDiv; 
    590661         
Note: See TracChangeset for help on using the changeset viewer.