diff --git a/bigbluebutton-client/.actionScriptProperties b/bigbluebutton-client/.actionScriptProperties index af87226ebaa19955045b60898cddb6bb4397d2e0..6466ce4039e6b300931df68bd68645aac2bd48c5 100755 --- a/bigbluebutton-client/.actionScriptProperties +++ b/bigbluebutton-client/.actionScriptProperties @@ -1,8 +1,9 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <actionScriptProperties analytics="false" mainApplicationPath="BigBlueButton.mxml" projectUUID="d0ee1158-6eb2-478c-9e78-b5aa55d7b59c" version="11"> - <compiler additionalCompilerArguments="-locale en_US -show-unused-type-selector-warnings=false" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="true" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" useFlashSDK="false" verifyDigests="true" warn="true"> + <compiler additionalCompilerArguments="-locale en_US -allow-source-path-overlap=true -show-unused-type-selector-warnings=false" autoRSLOrdering="true" copyDependentFiles="true" fteInMXComponents="true" generateAccessible="true" htmlExpressInstall="true" htmlGenerate="true" htmlHistoryManagement="true" htmlPlayerVersionCheck="true" includeNetmonSwc="false" outputFolderPath="bin-debug" removeUnusedRSL="true" sourceFolderPath="src" strict="true" targetPlayerVersion="0.0.0" useApolloConfig="false" useDebugRSLSwfs="true" useFlashSDK="false" verifyDigests="true" warn="true"> <compilerSourcePath> <compilerSourcePathEntry kind="1" linkType="1" path="branding/default/style/css"/> + <compilerSourcePathEntry kind="1" linkType="1" path="locale/{locale}"/> </compilerSourcePath> <libraryPath defaultLinkType="0"> <libraryPathEntry kind="4" path=""> @@ -33,6 +34,8 @@ <module application="src/BigBlueButton.mxml" destPath="ScreenshareModule.swf" optimize="true" sourcePath="src/ScreenshareModule.mxml"/> </modules> <workers/> - <buildCSSFiles/> + <buildCSSFiles> + <buildCSSFileEntry destPath="bin-debug" sourcePath="branding/default/style/css/V2Theme.css"/> + </buildCSSFiles> <flashCatalyst validateFlashCatalystCompatibility="false"/> </actionScriptProperties> diff --git a/bigbluebutton-client/.project b/bigbluebutton-client/.project index 671c3111ec41e6e7668c3e51e96744d63897b807..64d214ac89cb14aea841d4c58aac761427db442a 100755 --- a/bigbluebutton-client/.project +++ b/bigbluebutton-client/.project @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>z-bbb-client</name> + <name>flash-client</name> <comment></comment> <projects> </projects> diff --git a/bigbluebutton-client/build.xml b/bigbluebutton-client/build.xml index 176d5fd1b09a6251f961c426767cf7ab8133cc03..c2cbbe7d2fe30863aafbbb636ebc4f382392172b 100755 --- a/bigbluebutton-client/build.xml +++ b/bigbluebutton-client/build.xml @@ -287,7 +287,9 @@ <default-background-color>0xFFFFFF</default-background-color> <source-path path-element="@{themeDir}" /> <source-path path-element="@{flex}/frameworks" /> + <source-path path-element="@{app}/locale/{locale}" /> <show-unused-type-selector-warnings>false</show-unused-type-selector-warnings> + <allow-source-path-overlap>true</allow-source-path-overlap> <theme dir="@{flex}/frameworks/themes/Halo"> <include name="halo.swc" /> diff --git a/bigbluebutton-client/resources/config.xml.template b/bigbluebutton-client/resources/config.xml.template index 6708c90d2c4284cd241daa9dee92524dd352e6a6..210cbf0010f96cc98a916f4a7970e4674ebfe12c 100755 --- a/bigbluebutton-client/resources/config.xml.template +++ b/bigbluebutton-client/resources/config.xml.template @@ -6,9 +6,12 @@ <porttest host="HOST" application="video/portTest" timeout="10000"/> <bwMon server="HOST" application="video/bwTest"/> <application uri="rtmp://HOST/bigbluebutton" host="http://HOST/bigbluebutton/api/enter"/> - <language userSelectionEnabled="true" rtlEnabled="false"/> + <language userSelectionEnabled="true" + rtlEnabled="false" + localesConfig="http://HOST/client/conf/locales.xml" + localesDirectory="http://HOST/client/locale/"/> <skinning url="http://HOST/client/branding/css/V2Theme.css.swf?v=VERSION" /> - <branding logo="logo.swf" copyright="© 2017 <u><a href="http://HOST/home.html" target="_blank">BigBlueButton Inc.</a></u> (build {0})" background="" toolbarColor="" showQuote="true"/> + <branding logo="http://HOST/client/logo.swf" copyright="© 2017 <u><a href="http://HOST/home.html" target="_blank">BigBlueButton Inc.</a></u> (build {0})" background="" toolbarColor="" showQuote="true"/> <shortcutKeys showButton="true" /> <browserVersions chrome="CHROME_VERSION" firefox="FIREFOX_VERSION" flash="FLASH_VERSION"/> <layout showLogButton="false" defaultLayout="bbb.layout.name.defaultlayout" @@ -24,9 +27,9 @@ <modules> <module name="ChatModule" url="http://HOST/client/ChatModule.swf?v=VERSION" - uri="rtmp://HOST/bigbluebutton" - dependsOn="UsersModule" - privateEnabled="true" + uri="rtmp://HOST/bigbluebutton" + dependsOn="UsersModule" + privateEnabled="true" fontSize="14" baseTabIndex="801" colorPickerIsVisible="false" @@ -34,7 +37,7 @@ /> <module name="UsersModule" url="http://HOST/client/UsersModule.swf?v=VERSION" - uri="rtmp://HOST/bigbluebutton" + uri="rtmp://HOST/bigbluebutton" allowKickUser="true" enableEmojiStatus="true" enableSettingsButton="true" @@ -56,7 +59,7 @@ /> <module name="PhoneModule" url="http://HOST/client/PhoneModule.swf?v=VERSION" - uri="rtmp://HOST/sip" + uri="rtmp://HOST/sip" dependsOn="UsersModule" autoJoin="true" listenOnlyMode="true" @@ -75,6 +78,7 @@ uri="rtmp://HOST/video" dependsOn="UsersModule" baseTabIndex="401" + videoProfilesConfig="http://HOST/client/conf/profiles.xml" autoStart="false" skipCamSettingsCheck="false" showButton="true" @@ -87,21 +91,21 @@ /> <module name="WhiteboardModule" url="http://HOST/client/WhiteboardModule.swf?v=VERSION" - uri="rtmp://HOST/bigbluebutton" + uri="rtmp://HOST/bigbluebutton" dependsOn="PresentModule" baseTabIndex="601" keepToolbarVisible="false" /> <module name="PollingModule" url="http://HOST/client/PollingModule.swf?v=VERSION" - uri="rtmp://HOST/bigbluebutton" + uri="rtmp://HOST/bigbluebutton" dependsOn="PresentModule" /> <module name="PresentModule" url="http://HOST/client/PresentModule.swf?v=VERSION" - uri="rtmp://HOST/bigbluebutton" + uri="rtmp://HOST/bigbluebutton" dependsOn="UsersModule" - host="http://HOST" + host="http://HOST" showPresentWindow="true" showWindowControls="true" openExternalFileUploadDialog="false" @@ -112,7 +116,7 @@ /> <module name="CaptionModule" url="http://HOST/client/CaptionModule.swf?v=VERSION" - uri="rtmp://HOST/bigbluebutton" + uri="rtmp://HOST/bigbluebutton" dependsOn="UsersModule" maxPasteLength="1024" baseTabIndex="701" diff --git a/bigbluebutton-client/resources/prod/BigBlueButton.html b/bigbluebutton-client/resources/prod/BigBlueButton.html index 5c6b3f68a54fbd296f8269d84ebcbbb46bfdff32..c0670b32c1774c62f023d3305faf4260898e7a47 100755 --- a/bigbluebutton-client/resources/prod/BigBlueButton.html +++ b/bigbluebutton-client/resources/prod/BigBlueButton.html @@ -62,7 +62,7 @@ }; //swfobject.registerObject("BigBlueButton", "11", "expressInstall.swf"); - var flashvars = {}; + var flashvars = {"origin":window.location.origin}; var params = {}; params.quality = "high"; params.bgcolor = "#FFFFFF"; @@ -98,7 +98,7 @@ var fillContent = function(){ var content = document.getElementById("content"); if (content) { - content.innerHTML = '<object type="application/x-shockwave-flash" id="BigBlueButton" name="BigBlueButton" tabindex="0" data="BigBlueButton.swf?v=VERSION" style="position: relative; top: 0.5px;" width="100%" height="100%" align="middle"><param name="quality" value="high"><param name="bgcolor" value="#FFFFFF"><param name="allowfullscreen" value="true"><param name="allowfullscreeninteractive" value="true"><param name="wmode" value="window"><param name="allowscriptaccess" value="always"><param name="seamlesstabbing" value="true"></object>'; + content.innerHTML = '<object type="application/x-shockwave-flash" id="BigBlueButton" name="BigBlueButton" tabindex="0" data="BigBlueButton.swf?v=VERSION" style="position: relative; top: 0.5px;" width="100%" height="100%" align="middle"><param name="quality" value="high"><param name="bgcolor" value="#FFFFFF"><param name="allowfullscreen" value="true"><param name="allowfullscreeninteractive" value="true"><param name="wmode" value="window"><param name="allowscriptaccess" value="always"><param name="seamlesstabbing" value="true"><param name="FlashVars" value="origin='+window.location.origin+'"/></object>'; } }; } else { diff --git a/bigbluebutton-client/src/BigBlueButton.mxml b/bigbluebutton-client/src/BigBlueButton.mxml index 41d3e30c3bd8f006a7457669f7eea07c912fbbdf..9067e7bdcd5f70af0423a7f2d9d5f6095aa8185e 100755 --- a/bigbluebutton-client/src/BigBlueButton.mxml +++ b/bigbluebutton-client/src/BigBlueButton.mxml @@ -34,33 +34,21 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <fx:Style source="../branding/default/style/css/V2Theme.css" /> + <fx:Metadata> + [ResourceBundle("bbbResources")] + </fx:Metadata> + <fx:Script> <![CDATA[ - import mx.utils.URLUtil; - import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.getClassLogger; import org.bigbluebutton.common.LogUtil; - + private static const LOGGER:ILogger = getClassLogger(BigBlueButtonMainContainer); private function init():void { LogUtil.initLogging(true); } - - public function determineHtmlUrl():String { - var url:String = ""; - if(ExternalInterface.available) { - try { - url = String(ExternalInterface.call("window.location.href.toString")); - LOGGER.debug("HTML URL [{0}]", [url]); - } catch(s:Error) { - LOGGER.debug("Cannot determine HTML URL"); - } - } - - return url; - } ]]> </fx:Script> <views:BigBlueButtonMainContainer id="bbbShell"/> diff --git a/bigbluebutton-client/src/BigBlueButtonMainContainer.mxml b/bigbluebutton-client/src/BigBlueButtonMainContainer.mxml index 3c77c147803ea3a71ed23a70313bedc7c6eaf56c..c6ee696076abb15634cea60fb3b3d94fb9b88555 100755 --- a/bigbluebutton-client/src/BigBlueButtonMainContainer.mxml +++ b/bigbluebutton-client/src/BigBlueButtonMainContainer.mxml @@ -42,21 +42,21 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. import mx.managers.HistoryManager; import mx.managers.IDragManager; import mx.managers.ToolTipManager; - import mx.utils.URLUtil; import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.getClassLogger; + import org.bigbluebutton.common.events.LocaleChangeEvent; import org.bigbluebutton.core.BBB; import org.bigbluebutton.core.KeyboardUtil; import org.bigbluebutton.main.api.ExternalApiCallbacks; + import org.bigbluebutton.main.events.ConfigLoadedEvent; import org.bigbluebutton.main.events.ShortcutEvent; import org.bigbluebutton.main.model.ShortcutOptions; + import org.bigbluebutton.main.views.MainApplicationShell; import org.bigbluebutton.util.i18n.ResourceUtil; private static const LOGGER:ILogger = getClassLogger(BigBlueButtonMainContainer); - private var langResources:ResourceUtil = null; - private var globalModifier:String; /** * Thse two lines are workaround for this. (ralam - Nov 8, 2008) @@ -74,8 +74,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. protected function init():void { setupTooltips(); - setupAPI(); - BBB.initVideoProfileManager(); globalModifier = ExternalInterface.call("determineGlobalModifier"); } @@ -107,10 +105,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. private var api:ExternalApiCallbacks; private function setupAPI():void { - langResources = ResourceUtil.getInstance(); api = new ExternalApiCallbacks(); - //Security.allowDomain(FlexGlobals.topLevelApplication.determineHtmlUrl()); - //LOGGER.debug("Security.allowDomain({0});", [FlexGlobals.topLevelApplication.determineHtmlUrl()]); Security.allowDomain("*"); LOGGER.debug("Security.allowDomain({0});", ["*"]); } @@ -131,7 +126,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. */ private function onAddedToStage():void { - hotkeyCapture(); queryForSessionToken(); } @@ -204,6 +198,20 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. globalDispatcher.dispatchEvent(new ShortcutEvent(keyCombos[keyPress])); } } + + private function handleConfigLoaded(e:ConfigLoadedEvent):void { + setupAPI(); + ResourceUtil.getInstance().initialize(); + } + + private function handleLocaleInit(e:LocaleChangeEvent):void { + BBB.initVideoProfileManager(); + hotkeyCapture(); + + var mainShell : MainApplicationShell = new MainApplicationShell(); + mainShell.id = "mainShell"; + this.addChild(mainShell); + } // Moves page focus outside and past the Flash content private function loseFocusFromApp(e:Event):void { @@ -222,8 +230,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <maps:ApplicationEventMap /> <mate:Listener type="{ShortcutEvent.FOCUS_AWAY_EVENT}" method="loseFocusFromApp" /> + + <mate:Listener type="{ConfigLoadedEvent.CONFIG_LOADED_EVENT}" method="handleConfigLoaded"/> + + <mate:Listener type="{LocaleChangeEvent.LOCALE_INIT}" method="handleLocaleInit"/> </fx:Declarations> - <views:MainApplicationShell id="mainShell"/> - </mx:Canvas> diff --git a/bigbluebutton-client/src/org/bigbluebutton/common/events/LocaleChangeEvent.as b/bigbluebutton-client/src/org/bigbluebutton/common/events/LocaleChangeEvent.as index 99af34aa123938b98fc6cc9f122dfd2cab7282f8..11726a32c9e21cf3cbf971b5dbd2f32034ace330 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/common/events/LocaleChangeEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/common/events/LocaleChangeEvent.as @@ -24,6 +24,8 @@ package org.bigbluebutton.common.events { public static const LOCALE_CHANGED:String = "LOCALE_CHANGED_EVENT"; + public static const LOCALE_INIT:String = "LOCALE_INIT"; + public function LocaleChangeEvent(type:String) { super(type, true, false); diff --git a/bigbluebutton-client/src/org/bigbluebutton/core/BBB.as b/bigbluebutton-client/src/org/bigbluebutton/core/BBB.as index 279ff41b3b34e23cf11350279e44c309b761545e..5bf1f4953a785431460fe6316193cac546303763 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/core/BBB.as +++ b/bigbluebutton-client/src/org/bigbluebutton/core/BBB.as @@ -21,7 +21,6 @@ package org.bigbluebutton.core { import flash.system.Capabilities; import mx.core.FlexGlobals; - import mx.utils.URLUtil; import org.bigbluebutton.core.managers.ConfigManager2; import org.bigbluebutton.core.managers.ConnectionManager; @@ -127,10 +126,8 @@ package org.bigbluebutton.core { return logoutUrl; } - private static function getBaseURL():String { - var protocol:String = URLUtil.getProtocol(FlexGlobals.topLevelApplication.determineHtmlUrl()); - var serverName:String = URLUtil.getServerNameWithPort(FlexGlobals.topLevelApplication.determineHtmlUrl()); - return protocol + "://" + serverName; + public static function getBaseURL():String { + return FlexGlobals.topLevelApplication.loaderInfo.parameters.origin } } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/core/managers/ConfigManager2.as b/bigbluebutton-client/src/org/bigbluebutton/core/managers/ConfigManager2.as index 11ed5370ebff6626deb1ef504edb13821e3cb9aa..5daa3af64205f91f18a725b6541a45d401d0222e 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/core/managers/ConfigManager2.as +++ b/bigbluebutton-client/src/org/bigbluebutton/core/managers/ConfigManager2.as @@ -26,12 +26,10 @@ package org.bigbluebutton.core.managers { import flash.net.URLVariables; import flash.utils.Dictionary; - import mx.core.FlexGlobals; - import mx.utils.URLUtil; - import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.getClassLogger; import org.bigbluebutton.common.LogUtil; + import org.bigbluebutton.core.BBB; import org.bigbluebutton.core.model.Config; import org.bigbluebutton.main.events.ConfigLoadedEvent; import org.bigbluebutton.main.events.MeetingNotFoundEvent; @@ -57,7 +55,7 @@ package org.bigbluebutton.core.managers { urlLoader.addEventListener(Event.COMPLETE, handleComplete); var date:Date = new Date(); - var localeReqURL:String = buildRequestURL(); + var localeReqURL:String = BBB.getBaseURL() + "/" + CONFIG_XML;; trace("::loadConfig [{0}]", [localeReqURL]); trace(localeReqURL + " session=[" + sessionToken + "]"); @@ -69,13 +67,6 @@ package org.bigbluebutton.core.managers { urlLoader.load(request); } - private function buildRequestURL():String { - var swfURL:String = FlexGlobals.topLevelApplication.determineHtmlUrl(); - var protocol:String = URLUtil.getProtocol(swfURL); - var serverName:String = URLUtil.getServerNameWithPort(swfURL); - return protocol + "://" + serverName + "/" + CONFIG_XML; - } - private function handleComplete(e:Event):void { trace("handleComplete [{0}]", [new XML(e.target.data)]); diff --git a/bigbluebutton-client/src/org/bigbluebutton/core/managers/LogoutManager.as b/bigbluebutton-client/src/org/bigbluebutton/core/managers/LogoutManager.as new file mode 100644 index 0000000000000000000000000000000000000000..b7a339ccc8cd5c519435a05872cd902ed754c47a --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/core/managers/LogoutManager.as @@ -0,0 +1,122 @@ +/** + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * + * Copyright (c) 2017 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 3.0 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.core.managers { + import com.asfusion.mate.events.Dispatcher; + + import flash.display.DisplayObject; + import flash.events.Event; + import flash.events.IOErrorEvent; + import flash.external.ExternalInterface; + import flash.net.URLLoader; + import flash.net.URLRequest; + import flash.net.navigateToURL; + + import mx.core.FlexGlobals; + + import org.as3commons.logging.api.ILogger; + import org.as3commons.logging.api.getClassLogger; + import org.bigbluebutton.core.BBB; + import org.bigbluebutton.core.Options; + import org.bigbluebutton.core.PopUpUtil; + import org.bigbluebutton.core.UsersUtil; + import org.bigbluebutton.main.events.ExitApplicationEvent; + import org.bigbluebutton.main.events.InvalidAuthTokenEvent; + import org.bigbluebutton.main.events.MeetingNotFoundEvent; + import org.bigbluebutton.main.model.options.LayoutOptions; + import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent; + import org.bigbluebutton.main.views.LoggedOutWindow; + import org.bigbluebutton.util.i18n.ResourceUtil; + + public class LogoutManager { + + private static const LOGGER:ILogger = getClassLogger(LogoutManager); + + private var dispatcher:Dispatcher = new Dispatcher(); + + public function handleMeetingNotFoundEvent(e:MeetingNotFoundEvent):void { + showlogoutWindow(ResourceUtil.getInstance().getString('bbb.mainshell.meetingNotFound')); + } + + private function showlogoutWindow(reason:String):void { + var layoutOptions:LayoutOptions = Options.getOptions(LayoutOptions) as LayoutOptions; + + if (layoutOptions != null && layoutOptions.showLogoutWindow) { + if (UsersUtil.iAskedToLogout()) { + handleExitApplicationEvent(); + return; + } + var loggedOutWindow:LoggedOutWindow = PopUpUtil.createModalPopUp(FlexGlobals.topLevelApplication as DisplayObject, LoggedOutWindow, true) as LoggedOutWindow; + + if (loggedOutWindow) { + loggedOutWindow.setReason(reason); + dispatcher.dispatchEvent(new ExitApplicationEvent(ExitApplicationEvent.CLOSE_APPLICATION)); + } + } else { + dispatcher.dispatchEvent(new ExitApplicationEvent(ExitApplicationEvent.CLOSE_APPLICATION)); + + LOGGER.debug("SingOut to [{0}/bigbluebutton/api/signOut]", [BBB.getBaseURL()]); + var request:URLRequest = new URLRequest(BBB.getBaseURL() + "/bigbluebutton/api/signOut"); + var urlLoader:URLLoader = new URLLoader(); + urlLoader.addEventListener(Event.COMPLETE, handleLogoutComplete); + urlLoader.addEventListener(IOErrorEvent.IO_ERROR, handleLogoutError); + urlLoader.load(request); + } + } + + private function handleLogoutError(e:Event):void { + LOGGER.debug("Call to signOut URL failed."); + redirectToLogoutUrl(); + } + + private function handleLogoutComplete(e:Event):void { + LOGGER.debug("Call to signOut URL succeeded."); + redirectToLogoutUrl(); + } + + public function handleExitApplicationEvent(e:ExitApplicationEvent = null):void { + if (!UsersUtil.isBreakout()) { + navigateToURL(new URLRequest(BBB.getLogoutURL()), "_self"); + } else { + ExternalInterface.call("window.close"); + } + } + + private function redirectToLogoutUrl():void { + var logoutURL:String = BBB.getLogoutURL(); + var request:URLRequest = new URLRequest(logoutURL); + LOGGER.debug("Logging out to: {0}", [logoutURL]); + navigateToURL(request, '_self'); + } + + private function handleLogout(e:ConnectionFailedEvent):void { + if (e is ConnectionFailedEvent) { + showlogoutWindow((e as ConnectionFailedEvent).type); + } else + showlogoutWindow("You have logged out of the conference"); + } + + public function connectionFailedHandler(e:ConnectionFailedEvent):void { + handleLogout(e); + } + + public function handleInvalidAuthToken(event:InvalidAuthTokenEvent):void { + showlogoutWindow(ResourceUtil.getInstance().getString('bbb.mainshell.invalidAuthToken')); + } + } +} diff --git a/bigbluebutton-client/src/org/bigbluebutton/core/managers/VideoProfileManager.as b/bigbluebutton-client/src/org/bigbluebutton/core/managers/VideoProfileManager.as index 1d5bd6df40900052d6975bc300045f487e9a4c97..f751468e1bd25c9fd57d0d081b489a524bafd20b 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/core/managers/VideoProfileManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/core/managers/VideoProfileManager.as @@ -23,36 +23,29 @@ package org.bigbluebutton.core.managers import flash.net.URLLoader; import flash.net.URLRequest; - import mx.core.FlexGlobals; - import mx.utils.URLUtil; - import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.getClassLogger; - import org.bigbluebutton.core.model.VideoProfile; + import org.bigbluebutton.core.Options; + import org.bigbluebutton.core.model.VideoProfile; + import org.bigbluebutton.modules.videoconf.model.VideoConfOptions; public class VideoProfileManager extends EventDispatcher { private static const LOGGER:ILogger = getClassLogger(VideoProfileManager); - public static const PROFILES_XML:String = "client/conf/profiles.xml"; public static const DEFAULT_FALLBACK_LOCALE:String = "en_US"; private var _profiles:Array = new Array(); public function loadProfiles():void { + var options : VideoConfOptions = Options.getOptions(VideoConfOptions) as VideoConfOptions; + var urlLoader:URLLoader = new URLLoader(); urlLoader.addEventListener(Event.COMPLETE, handleComplete); var date:Date = new Date(); - var localeReqURL:String = buildRequestURL() + "?a=" + date.time; + var localeReqURL:String = options.videoProfilesConfig + "?a=" + date.time; LOGGER.debug("VideoProfileManager::loadProfiles [{0}]", [localeReqURL]); urlLoader.load(new URLRequest(localeReqURL)); } - private function buildRequestURL():String { - var swfURL:String = FlexGlobals.topLevelApplication.url; - var protocol:String = URLUtil.getProtocol(swfURL); - var serverName:String = URLUtil.getServerNameWithPort(swfURL); - return protocol + "://" + serverName + "/" + PROFILES_XML; - } - private function handleComplete(e:Event):void{ LOGGER.debug("VideoProfileManager::handleComplete [{0}]", [new XML(e.target.data)]); diff --git a/bigbluebutton-client/src/org/bigbluebutton/core/services/SkinningService.as b/bigbluebutton-client/src/org/bigbluebutton/core/services/SkinningService.as index ad27b582ec4b0cf99266dfbb8f8c1a3b33eb33ba..ad1b5c6352d5ae0ed40711a9c86c68c9f0aab624 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/core/services/SkinningService.as +++ b/bigbluebutton-client/src/org/bigbluebutton/core/services/SkinningService.as @@ -36,7 +36,9 @@ package org.bigbluebutton.core.services { public function loadSkins():void { var skinOptions:SkinningOptions = Options.getOptions(SkinningOptions) as SkinningOptions; - var skinToLoad:String = StringUtils.remove(".css.swf", StringUtils.substringAfterLast(skinOptions.url, "/")); + + var skinNamePattern:RegExp = /\.css\.swf(\??.*)/; + var skinToLoad:String = StringUtils.substringAfterLast(skinOptions.url, "/").replace(skinNamePattern, ""); if (!StringUtils.isEmpty(skinOptions.url) && skinToLoad != loadedSkin) { LOGGER.info("Loading new skin {}", [skinToLoad]); myStyleManager = StyleManager.getStyleManager(null); diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/events/ExitApplicationEvent.as b/bigbluebutton-client/src/org/bigbluebutton/main/events/ExitApplicationEvent.as index 312ab69be400f046282f59151e0d9a37b8705fb1..e11448ee259ac400a478a41e5bfaa0580f82759a 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/main/events/ExitApplicationEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/events/ExitApplicationEvent.as @@ -21,7 +21,8 @@ package org.bigbluebutton.main.events { public class ExitApplicationEvent extends Event { - public static const EXIT_APPLICATION:String = "EXIT_APPLICATION"; + public static const CLOSE_APPLICATION:String = "CLOSE_APPLICATION"; + public static const EXIT_APPLICATION:String = "EXIT_APPLICATION"; public function ExitApplicationEvent(type:String, bubbles:Boolean = true, cancelable:Boolean = false) { super(type, bubbles, cancelable); diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/maps/ApplicationEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/maps/ApplicationEventMap.mxml index 6b5a592ae4dfd768d064729558f8067d5a194010..a3fe15c90534c0f56319c739ad2b6dc58a2d8522 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/maps/ApplicationEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/maps/ApplicationEventMap.mxml @@ -32,7 +32,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <ObjectBuilder generator="{ModulesProxy}" cache="global" /> <ObjectBuilder generator="{ReconnectionManager}" cache="global" /> <ObjectBuilder generator="{StreamMonitor}" cache="global" /> - <ObjectBuilder generator="{UserService}" cache="global" /> + <ObjectBuilder generator="{UserService}" cache="global" /> + <ObjectBuilder generator="{LogoutManager}" cache="global" /> </EventHandlers> <EventHandlers type="{LoadConfigCommand.LOAD_CONFIG_COMMAND}" > @@ -67,7 +68,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <MethodInvoker generator="{ModulesProxy}" method="handleConfigLoaded" /> <MethodInvoker generator="{SkinningService}" method="loadSkins"/> </EventHandlers> - + <EventHandlers type="{ModuleLoadEvent.START_ALL_MODULES}"> <MethodInvoker generator="{ModulesProxy}" method="startLayoutModule" /> </EventHandlers> @@ -99,27 +100,74 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <EventHandlers type="{UsersConnectionEvent.CONNECTION_SUCCESS}" > <MethodInvoker generator="{UserService}" method="userLoggedIn" arguments="{event}" /> </EventHandlers> + + <!-- Events leading to user logout --> + + <EventHandlers type="{MeetingNotFoundEvent.MEETING_NOT_FOUND}" > + <MethodInvoker generator="{LogoutManager}" method="handleMeetingNotFoundEvent" arguments="{event}"/> + </EventHandlers> + + <EventHandlers type="{ConnectionFailedEvent.CONNECTION_FAILED}" > + <MethodInvoker generator="{LogoutManager}" method="connectionFailedHandler" arguments="{event}"/> + </EventHandlers> + + <EventHandlers type="{ConnectionFailedEvent.CONNECTION_CLOSED}" > + <MethodInvoker generator="{LogoutManager}" method="connectionFailedHandler" arguments="{event}"/> + </EventHandlers> + + <EventHandlers type="{ConnectionFailedEvent.UNKNOWN_REASON}" > + <MethodInvoker generator="{LogoutManager}" method="connectionFailedHandler" arguments="{event}"/> + </EventHandlers> + + <EventHandlers type="{ConnectionFailedEvent.CONNECTION_REJECTED}" > + <MethodInvoker generator="{LogoutManager}" method="connectionFailedHandler" arguments="{event}"/> + </EventHandlers> + + <EventHandlers type="{ConnectionFailedEvent.USER_LOGGED_OUT}" > + <MethodInvoker generator="{LogoutManager}" method="connectionFailedHandler" arguments="{event}"/> + </EventHandlers> + + <EventHandlers type="{ConnectionFailedEvent.USER_EJECTED_FROM_MEETING}" > + <MethodInvoker generator="{LogoutManager}" method="connectionFailedHandler" arguments="{event}"/> + </EventHandlers> + + <EventHandlers type="{ConnectionFailedEvent.MODERATOR_DENIED_ME}" > + <MethodInvoker generator="{LogoutManager}" method="connectionFailedHandler" arguments="{event}"/> + </EventHandlers> + + <EventHandlers type="{InvalidAuthTokenEvent.INVALID_AUTH_TOKEN}" > + <MethodInvoker generator="{LogoutManager}" method="handleInvalidAuthToken" arguments="{event}"/> + </EventHandlers> + + <EventHandlers type="{ExitApplicationEvent.EXIT_APPLICATION}" > + <MethodInvoker generator="{LogoutManager}" method="handleExitApplicationEvent" arguments="{event}"/> + </EventHandlers> + </fx:Declarations> <fx:Script> <![CDATA[ - import mx.events.FlexEvent; - - import org.bigbluebutton.core.managers.ReconnectionManager; - import org.bigbluebutton.core.services.SkinningService; - import org.bigbluebutton.core.services.StreamMonitor; - import org.bigbluebutton.main.events.BBBEvent; - import org.bigbluebutton.main.events.ConfigLoadedEvent; - import org.bigbluebutton.main.events.LoadConfigCommand; - import org.bigbluebutton.main.events.LogoutEvent; - import org.bigbluebutton.main.events.ModuleLoadEvent; - import org.bigbluebutton.main.events.PortTestEvent; - import org.bigbluebutton.main.events.SuccessfulLoginEvent; - import org.bigbluebutton.main.model.modules.ModulesProxy; - import org.bigbluebutton.main.model.users.UserService; - import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent; - import org.bigbluebutton.main.model.users.events.UsersConnectionEvent; + import mx.events.FlexEvent; + + import org.bigbluebutton.core.managers.LogoutManager; + import org.bigbluebutton.core.managers.ReconnectionManager; + import org.bigbluebutton.core.services.SkinningService; + import org.bigbluebutton.core.services.StreamMonitor; + import org.bigbluebutton.main.events.BBBEvent; + import org.bigbluebutton.main.events.ConfigLoadedEvent; + import org.bigbluebutton.main.events.ExitApplicationEvent; + import org.bigbluebutton.main.events.InvalidAuthTokenEvent; + import org.bigbluebutton.main.events.LoadConfigCommand; + import org.bigbluebutton.main.events.LogoutEvent; + import org.bigbluebutton.main.events.MeetingNotFoundEvent; + import org.bigbluebutton.main.events.ModuleLoadEvent; + import org.bigbluebutton.main.events.PortTestEvent; + import org.bigbluebutton.main.events.SuccessfulLoginEvent; + import org.bigbluebutton.main.model.modules.ModulesProxy; + import org.bigbluebutton.main.model.users.UserService; + import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent; + import org.bigbluebutton.main.model.users.events.UsersConnectionEvent; ]]> </fx:Script> diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/modules/ModuleDescriptor.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/modules/ModuleDescriptor.as index dcc1a04b737beac7c02f4c1c3cbef6c50591009a..543e2f3d324c11c5851700553b96733a74a94f20 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/modules/ModuleDescriptor.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/modules/ModuleDescriptor.as @@ -167,16 +167,16 @@ package org.bigbluebutton.main.model.modules unresolvedDependancies.addItem(dependancies[i]); } } - - public function loadConfigAttributes(protocol:String):void{ - var intMeetingId: String = LiveMeeting.inst().meeting.internalId; - var userName: String = LiveMeeting.inst().me.name; - var role: String = LiveMeeting.inst().me.role; - var intUserId: String = LiveMeeting.inst().me.id; - var voiceConf: String = LiveMeeting.inst().meeting.voiceConf; - var welcome: String = LiveMeeting.inst().me.welcome; - var extUserId: String = LiveMeeting.inst().me.externalId; - + + public function loadConfigAttributes(protocol:String):void { + var intMeetingId:String = LiveMeeting.inst().meeting.internalId; + var userName:String = LiveMeeting.inst().me.name; + var role:String = LiveMeeting.inst().me.role; + var intUserId:String = LiveMeeting.inst().me.id; + var voiceConf:String = LiveMeeting.inst().meeting.voiceConf; + var welcome:String = LiveMeeting.inst().me.welcome; + var extUserId:String = LiveMeeting.inst().me.externalId; + addAttribute("conference", intMeetingId); addAttribute("username", userName); addAttribute("userrole", role); diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/modules/ModuleManager.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/modules/ModuleManager.as index 47dd1241bf48eb1612589b2126a7f974c64a51d7..30c8d55c2348c59137a782e170a7dafd7060591e 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/modules/ModuleManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/modules/ModuleManager.as @@ -75,11 +75,11 @@ package org.bigbluebutton.main.model.modules BBB.getConfigManager(); BBB.loadConfig(); } - + public function useProtocol(tunnel:Boolean):void { - BBB.initConnectionManager().isTunnelling = tunnel; + BBB.initConnectionManager().isTunnelling = tunnel; } - + public function get portTestHost():String { return portTestOptions.host; } @@ -171,13 +171,13 @@ package org.bigbluebutton.main.model.modules loadModule(m.getName()); } } - - public function startLayoutModule():void{ - for (var i:int = 0; i<sorted.length; i++){ + + public function startLayoutModule():void { + for (var i:int = 0; i < sorted.length; i++) { var m:ModuleDescriptor = sorted.getItemAt(i) as ModuleDescriptor; - if (m.getName() == "LayoutModule") { - startModule(m.getName()); - } + if (m.getName() == "LayoutModule") { + startModule(m.getName()); + } } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/options/LanguageOptions.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/options/LanguageOptions.as index 04e3b1f930ecb49e66af081fa9babb879fc30dae..e68bc8b9f131b1827fb34f30e24eef1335984676 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/options/LanguageOptions.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/options/LanguageOptions.as @@ -23,7 +23,13 @@ package org.bigbluebutton.main.model.options { [Bindable] public var userSelectionEnabled:Boolean = true; + + [Bindable] + public var localesConfig:String = ""; + [Bindable] + public var localesDirectory:String = ""; + [Bindable] public var rtlEnabled:Boolean = false; diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/NetConnectionDelegate.as b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/NetConnectionDelegate.as index 34cd29dda1eb596ffbd1c3f7b8c48da297f53271..830e51a2b16792e7bbbeeac43dcd00f344ecfaf2 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/model/users/NetConnectionDelegate.as +++ b/bigbluebutton-client/src/org/bigbluebutton/main/model/users/NetConnectionDelegate.as @@ -152,6 +152,7 @@ package org.bigbluebutton.main.model.users } } else { dispatcher.dispatchEvent(new InvalidAuthTokenEvent()); + dispatcher.dispatchEvent(new BBBEvent(BBBEvent.CANCEL_RECONNECTION_EVENT)); } if (reconnecting) { @@ -319,6 +320,7 @@ package org.bigbluebutton.main.model.users LiveMeeting.inst().me.authTokenValid = true; } else { dispatcher.dispatchEvent(new InvalidAuthTokenEvent()); + dispatcher.dispatchEvent(new BBBEvent(BBBEvent.CANCEL_RECONNECTION_EVENT)); } if (reconnecting) { @@ -345,6 +347,7 @@ package org.bigbluebutton.main.model.users // LiveMeeting.inst().me.authTokenValid = true; } else { dispatcher.dispatchEvent(new InvalidAuthTokenEvent()); + dispatcher.dispatchEvent(new BBBEvent(BBBEvent.CANCEL_RECONNECTION_EVENT)); } if (reconnecting) { diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml index c68ae270502e14acd8c58b70a15b5c48642f8d8e..a86858e866844bb73c7e09189b220e5f800e6198 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml @@ -45,15 +45,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <mate:Listener type="{CloseWindowEvent.CLOSE_WINDOW_EVENT}" method="handleCloseWindowEvent"/> <mate:Listener type="{AddUIComponentToMainCanvas.ADD_COMPONENT}" method="addComponentToCanvas" /> <mate:Listener type="{AppVersionEvent.APP_VERSION_EVENT}" method="handleApplicationVersionEvent" /> - <mate:Listener type="{MeetingNotFoundEvent.MEETING_NOT_FOUND}" method="handleMeetingNotFoundEvent" /> - <mate:Listener type="{ConnectionFailedEvent.USER_LOGGED_OUT}" method="handleLogout" /> - <mate:Listener type="{ConnectionFailedEvent.USER_EJECTED_FROM_MEETING}" method="handleLogout" /> - <mate:Listener type="{ConnectionFailedEvent.CONNECTION_FAILED}" method="attemptReconnect" /> - <mate:Listener type="{ConnectionFailedEvent.CONNECTION_CLOSED}" method="attemptReconnect" /> - <mate:Listener type="{ConnectionFailedEvent.UNKNOWN_REASON}" method="attemptReconnect" /> - <mate:Listener type="{ConnectionFailedEvent.CONNECTION_REJECTED}" method="attemptReconnect" /> - <mate:Listener type="{ExitApplicationEvent.EXIT_APPLICATION}" method="handleExitApplicationEvent" /> - <mate:Listener type="{ConfigLoadedEvent.CONFIG_LOADED_EVENT}" method="initOptions" /> + <mate:Listener type="{ExitApplicationEvent.CLOSE_APPLICATION}" method="handleCloseApplication"/> <mate:Listener type="{FullscreenToggledEvent.IS_FULLSCREEN_TOGGLED}" method="handleFullscreenToggleState" /> <mate:Listener type="{FlashMicSettingsEvent.FLASH_MIC_SETTINGS}" method="handleFlashMicSettingsEvent" /> <mate:Listener type="{WebRTCEchoTestEvent.WEBRTC_ECHO_TEST_CONNECTING}" method="handleWebRTCEchoTestConnectingEvent" /> @@ -70,30 +62,25 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <mate:Listener type="{BBBEvent.INACTIVITY_WARNING_EVENT}" method="handleInactivityWarningEvent" /> <mate:Listener type="{LockControlEvent.OPEN_LOCK_SETTINGS}" method="openLockSettingsWindow" /> <mate:Listener type="{BreakoutRoomEvent.OPEN_BREAKOUT_ROOMS_PANEL}" method="openBreakoutRoomsWindow" /> - <mate:Listener type="{InvalidAuthTokenEvent.INVALID_AUTH_TOKEN}" method="handleInvalidAuthToken" /> <mate:Listener type="{SwitchedLayoutEvent.SWITCHED_LAYOUT_EVENT}" method="onLayoutChanged" /> <mate:Listener type="{LocaleChangeEvent.LOCALE_CHANGED}" method="onLocaleChanged" /> <mate:Listener type="{NetworkStatsEvent.OPEN_NETSTATS_WIN}" method="openNetworkStatsWindow" /> - <mate:Listener type="{ConnectionFailedEvent.MODERATOR_DENIED_ME}" method="handleLogout" /> <mate:Listener type="{BBBEvent.MODERATOR_ALLOWED_ME_TO_JOIN}" method="guestAllowed" /> <mate:Listener type="{NewGuestWaitingEvent.NEW_GUEST_WAITING}" method="refreshGuestView" /> <mate:Listener type="{BBBEvent.REMOVE_GUEST_FROM_LIST}" method="removeGuestWindow" /> <mate:Listener type="{BBBEvent.WAITING_FOR_MODERATOR_ACCEPTANCE}" method="openWaitWindow" /> <mate:Listener type="{BBBEvent.RECONNECT_DISCONNECTED_EVENT}" method="closeWaitWindow"/> <mate:Listener type="{RoundTripLatencyReceivedEvent.ROUND_TRIP_LATENCY_RECEIVED}" method="handleRoundTripLatencyReceivedEvent"/> - </fx:Declarations> <fx:Script> <![CDATA[ import com.asfusion.mate.events.Dispatcher; import flash.events.Event; - import flash.events.IOErrorEvent; import flash.events.TextEvent; import flash.geom.Point; - import flash.net.navigateToURL; import flash.utils.setTimeout; import mx.binding.utils.ChangeWatcher; @@ -128,10 +115,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. import org.bigbluebutton.main.events.BBBEvent; import org.bigbluebutton.main.events.BreakoutRoomEvent; import org.bigbluebutton.main.events.ClientStatusEvent; - import org.bigbluebutton.main.events.ConfigLoadedEvent; import org.bigbluebutton.main.events.ExitApplicationEvent; - import org.bigbluebutton.main.events.InvalidAuthTokenEvent; - import org.bigbluebutton.main.events.MeetingNotFoundEvent; import org.bigbluebutton.main.events.ModuleLoadEvent; import org.bigbluebutton.main.events.NetworkStatsEvent; import org.bigbluebutton.main.events.ShortcutEvent; @@ -142,7 +126,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. import org.bigbluebutton.main.model.options.BrowserVersionsOptions; import org.bigbluebutton.main.model.options.LanguageOptions; import org.bigbluebutton.main.model.options.LayoutOptions; - import org.bigbluebutton.main.model.users.events.ConnectionFailedEvent; import org.bigbluebutton.modules.phone.events.AudioSelectionWindowEvent; import org.bigbluebutton.modules.phone.events.FlashMicSettingsEvent; import org.bigbluebutton.modules.phone.events.WebRTCCallEvent; @@ -209,10 +192,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. return logWindow; } - public function initOptions(e:Event):void { - brandingOptions = Options.getOptions(BrandingOptions) as BrandingOptions; + public function initOptions():void { layoutOptions = Options.getOptions(LayoutOptions) as LayoutOptions; usersOptions = Options.getOptions(UsersOptions) as UsersOptions; + brandingOptions = Options.getOptions(BrandingOptions) as BrandingOptions; updateCopyrightText(); loadBackground(); @@ -247,10 +230,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. } private function initQuote() : void { - if (brandingOptions.showQuote) { - quoteView.init(); - } else { + if (!brandingOptions.showQuote) { quoteView.dispose(); + } else { + quoteView.init(); } } @@ -258,6 +241,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. globalDispatcher = new Dispatcher(); copyrightLabel2.addEventListener(FlexEvent.UPDATE_COMPLETE, updateCopyrightLabelDimensions); + + initOptions(); } // See this stackoverflow post for an explanation on why the size watching is done this way, https://stackoverflow.com/a/2141223 @@ -321,7 +306,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. private function handleApplicationVersionEvent(event:AppVersionEvent):void { var logData:Object = UsersUtil.initLogData(); - + appVersion = event.appVersion; updateCopyrightText(); @@ -436,12 +421,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. var window:IBbbModuleWindow = event.window; mdiCanvas.addWindow(window); } - - private function handleCloseWindowEvent(event:CloseWindowEvent):void { - var window:IBbbModuleWindow = event.window; - mdiCanvas.removeWindow(window); - } - + + private function handleCloseWindowEvent(event:CloseWindowEvent):void { + var window:IBbbModuleWindow = event.window; + mdiCanvas.removeWindow(window); + } + private function versionCheck():void { var browserOptions : BrowserVersionsOptions = Options.getOptions(BrowserVersionsOptions) as BrowserVersionsOptions; if (!StringUtils.isEmpty(browserOptions.chrome) && !StringUtils.isEmpty(browserOptions.firefox) && !StringUtils.isEmpty(browserOptions.flash)) { @@ -599,44 +584,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. } } - private function handleMeetingNotFoundEvent(e:MeetingNotFoundEvent):void { - showlogoutWindow(ResourceUtil.getInstance().getString('bbb.mainshell.meetingNotFound')); - } - - private function showlogoutWindow(reason:String):void { - if (layoutOptions != null && layoutOptions.showLogoutWindow) { - if (UsersUtil.iAskedToLogout()) { - handleExitApplicationEvent(); - return; - } - var loggedOutWindow:LoggedOutWindow = PopUpUtil.createModalPopUp(mdiCanvas, LoggedOutWindow, false) as LoggedOutWindow; - if (loggedOutWindow) { - var point1:Point = new Point(); - // Calculate position of TitleWindow in Application's coordinates. - point1.x = width / 2; - point1.y = height / 2; - loggedOutWindow.x = point1.x - (loggedOutWindow.width / 2); - loggedOutWindow.y = point1.y - (loggedOutWindow.height / 2); - - loggedOutWindow.setReason(reason); - mdiCanvas.removeAllPopUps(); - removeToolBars(); - } - } else { - mdiCanvas.removeAllPopUps(); - removeToolBars(); - var serverURL:String = FlexGlobals.topLevelApplication.determineHtmlUrl(); - var pageHost:String = serverURL.split("/")[0]; - var pageURL:String = serverURL.split("/")[2]; - LOGGER.debug("SingOut to [{0}//{1}/bigbluebutton/api/signOut]", [pageHost, pageURL]); - var request:URLRequest = new URLRequest(pageHost + "//" + pageURL + "/bigbluebutton/api/signOut"); - var urlLoader:URLLoader = new URLLoader(); - urlLoader.addEventListener(Event.COMPLETE, handleLogoutComplete); - urlLoader.addEventListener(IOErrorEvent.IO_ERROR, handleLogoutError); - urlLoader.load(request); - } - } - /** * Removes toolbars from the display list. * Used only when the user completely logged out. @@ -646,43 +593,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. this.removeChild(controlBar); } - private function handleLogout(e:ConnectionFailedEvent):void { - if (e is ConnectionFailedEvent) { - showlogoutWindow((e as ConnectionFailedEvent).type); - } else - showlogoutWindow("You have logged out of the conference"); - } - - private function handleExitApplicationEvent(e:ExitApplicationEvent = null):void { - if (! UsersUtil.isBreakout()) { - navigateToURL(new URLRequest(BBB.getLogoutURL()), "_self"); - } else { - ExternalInterface.call("window.close"); - } - } - - private function redirectToLogoutUrl ():void { - var logoutURL:String = BBB.getLogoutURL(); - var request:URLRequest = new URLRequest(logoutURL); - LOGGER.debug("Logging out to: {0}", [logoutURL]); - navigateToURL(request, '_self'); - } - - - private function handleLogoutError(e:Event):void { - LOGGER.debug("Call to signOut URL failed."); - redirectToLogoutUrl(); - } - - private function handleLogoutComplete(e:Event):void { - LOGGER.debug("Call to signOut URL succeeded."); - redirectToLogoutUrl(); - } - - private function attemptReconnect(e:ConnectionFailedEvent):void{ - handleLogout(e); - } - private function handleAddToolbarComponent(event:ToolbarButtonEvent):void { if (event.location == ToolbarButtonEvent.BOTTOM_TOOLBAR) { var newComponentTabIndex:int = tabIndexer.startIndex + addedBtns.numChildren + 10; @@ -703,11 +613,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. lblWebRTC.visible = lblWebRTC.includeInLayout = false; } - private function handleInvalidAuthToken(event:InvalidAuthTokenEvent):void { - showlogoutWindow(ResourceUtil.getInstance().getString('bbb.mainshell.invalidAuthToken')); - globalDispatcher.dispatchEvent(new BBBEvent(BBBEvent.CANCEL_RECONNECTION_EVENT)); - } - private function handleRemoveToolbarComponent(event:ToolbarButtonEvent):void { if (addedBtns.contains(event.button as UIComponent)) addedBtns.removeChild(event.button as UIComponent); @@ -825,6 +730,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. PopUpUtil.initAlert(); } + private function handleCloseApplication(event:ExitApplicationEvent):void { + mdiCanvas.removeAllPopUps(); + removeToolBars(); + } ]]> </fx:Script> @@ -840,7 +749,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. visible="{_showToolbar}" includeInLayout="{showToolbarOpt}" verticalAlign="middle" - toolbarOptions="{layoutOptions}" updateComplete="updateToolbarHeight()"/> <!-- MainCanvas height has to be forced or it will never show and the application will not continue loading --> diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml index 3955d785ab51f56bb335d05b01d99f4c76c3258b..4ece858be6b05aa0bfcf8487357495053bc2aef0 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainToolbar.mxml @@ -35,7 +35,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <mate:Listener type="{BBBEvent.END_MEETING_EVENT}" method="handleEndMeetingEvent"/> <mate:Listener type="{ConnectionFailedEvent.USER_LOGGED_OUT}" method="hideToolbar" /> <mate:Listener type="{ConnectionFailedEvent.CONNECTION_CLOSED}" method="hideToolbar" /> - <mate:Listener type="{ConfigLoadedEvent.CONFIG_LOADED_EVENT}" method="handleConfigLoadedEvent" /> <mate:Listener type="{SettingsEvent.SETTINGS_MODULE_LOADED}" method="showSettingsButton" /> <mate:Listener type="{LocaleChangeEvent.LOCALE_CHANGED}" method="localeChanged" /> <mate:Listener type="{ShortcutEvent.REMOTE_OPEN_SHORTCUT_WIN}" method="remoteShortcutClick" /> @@ -78,7 +77,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. import org.bigbluebutton.core.model.Config; import org.bigbluebutton.core.model.LiveMeeting; import org.bigbluebutton.main.events.BBBEvent; - import org.bigbluebutton.main.events.ConfigLoadedEvent; import org.bigbluebutton.main.events.LogoutEvent; import org.bigbluebutton.main.events.NetworkStatsEvent; import org.bigbluebutton.main.events.SettingsEvent; @@ -103,7 +101,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. [Bindable] private var showHelpBtn:Boolean = false; [Bindable] private var showToolbar:Boolean = false; [Bindable] private var showRecordButton:Boolean = false; - [Bindable] public var toolbarOptions:LayoutOptions; + [Bindable] private var toolbarOptions:LayoutOptions; [Bindable] private var brandingOptions:BrandingOptions; [Bindable] private var usersOptions:UsersOptions; @@ -126,9 +124,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. private var settingsComponents:Array = new Array(); private function init():void{ - toolbarOptions = Options.getOptions(LayoutOptions) as LayoutOptions; brandingOptions = Options.getOptions(BrandingOptions) as BrandingOptions; usersOptions = Options.getOptions(UsersOptions) as UsersOptions; + toolbarOptions = Options.getOptions(LayoutOptions) as LayoutOptions; numButtons = 0; @@ -138,6 +136,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. timer.start(); BindingUtils.bindSetter(refreshModeratorButtonsVisibility, LiveMeeting.inst().meeting, "recorded"); + + initConfig(); } private function checkAccessiblity(e:TimerEvent):void { @@ -389,7 +389,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. addedBtnsWebcam.removeChild(event.button as UIComponent); } - private function handleConfigLoadedEvent(e:ConfigLoadedEvent):void{ + private function initConfig():void{ var config:Config = BBB.getConfigManager().config; var shortcutKeysOptions : ShortcutKeysOptions = Options.getOptions(ShortcutKeysOptions) as ShortcutKeysOptions; shortcutKeysBtn.includeInLayout = shortcutKeysBtn.visible = shortcutKeysOptions.showButton; diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/QuotesView.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/QuotesView.mxml index 5d4eb923213ef8bd6c15da2ccf84ff67383336c2..a31bf6188da0d500baa1369b8bbc446cbcdd7d6c 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/main/views/QuotesView.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/QuotesView.mxml @@ -41,26 +41,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <fx:Script> <![CDATA[ - import mx.events.EffectEvent; - - import org.as3commons.lang.StringUtils; import org.bigbluebutton.main.events.ModuleLoadEvent; import org.bigbluebutton.util.i18n.ResourceUtil; - private function dissolveOutHandler(event:EffectEvent):void { - showNewQuote(); - } - - private function showNewQuote():void { + public function init():void { var randomQuoteId:int = Math.ceil(Math.random() * 5); var quote:String = ResourceUtil.getInstance().getString('bbb.mainshell.quote.sentence.' + randomQuoteId); var attribution:String = ResourceUtil.getInstance().getString('bbb.mainshell.quote.attribution.' + randomQuoteId); - if (StringUtils.isEmpty(quote)) { - quote = "Research is creating new knowledge." - } - if (StringUtils.isEmpty(attribution)) { - attribution = "Neil Armstrong" - } quoteLabel.text = "“ " + quote + " â€"; quoteAttribution.text = attribution; dissolveIn.play(); @@ -70,10 +57,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. dispose(); } - public function init():void { - showNewQuote(); - } - public function dispose():void { if (parent != null) parent.removeChild(this); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatOptions.as b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatOptions.as index 6b6cf9e5fc1e4bb039837f919506452add7addb3..e2500e0cc8de97f394ee0bad720568778ead4834 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatOptions.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/chat/model/ChatOptions.as @@ -36,10 +36,10 @@ package org.bigbluebutton.modules.chat.model { [Bindable] public var maxMessageLength:uint = 1024; - - public var maxNumWindows:uint = 9; - - public var maxNumChatPerWindow:uint = 10; + + public var maxNumWindows:uint = 9; + + public var maxNumChatPerWindow:uint = 10; public function ChatOptions() { name = "ChatModule"; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/managers/LayoutManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/managers/LayoutManager.as index 8789bd413f8f2be157101797fdc91088fa810d0b..df551a427a6cc845af55fbf01df7eee6b6008435 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/managers/LayoutManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/managers/LayoutManager.as @@ -57,6 +57,7 @@ package org.bigbluebutton.modules.layout.managers import org.bigbluebutton.modules.layout.model.LayoutDefinition; import org.bigbluebutton.modules.layout.model.LayoutLoader; import org.bigbluebutton.modules.layout.model.LayoutModel; + import org.bigbluebutton.modules.layout.model.LayoutModuleOptions; import org.bigbluebutton.modules.layout.views.CustomLayoutNameWindow; import org.bigbluebutton.util.i18n.ResourceUtil; @@ -94,8 +95,9 @@ package org.bigbluebutton.modules.layout.managers * combo is created first. We use two booleans to sync it and only dispatch * the layouts to populate the list when both are created. */ - public function loadServerLayouts(layoutUrl:String):void { - //trace(LOG + " loading server layouts from " + layoutUrl); + public function loadServerLayouts():void { + var options : LayoutModuleOptions = Options.getOptions(LayoutModuleOptions) as LayoutModuleOptions; + var loader:LayoutLoader = new LayoutLoader(); loader.addEventListener(LayoutsLoadedEvent.LAYOUTS_LOADED_EVENT, function(e:LayoutsLoadedEvent):void { if (e.success) { @@ -104,19 +106,18 @@ package org.bigbluebutton.modules.layout.managers broadcastLayouts(); _serverLayoutsLoaded = true; - //trace(LOG + " layouts loaded successfully"); } else { - LOGGER.debug("layouts not loaded ({0})", [e.error.message]); + LOGGER.warn("layouts not loaded ({0})", [e.error.message]); } }); - loader.loadFromUrl(layoutUrl); + loader.loadFromUrl(options.layoutConfig); + } + + private function broadcastLayouts():void { + var layoutsReady:LayoutsReadyEvent = new LayoutsReadyEvent(); + _globalDispatcher.dispatchEvent(layoutsReady); } - private function broadcastLayouts():void { - var layoutsReady:LayoutsReadyEvent = new LayoutsReadyEvent(); - _globalDispatcher.dispatchEvent(layoutsReady); - } - public function saveLayoutsToFile():void { if (!_currentLayout.currentLayout) { var alertSaveCurrentLayToFile:Alert = Alert.show(ResourceUtil.getInstance().getString('bbb.layout.addCurrentToFileWindow.text'), diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMap.mxml index 58903b85b8a71ef3f5e69ef349ffe894d5b76dd5..bd94e4635690d025792c6e5cb6f9c5daaea4764b 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMap.mxml @@ -48,8 +48,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <EventHandlers type="{StartLayoutModuleEvent.START_LAYOUT_MODULE_EVENT}"> <ObjectBuilder generator="{LayoutService}" /> - <MethodInvoker generator="{LayoutEventMapDelegate}" method="startModule" arguments="{event.attributes}" /> - <MethodInvoker generator="{LayoutManager}" method="loadServerLayouts" arguments="{event.attributes.layoutConfig}" /> + <MethodInvoker generator="{LayoutEventMapDelegate}" method="startModule"/> + <MethodInvoker generator="{LayoutManager}" method="loadServerLayouts" /> </EventHandlers> <EventHandlers type="{ViewInitializedEvent.VIEW_INITIALIZED_EVENT}"> diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMapDelegate.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMapDelegate.mxml index 3ab86db473666854d4eb3f90433a03d654b7ef6b..a154aba3696132618651124b4dda86eb11fb951b 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMapDelegate.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMapDelegate.mxml @@ -28,28 +28,29 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. import org.bigbluebutton.core.Options; import org.bigbluebutton.main.model.options.LayoutOptions; import org.bigbluebutton.main.model.users.events.ChangeMyRole; + import org.bigbluebutton.modules.layout.model.LayoutModuleOptions; import org.bigbluebutton.modules.layout.views.ToolbarComponent; - private var _attributes:Object; + private var _globalDispatcher:Dispatcher = new Dispatcher(); private var options:LayoutOptions; + private var moduleOptions:LayoutModuleOptions; private var layoutComponent:ToolbarComponent; public function stopModule():void { } - public function startModule(attributes:Object):void { - _attributes = attributes; + public function startModule():void { options = Options.getOptions(LayoutOptions) as LayoutOptions; + moduleOptions = Options.getOptions(LayoutModuleOptions) as LayoutModuleOptions; layoutComponent = new ToolbarComponent(); - layoutComponent.enableEdit(_attributes.enableEdit == "true"); + layoutComponent.enableEdit = moduleOptions.enableEdit; layoutComponent.visibleTools(options.showLayoutTools); var event:ToolbarButtonEvent = new ToolbarButtonEvent(ToolbarButtonEvent.ADD); event.button = layoutComponent; event.location = ToolbarButtonEvent.BOTTOM_TOOLBAR; _globalDispatcher.dispatchEvent(event); - } public function refreshRole(e:ChangeMyRole):void { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutModuleOptions.as b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutModuleOptions.as new file mode 100644 index 0000000000000000000000000000000000000000..767dabc43fec90e95656c35fab08518d962a04a6 --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutModuleOptions.as @@ -0,0 +1,34 @@ +/** + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * + * Copyright (c) 2017 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 3.0 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.modules.layout.model { + import org.bigbluebutton.core.Options; + + public class LayoutModuleOptions extends Options { + + [Bindable] + public var layoutConfig:String = ""; + + [Bindable] + public var enableEdit:Boolean = false; + + public function LayoutModuleOptions() { + name = "LayoutModule"; + } + } +} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/ToolbarComponent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/ToolbarComponent.as index 860cf5e434e2fe849fc425aba1f281300c4d36ae..7dd0f98283a26d66d8c7f69095759a41b4705401 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/ToolbarComponent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/ToolbarComponent.as @@ -57,7 +57,7 @@ package org.bigbluebutton.modules.layout.views { _dispatcher.dispatchEvent(evt); } - public function enableEdit(editable:Boolean):void { + public function set enableEdit(editable:Boolean):void { layoutButton.enableEditOptions(editable); } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/models/PhoneOptions.as b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/models/PhoneOptions.as index 69434b7b2d46a2d0fe1448c9649d03208250eae6..a45d3e8abcd19e2a101ba8544f75f373876d5d28 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/phone/models/PhoneOptions.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/phone/models/PhoneOptions.as @@ -22,7 +22,7 @@ package org.bigbluebutton.modules.phone.models { public class PhoneOptions extends Options { static public var firstAudioJoin:Boolean = true; - public var uri:String = "unknown"; + public var uri:String = ""; [Bindable] public var showButton:Boolean = true; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/model/VideoConfOptions.as b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/model/VideoConfOptions.as index 9fd13901574f9a1d9a840e92c0177f4d167db926..c46915934fa9f17c4fe9b534980b512d14273fe1 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/model/VideoConfOptions.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/videoconf/model/VideoConfOptions.as @@ -21,7 +21,9 @@ package org.bigbluebutton.modules.videoconf.model { import org.bigbluebutton.util.browser.BrowserCheck; public class VideoConfOptions extends Options { - public var uri:String = "rtmp://localhost/video"; + public var uri:String = ""; + + public var videoProfilesConfig:String = ""; [Bindable] public var autoStart:Boolean = false; diff --git a/bigbluebutton-client/src/org/bigbluebutton/util/browser/BrowserCheck.as b/bigbluebutton-client/src/org/bigbluebutton/util/browser/BrowserCheck.as index 7325903ba6866114d6a67a49aa4ba7fdec21a3f7..43645e1802551fc381386ab54424efc88c670708 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/util/browser/BrowserCheck.as +++ b/bigbluebutton-client/src/org/bigbluebutton/util/browser/BrowserCheck.as @@ -23,6 +23,7 @@ package org.bigbluebutton.util.browser { import org.as3commons.lang.StringUtils; import org.as3commons.logging.api.ILogger; import org.as3commons.logging.api.getClassLogger; + import org.bigbluebutton.core.BBB; public class BrowserCheck { private static const LOGGER:ILogger = getClassLogger(BrowserCheck); @@ -87,9 +88,8 @@ package org.bigbluebutton.util.browser { } public static function isHttps():Boolean { - var url:String = ExternalInterface.call("window.location.href.toString"); var httpsPattern:RegExp = /^https/; - return httpsPattern.test(url); + return httpsPattern.test(BBB.getBaseURL()); } } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/util/i18n/ResourceUtil.as b/bigbluebutton-client/src/org/bigbluebutton/util/i18n/ResourceUtil.as index c78f631b1165e03ddac8fbed27e57f461a3f3e8e..6e1c7846eff39fe91066bf04ab6decd942d00f6d 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/util/i18n/ResourceUtil.as +++ b/bigbluebutton-client/src/org/bigbluebutton/util/i18n/ResourceUtil.as @@ -31,9 +31,7 @@ package org.bigbluebutton.util.i18n import mx.core.FlexGlobals; import mx.events.ResourceEvent; - import mx.resources.IResourceManager; import mx.resources.ResourceManager; - import mx.utils.URLUtil; import org.as3commons.lang.StringUtils; import org.as3commons.logging.api.ILogger; @@ -46,30 +44,23 @@ package org.bigbluebutton.util.i18n public class ResourceUtil extends EventDispatcher { private static const LOGGER:ILogger = getClassLogger(ResourceUtil); - public static const LOCALES_FILE:String = "client/conf/locales.xml"; - private static var instance:ResourceUtil = null; private var inited:Boolean = false; - + private var dispatcher:Dispatcher = new Dispatcher(); + private static var BBB_RESOURCE_BUNDLE:String = 'bbbResources'; - private static var MASTER_LOCALE:String = "en_US"; + private static var MASTER_LOCALE:String; private static var DEFAULT_LOCALE_IDENTIFIER:String = "default"; [Bindable] public var locales:Array = new Array(); - //private var eventDispatcher:IEventDispatcher; - private var resourceManager:IResourceManager; private var preferredLocale:String private var preferredDirection:String - private var masterLocaleLoaded:Boolean = false; - private var masterLocaleLoadedCallback:Function = null; - public function ResourceUtil(enforcer:SingletonEnforcer) { if (enforcer == null) { throw new Error( "You Can Only Have One ResourceUtil" ); } - initialize(); } private function isInited():Boolean { @@ -77,34 +68,34 @@ package org.bigbluebutton.util.i18n } public function initialize():void { - resourceManager = ResourceManager.getInstance(); + var languageOptions : LanguageOptions = Options.getOptions(LanguageOptions) as LanguageOptions; + + // We embedd the master locale within the application to save resources loading and load + // the preferred locale at the first shot + MASTER_LOCALE = FlexGlobals.topLevelApplication.systemManager.info()['compiledLocales'][0]; + // Add a random string on the query so that we always get an up-to-date config.xml var date:Date = new Date(); var _urlLoader:URLLoader = new URLLoader(); _urlLoader.addEventListener(Event.COMPLETE, handleComplete); - var localeReqURL:String = buildRequestURL() + LOCALES_FILE + "?a=" + date.time; + var localeReqURL:String = languageOptions.localesConfig + "?a=" + date.time; _urlLoader.load(new URLRequest(localeReqURL)); } - private function buildRequestURL():String { - var swfURL:String = FlexGlobals.topLevelApplication.url; - var protocol:String = URLUtil.getProtocol(swfURL); - var serverName:String = URLUtil.getServerNameWithPort(swfURL); - return protocol + "://" + serverName + "/"; - } - private function handleComplete(e:Event):void{ parse(new XML(e.target.data)); preferredLocale = getDefaultLocale(); if (preferredLocale != MASTER_LOCALE) { - trace("Preferred locale=" + preferredLocale + " is not the same as master locale=" + MASTER_LOCALE); - loadMasterLocale(MASTER_LOCALE); + LOGGER.debug("Preferred locale=" + preferredLocale + " is not the same as master locale=" + MASTER_LOCALE); + // Improve language detection + setPreferredLocale({code:preferredLocale, direction:"ltr"}); + } else { + inited = true; + dispatcher.dispatchEvent(new LocaleChangeEvent(LocaleChangeEvent.LOCALE_INIT)); } - // To improve - setPreferredLocale({code:preferredLocale, direction:"ltr"}); } private function parse(xml:XML):void{ @@ -181,34 +172,15 @@ package org.bigbluebutton.util.i18n locales.sort(localesCompareFunction); } - private function loadMasterLocale(locale:String):void { - trace("Loading master locale=" + locale); - /** - * http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/resources/IResourceManager.html#localeChain - * Always load the default language, so if the chosen language - * doesn't provide a resource, the default language resource is used - */ - var dispatcher:IEventDispatcher = loadResource(locale); - dispatcher.addEventListener(ResourceEvent.COMPLETE, onMasterLocaleLoaded); - } - - private function onMasterLocaleLoaded(event:ResourceEvent):void { - trace("Master locale is loaded"); - masterLocaleLoaded = true; - if (masterLocaleLoadedCallback != null) { - trace("Calling callback to load a second language"); - masterLocaleLoadedCallback(); - } - } - private function loadResource(language:String):IEventDispatcher { // Add a random string on the query so that we don't get a cached version. - + var languageOptions : LanguageOptions = Options.getOptions(LanguageOptions) as LanguageOptions; + var date:Date = new Date(); - var localeURI:String = buildRequestURL() + 'client/locale/' + language + '_resources.swf?a=' + date.time; - trace("Loading locale " + localeURI); - return resourceManager.loadResourceModule( localeURI, false); - } + var localeURI:String = languageOptions.localesDirectory + language + '_resources.swf?a=' + date.time; + LOGGER.debug("Loading locale " + localeURI); + return ResourceManager.getInstance().loadResourceModule(localeURI, false); + } public static function getInstance():ResourceUtil { if (instance == null) { @@ -224,30 +196,22 @@ package org.bigbluebutton.util.i18n } public function changeLocale(locale:String):void { - if (masterLocaleLoaded || locale == MASTER_LOCALE) { - trace("Loading immediately " + locale); - changeLocaleHelper(locale); - } else { - trace("Registering callback to load " + locale + " later"); - masterLocaleLoadedCallback = function():void { - changeLocaleHelper(locale); - } - } + LOGGER.debug("Loading immediately " + locale); + changeLocaleHelper(locale); } private function localeChangeComplete(event:ResourceEvent):void { // Set the preferred locale and master as backup. if (preferredLocale != MASTER_LOCALE) { - resourceManager.localeChain = [preferredLocale, MASTER_LOCALE]; + ResourceManager.getInstance().localeChain = [preferredLocale, MASTER_LOCALE]; } else { if (preferredLocale != MASTER_LOCALE) { var logData:Object = UsersUtil.initLogData(); logData.tags = ["locale"]; logData.message = "Failed to load locale = " + preferredLocale; - trace(JSON.stringify(logData)); + LOGGER.debug(JSON.stringify(logData)); } - masterLocaleLoaded = true; - resourceManager.localeChain = [MASTER_LOCALE]; + ResourceManager.getInstance().localeChain = [MASTER_LOCALE]; preferredLocale = MASTER_LOCALE; } @@ -259,15 +223,18 @@ package org.bigbluebutton.util.i18n * @param event */ private function handleResourceNotLoaded(event:ResourceEvent):void { - trace("Resource locale [" + preferredLocale + "] could not be loaded."); - resourceManager.localeChain = [MASTER_LOCALE]; + LOGGER.debug("Resource locale [" + preferredLocale + "] could not be loaded."); + ResourceManager.getInstance().localeChain = [MASTER_LOCALE]; preferredLocale = MASTER_LOCALE; update(); } public function update():void{ reloadLocaleNames(); - var dispatcher:Dispatcher = new Dispatcher; + if (!isInited()) { + inited = true; + dispatcher.dispatchEvent(new LocaleChangeEvent(LocaleChangeEvent.LOCALE_INIT)); + } dispatcher.dispatchEvent(new LocaleChangeEvent(LocaleChangeEvent.LOCALE_CHANGED)); dispatchEvent(new Event(Event.CHANGE)); } @@ -282,13 +249,13 @@ package org.bigbluebutton.util.i18n * the key is available in the locale and thus not bother falling back to the master locale. * (ralam dec 15, 2011). */ - if (resourceManager.getObject(BBB_RESOURCE_BUNDLE, resourceName, locale) == undefined) { + if (ResourceManager.getInstance().getObject(BBB_RESOURCE_BUNDLE, resourceName, locale) == undefined) { locale = MASTER_LOCALE; } - var localeTxt:String = resourceManager.getString(BBB_RESOURCE_BUNDLE, resourceName, parameters, locale); + var localeTxt:String = ResourceManager.getInstance().getString(BBB_RESOURCE_BUNDLE, resourceName, parameters, locale); if (locale != MASTER_LOCALE && StringUtils.isEmpty(localeTxt)) { - localeTxt = resourceManager.getString(BBB_RESOURCE_BUNDLE, resourceName, parameters, MASTER_LOCALE); + localeTxt = ResourceManager.getInstance().getString(BBB_RESOURCE_BUNDLE, resourceName, parameters, MASTER_LOCALE); } return localeTxt; } diff --git a/bigbluebutton-client/src/org/bigbluebutton/util/logging/ServerLogTarget.as b/bigbluebutton-client/src/org/bigbluebutton/util/logging/ServerLogTarget.as index bfc516464bebe8da7026eb3e664790545cd90362..79f45306b74057d8b30ab23d107bbabcb6587f47 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/util/logging/ServerLogTarget.as +++ b/bigbluebutton-client/src/org/bigbluebutton/util/logging/ServerLogTarget.as @@ -24,7 +24,6 @@ package org.bigbluebutton.util.logging import flash.net.URLLoader; import flash.net.URLRequest; import flash.net.URLRequestMethod; - import flash.net.URLVariables; import flash.utils.Timer; import org.as3commons.lang.ArrayUtils;