refactored the events names

This commit is contained in:
Felipe Cecagno 2013-06-19 16:36:42 -03:00
parent 2c24931bac
commit 0c01f1beae
7 changed files with 72 additions and 66 deletions

View File

@ -33,7 +33,19 @@ package org.bigbluebutton.main.events {
public static const VIDEO_STARTED:String = 'BBB_VIDEO_STARTED';
public static const START_DESKSHARE:String = 'BBB_START_DESKSHARE';
public static const DESKSHARE_STARTED:String = 'BBB_DESKSHARE_STARTED';
public static const SETTINGS_CONFIRMED:String = "BBB_SETTINGS_CONFIRMED";
public static const SETTINGS_CANCELLED:String = "BBB_SETTINGS_CANCELLED";
public static const ACCEPT_ALL_WAITING_GUESTS:String = "BBB_ACCEPT_ALL_WAITING_GUESTS";
public static const DENY_ALL_WAITING_GUESTS:String = "BBB_DENY_ALL_WAITING_GUESTS";
public static const DENY_GUEST:String = "BBB_DENY_GUEST";
public static const ACCEPT_GUEST:String = "BBB_ACCEPT_GUEST";
public static const ASK_TO_ACCEPT_GUEST:String = "BBB_ASK_TO_ACCEPT_GUEST";
public static const BROADCAST_GUEST_POLICY:String = "BBB_BROADCAST_GUEST_POLICY";
public static const RETRIEVE_GUEST_POLICY:String = "BBB_RETRIEVE_GUEST_POLICY";
public var message:String;
public var payload:Object = new Object();

View File

@ -93,19 +93,19 @@
<MethodInvoker generator="{UserService}" method="responseToAllGuests" arguments="{event}" />
</EventHandlers>
<EventHandlers type="ASK_TO_ACCEPT_GUEST" >
<EventHandlers type="{BBBEvent.ASK_TO_ACCEPT_GUEST}" >
<MethodInvoker generator="{UserService}" method="askToAccept" />
</EventHandlers>
<EventHandlers type="ACCEPT_GUEST" >
<EventHandlers type="{BBBEvent.ACCEPT_GUEST}" >
<MethodInvoker generator="{UserService}" method="acceptGuest" />
</EventHandlers>
<EventHandlers type="DENY_GUEST" >
<EventHandlers type="{BBBEvent.DENY_GUEST}" >
<MethodInvoker generator="{UserService}" method="denyGuest" />
</EventHandlers>
<EventHandlers type="GUEST_POLICY" >
<EventHandlers type="{BBBEvent.BROADCAST_GUEST_POLICY}" >
<MethodInvoker generator="{UserService}" method="newGuestPolicy" arguments="{event}" />
</EventHandlers>
@ -153,6 +153,7 @@
import org.bigbluebutton.core.managers.ConfigManager;
import org.bigbluebutton.core.services.SkinningService;
import org.bigbluebutton.main.events.BBBEvent;
import org.bigbluebutton.main.events.ConfigEvent;
import org.bigbluebutton.main.events.LogoutEvent;
import org.bigbluebutton.main.events.ModuleLoadEvent;

View File

@ -363,7 +363,7 @@ package org.bigbluebutton.main.model.users {
}
public function guestPolicyChanged(guestPolicy:String):void {
var policy:BBBEvent = new BBBEvent("GET_GUEST_POLICY");
var policy:BBBEvent = new BBBEvent(BBBEvent.RETRIEVE_GUEST_POLICY);
policy.payload['guestPolicy'] = guestPolicy;
dispatcher.dispatchEvent(policy);
@ -378,15 +378,15 @@ package org.bigbluebutton.main.model.users {
"participants.getGuestPolicy",// Remote function name
new Responder(
function(result:Object):void {
var policy:BBBEvent = new BBBEvent("GET_GUEST_POLICY");
var policy:BBBEvent = new BBBEvent(BBBEvent.RETRIEVE_GUEST_POLICY);
policy.payload['guestPolicy'] = result;
if(UserManager.getInstance().getConference().isGuest()) {
if(result == "ALWAYS_DENY")
dispatcher.dispatchEvent(new BBBEvent("DENY_GUEST"));
dispatcher.dispatchEvent(new BBBEvent(BBBEvent.DENY_GUEST));
else if(result == "ALWAYS_ACCEPT")
dispatcher.dispatchEvent(new BBBEvent("ACCEPT_GUEST"));
dispatcher.dispatchEvent(new BBBEvent(BBBEvent.ACCEPT_GUEST));
else
dispatcher.dispatchEvent(new BBBEvent("ASK_TO_ACCEPT_GUEST"));
dispatcher.dispatchEvent(new BBBEvent(BBBEvent.ASK_TO_ACCEPT_GUEST));
}
dispatcher.dispatchEvent(policy);
},

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" layout="vertical"
showCloseButton="true" close="onCancelClicked()"
showCloseButton="false"
xmlns:mate="http://mate.asfusion.com/"
minWidth="250"
creationComplete="onCancelClicked()"
@ -30,14 +30,20 @@
}
private function onCancelClicked():void {
var event:BBBEvent = new BBBEvent("CANCEL_CLICKED_EVENT");
var event:BBBEvent = new BBBEvent(BBBEvent.SETTINGS_CANCELLED);
dispatchEvent(event);
this.visible = false;
close();
}
private function onOkClicked():void {
var event:BBBEvent = new BBBEvent("OK_CLICKED_EVENT");
dispatchEvent(event);
var event:BBBEvent = new BBBEvent(BBBEvent.SETTINGS_CONFIRMED);
dispatchEvent(event);
close();
}
private function close():void {
// ideally we would like to remove the popup instead of just make it invisible
//PopUpManager.removePopUp(this);
this.visible = false;
}

View File

@ -4,9 +4,9 @@
width="400" >
<mate:Listener type="GET_GUEST_POLICY" method="refreshGuestPolicy"/>
<mate:Listener type="OK_CLICKED_EVENT" method="onOkClicked"/>
<mate:Listener type="CANCEL_CLICKED_EVENT" method="onCancelClicked"/>
<mate:Listener type="{BBBEvent.RETRIEVE_GUEST_POLICY}" method="refreshGuestPolicy"/>
<mate:Listener type="{BBBEvent.SETTINGS_CONFIRMED}" method="onOkClicked"/>
<mate:Listener type="{BBBEvent.SETTINGS_CANCELLED}" method="onCancelClicked"/>
<mx:Script>
<![CDATA[
@ -20,39 +20,26 @@
import org.bigbluebutton.common.events.SettingsComponentEvent;
import com.asfusion.mate.events.Dispatcher;
private var option:Number = 0;
private var guestPolicy:String;
private function refreshGuestPolicy(event:BBBEvent):void {
this.guestPolicy = event.payload.guestPolicy;
if(guestPolicy == "ASK_MODERATOR") {
guestManagement.selectedValue = 0; option = 0;
} else if(guestPolicy == "ALWAYS_ACCEPT") {
guestManagement.selectedValue = 1; option = 1;
}
else
{ guestManagement.selectedValue = 2;
option = 2;
}
setGuestPolicy(event.payload.guestPolicy);
}
public function setGuestPolicy(guestPolicy:String):void {
this.guestPolicy = guestPolicy;
if(guestPolicy == "ASK_MODERATOR") {
guestManagement.selectedValue = 0;
option = 0;
guestManagement.selectedValue = 0;
option = 0;
} else if(guestPolicy == "ALWAYS_ACCEPT") {
guestManagement.selectedValue = 1;
option = 1;
}
else
{ guestManagement.selectedValue = 2;
option = 2;
}
guestManagement.selectedValue = 1;
option = 1;
} else {
guestManagement.selectedValue = 2;
option = 2;
}
}
public function addToSettings():void {
@ -63,29 +50,28 @@
}
private function onCancelClicked(e:Event = null):void {
setGuestPolicy(guestPolicy);
}
setGuestPolicy(guestPolicy);
}
private function handleGuestClick(event:ItemClickEvent):void {
option = event.currentTarget.selectedValue;
}
private function onOkClicked(e:Event = null):void {
var event:BBBEvent = new BBBEvent("GUEST_POLICY");
var event:BBBEvent = new BBBEvent(BBBEvent.BROADCAST_GUEST_POLICY);
if(option == 0) {
event.payload['guestPolicy'] = "ASK_MODERATOR";
dispatchEvent(event);
dispatchEvent(event);
}
else if(option == 1) {
event.payload['guestPolicy'] = "ALWAYS_ACCEPT";
dispatchEvent(event);
dispatchEvent(new BBBEvent("ACCEPT_ALL_WAITING_GUESTS"));
dispatchEvent(new BBBEvent(BBBEvent.ACCEPT_ALL_WAITING_GUESTS));
}
else {
event.payload['guestPolicy'] = "ALWAYS_DENY";
dispatchEvent(event);
dispatchEvent(new BBBEvent("DENY_ALL_WAITING_GUESTS"));
dispatchEvent(new BBBEvent(BBBEvent.DENY_ALL_WAITING_GUESTS));
}
LogUtil.debug("SENDING TO SERVER POLICY");
}

View File

@ -25,9 +25,9 @@
x="0" y="0" layout="vertical" width="320" horizontalAlign="center"
xmlns:mate="http://mate.asfusion.com/" >
<mate:Listener type="ACCEPT_ALL_WAITING_GUESTS" method="acceptAllWaitingGuests"/>
<mate:Listener type="DENY_ALL_WAITING_GUESTS" method="denyAllWaitingGuests"/>
<mate:Listener type="ResponseModeratorEvent.RESPONSE" method="onModeratorResponse" />
<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" />
<mx:Script>
<![CDATA[
@ -57,8 +57,6 @@
}
public function addGuest(userid:Number, username:String):void {
// for (var i:int = 0; i < 30; ++i) {
// username += i;
numberOfGuests++;
guestWindowMap[userid] = username;
@ -67,8 +65,8 @@
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
this.visible = true;
// }
}
public function sendResponseToAllGuests(resp:Boolean):void {
@ -79,12 +77,11 @@
}
public function sendResponseToAllGuestsCheckBox(resp:Boolean):void {
if(checkBoxR.selected) {
var event:BBBEvent = new BBBEvent("GUEST_POLICY");
if(resp) {
if(rememberCheckBox.selected) {
var event:BBBEvent = new BBBEvent(BBBEvent.BROADCAST_GUEST_POLICY);
if (resp) {
event.payload['guestPolicy'] = "ALWAYS_ACCEPT";
}
else {
} else {
event.payload['guestPolicy'] = "ALWAYS_DENY";
}
dispatchEvent(event);
@ -109,7 +106,7 @@
}
guestWindowMap = new Object();
guestButtons = new Object();
this.visible = false;
close();
}
public function remove(userid:Number):void {
@ -119,22 +116,26 @@
delete guestWindowMap[userid];
guestListBox.removeChild(guestButtons[userid]);
delete guestButtons[userid];
if(this.hasGuest() == false) {
this.visible = false;
if (!hasGuest()) {
close();
}
}
}
public function hasGuest():Boolean {
if(numberOfGuests > 0)
return true;
else
return false;
return numberOfGuests > 0;
}
public function removeAll():void {
close();
PopUpManager.removePopUp(this);
}
public function close():void {
rememberCheckBox.selected = false;
this.visible = false;
}
private function onModeratorResponse(event:ResponseModeratorEvent):void {
remove(event.userid);
@ -146,7 +147,7 @@
<mx:HRule width="100%"/>
<mx:Button id="allowEveryoneBtn" label="{ResourceUtil.getInstance().getString('bbb.guests.allowEveryoneBtn.text')}" width="70%" click="sendResponseToAllGuestsCheckBox(true)" toolTip="{allowEveryoneBtn.label}"/>
<mx:Button id="denyEveryoneBtn" label="{ResourceUtil.getInstance().getString('bbb.guests.denyEveryoneBtn.text')}" width="70%" click="sendResponseToAllGuestsCheckBox(false)" toolTip="{denyEveryoneBtn.label}"/>
<mx:CheckBox id="checkBoxR" label="{ResourceUtil.getInstance().getString('bbb.guests.rememberAction.text')}"/>
<mx:CheckBox id="rememberCheckBox" label="{ResourceUtil.getInstance().getString('bbb.guests.rememberAction.text')}"/>
<mx:HRule width="100%"/>
<mx:VBox id="guestListBox" width="100%" height="100%" maxHeight="200" paddingLeft="10" paddingRight="10" paddingBottom="2" />

View File

@ -47,7 +47,7 @@
<mate:Listener type="SHOW_BBB_SETTINGS" method="showBBBSettings" />
<mate:Listener type="{NewGuestEvent.NEW_GUEST_EVENT}" method="newGuestWindow" />
<mate:Listener type="{ModeratorRespEvent.GUEST_ALLOWED}" method="guestAllowed" />
<mate:Listener type="GET_GUEST_POLICY" method="setGuestPolicy"/>
<mate:Listener type="{BBBEvent.RETRIEVE_GUEST_POLICY}" method="setGuestPolicy"/>
<mx:Script>
<![CDATA[