Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
 into edit-styles

Conflicts:
	src/org/bigbluebutton/view/navigation/pages/login/LoginPageViewBase.mxml
  • Loading branch information
GaryDeng committed Sep 9, 2014
2 parents 49d9260 + b5d1588 commit 391c061
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 86 deletions.
3 changes: 2 additions & 1 deletion src/locale/en_US/resources.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ login.error.genericError=It was not possible to join this meeting, please try ag
login.error.invalidMeetingIdentifier=Meeting not found.\nPlease make sure that the meeting is running.
login.error.invalidPassword=Unauthorized access.\nThe provided password for this meeting is invalid.
login.error.noRedirect=Please use the web browser to access a meeting.
login.error.invalidURL=Invalid join URL.\nPlease contact your administrator.
participants.title=Participants
participants.status.presenter=Status:Presenter
participants.status.moderator=Status:Moderator
Expand Down Expand Up @@ -56,4 +57,4 @@ audioSettings.listenOnly.on=Enable Listen Only
audioSettings.listenOnly.off=Disable Listen Only
audioSettings.shareMicrophone.on=Share Microphone
audioSettings.shareMicrophone.off=Stop Microphone
audioSettings.label.text=How do you want to join the audio?
audioSettings.label.text=How do you want to join the audio?
11 changes: 2 additions & 9 deletions src/org/bigbluebutton/core/EnterService.as
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
package org.bigbluebutton.core
{
import flash.events.Event;
import flash.events.HTTPStatusEvent;
import flash.events.IOErrorEvent;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.net.URLRequestHeader;
import flash.net.URLRequestMethod;

import mx.utils.ObjectUtil;

import org.bigbluebutton.core.util.URLFetcher;
import org.osflash.signals.ISignal;
Expand All @@ -35,7 +27,8 @@ package org.bigbluebutton.core
}

protected function onSuccess(data:Object, responseUrl:String, urlRequest:URLRequest):void {
successSignal.dispatch(new XML(data));
var result : Object = JSON.parse(data as String);
successSignal.dispatch(result.response);
}

protected function onUnsuccess(reason:String):void {
Expand Down
45 changes: 31 additions & 14 deletions src/org/bigbluebutton/core/JoinService.as
Original file line number Diff line number Diff line change
Expand Up @@ -7,56 +7,73 @@ package org.bigbluebutton.core
import flash.net.URLRequest;
import flash.net.URLRequestHeader;
import flash.net.URLRequestMethod;

import mx.graphics.shaderClasses.ExclusionShader;
import mx.utils.ObjectUtil;
import org.flexunit.internals.events.ExecutionCompleteEvent;

import org.bigbluebutton.core.util.URLFetcher;
import org.bigbluebutton.model.Config;
import org.flexunit.internals.events.ExecutionCompleteEvent;
import org.osflash.signals.ISignal;
import org.osflash.signals.Signal;
import org.bigbluebutton.core.util.URLFetcher;

public class JoinService
{
protected var _successSignal:Signal = new Signal();
protected var _unsuccessSignal:Signal = new Signal();


private static const URL_REQUEST_ERROR_TYPE:String = "TypeError";
private static const URL_REQUEST_INVALID_URL_ERROR:String = "invalidURL";
private static const URL_REQUEST_GENERIC_ERROR:String = "genericError";
private static const XML_RETURN_CODE_FAILED:String = "FAILED";
private static const JOIN_URL_EMPTY:String = "emptyJoinUrl";

public function get successSignal():ISignal {
return _successSignal;
}

public function get unsuccessSignal():ISignal {
return _unsuccessSignal;
}

public function join(joinUrl:String):void {
if (joinUrl.length == 0) {
onUnsuccess("emptyJoinUrl");
onUnsuccess(JOIN_URL_EMPTY);
return;
}

var fetcher:URLFetcher = new URLFetcher();
fetcher.successSignal.add(onSuccess);
fetcher.unsuccessSignal.add(onUnsuccess);
fetcher.fetch(joinUrl);
}

protected function onSuccess(data:Object, responseUrl:String, urlRequest:URLRequest):void {
try {
var xml:XML = new XML(data);
if (xml.returncode == "FAILED") {
if (xml.returncode == XML_RETURN_CODE_FAILED) {
onUnsuccess(xml.messageKey);
return;
}
} catch (e:Error) {
trace("The response is probably not a XML, continuing");
switch(e.name)
{
case URL_REQUEST_ERROR_TYPE:
onUnsuccess(URL_REQUEST_INVALID_URL_ERROR);
break;
default:
onUnsuccess(URL_REQUEST_GENERIC_ERROR);
}

trace("The response is probably not a XML. " + e.message);
return;
}
successSignal.dispatch(urlRequest, responseUrl);
}

protected function onUnsuccess(reason:String):void {
unsuccessSignal.dispatch(reason);
}
}
}
}

53 changes: 27 additions & 26 deletions src/org/bigbluebutton/core/LoginService.as
Original file line number Diff line number Diff line change
Expand Up @@ -76,38 +76,39 @@ package org.bigbluebutton.core
enterSubservice.enter(config.application.host, _urlRequest);
}

protected function afterEnter(xml:XML):void {
if (xml.returncode == 'SUCCESS') {
protected function afterEnter(result:Object):void {
if (result.returncode == 'SUCCESS') {
trace("Join SUCCESS");
var user:Object = {
username:xml.fullname,
conference:xml.conference,
conferenceName:xml.confname,
externMeetingID:xml.externMeetingID,
meetingID:xml.meetingID,
externUserID:xml.externUserID,
internalUserId:xml.internalUserID,
role:xml.role,
room:xml.room,
authToken:xml.room,
record:xml.record,
webvoiceconf:xml.webvoiceconf,
dialnumber:xml.dialnumber,
voicebridge:xml.voicebridge,
mode:xml.mode,
welcome:xml.welcome,
logoutUrl:xml.logoutUrl,
defaultLayout:xml.defaultLayout,
avatarURL:xml.avatarURL,
guest:xml.guest };
username:result.fullname,
conference:result.conference,
conferenceName:result.confname,
externMeetingID:result.externMeetingID,
meetingID:result.meetingID,
externUserID:result.externUserID,
internalUserId:result.internalUserID,
role:result.role,
room:result.room,
authToken:result.room,
record:result.record,
webvoiceconf:result.webvoiceconf,
dialnumber:result.dialnumber,
voicebridge:result.voicebridge,
mode:result.mode,
welcome:result.welcome,
logoutUrl:result.logoutUrl,
defaultLayout:result.defaultLayout,
avatarURL:result.avatarURL,
guest:result.guest };
user.customdata = new Object();
if(xml.customdata)
if(result.customdata)
{
for each(var cdnode:XML in xml.customdata.elements()){
trace("checking user customdata: "+cdnode.name() + " = " + cdnode);
user.customdata[cdnode.name()] = cdnode.toString();
for (var key:String in result.customdata) {
trace("checking user customdata: "+key + " = " + result.customdata[key]);
user.customdata[key] = result.customdata[key].toString();
}
}

successJoinedSignal.dispatch(user);
} else {
trace("Join FAILED");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<view:NoTabView xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:view="org.bigbluebutton.core.view.*"
>
<view:NoTabView xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:view="org.bigbluebutton.core.view.*"
>
<fx:Script>
<![CDATA[
public static const STATE_BASE:String = "Base";
Expand All @@ -12,6 +12,7 @@
public static const STATE_CHECKSUM_ERROR:String = "ChecksumError";
public static const STATE_INVALID_PASSWORD:String = "InvalidPassword";
public static const STATE_GENERIC_ERROR:String = "GenericError";
public static const STATE_INAVLID_URL:String = "InvalidURL";
]]>
</fx:Script>
<view:states>
Expand All @@ -21,18 +22,21 @@
<s:State name="ChecksumError"/>
<s:State name="InvalidPassword"/>
<s:State name="GenericError"/>
<s:State name="InvalidURL"/>
</view:states>
<s:Group width="100%" height="100%">
<s:layout>
<s:VerticalLayout horizontalAlign="center" verticalAlign="middle"/>
</s:layout>
<s:Image styleName="bbbLogoStyle" includeIn="ChecksumError,GenericError,InvalidMeetingIdentifier,InvalidPassword,NoRedirect"/>
<s:Label id="messageText0" width="90%" textAlign="center"
includeIn="ChecksumError,GenericError,InvalidMeetingIdentifier,InvalidPassword,NoRedirect"
<s:Image styleName="bbbLogoStyle" includeIn="ChecksumError,GenericError,InvalidMeetingIdentifier,InvalidPassword,NoRedirect,InvalidURL"/>
<s:Label id="messageText0" width="90%"
includeIn="ChecksumError,GenericError,InvalidMeetingIdentifier,InvalidPassword,NoRedirect,InvalidURL"
text.ChecksumError="{resourceManager.getString('resources', 'login.error.checksumError')}"
text.GenericError="{resourceManager.getString('resources', 'login.error.genericError')}"
text.InvalidMeetingIdentifier="{resourceManager.getString('resources', 'login.error.invalidMeetingIdentifier')}"
text.InvalidPassword="{resourceManager.getString('resources', 'login.error.invalidPassword')}"
text.NoRedirect="{resourceManager.getString('resources', 'login.error.noRedirect')}"/>
text.NoRedirect="{resourceManager.getString('resources', 'login.error.noRedirect')}"
text.InvalidURL="{resourceManager.getString('resources', 'login.error.invalidURL')}"/>

</s:Group>
</view:NoTabView>
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ package org.bigbluebutton.view.navigation.pages.login
import flash.events.InvokeEvent;
import flash.filesystem.File;
import flash.system.Capabilities;

import mx.core.FlexGlobals;

import org.bigbluebutton.command.JoinMeetingSignal;
import org.bigbluebutton.core.ILoginService;
import org.bigbluebutton.model.IUserSession;
Expand All @@ -16,45 +16,45 @@ package org.bigbluebutton.view.navigation.pages.login
import org.bigbluebutton.view.navigation.IPagesNavigatorView;
import org.flexunit.internals.namespaces.classInternal;
import org.osmf.logging.Log;

import robotlegs.bender.bundles.mvcs.Mediator;

import spark.components.Application;

public class LoginPageViewMediator extends Mediator
{
[Inject]
public var view: ILoginPageView;

[Inject]
public var joinMeetingSignal: JoinMeetingSignal;

[Inject]
public var loginService: ILoginService;

[Inject]
public var userSession: IUserSession;

[Inject]
public var userUISession: IUserUISession;


override public function initialize():void
{
Log.getLogger("org.bigbluebutton").info(String(this));

//loginService.unsuccessJoinedSignal.add(onUnsucess);
userUISession.unsuccessJoined.add(onUnsucess);

NativeApplication.nativeApplication.addEventListener(InvokeEvent.INVOKE, onInvokeEvent);
}

private function onUnsucess(reason:String):void
{
Log.getLogger("org.bigbluebutton").info(String(this) + ":onUnsucess() " + reason);
FlexGlobals.topLevelApplication.topActionBar.visible=false;
FlexGlobals.topLevelApplication.bottomMenu.visible=false;

switch(reason) {
case "emptyJoinUrl":
view.currentState = LoginPageViewBase.STATE_NO_REDIRECT;
Expand All @@ -68,58 +68,65 @@ package org.bigbluebutton.view.navigation.pages.login
case "invalidPassword":
view.currentState = LoginPageViewBase.STATE_INVALID_PASSWORD;
break;
case "invalidURL":
view.currentState = LoginPageViewBase.STATE_INAVLID_URL;
break;
case "genericError":
view.currentState = LoginPageViewBase.STATE_GENERIC_ERROR;
break;
default:
view.currentState = LoginPageViewBase.STATE_GENERIC_ERROR;
break;
}
// view.messageText.text = reason;
}

public function onInvokeEvent(invocation:InvokeEvent):void
{
var url:String = invocation.arguments.toString();

if(Capabilities.isDebugger)
{
// test-install server no longer works with 0.9 mobile client

//url = "bigbluebutton://test-install.blindsidenetworks.com/bigbluebutton/api/join?fullName=Air&meetingID=Demo+Meeting&password=ap&checksum=512620179852dadd6fe0665a48bcb852a3c0afac";
//url = "bigbluebutton://lab1.mconf.org/bigbluebutton/api/join?fullName=Air+client&meetingID=Test+room+4&password=prof123&checksum=5805753edd08fbf9af50f9c28bb676c7e5241349"
}

if (url.lastIndexOf("://") != -1)
{
NativeApplication.nativeApplication.removeEventListener(InvokeEvent.INVOKE, onInvokeEvent);

url = getEndURL(url);
}
else
{

}

joinMeetingSignal.dispatch(url);
}

/**
* Replace the schema with "http"
*/
protected function getEndURL(origin:String):String
{
return origin.replace('bigbluebutton://', 'http://');
}

override public function destroy():void
{
super.destroy();

//loginService.unsuccessJoinedSignal.remove(onUnsucess);
userUISession.unsuccessJoined.remove(onUnsucess);

NativeApplication.nativeApplication.removeEventListener(InvokeEvent.INVOKE, onInvokeEvent);

view.dispose();
view = null;
}
}
}
}

0 comments on commit 391c061

Please sign in to comment.