Changeset 2298 for sandbox


Ignore:
Timestamp:
03/18/10 17:33:07 (14 years ago)
Author:
alexandrecorreia
Message:

Ticket #986 - Implementado envio das mensagens dentro das janelas.

Location:
sandbox/jabberit_messenger/trophy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • sandbox/jabberit_messenger/trophy/js/trophyim.js

    r2293 r2298  
    196196     */ 
    197197    chatHistory : {}, 
     198     
    198199    /** Object: activeChats 
    199200     * 
    200201     *  This object stores the currently active chats. 
    201202     */ 
    202     activeChats : {current: null, divs: {}}, 
    203     /** Function: setCookie 
     203     
     204     activeChats : {current: null, divs: {}}, 
     205     
     206     /** Function: setCookie 
    204207     * 
    205208     *  Sets cookie name/value pair.  Date and path are auto-selected. 
     
    618621            var message =  
    619622            {  
    620                 contact : contact, 
     623                contact : "<font style='font-weight:bold; color:black;'>" + contact + "</font>", 
    621624                msg             : Strophe.getText(elems[0])      
    622625            }; 
     
    668671        { 
    669672                        'idChatBox' : barjid + "__chatBox", 
     673                        'jidTo'         : barjid, 
    670674        }; 
    671          
    672675         
    673676        var winChatBox =  
     
    787790        var messageDiv  = document.createElement("div"); 
    788791                messageDiv.style.margin = "3px 0px 3px 3px"; 
    789                 messageDiv.innerHTML    = "<font style='font-weight:bold;'>" + msg.contact + "</font> : " + msg.msg ; 
     792                messageDiv.innerHTML    = msg.contact + " : " + msg.msg ; 
    790793                 
    791794        chatBox.appendChild(messageDiv); 
     
    10611064     *  Send message from chat input to user 
    10621065     */ 
    1063     sendMessage : function(chat_box) { 
    1064         var message_input = 
    1065         getElementsByClassName('trophyimchatinput', null, 
    1066         chat_box.parentNode)[0]; 
     1066      
     1067    sendMessage : function() 
     1068    { 
     1069 
     1070        if( arguments.length > 0 ) 
     1071        { 
     1072                var jidTo = arguments[0]; 
     1073                var message_input = document.getElementById(jidTo + "__sendBox"); 
     1074             
     1075                if( message_input.value.replace(/^\s+|\s+$/g,"") != "" ) 
     1076                { 
     1077                        // Send Message 
     1078                        TrophyIM.connection.send($msg({to: jidTo, from: TrophyIM.connection.jid, type: 'chat'}).c('body').t(message_input.value).tree()); 
     1079                         
     1080                        var message =  
     1081                        { 
     1082                                        contact : "<font style='font-weight:bold; color:red;'>" + "Eu" + "</font>", 
     1083                                        msg : message_input.value 
     1084                        } 
     1085                         
     1086                        message_input.value = ''; 
     1087                         
     1088                        // Add Message in chatBox; 
     1089                        TrophyIM.addMessage( message, jidTo); 
     1090                } 
     1091        } 
     1092         
     1093         
     1094        /* 
     1095         * Codigo original comentado  
     1096         * 
     1097        var message_input = getElementsByClassName('trophyimchatinput', null, chat_box.parentNode)[0]; 
    10671098        var active_jid = TrophyIM.activeChats['current']; 
    1068         if(TrophyIM.activeChats['current']) { 
     1099         
     1100        if(TrophyIM.activeChats['current']) 
     1101        { 
    10691102            var active_chat = 
    10701103            TrophyIM.activeChats['divs'][TrophyIM.activeChats['current']]; 
    10711104            var to = TrophyIM.activeChats['current']; 
    1072             if (active_chat['resource']) { 
     1105            if (active_chat['resource']) 
     1106            { 
    10731107                to += "/" + active_chat['resource']; 
    10741108            } 
    1075             TrophyIM.connection.send($msg({to: to, from: 
    1076             TrophyIM.connection.jid, type: 'chat'}).c('body').t( 
    1077             message_input.value).tree()); 
     1109            TrophyIM.connection.send($msg({to: to, from: TrophyIM.connection.jid, type: 'chat'}).c('body').t(message_input.value).tree()); 
     1110             
    10781111            TrophyIM.addMessage("Me:\n" + message_input.value, 
    10791112            TrophyIM.activeChats['current']); 
    10801113        } 
     1114         
    10811115        message_input.value = ''; 
    10821116        message_input.focus(); 
     1117        */ 
    10831118    } 
    10841119}; 
  • sandbox/jabberit_messenger/trophy/xsl/chatBox.xsl

    r2293 r2298  
    44         
    55        <xsl:param name="idChatBox" /> 
     6        <xsl:param name="jidTo" /> 
    67 
    78        <xsl:template match="chat_box"> 
     
    1011                                <div id="{$idChatBox}" style="height:190px; width:370px; overflow-y:scroll"></div> 
    1112                                <div style="margin:2px;"> 
    12                                         <form name="chat" onsubmit="TrophyIM.sendMessage(this); return(false);"> 
    13                                                 <div style="margin-top:0px; width:70px; height:93px; position:relative; float:right; background-image:url('images/photo.png');"></div> 
    14                                                 <textarea class="trophyimchatinput" rows="5" cols="38"/> 
    15                                         </form> 
    16                                 </div> 
    17                                 <div style="margin-left:2px;"> 
    18                                         <input type="button" value="Send" onclick="TrophyIM.sendMessage(this)"/> 
     13                                        <div style="margin-top:0px; width:70px; height:93px; position:relative; float:right; background-image:url('images/photo.png');"></div> 
     14                                        <textarea id="{$jidTo}__sendBox" class="trophyimchatinput" rows="5" cols="38"></textarea> 
     15                                        <div style="margin-left:2px;"> 
     16                                                <input type="button" value="Send" onclick="TrophyIM.sendMessage('{$jidTo}')"/> 
     17                                        </div> 
    1918                                </div> 
    2019                        </div>                   
Note: See TracChangeset for help on using the changeset viewer.