Refactoring guest
This commit is contained in:
parent
7c39c15209
commit
a68635561d
@ -0,0 +1,36 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2010 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 2.1 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.main.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class AddGuestEvent extends Event
|
||||
{
|
||||
public static const ADD_GUEST:String = "AddGuest";
|
||||
|
||||
|
||||
public var userid:Number;
|
||||
public var name:String;
|
||||
|
||||
public function AddGuestEvent(type:String = ADD_GUEST)
|
||||
{
|
||||
super(type, true, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2010 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 2.1 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.main.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class RefreshGuestEvent extends Event
|
||||
{
|
||||
public static const REFRESH_GUEST_VIEW:String = "RefreshGuestView";
|
||||
|
||||
|
||||
public listOfGuests:Object;
|
||||
|
||||
public function RefreshGuestEvent(type:String = REFRESH_GUEST_VIEW)
|
||||
{
|
||||
super(type, true, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2010 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 2.1 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.main.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class RemoveGuestEvent extends Event
|
||||
{
|
||||
public static const REMOVE_GUEST:String = "RemoveGuest";
|
||||
public static const REMOVE_ALL:String = "RemoveAllGuests";
|
||||
|
||||
public var userid:Number;
|
||||
|
||||
public function RemoveGuestEvent(type:String = REMOVE_GUEST)
|
||||
{
|
||||
super(type, true, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -31,6 +31,7 @@
|
||||
<ObjectBuilder generator="{ModulesProxy}" cache="global" />
|
||||
<ObjectBuilder generator="{UserService}" cache="global" />
|
||||
<ObjectBuilder generator="{ConfigManager}" cache="global" />
|
||||
<ObjectBuilder generator="{GuestManager}" cache="global" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{PortTestEvent.TEST_RTMP}" >
|
||||
@ -38,7 +39,13 @@
|
||||
</EventHandlers>
|
||||
|
||||
|
||||
|
||||
<EventHandlers type="{AddGuestEvent.ADD_GUEST}" >
|
||||
<MethodInvoker generator="{GuestManager}" method="addNewGuest" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{ResponseModeratorEvent.RESPONSE}" >
|
||||
<MethodInvoker generator="{GuestManager}" method="removeGuest" arguments="{event.userid}" />
|
||||
</EventHandlers>
|
||||
|
||||
|
||||
<EventHandlers type="{PortTestEvent.PORT_TEST_SUCCESS}" >
|
||||
@ -161,6 +168,7 @@
|
||||
import org.bigbluebutton.main.events.PortTestEvent;
|
||||
import org.bigbluebutton.main.events.SuccessfulLoginEvent;
|
||||
import org.bigbluebutton.main.events.UserServicesEvent;
|
||||
import org.bigbluebutton.main.model.GuestManager;
|
||||
import org.bigbluebutton.main.model.PortTestProxy;
|
||||
import org.bigbluebutton.main.model.modules.ModulesProxy;
|
||||
import org.bigbluebutton.main.model.users.UserService;
|
||||
@ -173,6 +181,8 @@
|
||||
import org.bigbluebutton.main.model.users.events.UsersConnectionEvent;
|
||||
import org.bigbluebutton.main.events.WaitModeratorEvent;
|
||||
import org.bigbluebutton.main.events.ResponseModeratorEvent;
|
||||
import org.bigbluebutton.main.events.AddGuestEvent;
|
||||
import org.bigbluebutton.main.events.ResponseModeratorEvent;
|
||||
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
@ -20,19 +20,12 @@
|
||||
package org.bigbluebutton.main.model
|
||||
{
|
||||
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
|
||||
public class Guest
|
||||
{
|
||||
private var listOfGuests:Object = new Object();
|
||||
private var numberOfGuests = 0;
|
||||
private var dispatcher;
|
||||
|
||||
function Guest(dispatcher:Dispatcher) {
|
||||
this.dispatcher = dispatcher;
|
||||
}
|
||||
|
||||
public function hasGuest():Boolean {
|
||||
return numberOfGuests > 0;
|
||||
}
|
||||
@ -47,6 +40,10 @@ package org.bigbluebutton.main.model
|
||||
numberOfGuests++;
|
||||
}
|
||||
|
||||
public function getGuests():Object {
|
||||
return this.listOfGuests;
|
||||
}
|
||||
|
||||
public function removeAllGuests():void {
|
||||
listOfGuests = new Object();
|
||||
numberOfGuests = 0;
|
||||
|
@ -0,0 +1,62 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2013 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 2.1 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/>.
|
||||
*
|
||||
* author:
|
||||
*/
|
||||
package org.bigbluebutton.main.model
|
||||
{
|
||||
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import org.bigbluebutton.main.events.RefreshGuestEvent;
|
||||
import org.bigbluebutton.main.events.AddGuestEvent;
|
||||
|
||||
public class GuestManager
|
||||
{
|
||||
private var guest:Guest;
|
||||
|
||||
function GuestManager(dispatcher:Dispatcher) {
|
||||
this.dispatcher = new Dispatcher();
|
||||
this.guest = new Guest();
|
||||
}
|
||||
|
||||
public function addGuest(evt:AddGuestEvent):void {
|
||||
guest.addGuest(evt.userid, evt.name);
|
||||
refreshGuestView();
|
||||
}
|
||||
|
||||
private function refreshGuestView():void {
|
||||
var refreshGuestEvent:RefreshGuestEvent = new RefreshGuestEvent();
|
||||
refreshGuestEvent.listOfGuests = guest.getGuests();
|
||||
dispatcher.dispatchEvent(refreshGuestEvent);
|
||||
}
|
||||
|
||||
public function removeAllGuests():void {
|
||||
guest.removeAllGuests();
|
||||
}
|
||||
|
||||
private function removeGuetFromView(userid:Number):void {
|
||||
var removeGuestFromViewEvent:RemoveGuestFromViewEvent = new RemoveGuestFromViewEvent();
|
||||
removeGuestFromViewEvent.userid = userid;
|
||||
dispatcher.dispatchEvent(removeGuestFromViewEvent);
|
||||
}
|
||||
|
||||
public function removeGuest(userid:Number):void {
|
||||
guest.remove(userid);
|
||||
removeGuetFromView(userid);
|
||||
}
|
||||
}
|
||||
}
|
@ -32,7 +32,7 @@ package org.bigbluebutton.main.model.users {
|
||||
import org.bigbluebutton.main.events.MadePresenterEvent;
|
||||
import org.bigbluebutton.main.events.ParticipantJoinEvent;
|
||||
import org.bigbluebutton.main.events.PresenterStatusEvent;
|
||||
import org.bigbluebutton.main.events.NewGuestEvent;
|
||||
import org.bigbluebutton.main.events.AddGuestEvent;
|
||||
import org.bigbluebutton.main.events.RemoveGuestRequestEvent;
|
||||
import org.bigbluebutton.main.events.ModeratorRespEvent;
|
||||
import org.bigbluebutton.main.model.ConferenceParameters;
|
||||
@ -288,7 +288,7 @@ package org.bigbluebutton.main.model.users {
|
||||
//Callback from server
|
||||
public function guestEntrance(userid:Number, name:String):void {
|
||||
if(UserManager.getInstance().getConference().amIModerator() && UserManager.getInstance().getConference().amIWaitForModerator() == false) {
|
||||
var e:NewGuestEvent = new NewGuestEvent(NewGuestEvent.NEW_GUEST_EVENT);
|
||||
var e:AddGuestEvent = new AddGuestEvent();
|
||||
e.userid = userid;
|
||||
e.name = name;
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
|
@ -37,17 +37,16 @@
|
||||
import org.bigbluebutton.common.Images;
|
||||
import org.bigbluebutton.core.BBB;
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.main.events.ResponseModeratorEvent;
|
||||
import org.bigbluebutton.main.events.ModuleLoadEvent;
|
||||
import org.bigbluebutton.main.events.RemoveGuestEvent;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
import mx.containers.HBox;
|
||||
import mx.controls.Button;
|
||||
import mx.controls.Spacer;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
|
||||
private var guestWindowMap:Object = new Object();
|
||||
private var guestButtons:Object = new Object();
|
||||
[Bindable] private var numberOfGuests:Number = 0;
|
||||
private var numberOfGuests:Number = 0;
|
||||
private var dispatcher:Dispatcher = new Dispatcher();
|
||||
|
||||
public function init():void {
|
||||
@ -55,19 +54,20 @@
|
||||
//this.isPopUp = false;
|
||||
}
|
||||
|
||||
public function addGuest(userid:Number, username:String):void {
|
||||
numberOfGuests++;
|
||||
guestWindowMap[userid] = username;
|
||||
|
||||
var guestItem:GuestItem = new GuestItem();
|
||||
guestItem.setUser(username, userid);
|
||||
guestListBox.addChild(guestItem);
|
||||
guestButtons[userid] = guestItem;
|
||||
|
||||
// ideally we would like to control if the view is displayed or not adding or removing the popup, not using the visible property
|
||||
public refreshGuestView(listOfGuests:Object):void {
|
||||
for (var key:String in listOfGuests) {
|
||||
var userid:Number = new Number(key);
|
||||
if(guestButtons[userid] == null) {
|
||||
var guestItem:GuestItem = new GuestItem();
|
||||
guestItem.setUser(username, userid);
|
||||
guestListBox.addChild(guestItem);
|
||||
guestButtons[userid] = guestItem;
|
||||
numberOfGuests++;
|
||||
}
|
||||
}
|
||||
this.visible = true;
|
||||
}
|
||||
|
||||
|
||||
public function sendResponseToAllGuests(resp:Boolean):void {
|
||||
removeAllGuests();
|
||||
var respCommand:ResponseModeratorEvent = new ResponseModeratorEvent(ResponseModeratorEvent.RESPONSE_ALL);
|
||||
@ -83,7 +83,7 @@
|
||||
} else {
|
||||
event.payload['guestPolicy'] = "ALWAYS_DENY";
|
||||
}
|
||||
dispatchEvent(event);
|
||||
dispatcher.dispatchEvent(event);
|
||||
}
|
||||
sendResponseToAllGuests(resp);
|
||||
}
|
||||
@ -97,27 +97,23 @@
|
||||
}
|
||||
|
||||
public function removeAllGuests():void {
|
||||
numberOfGuests = 0;
|
||||
var removeGuestEvent:RemoveGuestEvent = new RemoveGuestEvent(RemoveGuestEvent.REMOVE_ALL):
|
||||
dispatcher.dispatchEvent(removeGuestEvent);
|
||||
|
||||
for (var key:String in guestWindowMap) {
|
||||
var userid:Number = new Number(key);
|
||||
guestListBox.removeChild(guestButtons[userid]);
|
||||
}
|
||||
guestWindowMap = new Object();
|
||||
guestButtons = new Object();
|
||||
close();
|
||||
closeWindow();
|
||||
}
|
||||
|
||||
public function remove(userid:Number):void {
|
||||
if (guestWindowMap[userid] != null) {
|
||||
numberOfGuests--;
|
||||
|
||||
delete guestWindowMap[userid];
|
||||
if (guestButtons[userid] != null) {
|
||||
guestListBox.removeChild(guestButtons[userid]);
|
||||
delete guestButtons[userid];
|
||||
|
||||
var removeGuestEvent:RemoveGuestEvent = new RemoveGuestEvent():
|
||||
removeGuestEvent.userid = userid;
|
||||
dispatcher.dispatchEvent(removeGuestEvent);
|
||||
|
||||
if (!hasGuest()) {
|
||||
close();
|
||||
closeWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -126,14 +122,10 @@
|
||||
return numberOfGuests > 0;
|
||||
}
|
||||
|
||||
public function removeAll():void {
|
||||
close();
|
||||
PopUpManager.removePopUp(this);
|
||||
}
|
||||
|
||||
public function close():void {
|
||||
rememberCheckBox.selected = false;
|
||||
public function closeWindow():void {
|
||||
this.visible = false;
|
||||
PopUpManager.removePopUp(this);
|
||||
close();
|
||||
}
|
||||
|
||||
private function onModeratorResponse(event:ResponseModeratorEvent):void {
|
||||
|
@ -45,15 +45,16 @@
|
||||
<mate:Listener type="{RemoveGuestRequestEvent.GUEST_EVENT}" method="removeGuestWindow" />
|
||||
<mate:Listener type="SHOW_MIC_SETTINGS" method="showMicSettings" />
|
||||
<mate:Listener type="SHOW_BBB_SETTINGS" method="showBBBSettings" />
|
||||
<mate:Listener type="{NewGuestEvent.NEW_GUEST_EVENT}" method="addNewGuest" />
|
||||
<mate:Listener type="{ModeratorRespEvent.GUEST_ALLOWED}" method="guestAllowed" />
|
||||
<mate:Listener type="{BBBEvent.RETRIEVE_GUEST_POLICY}" method="setGuestPolicy"/>
|
||||
<mate:Listener type="{RefreshGuestEvent}" method="refreshGuestView"
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import flash.events.MouseEvent;
|
||||
import flash.events.Event;
|
||||
|
||||
import flexlib.mdi.containers.MDIWindow;
|
||||
import flexlib.mdi.effects.effectsLib.MDIVistaEffects;
|
||||
@ -82,12 +83,12 @@
|
||||
import org.bigbluebutton.main.events.PortTestEvent;
|
||||
import org.bigbluebutton.main.events.RecordStatusEvent;
|
||||
import org.bigbluebutton.main.events.WaitModeratorEvent;
|
||||
import org.bigbluebutton.main.events.NewGuestEvent;
|
||||
import org.bigbluebutton.main.events.RemoveGuestRequestEvent;
|
||||
import org.bigbluebutton.main.events.ModeratorRespEvent;
|
||||
import org.bigbluebutton.main.model.LayoutOptions;
|
||||
import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent;
|
||||
import org.bigbluebutton.main.model.Guest;
|
||||
import org.bigbluebutton.main.events.RefreshGuestEvent;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
import org.bigbluebutton.util.logging.Logger;
|
||||
import org.bigbluebutton.common.events.SettingsComponentEvent;
|
||||
@ -144,15 +145,12 @@
|
||||
}
|
||||
|
||||
private function setGuestPolicy(event:BBBEvent):void {
|
||||
LogUtil.debug("INICIALIZANDO GUEST_POLICY " + event.payload.guestPolicy);
|
||||
guestPolicy = event.payload.guestPolicy;
|
||||
if(guestManagement == null) {
|
||||
LogUtil.debug("ADD Guest Event");
|
||||
guestManagement = new GuestManagement();
|
||||
guestManagement.setGuestPolicy(guestPolicy);
|
||||
guestManagement.addToSettings();
|
||||
//Add event to init bbbsettings
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,17 +210,22 @@
|
||||
/* Do something specific here if we switched to normal mode. */
|
||||
}
|
||||
}
|
||||
|
||||
private function addNewGuest(evt:NewGuestEvent):void {
|
||||
guest.addGuest(evt.userid, evt.name);
|
||||
//if(guestWindow == null) {
|
||||
// guestWindow = PopUpManager.createPopUp( mdiCanvas, GuestWindow, false) as GuestWindow;
|
||||
// guestWindow.x = width - 400;
|
||||
// guestWindow.y = 20;
|
||||
//}
|
||||
//guestWindow.addGuest(evt.userid, evt.name);
|
||||
|
||||
|
||||
private function closeGuestWindow(e:Event) {
|
||||
LogUtil.debug("CLOSE GUEST WINDOW");
|
||||
guestWindow = null;
|
||||
}
|
||||
|
||||
private function refreshGuestView(evt:RefreshGuestEvent):void {
|
||||
if(guestWindow == null) {
|
||||
guestWindow = PopUpManager.createPopUp( mdiCanvas, GuestWindow, false) as GuestWindow;
|
||||
guestWindow.addEventListener(Event.CLOSE, closeGuestWindow);
|
||||
guestWindow.x = width - 400;
|
||||
guestWindow.y = 20;
|
||||
}
|
||||
guestWindow.refreshGuestView(evt.listOfGuests);
|
||||
}
|
||||
|
||||
public function removeGuestWindow(evt:RemoveGuestRequestEvent):void {
|
||||
if(guestWindow != null)
|
||||
guestWindow.remove(evt.userid);
|
||||
|
Loading…
Reference in New Issue
Block a user