Improved logout messages for the client

git-svn-id: http://bigbluebutton.googlecode.com/svn/trunk@4260 af16638f-c34d-0410-8cfa-b39d5352b314
This commit is contained in:
Denis Zgonjanin 2010-05-07 14:47:02 +00:00
parent 4e99f5d50d
commit aa10ad1800
7 changed files with 84 additions and 47 deletions

View File

@ -105,7 +105,7 @@ package org.bigbluebutton.main
break;
case EndpointMessageConstants.USER_LOGGED_OUT:
LogUtil.debug(NAME + "::Got USER_LOGGED_OUT from " + message.getHeader().SRC as String);
sendNotification(MainApplicationConstants.USER_LOGGED_OUT);
sendNotification(MainApplicationConstants.USER_LOGGED_OUT, message.getBody() as String);
break;
case EndpointMessageConstants.MODULE_STARTED:
LogUtil.debug(NAME + "::Got MODULE_STARTED from " + message.getBody() as String);

View File

@ -25,6 +25,7 @@ package org.bigbluebutton.main.view
import flexlib.mdi.containers.MDIWindow;
import mx.managers.PopUpManager;
import mx.managers.PopUpManagerChildList;
import org.bigbluebutton.common.IBbbModuleWindow;
import org.bigbluebutton.main.MainApplicationConstants;
@ -36,9 +37,9 @@ package org.bigbluebutton.main.view
import org.bigbluebutton.main.view.components.ModuleStoppedWindow;
import org.bigbluebutton.main.view.events.StartModuleEvent;
import org.bigbluebutton.modules.phone.views.components.ToolbarButton;
import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.mediator.Mediator;
import org.bigbluebutton.util.i18n.ResourceUtil;
import org.puremvc.as3.multicore.interfaces.INotification;
import org.puremvc.as3.multicore.patterns.mediator.Mediator;
/**
* This is the Mediator class for MainApplicationShell view compom\nent
@ -56,7 +57,7 @@ package org.bigbluebutton.main.view
private var phoneButton:ToolbarButton;
private var phoneRegistered:Boolean = false;
private var logoutWindow:LoggedOutWindow;
public function MainApplicationShellMediator( viewComponent:MainApplicationShell )
{
@ -130,7 +131,7 @@ package org.bigbluebutton.main.view
shell.mdiCanvas.windowManager.remove(rwin as MDIWindow);
break;
case MainApplicationConstants.USER_LOGGED_OUT:
handleUserLoggedOut();
handleUserLoggedOut(notification.getBody() as String);
// if (red5phoneAdded) {
// red5phoneAdded = false;
// shell.mdiCanvas.windowManager.remove(red5PhoneWindow as MDIWindow);
@ -198,23 +199,24 @@ package org.bigbluebutton.main.view
portTestProxy.connect("RTMPT", host, "", "bigbluebutton");
}
private function handleUserLoggedOut():void {
private function handleUserLoggedOut(reason:String):void {
if (logoutWindow != null) return;
logoutWindow = LoggedOutWindow(PopUpManager.createPopUp( shell.mdiCanvas, LoggedOutWindow, false));
var t:LoggedOutWindow = LoggedOutWindow(PopUpManager.createPopUp( shell.mdiCanvas, LoggedOutWindow, false));
var point1:Point = new Point();
// Calculate position of TitleWindow in Application's coordinates.
point1.x = 400;
point1.y = 300;
point1 = shell.localToGlobal(point1);
t.x = point1.x + 25;
t.y = point1.y + 25;
var point1:Point = new Point();
// Calculate position of TitleWindow in Application's coordinates.
point1.x = 400;
point1.y = 300;
point1 = shell.localToGlobal(point1);
logoutWindow.x = point1.x + 25;
logoutWindow.y = point1.y + 25;
logoutWindow.setReason(reason);
/*
var pageURL:String = mx.core.Application.application.url.split("/")[2];
var url:URLRequest = new URLRequest("http://" + pageURL + "/bigbluebutton/conference-session/signOut");
LogUtil.debug("Log out url: " + pageURL);
navigateToURL(url, '_self');
var pageURL:String = mx.core.Application.application.url.split("/")[2];
var url:URLRequest = new URLRequest("http://" + pageURL + "/bigbluebutton/conference-session/signOut");
LogUtil.debug("Log out url: " + pageURL);
navigateToURL(url, '_self');
*/
}

View File

@ -22,17 +22,19 @@
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
title="Logged Out" showCloseButton="true" creationComplete="init()"
x="168" y="86" layout="absolute" width="300" height="100">
x="168" y="86" layout="vertical" width="400" height="100" horizontalAlign="center">
<mx:Script>
<![CDATA[
import mx.controls.Alert;
import mx.managers.PopUpManager;
[Bindable] private var message:String = "You have logged out of the conference";
private function init():void {
addEventListener(Event.CLOSE, onUserLoggedOutWindowClose);
}
private function redirect():void {
private function redirect():void {
var pageURL:String = mx.core.Application.application.url.split("/")[2];
var url:URLRequest = new URLRequest("http://" + pageURL + "/bigbluebutton/conference-session/signOut");
LogUtil.debug("Log out url: " + pageURL);
@ -43,9 +45,13 @@
private function onUserLoggedOutWindowClose(e:Event):void {
PopUpManager.removePopUp(this);
}
public function setReason(reason:String):void{
message = reason;
}
]]>
</mx:Script>
<mx:Button id="okBtn" label="OK" click="redirect()" x="118.5" y="28"/>
<mx:Label text="You have logged out of the conference" y="7" x="24"/>
<mx:Button id="okBtn" label="OK" click="redirect()"/>
<mx:Label text="{message}"/>
</mx:TitleWindow>

View File

@ -95,8 +95,7 @@ package org.bigbluebutton.modules.viewers
EndpointMessageConstants.TO_MAIN_APP, user);
break;
case ViewersModuleConstants.LOGGED_OUT:
_endpoint.sendMessage(EndpointMessageConstants.USER_LOGGED_OUT,
EndpointMessageConstants.TO_MAIN_APP, "LOGGED_OUT"); // just send a string
sendLogoutMessage(notification.getBody() as String);
break;
case ViewersModuleConstants.STARTED:
LogUtil.debug("Sending Viewers MODULE_STARTED message to main");
@ -168,6 +167,32 @@ package org.bigbluebutton.modules.viewers
private function get proxy():ViewersProxy {
return facade.retrieveProxy(ViewersProxy.NAME) as ViewersProxy;
}
}
private function sendLogoutMessage(reason:String):void{
var logoutMessage:String;
switch(reason){
case ViewersModuleConstants.CONNECT_CLOSED:
logoutMessage = "The connection to the server has been closed";
break;
case ViewersModuleConstants.CONNECT_FAILED:
logoutMessage = "The connection to the server has failed";
break;
case ViewersModuleConstants.CONNECT_REJECTED:
logoutMessage = "The connection to the server has been rejected";
break;
case ViewersModuleConstants.INVALID_APP:
logoutMessage = "The app the client was trying to connect to doesn't exist on the red5 server";
break;
case ViewersModuleConstants.APP_SHUTDOWN:
logoutMessage = "The red5 app on the server has shutdown";
break;
case ViewersModuleConstants.UNKNOWN_REASON:
logoutMessage = "You have been logged out for an unknown reason";
break;
}
_endpoint.sendMessage(EndpointMessageConstants.USER_LOGGED_OUT,
EndpointMessageConstants.TO_MAIN_APP, logoutMessage);
}
}
}

View File

@ -52,6 +52,7 @@ package org.bigbluebutton.modules.viewers
public static const CLOSE_VIEWERS_WINDOW:String = 'CLOSE_VIEWERS_WINDOW';
public static const MODULE_STARTED:String = 'MODULE_STARTED';
public static const PLAYBACK_STARTED:String = "PLAYBACK_STARTED";
public static const ASSIGN_PRESENTER:String = "ASSIGN_PRESENTER";
public static const BECOME_VIEWER:String = "BECOME_VIEWER";
@ -61,6 +62,7 @@ package org.bigbluebutton.modules.viewers
public static const BECOME_PRESENTER_EVENT:String = "BECOME_PRESENTER_EVENT";
public static const QUERY_PRESENTER_EVENT:String = "QUERY_PRESENTER_EVENT";
public static const QUERY_PRESENTER_REPLY:String = "QUERY_PRESENTER_REPLY";
public static const QUERY_PARTICIPANTS_REPLY:String = "QUERY_PARTICIPANTS_SUCCESS";
public static const CONNECT_SUCCESS:String = "CONNECT_SUCCESS";
public static const CONNECT_FAILED:String = "CONNECT_FAILED";
@ -69,5 +71,6 @@ package org.bigbluebutton.modules.viewers
public static const APP_SHUTDOWN:String = "APP_SHUTDOWN";
public static const CONNECT_REJECTED:String = "CONNECT_REJECTED";
public static const UNKNOWN_REASON:String = "UNKNOWN_REASON";
public static const ASYNC_ERROR:String = "ASYNC_ERROR_REASON";
}
}

View File

@ -127,6 +127,7 @@ package org.bigbluebutton.modules.viewers.model.services
public function handleResult( event : Object ) : void {
var info : Object = event.info;
var statusCode : String = info.code;
switch ( statusCode )
{
case CONNECT_SUCCESS :
@ -139,7 +140,7 @@ package org.bigbluebutton.modules.viewers.model.services
LogUtil.debug("Successful result: " + result);
_userid = Number(result);
if (_userid >= 0) {
_connectionSuccessListener(true, {userid:_userid});
_connectionSuccessListener(true, ViewersModuleConstants.CONNECT_SUCCESS, {userid:_userid});
}
},
// status - On error occurred
@ -157,7 +158,7 @@ package org.bigbluebutton.modules.viewers.model.services
case CONNECT_FAILED :
if (tried_tunneling) {
LogUtil.debug(NAME + ":Connection to viewers application failed...even when tunneling");
_connectionSuccessListener(false, null, ViewersModuleConstants.CONNECT_FAILED);
_connectionSuccessListener(false, ViewersModuleConstants.CONNECT_FAILED, null);
} else {
disconnect();
_netConnection = null;
@ -170,27 +171,27 @@ package org.bigbluebutton.modules.viewers.model.services
case CONNECT_CLOSED :
LogUtil.debug(NAME + ":Connection to viewers application closed");
_connectionSuccessListener(false, null, ViewersModuleConstants.CONNECT_CLOSED);
_connectionSuccessListener(false, ViewersModuleConstants.CONNECT_CLOSED );
break;
case INVALID_APP :
LogUtil.debug(NAME + ":viewers application not found on server");
_connectionSuccessListener(false, null, ViewersModuleConstants.INVALID_APP);
_connectionSuccessListener(false, ViewersModuleConstants.INVALID_APP, null);
break;
case APP_SHUTDOWN :
LogUtil.debug(NAME + ":viewers application has been shutdown");
_connectionSuccessListener(false, null, ViewersModuleConstants.APP_SHUTDOWN);
_connectionSuccessListener(false, ViewersModuleConstants.APP_SHUTDOWN, null);
break;
case CONNECT_REJECTED :
LogUtil.debug(NAME + ":No permissions to connect to the viewers application" );
_connectionSuccessListener(false, null, ViewersModuleConstants.CONNECT_REJECTED);
LogUtil.debug(NAME + ":Connection to the server rejected. Uri: " + _module.uri + ". Check if the red5 specified in the uri exists and is running" );
_connectionSuccessListener(false, ViewersModuleConstants.CONNECT_REJECTED, null);
break;
default :
LogUtil.debug(NAME + ":Default status to the viewers application" );
_connectionSuccessListener(false, null, ViewersModuleConstants.UNKNOWN_REASON);
_connectionSuccessListener(false, ViewersModuleConstants.UNKNOWN_REASON, null);
break;
}
}

View File

@ -83,7 +83,7 @@ package org.bigbluebutton.modules.viewers.model.services
if (_messageSender != null) _messageSender(msg, body);
}
private function connectionSuccessListener(connected:Boolean, user:Object=null, failReason:String=""):void {
private function connectionSuccessListener(connected:Boolean, failReason:String, user:Object=null):void {
if (connected) {
LogUtil.debug(LOGNAME + ":Connected to the Viewers application " + user.userid);
_participants.me.userid = user.userid;
@ -122,7 +122,7 @@ package org.bigbluebutton.modules.viewers.model.services
// participants - On successful result
function(result:Object):void {
LogUtil.debug("Successfully started playback: ");
notifyConnectionStatusListener(true);
notifyConnectionStatusListener(true, ViewersModuleConstants.PLAYBACK_STARTED);
},
// status - On error occurred
function(status:Object):void {
@ -150,7 +150,7 @@ package org.bigbluebutton.modules.viewers.model.services
{
participantJoined(result.participants[p]);
}
notifyConnectionStatusListener(true);
notifyConnectionStatusListener(true, ViewersModuleConstants.QUERY_PARTICIPANTS_REPLY);
trace("Am I the only moderator?");
LogUtil.debug("Am I the only moderator?");
becomePresenterIfLoneModerator();
@ -408,7 +408,7 @@ package org.bigbluebutton.modules.viewers.model.services
}
private function notifyConnectionStatusListener(connected:Boolean, reason:String = null):void {
private function notifyConnectionStatusListener(connected:Boolean, reason:String):void {
if (_connectionStatusListener != null) {
_connectionStatusListener(connected, reason);
}
@ -422,37 +422,37 @@ package org.bigbluebutton.modules.viewers.model.services
{
case "NetConnection.Connect.Success" :
LogUtil.debug(LOGNAME + ":Connection Success");
notifyConnectionStatusListener(true);
notifyConnectionStatusListener(true, ViewersModuleConstants.CONNECT_SUCCESS);
break;
case "NetConnection.Connect.Failed" :
LogUtil.debug(LOGNAME + ":Connection to viewers application failed");
notifyConnectionStatusListener(false);
notifyConnectionStatusListener(false, ViewersModuleConstants.CONNECT_FAILED);
break;
case "NetConnection.Connect.Closed" :
LogUtil.debug(LOGNAME + ":Connection to viewers application closed");
notifyConnectionStatusListener(false);
notifyConnectionStatusListener(false, ViewersModuleConstants.CONNECT_CLOSED);
break;
case "NetConnection.Connect.InvalidApp" :
LogUtil.debug(LOGNAME + ":Viewers application not found on server");
notifyConnectionStatusListener(false);
notifyConnectionStatusListener(false, ViewersModuleConstants.INVALID_APP);
break;
case "NetConnection.Connect.AppShutDown" :
LogUtil.debug(LOGNAME + ":Viewers application has been shutdown");
notifyConnectionStatusListener(false);
notifyConnectionStatusListener(false, ViewersModuleConstants.APP_SHUTDOWN);
break;
case "NetConnection.Connect.Rejected" :
LogUtil.debug(LOGNAME + ":No permissions to connect to the viewers application" );
notifyConnectionStatusListener(false);
notifyConnectionStatusListener(false, ViewersModuleConstants.CONNECT_REJECTED);
break;
default :
LogUtil.debug(LOGNAME + ":default - " + event.info.code );
notifyConnectionStatusListener(false);
notifyConnectionStatusListener(false, event.info.code);
break;
}
}
@ -460,7 +460,7 @@ package org.bigbluebutton.modules.viewers.model.services
private function asyncErrorHandler ( event : AsyncErrorEvent ) : void
{
LogUtil.debug(LOGNAME + "participantsSO asyncErrorHandler " + event.error);
notifyConnectionStatusListener(false);
notifyConnectionStatusListener(false, ViewersModuleConstants.ASYNC_ERROR);
}
public function get connection():NetConnection