Breakout Module, Initial commit
This commit is contained in:
parent
8247a3bb4e
commit
e5a0aa4c5d
66
bigbluebutton-client/src/BreakoutModule.mxml
Executable file
66
bigbluebutton-client/src/BreakoutModule.mxml
Executable file
@ -0,0 +1,66 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<mx:Module xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"
|
||||
implements="org.bigbluebutton.common.IBigBlueButtonModule" xmlns:maps="org.bigbluebutton.modules.breakout.maps.*"
|
||||
>
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import org.bigbluebutton.modules.breakout.events.StartBreakoutModule;
|
||||
|
||||
private var globalDispatcher:Dispatcher;
|
||||
|
||||
private var _moduleId:String = "HighlighterModule";
|
||||
private var _moduleName:String = "Highlighter Module";
|
||||
private var _attributes:Object;
|
||||
|
||||
public function get moduleId():String {
|
||||
return _moduleId;
|
||||
}
|
||||
|
||||
public function get moduleName():String {
|
||||
return _moduleName;
|
||||
}
|
||||
|
||||
public function get uri():String {
|
||||
return _attributes.uri + "/" + _attributes.room;
|
||||
}
|
||||
|
||||
public function get username():String {
|
||||
return _attributes.username;
|
||||
}
|
||||
|
||||
public function get connection():NetConnection {
|
||||
return _attributes.connection;
|
||||
}
|
||||
|
||||
public function get mode():String {
|
||||
return _attributes.mode;
|
||||
}
|
||||
|
||||
public function get userid():Number {
|
||||
return _attributes.userid as Number;
|
||||
}
|
||||
|
||||
public function get role():String {
|
||||
return _attributes.userrole as String;
|
||||
}
|
||||
|
||||
public function start(attributes:Object):void {
|
||||
_attributes = attributes;
|
||||
globalDispatcher = new Dispatcher();
|
||||
|
||||
var e:StartBreakoutModule = new StartBreakoutModule(StartBreakoutModule.START_BREAKOUT);
|
||||
e.attributes = attributes;
|
||||
globalDispatcher.dispatchEvent(e);
|
||||
}
|
||||
|
||||
public function stop():void {
|
||||
|
||||
}
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
<maps:BreakoutMap id="breakoutMap"/>
|
||||
</mx:Module>
|
@ -0,0 +1,151 @@
|
||||
package org.bigbluebutton.modules.breakout.business
|
||||
{
|
||||
import com.adobe.crypto.SHA1;
|
||||
|
||||
import flash.events.Event;
|
||||
import flash.events.NetStatusEvent;
|
||||
import flash.events.SyncEvent;
|
||||
import flash.net.NetConnection;
|
||||
import flash.net.SharedObject;
|
||||
import flash.net.URLLoader;
|
||||
import flash.net.URLRequest;
|
||||
import flash.net.URLRequestMethod;
|
||||
import flash.net.navigateToURL;
|
||||
|
||||
import mx.controls.Alert;
|
||||
import mx.events.CloseEvent;
|
||||
|
||||
public class BreakoutProxy
|
||||
{
|
||||
public static const API_URL:String = "http://192.168.0.225/bigbluebutton/api";
|
||||
public static const API_SALT:String = "1708e5ecf25b7142b06f2338b4ea3cf1";
|
||||
|
||||
private var urlLoader:URLLoader;
|
||||
private var request:URLRequest;
|
||||
private var meetingName:String;
|
||||
private var attendeePW:String;
|
||||
private var moderatorPW:String;
|
||||
|
||||
private var host:String;
|
||||
private var conference:String;
|
||||
private var room:String;
|
||||
private var userid:Number;
|
||||
private var username:String;
|
||||
private var userrole:String;
|
||||
private var connection:NetConnection;
|
||||
private var ncURL:String;
|
||||
private var breakoutSO:SharedObject;
|
||||
|
||||
private var usersList:Array;
|
||||
private var kickUsers:Boolean;
|
||||
|
||||
private var completeJoinUrl:String;
|
||||
private var newWindow:String;
|
||||
|
||||
public function BreakoutProxy()
|
||||
{
|
||||
urlLoader = new URLLoader();
|
||||
}
|
||||
|
||||
public function connect(a:Object):void{
|
||||
host = a.host as String;
|
||||
conference = a.conference as String;
|
||||
room = a.room as String;
|
||||
userid = a.userid as Number;
|
||||
username = a.username as String;
|
||||
userrole = a.userrole as String;
|
||||
connection = a.connection;
|
||||
ncURL = connection.uri;
|
||||
|
||||
breakoutSO = SharedObject.getRemote("breakoutSO", ncURL, false);
|
||||
breakoutSO.addEventListener(SyncEvent.SYNC, sharedObjectSyncHandler);
|
||||
breakoutSO.addEventListener(NetStatusEvent.NET_STATUS, netStatusEventHandler);
|
||||
breakoutSO.client = this;
|
||||
breakoutSO.connect(connection);
|
||||
}
|
||||
|
||||
private function sharedObjectSyncHandler(e:SyncEvent):void{
|
||||
|
||||
}
|
||||
|
||||
private function netStatusEventHandler(e:NetStatusEvent):void{
|
||||
|
||||
}
|
||||
|
||||
public function createRoom(usersList:Array, kickUsers:Boolean):void{
|
||||
this.usersList = usersList;
|
||||
this.kickUsers = kickUsers;
|
||||
|
||||
meetingName = Math.random().toString();
|
||||
var createString:String = "create" + "name=" + meetingName + "&meetingID=" + meetingName + API_SALT;
|
||||
var hash:String = SHA1.hash(createString);
|
||||
|
||||
var completeUrl:String = API_URL + "/create?" + "name=" + meetingName + "&meetingID=" + meetingName + "&checksum=" + hash;
|
||||
request = new URLRequest(completeUrl);
|
||||
request.method = URLRequestMethod.GET;
|
||||
urlLoader.addEventListener(Event.COMPLETE, handleMeetingCreated);
|
||||
urlLoader.load(request);
|
||||
}
|
||||
|
||||
private function handleMeetingCreated(e:Event):void{
|
||||
//Alert.show("" + e.target.data);
|
||||
//var returnString:String = '<?xml version="1.0" ?>' + e.target.data;
|
||||
var xml:XML = new XML(e.target.data);
|
||||
|
||||
if (xml.returncode == "SUCCESS"){
|
||||
attendeePW = xml.attendeePW;
|
||||
moderatorPW = xml.moderatorPW;
|
||||
startRoom();
|
||||
} else if (xml.returncode == "FAILED"){
|
||||
Alert.show(xml.messageKey + ":" + xml.message);
|
||||
}
|
||||
urlLoader.removeEventListener(Event.COMPLETE, handleMeetingCreated);
|
||||
}
|
||||
|
||||
private function startRoom():void{
|
||||
breakoutSO.send("redirectUser", meetingName, moderatorPW, attendeePW, kickUsers, usersList);
|
||||
}
|
||||
|
||||
public function redirectUser(newMeetingName:String, newModeratorPW:String, newAttendeePW:String, kickUser:Boolean, userList:Array):void{
|
||||
if (!checkIfUserInList(userList)) return;
|
||||
|
||||
var password:String;
|
||||
if (userrole == "MODERATOR" ) password = newModeratorPW;
|
||||
else password = newAttendeePW;
|
||||
|
||||
var safeUsername:String = username.replace(" ", "+");
|
||||
|
||||
var joinString:String = "join" + "fullName=" + safeUsername + "&meetingID=" + newMeetingName + "&password=" + password + "&userID=" + userid + API_SALT;
|
||||
var hash:String = SHA1.hash(joinString);
|
||||
|
||||
completeJoinUrl = API_URL + "/join?" + "fullName=" + safeUsername + "&meetingID=" + newMeetingName +
|
||||
"&password=" + password + "&userID=" + userid + "&checksum=" + hash;
|
||||
|
||||
var logoutMessage:String;
|
||||
if (kickUser){
|
||||
newWindow = "_self";
|
||||
logoutMessage = "You are being redirected to a new meeting. Click to continue";
|
||||
}
|
||||
else if (!kickUser){
|
||||
newWindow = "_blank";
|
||||
logoutMessage = "A new meeting will open. Click to continue";
|
||||
}
|
||||
|
||||
//Alert.show(completeJoinUrl);
|
||||
|
||||
Alert.show(logoutMessage, "", 4, null, onAlertClose);
|
||||
}
|
||||
|
||||
private function onAlertClose(e:CloseEvent):void{
|
||||
request = new URLRequest(completeJoinUrl);
|
||||
navigateToURL(request, newWindow);
|
||||
}
|
||||
|
||||
private function checkIfUserInList(list:Array):Boolean{
|
||||
for (var i:int = 0; i<list.length; i++){
|
||||
if (list[i] == userid) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package org.bigbluebutton.modules.breakout.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class CreateRoomEvent extends Event
|
||||
{
|
||||
public static const CREATE_ROOM:String = "Create Breakout Room";
|
||||
|
||||
public var kickUsers:Boolean;
|
||||
public var usersList:Array;
|
||||
|
||||
public function CreateRoomEvent(type:String)
|
||||
{
|
||||
super(type, true, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package org.bigbluebutton.modules.breakout.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class StartBreakoutModule extends Event
|
||||
{
|
||||
public static const START_BREAKOUT:String = "START_BREAKOUT";
|
||||
|
||||
public var attributes:Object;
|
||||
|
||||
public function StartBreakoutModule(type:String)
|
||||
{
|
||||
super(type, true, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
package org.bigbluebutton.modules.breakout.managers
|
||||
{
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import org.bigbluebutton.main.events.ToolbarButtonEvent;
|
||||
import org.bigbluebutton.modules.breakout.views.BreakoutButton;
|
||||
|
||||
public class BreakoutManager
|
||||
{
|
||||
private var dispatcher:Dispatcher;
|
||||
|
||||
private var button:BreakoutButton;
|
||||
|
||||
public function BreakoutManager()
|
||||
{
|
||||
dispatcher = new Dispatcher();
|
||||
button = new BreakoutButton;
|
||||
}
|
||||
|
||||
public function addButton(attributes:Object):void{
|
||||
if (attributes.userrole != "MODERATOR") return;
|
||||
var e:ToolbarButtonEvent = new ToolbarButtonEvent(ToolbarButtonEvent.ADD);
|
||||
e.button = button;
|
||||
dispatcher.dispatchEvent(e);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<EventMap xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
xmlns="http://mate.asfusion.com/">
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import mx.events.FlexEvent;
|
||||
|
||||
import org.bigbluebutton.modules.breakout.business.BreakoutProxy;
|
||||
import org.bigbluebutton.modules.breakout.events.CreateRoomEvent;
|
||||
import org.bigbluebutton.modules.breakout.events.StartBreakoutModule;
|
||||
import org.bigbluebutton.modules.breakout.managers.BreakoutManager;
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
<EventHandlers type="{FlexEvent.PREINITIALIZE}" >
|
||||
<ObjectBuilder generator="{BreakoutProxy}" cache="global" />
|
||||
<ObjectBuilder generator="{BreakoutManager}" cache="global" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{StartBreakoutModule.START_BREAKOUT}" >
|
||||
<MethodInvoker generator="{BreakoutProxy}" method="connect" arguments="{event.attributes}" />
|
||||
<MethodInvoker generator="{BreakoutManager}" method="addButton" arguments="{event.attributes}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{CreateRoomEvent.CREATE_ROOM}" >
|
||||
<MethodInvoker generator="{BreakoutProxy}" method="createRoom" arguments="{[event.usersList, event.kickUsers]}" />
|
||||
</EventHandlers>
|
||||
|
||||
</EventMap>
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<mx:Button xmlns:mx="http://www.adobe.com/2006/mxml" label="Breakout" click="openWindow()" >
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import mx.core.Application;
|
||||
import mx.events.CloseEvent;
|
||||
import mx.managers.PopUpManager;
|
||||
|
||||
private var window:BreakoutWindow;
|
||||
|
||||
private function openWindow():void{
|
||||
window = BreakoutWindow(PopUpManager.createPopUp(this, BreakoutWindow, true));
|
||||
window.x = stage.width/2 - window.width/2;
|
||||
window.y = stage.height/2 - window.height/2;
|
||||
window.addEventListener(CloseEvent.CLOSE, onWindowClose);
|
||||
}
|
||||
|
||||
private function onWindowClose(e:CloseEvent):void{
|
||||
PopUpManager.removePopUp(window);
|
||||
window = null
|
||||
}
|
||||
]]>
|
||||
</mx:Script>
|
||||
</mx:Button>
|
@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="100%" borderStyle="solid" >
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
private function onClick():void{
|
||||
data.selected = checkUser.selected;
|
||||
}
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
<mx:Label id="lblName" width="100" text="{data.name}" />
|
||||
<mx:CheckBox id="checkUser" click="onClick()" />
|
||||
</mx:HBox>
|
@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" width="400" height="300" label="Breakout participants to a separate room:"
|
||||
creationComplete="onCreationComplete()"
|
||||
showCloseButton="true">
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import mx.collections.ArrayCollection;
|
||||
import mx.controls.Alert;
|
||||
import mx.events.CloseEvent;
|
||||
|
||||
import org.bigbluebutton.main.api.UserManager;
|
||||
import org.bigbluebutton.main.model.users.Conference;
|
||||
import org.bigbluebutton.modules.breakout.events.CreateRoomEvent;
|
||||
|
||||
private var dispatcher:Dispatcher;
|
||||
|
||||
private var conference:Conference;
|
||||
[Bindable] private var participants:ArrayCollection;
|
||||
|
||||
private function onCreationComplete():void{
|
||||
dispatcher = new Dispatcher();
|
||||
conference = UserManager.getInstance().getConference();
|
||||
participants = conference.users;
|
||||
}
|
||||
|
||||
private function onClick():void{
|
||||
var e:CreateRoomEvent = new CreateRoomEvent(CreateRoomEvent.CREATE_ROOM);
|
||||
e.kickUsers = checkKick.selected;
|
||||
e.usersList = getUsersToBreakout();
|
||||
dispatcher.dispatchEvent(e);
|
||||
|
||||
dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
|
||||
}
|
||||
|
||||
private function getUsersToBreakout():Array{
|
||||
var a:ArrayCollection = new ArrayCollection();
|
||||
for (var i:int = 0; i<participants.length; i++){
|
||||
if (participants.getItemAt(i).selected) a.addItem(participants[i].userid);
|
||||
}
|
||||
return a.toArray();
|
||||
}
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
||||
<mx:List width="100%" height="100%" id="breakoutList" itemRenderer="org.bigbluebutton.modules.breakout.views.BreakoutItem"
|
||||
dataProvider="{participants}" allowMultipleSelection="true" />
|
||||
|
||||
<mx:ControlBar>
|
||||
<mx:Button id="btnCreate" click="onClick()" label="Create Room" />
|
||||
<mx:CheckBox id="checkKick" label="Kick selected users from current meeting" />
|
||||
</mx:ControlBar>
|
||||
</mx:TitleWindow>
|
Loading…
Reference in New Issue
Block a user