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