Ignore:
Timestamp:
05/05/10 14:58:58 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Implementado a forma de informar um status de message tb pela lista de contatos.

Location:
sandbox/jabberit_messenger/trophy_expresso
Files:
3 edited

Legend:

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

    r2706 r2711  
    1010        var selectEditable      = null; 
    1111        var showhidden          = null; 
     12        var _statusMessage      = ""; 
    1213        var timeoutId           = null; 
    1314        var userCurrent         = null; 
     
    9697                        return; 
    9798                } 
     99                 
    98100                /**************************************************************************/ 
    99101                 
     
    169171                        if( _status == "xa" ) 
    170172                        { 
    171                                 TrophyIM.setPresence("available"); 
     173                                if( getStatusMessage() != "") 
     174                                        TrophyIM.setPresence("available", getStatusMessage()); 
     175                                else 
     176                                        TrophyIM.setPresence("available"); 
     177                                 
    172178                                loadscript.setStatusJabber("Disponível","available"); 
    173179                        } 
     
    194200                        if( _status == "available" ) 
    195201                        { 
    196                                 TrophyIM.setPresence("xa"); 
     202                                if(getStatusMessage() != "") 
     203                                        TrophyIM.setPresence("xa", getStatusMessage()); 
     204                                else 
     205                                        TrophyIM.setPresence("xa"); 
     206                                 
    197207                                loadscript.setStatusJabber("Não Disponível","xa"); 
    198208                        } 
     
    279289                        _divPhoto.style.backgroundImage = 'url(' + _imgUser + ')'; 
    280290                } 
     291        } 
     292         
     293        function getStatusMessage() 
     294        { 
     295                return _statusMessage; 
    281296        } 
    282297         
     
    747762        } 
    748763         
     764        function setMessageStatus() 
     765        { 
     766                if( arguments.length > 0 ) 
     767                { 
     768                        var _element = arguments[0]; 
     769                        var _parent      = _element.parentNode;                  
     770 
     771                        if( _element.nodeName.toLowerCase() == "label") 
     772                        { 
     773                                var _input                              = document.createElement("input");  
     774                                        _input.size                     = "35"; 
     775                                        _input.maxlength        = "35"; 
     776                                        _input.style.border = "0"; 
     777                                        _input.value            = _element.innerHTML; 
     778                                         
     779                                // OnkeyUp 
     780                                configEvents( _input, "onkeyup", function(e) 
     781                                                { 
     782                                                        if( e.keyCode == 13 ) loadscript.setMessageStatus(_input, _element); 
     783                                                } 
     784                                ); 
     785                                 
     786                                // Onblur        
     787                            configEvents(_input, "onblur", function(){ loadscript.setMessageStatus(_input, _element)});          
     788 
     789                             
     790                                if( _parent != null ) 
     791                                {        
     792                                        // Remove label 
     793                                        if( _element != null ) 
     794                                                _parent.removeChild( _element ); 
     795                                                 
     796                                        // Add Input 
     797                                        if( _input != null )  
     798                                                _parent.appendChild( _input ); 
     799                                } 
     800 
     801                                _input.focus(); 
     802                                _input.select(); 
     803                        } 
     804                        else 
     805                        { 
     806                                var _label              = arguments[1]; 
     807                                _statusMessage  = _element.value.replace(/^\(+|\)+$/g,""); 
     808                                 
     809                                if( ( _statusMessage = _statusMessage.replace(/^\s+|\s+$|^\n|\n$/g,"") ) != "") 
     810                                        _label.innerHTML = "( " + _statusMessage + " )"; 
     811                                else 
     812                                        _label.innerHTML = "( Digite aqui sua mensagem de Status )"; 
     813                                 
     814                                if( _parent != null ) 
     815                                {        
     816                                        // Remove Input 
     817                                        if( _element != null ) 
     818                                                _parent.removeChild( _element ); 
     819                                                 
     820                                        // Add Label 
     821                                        if( _label != null )  
     822                                                _parent.appendChild( _label ); 
     823                                } 
     824                                 
     825                                // Send Status Message 
     826                                TrophyIM.setPresence("status", _statusMessage ); 
     827                        }        
     828                } 
     829        } 
    749830         
    750831        function setPreferences() 
     
    9891070        loadIM.prototype.configEvents           = configEvents; 
    9901071        loadIM.prototype.getPhotoUser           = getPhotoUser; 
     1072        loadIM.prototype.getStatusMessage       = getStatusMessage; 
    9911073        loadIM.prototype.getShowContactsOffline = getShowContactsOffline; 
    9921074        loadIM.prototype.getUserCurrent         = getUserCurrent; 
     
    10011083        loadIM.prototype.searchUser                     = searchUser 
    10021084        loadIM.prototype.setAutorization        = setAutorization; 
     1085        loadIM.prototype.setMessageStatus       = setMessageStatus; 
    10031086        loadIM.prototype.setPreferences         = setPreferences; 
    10041087        loadIM.prototype.setPresence            = setPresence; 
  • sandbox/jabberit_messenger/trophy_expresso/js/trophyim.js

    r2706 r2711  
    13521352                                } 
    13531353                                else 
    1354                                         TrophyIM.connection.send($pres( ).c('show').t(_type).tree()); 
     1354                                { 
     1355                                        if( loadscript.getStatusMessage() != "" ) 
     1356                                        { 
     1357                                                var _presence = $pres( ); 
     1358                                                _presence.node.appendChild( Strophe.xmlElement( 'show' ) ).appendChild( Strophe.xmlTextNode( _type ) ); 
     1359                                                _presence.node.appendChild( Strophe.xmlElement( 'status' ) ).appendChild( Strophe.xmlTextNode( loadscript.getStatusMessage() )); 
     1360                                                 
     1361                                                TrophyIM.connection.send( _presence.tree() ); 
     1362                                        } 
     1363                                        else 
     1364                                        { 
     1365                                                TrophyIM.connection.send($pres( ).c('show').t(_type).tree()); 
     1366                                        } 
     1367                                } 
    13551368                        } 
    13561369                } 
     
    13601373                        var _status     = ""; 
    13611374                         
    1362                         if (( _status = prompt("Digite sua mensagem !") )) 
    1363                         { 
    1364                                 for(var resource in TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence ) 
    1365                                 { 
    1366                                 if ( TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[ resource ].constructor == Function ) 
    1367                                         continue; 
    1368                                  
    1369                                         if ( TROPHYIM_RESOURCE === ("/" + resource) ) 
    1370                                                 _show = TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[resource].show; 
    1371                                 } 
    1372  
    1373                                 var _presence = $pres( ); 
    1374                                 _presence.node.appendChild( Strophe.xmlElement( 'show' ) ).appendChild( Strophe.xmlTextNode( _show ) ); 
    1375                                 _presence.node.appendChild( Strophe.xmlElement( 'status' ) ).appendChild( Strophe.xmlTextNode( _status ) ); 
     1375                        if( arguments.length < 2 ) 
     1376                        { 
     1377                                if( loadscript.getStatusMessage() != "" ) 
     1378                                        _status = prompt("Digite sua mensagem !!!", loadscript.getStatusMessage()); 
     1379                                else 
     1380                                        _status = prompt("Digite sua mensagem !!!"); 
    13761381                                 
    1377                                 TrophyIM.connection.send( _presence.tree() ); 
     1382                                var _divStatus = document.getElementById("JabberIMStatusMessage"); 
     1383                                 
     1384                                if( ( _status = _status.replace(/^\s+|\s+$|^\n|\n$/g,"") ) != "") 
     1385                                        _divStatus.firstChild.innerHTML = "( " + _status + " )"; 
     1386                        }  
     1387                        else 
     1388                        { 
     1389                                _status = arguments[1]; 
    13781390                        } 
     1391 
     1392                        for(var resource in TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence ) 
     1393                        { 
     1394                        if ( TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[ resource ].constructor == Function ) 
     1395                                continue; 
     1396                         
     1397                                if ( TROPHYIM_RESOURCE === ("/" + resource) ) 
     1398                                        _show = TrophyIM.rosterObj.roster[Base64.decode(loadscript.getUserCurrent().jid)].presence[resource].show; 
     1399                        } 
     1400 
     1401                        var _presence = $pres( ); 
     1402                        _presence.node.appendChild( Strophe.xmlElement( 'show' ) ).appendChild( Strophe.xmlTextNode( _show ) ); 
     1403                        _presence.node.appendChild( Strophe.xmlElement( 'status' ) ).appendChild( Strophe.xmlTextNode( _status ) ); 
     1404                         
     1405                        TrophyIM.connection.send( _presence.tree() ); 
    13791406                } 
    13801407        }, 
  • sandbox/jabberit_messenger/trophy_expresso/xsl/contactsList.xsl

    r2706 r2711  
    1313                        <div id="{$idUser}__photo" style="position: absolute; left: 5px; top: 5px; width:60px; height:80px; background-image:url('{$path_jabberit}/templates/default/images/photo.png');"/> 
    1414 
    15                         <div style="position: absolute; left: 80px; top: 10px;"> <xsl:value-of select="$full_name"/> </div> 
     15                        <div style="position: absolute; left: 80px; top: 8px;"> <xsl:value-of select="$full_name"/> </div> 
    1616 
    17                         <div style="position: absolute; top: 30px; left: 80px;"> 
     17                        <div style="position: absolute; top: 28px; left: 80px;"> 
    1818                                <button style="width:35px;" alt="Adicionar Contatos" title="Adicionar Contatos" onclick="loadscript.addContact();"> 
    1919                                        <img src="{$path_jabberit}/templates/default/images/users.png"/> 
     
    2525                        </div> 
    2626 
    27                         <div style="position: absolute; left: 80px; top: 55px; cursor: pointer;" onclick="loadscript.setPresence(this);"> 
     27                        <div style="position: absolute; left: 80px; top: 53px; cursor: pointer;" onclick="loadscript.setPresence(this);"> 
    2828                                <div id="statusJabberImg" style="background: url('{$path_jabberit}/templates/default/images/available.gif'); margin-left: 13px;width:15px; height:15px;"></div> 
    2929                                <div id="statusJabberText" style="margin-top: -13px; margin-left: 30px;"> Disponível </div> 
     
    3131                        </div> 
    3232                         
    33                         <div id="JabberIMRosterLoadingGif" style="position:absolute; left:85px; top:72px; display:block;"> 
     33                        <div id="JabberIMRosterLoadingGif" style="position:absolute; left:136px; top:110px; display:block;"> 
    3434                                        <img src='{$path_jabberit}/templates/default/images/loading.gif' style="width:20px; height:20px;"/> 
    35                                         <span style="color:red;">Carregando...</span> 
     35                                        <span style="color:red;"> Carregando...!!</span> 
     36                        </div> 
     37                         
     38                        <div id="JabberIMStatusMessage" style="position:absolute; left:4px; top:90px; display:block;"> 
     39                                <label style="cursor:pointer;" onclick="loadscript.setMessageStatus(this);">( Digite aqui sua mensagem de Status )</label> 
    3640                        </div> 
    3741 
Note: See TracChangeset for help on using the changeset viewer.