Changeset 1402

Show
Ignore:
Timestamp:
02/16/11 12:24:09 (15 months ago)
Author:
zeank
Message:

private messaging
closes #273

Location:
HelpIM3/branches/chatgroups
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • HelpIM3/branches/chatgroups/HelpIM/chat/templates/SubChat.py

    r1397 r1402  
    6767    <table border="0" width="100%" height="100%" cellspacing="0" cellpadding="8px"> 
    6868        <tr> <!-- header --> 
    69           <td colspan=2 class="spaced" align="right"> 
     69          <td colspan="2" class="spaced" align="right"> 
    7070          <table border="0" cellspacing="0" cellpadding="0" width="100%"> 
    7171          <tr> 
     
    9696          <td style="height: 100%; width: 132px;" class="spaced"> 
    9797            <table width="100%" height="100%;" cellspacing="0" cellpadding="8px"> 
    98             <tr><td style="height: 100%; width: 120px;" id="roster_pane"> 
    99               <iframe src="/htdocs/groupchat_iroster.html" 
    100                       id="groupchatIRoster" 
    101                       name="groupchatIRoster" 
    102                       scrolling="auto" 
    103                       style="height:100%;width:120px;" 
    104                       class="gcIframe" 
    105                       frameborder="0"> 
    106               </iframe> 
    107                
    108             </td></tr> 
    109             <tr><td style="width: 120px;" valign="top" id="button_pane"> 
    110               <div id="rosterUserActionButtons"> 
    111               <button id="noneButton">kick</button> 
    112               <button id="participantButton">voice</button> 
    113               <button id="visitorButton">devoice</button> 
    114               </div> 
    115               <button id="visitorsButton">Devoice All</button> 
    116               <button id="participantsButton">Voice All</button> 
    117  
    118             </td></tr> 
     98              <tr><td style="height: 100%; width: 120px;" id="roster_pane"> 
     99                  <iframe src="/htdocs/groupchat_iroster.html" 
     100                          id="groupchatIRoster" 
     101                          name="groupchatIRoster" 
     102                          scrolling="auto" 
     103                          style="height:100%;width:120px;" 
     104                          class="gcIframe" 
     105                          frameborder="0"> 
     106                  </iframe> 
     107              </td></tr> 
     108              <tr><td style="width: 120px;" valign="top" id="button_pane"> 
     109                  <div id="rosterUserActionButtons"> 
     110                    <button id="noneButton">kick</button> 
     111                    <button id="participantButton">voice</button> 
     112                    <button id="visitorButton">devoice</button> 
     113                  </div> 
     114                  <button id="visitorsButton">Devoice All</button> 
     115                  <button id="participantsButton">Voice All</button> 
     116              </td></tr> 
    119117            </table> 
    120118          </td> 
    121119        </tr> 
    122120        <tr> 
    123           <td colspan=2 class="spaced"><span id="emoticonBar"></span><span id="typingnotification" class="notification"></span> 
     121          <td colspan="2" class="spaced"><span id="emoticonBar"></span><span id="typingnotification" class="notification"></span> 
    124122          </td> 
    125123        </tr> 
    126         <tr> 
     124      <tr> 
    127125          <td colspan="2" class="spaced"> 
    128             <textarea type="text"  
    129                     id="msgbox" style="width:100%;" rows="4" tabindex="1"  
    130                     onKeyPress="return msgboxKeyPressed(this,event);"   
    131                     onKeyDown="return msgboxKeyDown(this,event);"  
    132                     onFocus="storeCaret(this);" 
    133                     onKeyUp="return msgboxKeyUp(this);" 
    134                     onSelect="storeCaret(this);" 
    135                     onClick="storeCaret(this);"></textarea> 
     126           <table border="0" cellspacing="0" cellpadding="0" width="100%" height="100%"> 
     127              <tr> 
     128               <td id="send_to_label" nowrap="nowrap"></td> 
     129               <td width="100%"> 
     130                  <textarea type="text"  
     131                            id="msgbox" style="width:100%;" rows="4" tabindex="1"  
     132                            onKeyPress="return msgboxKeyPressed(this,event);"   
     133                            onKeyDown="return msgboxKeyDown(this,event);"  
     134                            onFocus="storeCaret(this);" 
     135                            onKeyUp="return msgboxKeyUp(this);" 
     136                            onSelect="storeCaret(this);" 
     137                            onClick="storeCaret(this);"></textarea> 
     138               </td> 
     139              </tr> 
     140            </table> 
    136141          </td> 
    137142        </tr> 
  • HelpIM3/branches/chatgroups/htdocs/chat.js

    r1359 r1402  
    6262 
    6363    var aMessage = new JSJaCMessage(); 
    64     if (staffChat && frames['groupchatIRoster'].userSelected) { 
     64    if ((staffChat || srcW.CHATGROUP_CHAT) && 
     65                HIM.el.byId('send_to_label').innerHTML != '') { 
    6566        to = frames['groupchatIRoster'].userSelected.getAttribute('username'); 
    6667        var jid = roster.getFullJIDByNick(htmlFullEnc(to)); 
     68                var user = roster.getUserByJID(jid); 
     69                if (!roster.me.role == 'moderator' && !user.role == 'moderator') { 
     70                        // not allowed to send to non moderator as non moderator 
     71                        return false; 
     72                } 
    6773        if (jid == null) { 
    6874            putMsgHTML("No such nick"+": " + htmlFullEnc(to), new Date().toLocaleTimeString(), group); 
     
    108114 
    109115function sendState(state) { 
    110     if (!staffChat) { // only send in one2one context 
    111         var aMessage = new JSJaCMessage();  
    112         aMessage.setType('groupchat'); 
    113         aMessage.setTo(group); 
    114         aMessage.setState(state); 
    115         if (aMessage.getState()) // only send if valid state 
    116             srcW.con.send(aMessage); 
     116    if (!staffChat) { // only send in one2one context or chatgroup context 
     117        var oMsg = new JSJaCMessage(); 
     118                if (HIM.el.byId('send_to_label').innerHTML != '' && 
     119                        frames['groupchatIRoster'].userSelected) { 
     120                        // seems we're in priv msg mode - check if allowed sending 
     121                        to = frames['groupchatIRoster'].userSelected.getAttribute('username'); 
     122                        var jid = roster.getFullJIDByNick(htmlFullEnc(to)); 
     123                        var user = roster.getUserByJID(jid); 
     124                        if (!roster.me.role == 'moderator' && !user.role == 'moderator') { 
     125                                // not allowed to send to non moderator as non moderator 
     126                                return false; 
     127                        } 
     128                        oMsg.setType('chat'); 
     129                        oMsg.setTo(jid); 
     130                } else { 
     131                        oMsg.setType('groupchat'); 
     132                        oMsg.setTo(group); 
     133                } 
     134                oMsg.setState(state); 
     135                if (oMsg.getState()) // only send if valid state 
     136                        srcW.con.send(oMsg); 
    117137    } 
    118138} 
  • HelpIM3/branches/chatgroups/htdocs/groupchat_iroster.html

    r1357 r1402  
    5353        firingobj = document.getElementById('rosterUser_'+nick); 
    5454    } 
     55        parent.HIM.el.byId('send_to_label').innerHTML = ""; // reset 
    5556    if (firingobj && (firingobj.className == 'rosterUserSelected' ||  
    5657                      firingobj.className == 'rosterUser') &&  
     
    6061        userSelected = firingobj; 
    6162 
     63                var user = parent.roster.getUserByJID(parent.roster.getFullJIDByNick(nick)); 
     64 
     65                if (parent.roster.me.role == 'moderator' || 
     66                        user.role == 'moderator') { 
     67                        parent.HIM.el.byId('send_to_label').innerHTML = "<span class='privMsg'>["+htmlEnc(nick)+"]</span>&nbsp;"; 
     68                } 
    6269 
    6370        if (parent.roster.me.role == 'moderator' && parent.srcW.CHATGROUP_CHAT) { 
    6471            // show action buttons 
    65             var user = parent.roster.getUserByJID( 
    66                 parent.roster.getFullJIDByNick(nick)); 
    6772            if (user && user.role != 'moderator') { 
    6873                actionButtons.forEach(