Ignore:
Timestamp:
05/04/10 16:36:51 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Implementado a parte de preferencias para mostrar ou não contatos offline.

Location:
sandbox/jabberit_messenger/trophy_expresso/js
Files:
2 edited

Legend:

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

    r2696 r2706  
    281281        } 
    282282         
     283        function getShowContactsOffline() 
     284        { 
     285                if( _preferencesIM[3] ) 
     286                { 
     287                        var showOffline = _preferencesIM[3].split(":"); 
     288                         
     289                        if( showOffline[1] === "true") 
     290                                return true; 
     291                        else 
     292                                return false; 
     293                } 
     294                 
     295                return true; 
     296        } 
     297 
    283298        function getUserCurrent() 
    284299        { 
     
    325340                                while( _elementNext ) 
    326341                                {        
    327                                         if( _elementNext.nodeType == 1 ) 
    328                                                 _elementNext.style.display = "block"; 
     342                                        if( _elementNext.nodeType == 1 && _elementNext.nodeName.toLowerCase() == "div") 
     343                                        { 
     344                                                var is_off = _elementNext.style.backgroundImage.indexOf("unavailable");  
     345 
     346                                                if( is_off > 0 && !getShowContactsOffline())     
     347                                                        _elementNext.style.display = "none"; 
     348                                                else 
     349                                                        _elementNext.style.display = "block"; 
     350                                        } 
    329351 
    330352                                        _elementNext = _elementNext.nextSibling; 
     
    515537                        'lang10' : 'Ausente', 
    516538                        'lang11' : 'Definir status de ausente depois de', 
    517                         'lang12' : 'minutos',                                               
     539                        'lang12' : 'minutos',    
     540                        'lang13' : 'Mostrar Contatos',   
     541                        'lang14' : 'Mostrar contatos desconectados', 
    518542                        'langYes': 'Sim', 
    519543                        'langNo' : 'Não'                                                                                            
     
    525549                                id_window        : "jabberit_preferences", 
    526550                                width            : 430, 
    527                                 height           : 330, 
     551                                height           : 410, 
    528552                                top                      : 150, 
    529553                                left             : 100, 
     
    571595                var element3    = document.getElementById(value3[0]); 
    572596                element3.value  = value3[1]; 
     597                 
     598                // Element showContactsOfflineJabberit 
     599                var value4                      = _preferencesIM[3].split(':'); 
     600                var element4            = document.getElementById(value4[0]); 
     601                var valueSelect4        = value4[1]; 
     602                for(var i = 0; i < element4.options.length; i++) 
     603                        if( element4.options[i].value == valueSelect4 ) 
     604                                element4.options[i].selected = true; 
    573605        } 
    574606         
     
    757789                        return false; 
    758790                } 
    759                  
    760                  
     791 
     792                // Element showContactsOfflineJabberit 
     793                var elementShowOffline  = document.getElementById('showContactsOfflineJabberit'); 
     794                 
     795                for(var i = 0 ; i < elementShowOffline.options.length; i++) 
     796                        if( elementShowOffline.options[i].selected == true) 
     797                        { 
     798                                _preferencesIM[3] = 'showContactsOfflineJabberit:' + elementShowOffline.options[i].value; 
     799                                value += '&preferences4=showContactsOfflineJabberit:' + elementShowOffline.options[i].value; 
     800                        } 
     801 
    761802                // Save Preferences 
    762803                conn.go('p.pf.setPreferences', 
     
    893934                        // Preferences 
    894935                        _preferencesIM = arguments[1].split(";"); 
    895  
     936                         
     937                        if( !_preferencesIM[3] ) _preferencesIM[3] = "showContactsOfflineJabberit:false"; 
     938                                 
    896939                        loadScripts(files); 
    897940                         
     
    946989        loadIM.prototype.configEvents           = configEvents; 
    947990        loadIM.prototype.getPhotoUser           = getPhotoUser; 
     991        loadIM.prototype.getShowContactsOffline = getShowContactsOffline; 
    948992        loadIM.prototype.getUserCurrent         = getUserCurrent; 
    949993        loadIM.prototype.getZIndex                      = getZindex; 
  • sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js

    r2678 r2706  
    10131013                                var element             = arguments[2]; 
    10141014                                var index               = arguments[3]; 
    1015  
     1015                                var showOffline = loadscript.getShowContactsOffline(); 
     1016                                 
    10161017                                var itensJid    = document.getElementById( 'itenContact_' + objContact.contact.jid + '_' + index ); 
    10171018 
     
    10571058                                        var paramsContact = 
    10581059                                        { 
    1059                                                 nameContact     : nameContact, 
    1060                                                 jid                             : objContact.contact.jid,        
     1060                                                divDisplay              : "block",  
    10611061                                                id                              : 'itenContact_' + objContact.contact.jid + '_' + index , 
    10621062                                                index                   : ((index == 0 ) ? "0" : index), 
     1063                                                jid                             : objContact.contact.jid, 
     1064                                                nameContact     : nameContact, 
    10631065                                                path_jabberit   : path_jabberit, 
    10641066                                                presence                : presence, 
     1067                                                spanDisplay             : statusDisplay, 
    10651068                                                status                  : status, 
    10661069                                                statusColor             : "black", 
    1067                                                 statusDisplay   : statusDisplay, 
    10681070                                                subscription    : objContact.contact.subscription 
    10691071                                        } 
     
    12051207                                        with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid + '_' + index ) ) 
    12061208                                        { 
    1207                                                 if( is_open > 0 ) 
     1209                                                /*if( is_open > 0 ) 
    12081210                                                { 
    12091211                                                        style.display   = statusDisplay; 
    12101212                                                        style.color             = statusColor; 
    12111213                                                        innerHTML               = status; 
     1214                                                }*/ 
     1215 
     1216                                                if( presence == "unavailable" && !showOffline ) 
     1217                                                { 
     1218                                                        style.display = "none"; 
     1219                                                } 
     1220                                                else 
     1221                                                { 
     1222                                                        if( is_open > 0 ) 
     1223                                                        { 
     1224                                                                style.display   = statusDisplay; 
     1225                                                                style.color             = statusColor; 
     1226                                                                innerHTML               = status; 
     1227                                                        } 
     1228                                                } 
     1229                                        } 
     1230                                         
     1231                                        if( presence == "unavailable" && !showOffline ) 
     1232                                                itensJid.style.display = "none"; 
     1233                                        else 
     1234                                        { 
     1235                                                if( is_open > 0 ) 
     1236                                                { 
     1237                                                        itensJid.style.display = "block"; 
    12121238                                                } 
    12131239                                        } 
    12141240                                         
    12151241                                        itensJid.style.background       = "url('"+path_jabberit+"templates/default/images/" + presence + ".gif') no-repeat center left"; 
     1242                                } 
     1243 
     1244                                // Contact OffLine 
     1245                                if( !objContact.presence && !showOffline ) 
     1246                                { 
     1247                                        with ( document.getElementById('span_show_' + 'itenContact_' + objContact.contact.jid + '_' + index )) 
     1248                                        { 
     1249                                                style.display   = "none"; 
     1250                                        } 
     1251 
     1252                                        with ( document.getElementById('itenContact_' + objContact.contact.jid + '_' + index ) ) 
     1253                                        { 
     1254                                                style.display   = "none"; 
     1255                                        } 
    12161256                                } 
    12171257                        } 
Note: See TracChangeset for help on using the changeset viewer.