Merge branch 'riadvice-chat-tabs'

This commit is contained in:
Richard Alam 2017-11-15 14:04:03 -08:00
commit 06640a445b
11 changed files with 312 additions and 227 deletions

View File

@ -581,7 +581,7 @@ views|ClientStatusItemRenderer {
//------------------------------ //------------------------------
*/ */
chat|AddChatTabBox { chat|ChatOptionsTab {
verticalGap : 20; verticalGap : 20;
paddingLeft : 20; paddingLeft : 20;
paddingRight : 20; paddingRight : 20;

View File

@ -349,7 +349,11 @@ bbb.chat.private.userJoined = The user has joined.
bbb.chat.private.closeMessage = You can close this tab by using the key combination {0}. bbb.chat.private.closeMessage = You can close this tab by using the key combination {0}.
bbb.chat.usersList.toolTip = Select User To Open Private Chat bbb.chat.usersList.toolTip = Select User To Open Private Chat
bbb.chat.usersList.accessibilityName = Select user to open private chat. Use the arrow keys to navigate. bbb.chat.usersList.accessibilityName = Select user to open private chat. Use the arrow keys to navigate.
bbb.chat.groupChatList.toolTip = Select a group chat to open
bbb.chat.groupChatList.accessibilityName = Select a group chat to open. Use the arrow keys to navigate.
bbb.chat.chatOptions = Chat Options bbb.chat.chatOptions = Chat Options
bbb.chat.newChat.label = New Group Chat
bbb.chat.newChat.create = Create
bbb.chat.fontSize = Chat Message Font Size bbb.chat.fontSize = Chat Message Font Size
bbb.chat.cmbFontSize.toolTip = Select Chat Message Font Size bbb.chat.cmbFontSize.toolTip = Select Chat Message Font Size
bbb.chat.messageList = Chat Messages bbb.chat.messageList = Chat Messages

View File

@ -30,6 +30,7 @@
uri="rtmp://HOST/bigbluebutton" uri="rtmp://HOST/bigbluebutton"
dependsOn="UsersModule" dependsOn="UsersModule"
privateEnabled="true" privateEnabled="true"
groupEnabled="true"
fontSize="14" fontSize="14"
baseTabIndex="801" baseTabIndex="801"
colorPickerIsVisible="false" colorPickerIsVisible="false"

View File

@ -25,6 +25,9 @@ package org.bigbluebutton.modules.chat.model {
[Bindable] [Bindable]
public var privateEnabled:Boolean = true; public var privateEnabled:Boolean = true;
[Bindable]
public var groupEnabled:Boolean = true;
[Bindable] [Bindable]
public var fontSize:String = "14"; public var fontSize:String = "14";

View File

@ -36,35 +36,35 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<fx:Script> <fx:Script>
<![CDATA[ <![CDATA[
import com.asfusion.mate.events.Dispatcher; import com.asfusion.mate.events.Dispatcher;
import mx.collections.ArrayCollection; import mx.collections.ArrayCollection;
import mx.controls.Alert; import mx.controls.Alert;
import mx.events.CloseEvent; import mx.events.CloseEvent;
import org.as3commons.logging.api.ILogger; import org.as3commons.lang.StringUtils;
import org.as3commons.logging.api.getClassLogger; import org.as3commons.logging.api.ILogger;
import org.bigbluebutton.core.EventConstants; import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.core.Options; import org.bigbluebutton.core.Options;
import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.events.CoreEvent; import org.bigbluebutton.core.events.LockControlEvent;
import org.bigbluebutton.core.events.LockControlEvent; import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.core.model.LiveMeeting; import org.bigbluebutton.main.events.UserJoinedEvent;
import org.bigbluebutton.main.events.UserJoinedEvent; import org.bigbluebutton.main.events.UserLeftEvent;
import org.bigbluebutton.main.events.UserLeftEvent; import org.bigbluebutton.main.model.users.events.ChangeMyRole;
import org.bigbluebutton.main.model.users.events.ChangeMyRole; import org.bigbluebutton.modules.chat.events.ChatNoiseEnabledEvent;
import org.bigbluebutton.modules.chat.events.ChatNoiseEnabledEvent; import org.bigbluebutton.modules.chat.events.ChatOptionsEvent;
import org.bigbluebutton.modules.chat.events.ChatOptionsEvent; import org.bigbluebutton.modules.chat.events.ChatToolbarButtonEvent;
import org.bigbluebutton.modules.chat.events.ChatToolbarButtonEvent; import org.bigbluebutton.modules.chat.events.CreateGroupChatReqEvent;
import org.bigbluebutton.modules.chat.events.CreateGroupChatReqEvent; import org.bigbluebutton.modules.chat.model.ChatOptions;
import org.bigbluebutton.modules.chat.model.ChatOptions; import org.bigbluebutton.modules.chat.model.GroupChat;
import org.bigbluebutton.modules.chat.model.GroupChat; import org.bigbluebutton.modules.chat.views.model.ChatUser;
import org.bigbluebutton.modules.chat.views.model.ChatUser; import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.util.i18n.ResourceUtil;
private static const LOGGER:ILogger = getClassLogger(AddChatTabBox); private static const LOGGER:ILogger = getClassLogger(ChatOptionsTab);
[Bindable] public var users:ArrayCollection; [Bindable] public var users:ArrayCollection;
[Bindable] public var groupChats:ArrayCollection;
[Bindable] public var chatView:ChatView; [Bindable] public var chatView:ChatView;
[Bindable] private var fontSizes:Array = ['8', '10', '12', '14', '16', '18']; [Bindable] private var fontSizes:Array = ['8', '10', '12', '14', '16', '18'];
@ -103,8 +103,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function onCreationComplete():void{ private function onCreationComplete():void{
clrBtnVisible = UsersUtil.amIModerator(); clrBtnVisible = UsersUtil.amIModerator();
handler.populateAllUsers() handler.populateAllUsers()
handler.populateAllGroupChats()
users = removeMe(handler.users); users = removeMe(handler.users);
groupChats = handler.groupChats;
chatOptions = Options.getOptions(ChatOptions) as ChatOptions; chatOptions = Options.getOptions(ChatOptions) as ChatOptions;
if (!chatOptions.privateEnabled) { if (!chatOptions.privateEnabled) {
@ -141,28 +143,40 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
dispatchEvent(new ChatNoiseEnabledEvent(chatNoiseCheckBox.selected)); dispatchEvent(new ChatNoiseEnabledEvent(chatNoiseCheckBox.selected));
} }
protected function openPrivateChat(event:Event):void{ protected function openPrivateChat(event:Event):void {
if (usersList.selectedIndex == -1) return; if (usersList.selectedIndex == -1)
return;
if (!usersList.visible || !usersList.enabled) return; if (!usersList.visible || !usersList.enabled)
return;
var chatWithIntId:String = usersList.selectedItem.userId; var chatWithIntId:String = usersList.selectedItem.userId;
// Don't want to be chatting with ourself. // Don't want to be chatting with ourself.
if (UsersUtil.isMe(chatWithIntId)) return; if (UsersUtil.isMe(chatWithIntId))
return;
usersList.selectedIndex = -1; usersList.selectedIndex = -1;
var testChatName:String = "Test Private Chat"; // @fixme : need to use a better chat name
var access:String = GroupChat.PRIVATE; var testChatName:String = "Test Private Chat";
var users:Array = new Array(); var access:String = GroupChat.PRIVATE;
users.push(chatWithIntId); var users:Array = new Array();
users.push(chatWithIntId);
var createEvent:CreateGroupChatReqEvent = var createEvent:CreateGroupChatReqEvent = new CreateGroupChatReqEvent(testChatName, access, users);
new CreateGroupChatReqEvent(testChatName, access, users); globalDispatcher.dispatchEvent(createEvent);
globalDispatcher.dispatchEvent(createEvent); }
} protected function openGroupChat(event:Event):void {
}
public function onGroupChatListKeyDown(event:KeyboardEvent):void{
if (event.keyCode == 32){
// openGroupChat(event);
}
}
/** /**
* For the Options tab focus the users list instead of the text area. * For the Options tab focus the users list instead of the text area.
@ -218,6 +232,17 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
globalDispatcher.dispatchEvent(clearEvent); globalDispatcher.dispatchEvent(clearEvent);
} }
} }
public function onCreateChatBtnClick():void {
var newChatName:String = newChatNameInput.text;
var access:String = GroupChat.PUBLIC;
var users:Array = new Array();
var createEvent:CreateGroupChatReqEvent = new CreateGroupChatReqEvent(newChatName, access, users);
globalDispatcher.dispatchEvent(createEvent);
newChatNameInput.text = "";
}
]]> ]]>
</fx:Script> </fx:Script>
@ -225,18 +250,33 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<common:TabIndexer id="tabIndexer" startIndex="1" tabIndices="{[usersList, cmbFontSize, chatNoiseCheckBox, saveBtn, copyBtn, clearBtn]}"/> <common:TabIndexer id="tabIndexer" startIndex="1" tabIndices="{[usersList, cmbFontSize, chatNoiseCheckBox, saveBtn, copyBtn, clearBtn]}"/>
</fx:Declarations> </fx:Declarations>
<mx:HBox width="100%" verticalAlign="middle" visible="{chatOptions.groupEnabled}" includeInLayout="{chatOptions.groupEnabled}">
<mx:Label text="{ResourceUtil.getInstance().getString('bbb.chat.newChat.label')}"/>
<mx:TextInput id="newChatNameInput" width="100%"/>
<mx:Button id="createChatGroupBtn" label="{ResourceUtil.getInstance().getString('bbb.chat.newChat.create')}"
styleName="mainActionButton" height="30"
enabled="{!StringUtils.isEmpty(newChatNameInput.text)}" click="onCreateChatBtnClick()" />
</mx:HBox>
<mx:Label id="lblSelect" styleName="chatOptionsLabel" <mx:Label id="lblSelect" styleName="chatOptionsLabel"
text="{ResourceUtil.getInstance().getString('bbb.chat.privateChatSelect')}" text="{ResourceUtil.getInstance().getString('bbb.chat.privateChatSelect')}"
visible="{chatOptions.privateEnabled}" includeInLayout="{chatOptions.privateEnabled}"/> visible="{chatOptions.privateEnabled}" includeInLayout="{chatOptions.privateEnabled}"/>
<mx:List id="usersList" height="50%" width="100%" dataProvider="{users}" dragEnabled="false" <mx:List id="usersList" width="100%" dataProvider="{users}" dragEnabled="false"
visible="{chatOptions.privateEnabled}" includeInLayout="{chatOptions.privateEnabled}" visible="{chatOptions.privateEnabled}" includeInLayout="{chatOptions.privateEnabled}"
itemRenderer="org.bigbluebutton.modules.chat.views.UserRenderer"
labelField="name" labelField="name"
itemClick="openPrivateChat(event)" itemClick="openPrivateChat(event)"
keyDown="onUserListKeyDown(event)" keyDown="onUserListKeyDown(event)"
toolTip="{ResourceUtil.getInstance().getString('bbb.chat.usersList.toolTip')}" toolTip="{ResourceUtil.getInstance().getString('bbb.chat.usersList.toolTip')}"
accessibilityName="{ResourceUtil.getInstance().getString('bbb.chat.usersList.accessibilityName')}"/> accessibilityName="{ResourceUtil.getInstance().getString('bbb.chat.usersList.accessibilityName')}"/>
<mx:List id="groupChatList" width="100%" dataProvider="{groupChats}" dragEnabled="false"
visible="{chatOptions.groupEnabled}" includeInLayout="{chatOptions.groupEnabled}"
labelField="name"
itemClick="openGroupChat(event)"
keyDown="onGroupChatListKeyDown(event)"
toolTip="{ResourceUtil.getInstance().getString('bbb.chat.groupChatList.toolTip')}"
accessibilityName="{ResourceUtil.getInstance().getString('bbb.chat.groupChatList.accessibilityName')}"/>
<mx:Label styleName="chatOptionsLabel" text="{ResourceUtil.getInstance().getString('bbb.chat.chatOptions')}" /> <mx:Label styleName="chatOptionsLabel" text="{ResourceUtil.getInstance().getString('bbb.chat.chatOptions')}" />
<mx:HBox width="100%"> <mx:HBox width="100%">
<mx:Label styleName="chatOptionsLabel" text="{ResourceUtil.getInstance().getString('bbb.chat.fontSize')}" width="100%"/> <mx:Label styleName="chatOptionsLabel" text="{ResourceUtil.getInstance().getString('bbb.chat.fontSize')}" width="100%"/>
<mx:ComboBox width="60" id="cmbFontSize" dataProvider="{fontSizes}" change="changeFontSize()" <mx:ComboBox width="60" id="cmbFontSize" dataProvider="{fontSizes}" change="changeFontSize()"

View File

@ -50,9 +50,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<fx:Script> <fx:Script>
<![CDATA[ <![CDATA[
import com.asfusion.mate.events.Dispatcher; import com.asfusion.mate.events.Dispatcher;
import flash.events.TextEvent; import flash.events.TextEvent;
import mx.binding.utils.BindingUtils; import mx.binding.utils.BindingUtils;
import flashx.textLayout.formats.Direction; import flashx.textLayout.formats.Direction;
import org.as3commons.lang.StringUtils; import org.as3commons.lang.StringUtils;
import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger; import org.as3commons.logging.api.getClassLogger;
@ -82,7 +86,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
import org.bigbluebutton.modules.polling.events.StartCustomPollEvent; import org.bigbluebutton.modules.polling.events.StartCustomPollEvent;
import org.bigbluebutton.util.i18n.ResourceUtil; import org.bigbluebutton.util.i18n.ResourceUtil;
private static const LOGGER:ILogger = getClassLogger(ChatBox); private static const LOGGER:ILogger = getClassLogger(ChatTab);
public var chatWithUserID:String; public var chatWithUserID:String;
public var chatWithUsername:String public var chatWithUsername:String
public var chatId: String = null; public var chatId: String = null;

View File

@ -45,13 +45,17 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<fx:Script> <fx:Script>
<![CDATA[ <![CDATA[
import com.asfusion.mate.events.Dispatcher; import com.asfusion.mate.events.Dispatcher;
import flash.events.Event; import flash.events.Event;
import flash.events.FocusEvent; import flash.events.FocusEvent;
import flash.media.Sound; import flash.media.Sound;
import mx.controls.Button; import mx.controls.Button;
import mx.core.INavigatorContent; import mx.core.INavigatorContent;
import flexlib.controls.tabBarClasses.SuperTab; import flexlib.controls.tabBarClasses.SuperTab;
import flexlib.events.SuperTabEvent; import flexlib.events.SuperTabEvent;
import org.bigbluebutton.core.EventConstants; import org.bigbluebutton.core.EventConstants;
import org.bigbluebutton.core.Options; import org.bigbluebutton.core.Options;
import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.UsersUtil;
@ -75,8 +79,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private var PUBLIC_CHAT_USERNAME:String = ResourceUtil.getInstance().getString("bbb.chat.publicChatUsername"); private var PUBLIC_CHAT_USERNAME:String = ResourceUtil.getInstance().getString("bbb.chat.publicChatUsername");
private var OPTION_TAB_ID:String = ResourceUtil.getInstance().getString("bbb.chat.optionsTabName"); private var OPTION_TAB_ID:String = ResourceUtil.getInstance().getString("bbb.chat.optionsTabName");
private var tabBox:AddChatTabBox; private var chatOptionsTab:ChatOptionsTab;
private var publicBox:ChatBox; private var publicChatTab:ChatTab;
private var focus:Boolean = true; private var focus:Boolean = true;
private var focusSwitchTimer:Timer; private var focusSwitchTimer:Timer;
private var globalDispatcher:Dispatcher = new Dispatcher(); private var globalDispatcher:Dispatcher = new Dispatcher();
@ -111,7 +115,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
makePublicChatUncloseable(); makePublicChatUncloseable();
if (openTabBox) { if (openTabBox) {
createAddTabBox(); addChatOptionsTab();
makeAddPrivateChatUncloseable(); makeAddPrivateChatUncloseable();
} }
@ -125,17 +129,17 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
systemManager.stage.addEventListener(Event.DEACTIVATE, deactivate); systemManager.stage.addEventListener(Event.DEACTIVATE, deactivate);
} }
private function getVisibleChatBox():ChatBox { private function getVisibleChatBox():ChatTab {
var chatBox:ChatBox = chatTabs.getChildAt(chatTabs.selectedIndex) as ChatBox; var chatBox:ChatTab = chatTabs.getChildAt(chatTabs.selectedIndex) as ChatTab;
return chatBox; return chatBox;
} }
private function getPublicChatBox():ChatBox { private function getPublicChatBox():ChatTab {
return publicBox; return publicChatTab;
} }
private function dispatchSaveChatEvent(e:Event):void { private function dispatchSaveChatEvent(e:Event):void {
var chatBox:ChatBox = getPublicChatBox(); var chatBox:ChatTab = getPublicChatBox();
var saveEvent:ChatSaveEvent = new ChatSaveEvent(ChatSaveEvent.SAVE_CHAT_EVENT); var saveEvent:ChatSaveEvent = new ChatSaveEvent(ChatSaveEvent.SAVE_CHAT_EVENT);
if (chatBox.chatWithUsername == null || chatBox.chatWithUsername == "") { if (chatBox.chatWithUsername == null || chatBox.chatWithUsername == "") {
@ -167,14 +171,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
PUBLIC_CHAT_USERNAME = ResourceUtil.getInstance().getString("bbb.chat.publicChatUsername"); PUBLIC_CHAT_USERNAME = ResourceUtil.getInstance().getString("bbb.chat.publicChatUsername");
OPTION_TAB_ID = ResourceUtil.getInstance().getString("bbb.chat.optionsTabName"); OPTION_TAB_ID = ResourceUtil.getInstance().getString("bbb.chat.optionsTabName");
if (tabBox != null) { if (chatOptionsTab != null) {
tabBox.id = OPTION_TAB_ID; chatOptionsTab.id = OPTION_TAB_ID;
tabBox.label = OPTION_TAB_ID; chatOptionsTab.label = OPTION_TAB_ID;
tabBox.name = OPTION_TAB_ID; chatOptionsTab.name = OPTION_TAB_ID;
} }
if (publicBox != null) { if (publicChatTab != null) {
publicBox.label = PUBLIC_CHAT_USERNAME; publicChatTab.label = PUBLIC_CHAT_USERNAME;
} }
} }
@ -253,11 +257,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
} }
private function calledOnTheNextScreenRefreshToMakeTabUncloseable():void { private function calledOnTheNextScreenRefreshToMakeTabUncloseable():void {
chatTabs.setClosePolicyForTab(chatTabs.getChildIndex(tabBox), SuperTab.CLOSE_NEVER); chatTabs.setClosePolicyForTab(chatTabs.getChildIndex(chatOptionsTab), SuperTab.CLOSE_NEVER);
} }
private function calledOnTheNextScreenRefreshToMakePublicChatUncloseable():void { private function calledOnTheNextScreenRefreshToMakePublicChatUncloseable():void {
var chatBox:ChatBox = getChatBoxForUser(mainChatId); var chatBox:ChatTab = getChatBoxForUser(mainChatId);
var chatIndex:int = getTabIndexFor(chatBox); var chatIndex:int = getTabIndexFor(chatBox);
chatTabs.setClosePolicyForTab(chatIndex, SuperTab.CLOSE_NEVER); chatTabs.setClosePolicyForTab(chatIndex, SuperTab.CLOSE_NEVER);
} }
@ -270,7 +274,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
} }
private function notifyParticipantOfUnreadMessageFrom(chatId:String):void { private function notifyParticipantOfUnreadMessageFrom(chatId:String):void {
var chatBox:ChatBox = getChatBoxForUser(chatId); var chatBox:ChatTab = getChatBoxForUser(chatId);
var tabIndex:int = getTabIndexFor(chatBox); var tabIndex:int = getTabIndexFor(chatBox);
var tab:Button = chatTabs.getTabAt(tabIndex); var tab:Button = chatTabs.getTabAt(tabIndex);
tab.styleName = "highlightedTabStyle"; tab.styleName = "highlightedTabStyle";
@ -279,7 +283,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
// However, the SuperTabNavigator does not cooperate with changes to it's accessibility properties. // However, the SuperTabNavigator does not cooperate with changes to it's accessibility properties.
} }
private function getTabIndexFor(chatBox:ChatBox):int { private function getTabIndexFor(chatBox:ChatTab):int {
return chatTabs.getChildIndex(chatBox); return chatTabs.getChildIndex(chatBox);
} }
@ -302,13 +306,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
} }
private function userHasChatBox(chatId:String):Boolean { private function userHasChatBox(chatId:String):Boolean {
var chatBox:ChatBox = chatTabs.getChildByName(chatId) as ChatBox; var chatBox:ChatTab = chatTabs.getChildByName(chatId) as ChatTab;
if (chatBox != null) return true; if (chatBox != null) return true;
return false; return false;
} }
private function getChatBoxForUser(chatId:String):ChatBox { private function getChatBoxForUser(chatId:String):ChatTab {
return chatTabs.getChildByName(chatId) as ChatBox; return chatTabs.getChildByName(chatId) as ChatTab;
} }
private function handleStartPrivateChatMessageEvent(event:CoreEvent):void { private function handleStartPrivateChatMessageEvent(event:CoreEvent):void {
@ -317,7 +321,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
chatTabs.selectedIndex = tabIndex; chatTabs.selectedIndex = tabIndex;
} }
public function openChatBoxFor(groupChatId:String, publicChat:Boolean=false):ChatBox { public function openChatBoxFor(groupChatId:String, publicChat:Boolean=false):ChatTab {
if (userHasChatBox(groupChatId)) { if (userHasChatBox(groupChatId)) {
return getChatBoxForUser(groupChatId); return getChatBoxForUser(groupChatId);
} else { } else {
@ -325,8 +329,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
} }
} }
private function createChatBoxFor(groupChatId:String, publicChat:Boolean = false):ChatBox { private function createChatBoxFor(groupChatId:String, publicChat:Boolean = false):ChatTab {
var chatBox:ChatBox = new ChatBox(); var chatBox:ChatTab = new ChatTab();
chatBox.name = groupChatId; chatBox.name = groupChatId;
chatBox.chatWithUserID = groupChatId; chatBox.chatWithUserID = groupChatId;
@ -337,7 +341,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
chatBox.chatId = groupChatId; chatBox.chatId = groupChatId;
chatBox.label = PUBLIC_CHAT_USERNAME chatBox.label = PUBLIC_CHAT_USERNAME
chatBox.publicChat = true; chatBox.publicChat = true;
publicBox = chatBox; // keep a reference to the public chat box publicChatTab = chatBox; // keep a reference to the public chat box
} else { } else {
var gc:GroupChat = LiveMeeting.inst().chats.getGroupChat(groupChatId); var gc:GroupChat = LiveMeeting.inst().chats.getGroupChat(groupChatId);
if (gc != null) { if (gc != null) {
@ -356,22 +360,22 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
chatTabs.addChild(chatBox); chatTabs.addChild(chatBox);
} }
// set the font size on tab opening // set the font size on tab opening
if (tabBox) if (chatOptionsTab)
chatBox.setStyle("fontSize", int(tabBox.cmbFontSize.selectedItem)); chatBox.setStyle("fontSize", int(chatOptionsTab.cmbFontSize.selectedItem));
return chatBox; return chatBox;
} }
private function createAddTabBox():AddChatTabBox { private function addChatOptionsTab():ChatOptionsTab {
tabBox = new AddChatTabBox(); chatOptionsTab = new ChatOptionsTab();
tabBox.chatView = this; chatOptionsTab.chatView = this;
tabBox.id = OPTION_TAB_ID; chatOptionsTab.id = OPTION_TAB_ID;
tabBox.label = OPTION_TAB_ID; chatOptionsTab.label = OPTION_TAB_ID;
tabBox.name = OPTION_TAB_ID; chatOptionsTab.name = OPTION_TAB_ID;
tabBox.chatOptions = chatOptions; chatOptionsTab.chatOptions = chatOptions;
tabBox.tabIndexer.startIndex = tabIndexer.startIndex + 10; chatOptionsTab.tabIndexer.startIndex = tabIndexer.startIndex + 10;
chatTabs.addChild(tabBox); chatTabs.addChild(chatOptionsTab);
return tabBox; return chatOptionsTab;
} }
@ -428,12 +432,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
} }
private function onTabClose(e:SuperTabEvent):void{ private function onTabClose(e:SuperTabEvent):void{
var chatBox:ChatBox = chatTabs.getChildAt(e.tabIndex) as ChatBox; var chatBox:ChatTab = chatTabs.getChildAt(e.tabIndex) as ChatTab;
dispatchEvent(e); dispatchEvent(e);
} }
private function onUserClosedTab(e:SuperTabEvent):void{ private function onUserClosedTab(e:SuperTabEvent):void{
var chatBox:ChatBox = chatTabs.getChildAt(e.tabIndex) as ChatBox; var chatBox:ChatTab = chatTabs.getChildAt(e.tabIndex) as ChatTab;
globalDispatcher.dispatchEvent(new GroupChatBoxClosedEvent(chatBox.chatId, globalDispatcher.dispatchEvent(new GroupChatBoxClosedEvent(chatBox.chatId,
chatBox.parentWindowId)); chatBox.parentWindowId));
} }
@ -454,7 +458,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function remoteClosePrivate(e:ShortcutEvent):void { private function remoteClosePrivate(e:ShortcutEvent):void {
var selectedTab:INavigatorContent = chatTabs.selectedChild; var selectedTab:INavigatorContent = chatTabs.selectedChild;
if (selectedTab is ChatBox && !(selectedTab as ChatBox).publicChat) { if (selectedTab is ChatTab && !(selectedTab as ChatTab).publicChat) {
chatTabs.removeChild(selectedTab as DisplayObject); chatTabs.removeChild(selectedTab as DisplayObject);
} }
} }

View File

@ -40,24 +40,22 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
<fx:Script> <fx:Script>
<![CDATA[ <![CDATA[
import com.asfusion.mate.events.Dispatcher; import com.asfusion.mate.events.Dispatcher;
import org.bigbluebutton.common.IBbbModuleWindow; import org.bigbluebutton.common.IBbbModuleWindow;
import org.bigbluebutton.common.events.LocaleChangeEvent; import org.bigbluebutton.common.events.LocaleChangeEvent;
import org.bigbluebutton.core.KeyboardUtil; import org.bigbluebutton.core.KeyboardUtil;
import org.bigbluebutton.core.model.LiveMeeting; import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.events.ShortcutEvent; import org.bigbluebutton.main.views.MainCanvas;
import org.bigbluebutton.main.views.MainCanvas; import org.bigbluebutton.modules.chat.model.ChatModel;
import org.bigbluebutton.modules.chat.events.CreateGroupChatReqEvent; import org.bigbluebutton.modules.chat.model.ChatOptions;
import org.bigbluebutton.modules.chat.model.ChatModel; import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.modules.chat.model.ChatOptions;
import org.bigbluebutton.modules.chat.model.GroupChat;
import org.bigbluebutton.util.i18n.ResourceUtil;
private var _xPosition:int; private var _xPosition:int;
private var _yPosition:int; private var _yPosition:int;
private var keyCombos:Object; private var keyCombos:Object;
private var disp:Dispatcher = new Dispatcher(); private var disp:Dispatcher = new Dispatcher();
[Bindable] public var chatOptions:ChatOptions; [Bindable] public var chatOptions:ChatOptions;
[Bindable] private var _windowId: String; [Bindable] private var _windowId: String;
@ -155,7 +153,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
override protected function resourcesChanged():void{ override protected function resourcesChanged():void{
super.resourcesChanged(); super.resourcesChanged();
this.title = ResourceUtil.getInstance().getString("bbb.chat.title"); if (_mainChatId == ChatModel.MAIN_PUBLIC_CHAT) {
this.title = ResourceUtil.getInstance().getString("bbb.chat.title");
}
if (titleBarOverlay != null) { if (titleBarOverlay != null) {
titleBarOverlay.accessibilityName = ResourceUtil.getInstance().getString('bbb.chat.titleBar'); titleBarOverlay.accessibilityName = ResourceUtil.getInstance().getString('bbb.chat.titleBar');
@ -202,21 +202,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
this.resizable = value; this.resizable = value;
} }
public function onCreateGCBtnClick():void {
var testChatName:String = "New Public Chat";
var access:String = GroupChat.PUBLIC;
var users:Array = new Array();
var createEvent:CreateGroupChatReqEvent =
new CreateGroupChatReqEvent(testChatName, access, users);
disp.dispatchEvent(createEvent);
}
]]> ]]>
</fx:Script> </fx:Script>
<mx:VBox width="100%" height="100%"> <mx:VBox width="100%" height="100%">
<mx:Button id="createGCBtn" label="Create" height="20" click="onCreateGCBtnClick()"
includeInLayout="{_mainChatId == ChatModel.MAIN_PUBLIC_CHAT}"/>
<views:ChatView id="chatView" chatOptions="{chatOptions}" mainChatId="{_mainChatId}" <views:ChatView id="chatView" chatOptions="{chatOptions}" mainChatId="{_mainChatId}"
windowId="{_windowId}" windowId="{_windowId}"
openTabBox="{_openAddTabBox}" includeInLayout="true"/> openTabBox="{_openAddTabBox}" includeInLayout="true"/>

View File

@ -1,72 +1,117 @@
package org.bigbluebutton.modules.chat.views package org.bigbluebutton.modules.chat.views {
{ import mx.collections.ArrayCollection;
import mx.collections.ArrayCollection;
import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.core.UsersUtil;
import org.bigbluebutton.core.model.LiveMeeting; import org.bigbluebutton.core.model.LiveMeeting;
import org.bigbluebutton.core.model.users.User2x; import org.bigbluebutton.core.model.users.User2x;
import org.bigbluebutton.main.events.UserJoinedEvent; import org.bigbluebutton.main.events.UserJoinedEvent;
import org.bigbluebutton.modules.chat.views.model.ChatUser; import org.bigbluebutton.modules.chat.model.ChatModel;
import org.bigbluebutton.modules.chat.model.GroupChat;
import org.bigbluebutton.modules.chat.views.model.ChatUser;
import org.bigbluebutton.modules.chat.views.model.GroupChatData;
public class ChatWindowEventHandler public class ChatWindowEventHandler {
{
[Bindable] public var users:ArrayCollection = new ArrayCollection();
[Bindable]
public var users:ArrayCollection = new ArrayCollection();
public function ChatWindowEventHandler() [Bindable]
{ public var groupChats:ArrayCollection = new ArrayCollection();
users.refresh();
}
public function populateAllUsers():void { public function ChatWindowEventHandler() {
getAllWebUsers(); users.refresh();
} groupChats.refresh();
}
private function getAllWebUsers():void { public function populateAllUsers():void {
var userIds: Array = LiveMeeting.inst().users.getUserIds(); getAllWebUsers();
}
for (var i:int = 0; i < userIds.length; i++) { public function populateAllGroupChats():void {
var userId: String = userIds[i] as String; getAllGroupChats();
var user: User2x = UsersUtil.getUser2x(userId); }
addUser(users, user);
}
users.refresh(); private function getAllWebUsers():void {
} var userIds:Array = LiveMeeting.inst().users.getUserIds();
public function handleUserJoinedEvent(event: UserJoinedEvent):void { for (var i:int = 0; i < userIds.length; i++) {
var user: User2x = UsersUtil.getUser(event.userID); var userId:String = userIds[i] as String;
if (user != null) { var user:User2x = UsersUtil.getUser2x(userId);
addUser(users, user); addUser(users, user);
users.refresh(); }
}
}
private function addUser(users: ArrayCollection, user: User2x):void { users.refresh();
var buser: ChatUser = new ChatUser(); }
buser.userId = user.intId;
buser.name = user.name;
// We want to remove the user if it's already in the collection and re-add it. public function handleUserJoinedEvent(event:UserJoinedEvent):void {
removeUser(user.intId, users); var user:User2x = UsersUtil.getUser(event.userID);
if (user != null) {
addUser(users, user);
users.refresh();
}
}
users.addItem(buser); private function addUser(users:ArrayCollection, user:User2x):void {
} var buser:ChatUser = new ChatUser();
buser.userId = user.intId;
buser.name = user.name;
private function removeUser(userId:String, users: ArrayCollection):void { // We want to remove the user if it's already in the collection and re-add it.
for (var i:int = 0; i < users.length; i++) { removeUser(user.intId, users);
var user:ChatUser = users.getItemAt(i) as ChatUser;
if (user.userId == userId) {
users.removeItemAt(i);
users.refresh();
return;
}
}
}
public function handleUserLeftEvent(userId: String):void { users.addItem(buser);
removeUser(userId, users); }
}
} private function addGroupChat(groupChats:ArrayCollection, groupChat:GroupChat):void {
var chatData:GroupChatData = new GroupChatData();
chatData.chatId = groupChat.id;
chatData.name = groupChat.name;
// We want to remove the group chat if it's already in the collection and re-add it.
removeGroupChat(groupChat.id, groupChats);
groupChats.addItem(chatData);
}
private function removeUser(userId:String, users:ArrayCollection):void {
for (var i:int = 0; i < users.length; i++) {
var user:ChatUser = users.getItemAt(i) as ChatUser;
if (user.userId == userId) {
users.removeItemAt(i);
users.refresh();
return;
}
}
}
private function removeGroupChat(chatId:String, groupChats:ArrayCollection):void {
for (var i:int = 0; i < groupChats.length; i++) {
var groupChat:GroupChatData = groupChats.getItemAt(i) as GroupChatData;
if (groupChat.chatId == chatId) {
groupChats.removeItemAt(i);
groupChats.refresh();
return;
}
}
}
public function handleUserLeftEvent(userId:String):void {
removeUser(userId, users);
}
public function getAllGroupChats():void {
var chatIds:Array = LiveMeeting.inst().chats.getGroupChatIds();
for (var i:int = 0; i < chatIds.length; i++) {
var chatId:String = chatIds[i] as String;
if (chatId != ChatModel.MAIN_PUBLIC_CHAT) {
var groupChat:GroupChat = LiveMeeting.inst().chats.getGroupChat(chatId);
addGroupChat(groupChats, groupChat);
}
}
groupChats.refresh();
}
}
} }

View File

@ -1,33 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
This program is free software; you can redistribute it and/or modify it under the
terms of the GNU Lesser General Public License as published by the Free Software
Foundation; either version 3.0 of the License, or (at your option) any later
version.
BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along
with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
-->
<mx:HBox xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:fx="http://ns.adobe.com/mxml/2009"
verticalScrollPolicy="off" horizontalScrollPolicy="off">
<!-- No 'me' property on the User2x class -->
<!--
<mx:Label id="nameLabel" textAlign="left" text="{data.name} {data.me ? '(' + ResourceUtil.getInstance().getString('bbb.users.usersGrid.nameItemRenderer.youIdentifier') + ')' : ''}"
fontWeight="{data.me ? 'bold' : 'normal'}"
color="{data.me ? 0x003399 : 0x000000}"/>
-->
<mx:Label id="nameLabel" textAlign="left" text="{data.name}"
fontWeight="{'normal'}"/>
</mx:HBox>

View File

@ -0,0 +1,29 @@
/**
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
*
* Copyright (c) 2017 BigBlueButton Inc. and by respective authors (see below).
*
* This program is free software; you can redistribute it and/or modify it under the
* terms of the GNU Lesser General Public License as published by the Free Software
* Foundation; either version 3.0 of the License, or (at your option) any later
* version.
*
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License along
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
*
*/
package org.bigbluebutton.modules.chat.views.model {
public class GroupChatData {
[Bindable]
public var chatId:String;
[Bindable]
public var name:String;
}
}