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
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy_expresso/inc/preferencesJMessenger.php

    r2696 r2706  
    2525                        $preferences .= ";". $pArgs['preferences3']; 
    2626 
     27                if(isset($pArgs['preferences4'])) 
     28                        $preferences .= ";". $pArgs['preferences4']; 
     29 
    2730                return setPreferences($preferences); 
    2831        } 
  • 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                        } 
  • sandbox/jabberit_messenger/trophy_expresso/xsl/contactsList.xsl

    r2670 r2706  
    1919                                        <img src="{$path_jabberit}/templates/default/images/users.png"/> 
    2020                                </button> 
     21                                 
     22                                <img style="height:15px; margin-left:10px;cursor:pointer;" alt="Minhas Preferências" title="Minhas Preferências" src="{$path_jabberit}/templates/default/images/preferences.png" onclick="loadscript.preferences();"/> 
     23                                 
     24                                <img style="height:16px; margin-left:10px;cursor:pointer;" alt="Help" title="Help" src="{$path_jabberit}/templates/default/images/help.png" onclick="alert('2');" /> 
    2125                        </div> 
    2226 
     
    2731                        </div> 
    2832                         
    29                         <div id="JabberIMRosterLoadingGif" style="position:absolute; left:80px; top:72px; display:block;"> 
     33                        <div id="JabberIMRosterLoadingGif" style="position:absolute; left:85px; top:72px; display:block;"> 
    3034                                        <img src='{$path_jabberit}/templates/default/images/loading.gif' style="width:20px; height:20px;"/> 
    3135                                        <span style="color:red;">Carregando...</span> 
  • sandbox/jabberit_messenger/trophy_expresso/xsl/itensGroup.xsl

    r2670 r2706  
    33        <xsl:output method="html" omit-xml-declaration="yes"/> 
    44         
    5         <xsl:param name="nameContact" /> 
    6         <xsl:param name="jid"/> 
     5        <xsl:param name="divDisplay" /> 
    76        <xsl:param name="id" /> 
    87        <xsl:param name="index" /> 
     8        <xsl:param name="jid"/> 
     9        <xsl:param name="nameContact" /> 
    910        <xsl:param name="path_jabberit" /> 
    1011        <xsl:param name="presence" /> 
     12        <xsl:param name="spanDisplay"/> 
    1113        <xsl:param name="status"/> 
    1214        <xsl:param name="statusColor" /> 
    13         <xsl:param name="statusDisplay"/> 
    1415        <xsl:param name="subscription" /> 
    1516         
    1617        <xsl:template match="itens_group"> 
    1718 
    18                         <div id="{$id}" subscription="{$subscription}" onmousedown="loadscript.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;"> 
     19                        <div id="{$id}" subscription="{$subscription}" onmousedown="loadscript.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; display:{$divDisplay};"> 
    1920                                <xsl:value-of select="$nameContact"/> 
    2021                        </div> 
    21                         <span id="span_show_{$id}" style="margin:2px 0px 0px 10px; font-size: 10px; font-style:italic; display:{$statusDisplay}; color:{$statusColor};"><xsl:value-of select="$status"/></span> 
     22                        <span id="span_show_{$id}" style="margin:2px 0px 0px 10px; font-size: 10px; font-style:italic; display:{$spanDisplay}; color:{$statusColor};"><xsl:value-of select="$status"/></span> 
    2223                         
    2324        </xsl:template> 
  • sandbox/jabberit_messenger/trophy_expresso/xsl/preferences.xsl

    r2696 r2706  
    1414        <xsl:param name="lang11" /> 
    1515        <xsl:param name="lang12" /> 
     16        <xsl:param name="lang13" /> 
     17        <xsl:param name="lang14" /> 
    1618        <xsl:param name="langYes" /> 
    1719        <xsl:param name="langNo" />              
     
    2931                                </select> 
    3032                        </fieldset> 
    31                         <fieldset style="height:60px;margin-bottom:6px;padding:5px; border:1px solid #cecece;"> 
     33                        <fieldset style="height:60px;margin-top:6px;padding:5px; border:1px solid #cecece;"> 
    3234                                <legend><xsl:value-of select="$lang8"/></legend> 
    3335                                <br/> 
     
    4345                                <label><xsl:value-of select="$lang11"/><input id="flagAwayIM" type="text" size="2" maxlength="2" style="margin-left:4px; margin-right:4px;" onclick="this.select();" /><xsl:value-of select="$lang12"/></label> 
    4446                        </fieldset> 
     47                         
     48                        <fieldset style="height:60px;margin-top:6px;padding:5px; border:1px solid #cecece;"> 
     49                                <legend><xsl:value-of select="$lang13"/></legend>                        
     50                                <br/> 
     51                                <label><xsl:value-of select="$lang14"/> .: </label> 
     52                                <select id="showContactsOfflineJabberit"> 
     53                                        <option value="true"><xsl:value-of select="$langYes"/></option> 
     54                                        <option value="false"><xsl:value-of select="$langNo"/></option>                                  
     55                                </select> 
     56                        </fieldset> 
     57                         
    4558                </fieldset> 
    4659 
Note: See TracChangeset for help on using the changeset viewer.