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

View File

@ -22,12 +22,14 @@
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml" <mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
title="Logged Out" showCloseButton="true" creationComplete="init()" 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> <mx:Script>
<![CDATA[ <![CDATA[
import mx.controls.Alert; import mx.controls.Alert;
import mx.managers.PopUpManager; import mx.managers.PopUpManager;
[Bindable] private var message:String = "You have logged out of the conference";
private function init():void { private function init():void {
addEventListener(Event.CLOSE, onUserLoggedOutWindowClose); addEventListener(Event.CLOSE, onUserLoggedOutWindowClose);
} }
@ -43,9 +45,13 @@
private function onUserLoggedOutWindowClose(e:Event):void { private function onUserLoggedOutWindowClose(e:Event):void {
PopUpManager.removePopUp(this); PopUpManager.removePopUp(this);
} }
public function setReason(reason:String):void{
message = reason;
}
]]> ]]>
</mx:Script> </mx:Script>
<mx:Button id="okBtn" label="OK" click="redirect()" x="118.5" y="28"/> <mx:Button id="okBtn" label="OK" click="redirect()"/>
<mx:Label text="You have logged out of the conference" y="7" x="24"/> <mx:Label text="{message}"/>
</mx:TitleWindow> </mx:TitleWindow>

View File

@ -95,8 +95,7 @@ package org.bigbluebutton.modules.viewers
EndpointMessageConstants.TO_MAIN_APP, user); EndpointMessageConstants.TO_MAIN_APP, user);
break; break;
case ViewersModuleConstants.LOGGED_OUT: case ViewersModuleConstants.LOGGED_OUT:
_endpoint.sendMessage(EndpointMessageConstants.USER_LOGGED_OUT, sendLogoutMessage(notification.getBody() as String);
EndpointMessageConstants.TO_MAIN_APP, "LOGGED_OUT"); // just send a string
break; break;
case ViewersModuleConstants.STARTED: case ViewersModuleConstants.STARTED:
LogUtil.debug("Sending Viewers MODULE_STARTED message to main"); LogUtil.debug("Sending Viewers MODULE_STARTED message to main");
@ -169,5 +168,31 @@ package org.bigbluebutton.modules.viewers
private function get proxy():ViewersProxy { private function get proxy():ViewersProxy {
return facade.retrieveProxy(ViewersProxy.NAME) as 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 CLOSE_VIEWERS_WINDOW:String = 'CLOSE_VIEWERS_WINDOW';
public static const MODULE_STARTED:String = 'MODULE_STARTED'; 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 ASSIGN_PRESENTER:String = "ASSIGN_PRESENTER";
public static const BECOME_VIEWER:String = "BECOME_VIEWER"; 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 BECOME_PRESENTER_EVENT:String = "BECOME_PRESENTER_EVENT";
public static const QUERY_PRESENTER_EVENT:String = "QUERY_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_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_SUCCESS:String = "CONNECT_SUCCESS";
public static const CONNECT_FAILED:String = "CONNECT_FAILED"; 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 APP_SHUTDOWN:String = "APP_SHUTDOWN";
public static const CONNECT_REJECTED:String = "CONNECT_REJECTED"; public static const CONNECT_REJECTED:String = "CONNECT_REJECTED";
public static const UNKNOWN_REASON:String = "UNKNOWN_REASON"; 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 { public function handleResult( event : Object ) : void {
var info : Object = event.info; var info : Object = event.info;
var statusCode : String = info.code; var statusCode : String = info.code;
switch ( statusCode ) switch ( statusCode )
{ {
case CONNECT_SUCCESS : case CONNECT_SUCCESS :
@ -139,7 +140,7 @@ package org.bigbluebutton.modules.viewers.model.services
LogUtil.debug("Successful result: " + result); LogUtil.debug("Successful result: " + result);
_userid = Number(result); _userid = Number(result);
if (_userid >= 0) { if (_userid >= 0) {
_connectionSuccessListener(true, {userid:_userid}); _connectionSuccessListener(true, ViewersModuleConstants.CONNECT_SUCCESS, {userid:_userid});
} }
}, },
// status - On error occurred // status - On error occurred
@ -157,7 +158,7 @@ package org.bigbluebutton.modules.viewers.model.services
case CONNECT_FAILED : case CONNECT_FAILED :
if (tried_tunneling) { if (tried_tunneling) {
LogUtil.debug(NAME + ":Connection to viewers application failed...even when 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 { } else {
disconnect(); disconnect();
_netConnection = null; _netConnection = null;
@ -170,27 +171,27 @@ package org.bigbluebutton.modules.viewers.model.services
case CONNECT_CLOSED : case CONNECT_CLOSED :
LogUtil.debug(NAME + ":Connection to viewers application closed"); LogUtil.debug(NAME + ":Connection to viewers application closed");
_connectionSuccessListener(false, null, ViewersModuleConstants.CONNECT_CLOSED); _connectionSuccessListener(false, ViewersModuleConstants.CONNECT_CLOSED );
break; break;
case INVALID_APP : case INVALID_APP :
LogUtil.debug(NAME + ":viewers application not found on server"); LogUtil.debug(NAME + ":viewers application not found on server");
_connectionSuccessListener(false, null, ViewersModuleConstants.INVALID_APP); _connectionSuccessListener(false, ViewersModuleConstants.INVALID_APP, null);
break; break;
case APP_SHUTDOWN : case APP_SHUTDOWN :
LogUtil.debug(NAME + ":viewers application has been shutdown"); LogUtil.debug(NAME + ":viewers application has been shutdown");
_connectionSuccessListener(false, null, ViewersModuleConstants.APP_SHUTDOWN); _connectionSuccessListener(false, ViewersModuleConstants.APP_SHUTDOWN, null);
break; break;
case CONNECT_REJECTED : case CONNECT_REJECTED :
LogUtil.debug(NAME + ":No permissions to connect to the viewers application" ); 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, null, ViewersModuleConstants.CONNECT_REJECTED); _connectionSuccessListener(false, ViewersModuleConstants.CONNECT_REJECTED, null);
break; break;
default : default :
LogUtil.debug(NAME + ":Default status to the viewers application" ); LogUtil.debug(NAME + ":Default status to the viewers application" );
_connectionSuccessListener(false, null, ViewersModuleConstants.UNKNOWN_REASON); _connectionSuccessListener(false, ViewersModuleConstants.UNKNOWN_REASON, null);
break; break;
} }
} }

View File

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