Refactoring guest
This commit is contained in:
parent
a68635561d
commit
e7cb88cf29
@ -24,8 +24,7 @@ package org.bigbluebutton.main.events
|
||||
{
|
||||
public static const REFRESH_GUEST_VIEW:String = "RefreshGuestView";
|
||||
|
||||
|
||||
public listOfGuests:Object;
|
||||
public var listOfGuests:Object;
|
||||
|
||||
public function RefreshGuestEvent(type:String = REFRESH_GUEST_VIEW)
|
||||
{
|
||||
|
@ -0,0 +1,34 @@
|
||||
/**
|
||||
* 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 RemoveGuestFromViewEvent extends Event
|
||||
{
|
||||
public static const REMOVE_GUEST:String = "RemoveGuest";
|
||||
|
||||
public var userid:Number;
|
||||
|
||||
public function RemoveGuestFromViewEvent(type:String = REMOVE_GUEST)
|
||||
{
|
||||
super(type, true, false);
|
||||
}
|
||||
}
|
||||
}
|
@ -43,11 +43,6 @@
|
||||
<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}" >
|
||||
<MethodInvoker generator="{ModulesProxy}" method="portTestSuccess" arguments="{event.protocol}" />
|
||||
</EventHandlers>
|
||||
@ -93,8 +88,12 @@
|
||||
|
||||
<EventHandlers type="{ResponseModeratorEvent.RESPONSE}" >
|
||||
<MethodInvoker generator="{UserService}" method="responseToGuest" arguments="{event}" />
|
||||
<MethodInvoker generator="{GuestManager}" method="removeGuest" arguments="{event.userid}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{RemoveGuestRequestEvent.GUEST_EVENT}" >
|
||||
<MethodInvoker generator="{GuestManager}" method="removeGuest" arguments="{event.userid}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{ResponseModeratorEvent.RESPONSE_ALL}" >
|
||||
<MethodInvoker generator="{UserService}" method="responseToAllGuests" arguments="{event}" />
|
||||
@ -183,6 +182,7 @@
|
||||
import org.bigbluebutton.main.events.ResponseModeratorEvent;
|
||||
import org.bigbluebutton.main.events.AddGuestEvent;
|
||||
import org.bigbluebutton.main.events.ResponseModeratorEvent;
|
||||
import org.bigbluebutton.main.events.RemoveGuestRequestEvent;
|
||||
|
||||
]]>
|
||||
</mx:Script>
|
||||
|
@ -23,8 +23,7 @@ package org.bigbluebutton.main.model
|
||||
public class Guest
|
||||
{
|
||||
private var listOfGuests:Object = new Object();
|
||||
private var numberOfGuests = 0;
|
||||
private var dispatcher;
|
||||
private var numberOfGuests:Number = 0;
|
||||
|
||||
public function hasGuest():Boolean {
|
||||
return numberOfGuests > 0;
|
||||
@ -34,9 +33,8 @@ package org.bigbluebutton.main.model
|
||||
return numberOfGuests;
|
||||
}
|
||||
|
||||
public function addGuest(userID:Number, userName:String):void {
|
||||
var guest:Object = {userid:userID, username:userName};
|
||||
listOfGuests.addItem(guest);
|
||||
public function addGuest(userid:Number, username:String):void {
|
||||
listOfGuests[userid] = username;
|
||||
numberOfGuests++;
|
||||
}
|
||||
|
||||
|
@ -23,12 +23,14 @@ package org.bigbluebutton.main.model
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import org.bigbluebutton.main.events.RefreshGuestEvent;
|
||||
import org.bigbluebutton.main.events.AddGuestEvent;
|
||||
import org.bigbluebutton.main.events.RemoveGuestFromViewEvent;
|
||||
|
||||
public class GuestManager
|
||||
{
|
||||
private var guest:Guest;
|
||||
private var dispatcher:Dispatcher;
|
||||
|
||||
function GuestManager(dispatcher:Dispatcher) {
|
||||
function GuestManager() {
|
||||
this.dispatcher = new Dispatcher();
|
||||
this.guest = new Guest();
|
||||
}
|
||||
@ -48,7 +50,7 @@ package org.bigbluebutton.main.model
|
||||
guest.removeAllGuests();
|
||||
}
|
||||
|
||||
private function removeGuetFromView(userid:Number):void {
|
||||
private function removeGuestFromView(userid:Number):void {
|
||||
var removeGuestFromViewEvent:RemoveGuestFromViewEvent = new RemoveGuestFromViewEvent();
|
||||
removeGuestFromViewEvent.userid = userid;
|
||||
dispatcher.dispatchEvent(removeGuestFromViewEvent);
|
||||
@ -56,7 +58,7 @@ package org.bigbluebutton.main.model
|
||||
|
||||
public function removeGuest(userid:Number):void {
|
||||
guest.remove(userid);
|
||||
removeGuetFromView(userid);
|
||||
removeGuestFromView(userid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -409,11 +409,11 @@ package org.bigbluebutton.main.model.users {
|
||||
for(i = 0; i < users.length; i++) {
|
||||
if(users[i] != "") {
|
||||
var pairSplited:Array = users[i].split("!2");
|
||||
var newGuestEvent:NewGuestEvent = new NewGuestEvent(NewGuestEvent.NEW_GUEST_EVENT);
|
||||
newGuestEvent.userid = new Number(pairSplited[0]);
|
||||
newGuestEvent.name = pairSplited[1];
|
||||
var addGuestEvent:AddGuestEvent = new AddGuestEvent(AddGuestEvent.ADD_GUEST);
|
||||
addGuestEvent.userid = new Number(pairSplited[0]);
|
||||
addGuestEvent.name = pairSplited[1];
|
||||
var dispatcher:Dispatcher = new Dispatcher();
|
||||
dispatcher.dispatchEvent(newGuestEvent);
|
||||
dispatcher.dispatchEvent(addGuestEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@
|
||||
|
||||
<mate:Listener type="{BBBEvent.ACCEPT_ALL_WAITING_GUESTS}" method="acceptAllWaitingGuests" />
|
||||
<mate:Listener type="{BBBEvent.DENY_ALL_WAITING_GUESTS}" method="denyAllWaitingGuests" />
|
||||
<mate:Listener type="{ResponseModeratorEvent.RESPONSE}" method="onModeratorResponse" />
|
||||
<mate:Listener type="{RemoveGuestFromViewEvent.REMOVE_GUEST}" receive="{remove(event.userid)}" />
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
@ -39,14 +39,17 @@
|
||||
import org.bigbluebutton.core.managers.UserManager;
|
||||
import org.bigbluebutton.main.events.ModuleLoadEvent;
|
||||
import org.bigbluebutton.main.events.RemoveGuestEvent;
|
||||
import org.bigbluebutton.main.events.ResponseModeratorEvent;
|
||||
import org.bigbluebutton.main.events.RemoveGuestFromViewEvent;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
import mx.containers.HBox;
|
||||
import mx.controls.Button;
|
||||
import mx.controls.Spacer;
|
||||
import mx.events.CloseEvent;
|
||||
import org.bigbluebutton.main.events.BBBEvent;
|
||||
|
||||
private var guestButtons:Object = new Object();
|
||||
private var numberOfGuests:Number = 0;
|
||||
[Bindable] private var numberOfGuests:Number = 0;
|
||||
private var dispatcher:Dispatcher = new Dispatcher();
|
||||
|
||||
public function init():void {
|
||||
@ -54,12 +57,12 @@
|
||||
//this.isPopUp = false;
|
||||
}
|
||||
|
||||
public refreshGuestView(listOfGuests:Object):void {
|
||||
public function 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);
|
||||
guestItem.setUser(listOfGuests[userid], userid);
|
||||
guestListBox.addChild(guestItem);
|
||||
guestButtons[userid] = guestItem;
|
||||
numberOfGuests++;
|
||||
@ -97,7 +100,7 @@
|
||||
}
|
||||
|
||||
public function removeAllGuests():void {
|
||||
var removeGuestEvent:RemoveGuestEvent = new RemoveGuestEvent(RemoveGuestEvent.REMOVE_ALL):
|
||||
var removeGuestEvent:RemoveGuestEvent = new RemoveGuestEvent(RemoveGuestEvent.REMOVE_ALL);
|
||||
dispatcher.dispatchEvent(removeGuestEvent);
|
||||
|
||||
closeWindow();
|
||||
@ -108,7 +111,7 @@
|
||||
guestListBox.removeChild(guestButtons[userid]);
|
||||
delete guestButtons[userid];
|
||||
|
||||
var removeGuestEvent:RemoveGuestEvent = new RemoveGuestEvent():
|
||||
var removeGuestEvent:RemoveGuestEvent = new RemoveGuestEvent();
|
||||
removeGuestEvent.userid = userid;
|
||||
dispatcher.dispatchEvent(removeGuestEvent);
|
||||
|
||||
@ -125,11 +128,7 @@
|
||||
public function closeWindow():void {
|
||||
this.visible = false;
|
||||
PopUpManager.removePopUp(this);
|
||||
close();
|
||||
}
|
||||
|
||||
private function onModeratorResponse(event:ResponseModeratorEvent):void {
|
||||
remove(event.userid);
|
||||
dispatchEvent(new CloseEvent(CloseEvent.CLOSE));
|
||||
}
|
||||
|
||||
]]>
|
||||
|
@ -47,7 +47,7 @@
|
||||
<mate:Listener type="SHOW_BBB_SETTINGS" method="showBBBSettings" />
|
||||
<mate:Listener type="{ModeratorRespEvent.GUEST_ALLOWED}" method="guestAllowed" />
|
||||
<mate:Listener type="{BBBEvent.RETRIEVE_GUEST_POLICY}" method="setGuestPolicy"/>
|
||||
<mate:Listener type="{RefreshGuestEvent}" method="refreshGuestView"
|
||||
<mate:Listener type="{RefreshGuestEvent}" method="refreshGuestView" />
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
@ -211,9 +211,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
private function closeGuestWindow(e:Event) {
|
||||
LogUtil.debug("CLOSE GUEST WINDOW");
|
||||
guestWindow = null;
|
||||
private function closeGuestWindow(e:Event):void {
|
||||
guestWindow.closeWindow();
|
||||
}
|
||||
|
||||
private function refreshGuestView(evt:RefreshGuestEvent):void {
|
||||
@ -346,9 +345,9 @@
|
||||
if(waitWindow != null)
|
||||
waitWindow.removeWindow();
|
||||
|
||||
if(guestWindow != null)
|
||||
guestWindow.removeAll();
|
||||
|
||||
if(guestWindow != null) {
|
||||
guestWindow.closeWindow();
|
||||
}
|
||||
|
||||
|
||||
if (layoutOptions.showLogoutWindow) {
|
||||
|
Loading…
Reference in New Issue
Block a user