bigbluebutton-Github/bigbluebutton-client/src/BigBlueButtonMainContainer.mxml

245 lines
10 KiB
Plaintext
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
2013-09-17 04:57:06 +08:00
<!--
BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
Copyright (c) 2012 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/>.
-->
<mx:Canvas xmlns:mx="library://ns.adobe.com/flex/mx"
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:views="org.bigbluebutton.main.views.*"
xmlns:maps="org.bigbluebutton.main.maps.*"
xmlns:userMap="org.bigbluebutton.modules.users.maps.*"
xmlns:apimap="org.bigbluebutton.main.api.maps.*"
xmlns:coreMap="org.bigbluebutton.core.controllers.maps.*"
xmlns:toaster="org.bigbluebutton.common.toaster.*"
xmlns:mate="http://mate.asfusion.com/"
width="100%" height="100%"
backgroundColor="white"
horizontalScrollPolicy="off"
verticalScrollPolicy="off"
2015-01-30 02:03:13 +08:00
creationComplete="init()"
addedToStage="onAddedToStage()">
<fx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import flash.events.Event;
2014-08-14 06:31:29 +08:00
import mx.managers.HistoryManager;
import mx.managers.IDragManager;
2014-08-14 06:31:29 +08:00
import mx.managers.ToolTipManager;
import org.as3commons.logging.api.ILogger;
import org.as3commons.logging.api.getClassLogger;
import org.bigbluebutton.common.events.LocaleChangeEvent;
2014-08-14 06:31:29 +08:00
import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.KeyboardUtil;
2014-08-14 06:31:29 +08:00
import org.bigbluebutton.main.api.ExternalApiCallbacks;
import org.bigbluebutton.main.events.ConfigLoadedEvent;
2014-08-14 06:31:29 +08:00
import org.bigbluebutton.main.events.ShortcutEvent;
import org.bigbluebutton.main.model.ShortcutOptions;
import org.bigbluebutton.main.views.MainApplicationShell;
2014-08-14 06:31:29 +08:00
import org.bigbluebutton.util.i18n.ResourceUtil;
private static const LOGGER:ILogger = getClassLogger(BigBlueButtonMainContainer);
private var globalModifier:String;
/**
* Thse two lines are workaround for this. (ralam - Nov 8, 2008)
* http://gregjessup.com/flex-3-advanceddatagrid-cannot-convert-mxmanagersdragmanagerimpl-to-mxmanagersidragmanager/
* http://butterfliesandbugs.wordpress.com/2007/10/25/workaround-for-error-when-loading-popups-from-modules/
*/
private var iDragManager:IDragManager;
/** another workaround - for this issue: https://bugs.adobe.com/jira/browse/SDK-13121*/
private var hist:HistoryManager
private var globalDispatcher:Dispatcher = new Dispatcher();
private var _timer:Timer;
protected function init():void {
2014-08-14 06:31:29 +08:00
setupTooltips();
globalModifier = ExternalInterface.call("determineGlobalModifier");
}
private function queryForSessionToken():void {
/** We attempt to query several times to try to get the sessionToken from the browser url.
* (ralam oct 6, 2015)
*/
_timer = new Timer(500, 6);
_timer.addEventListener(TimerEvent.TIMER, timerHandler);
_timer.addEventListener(TimerEvent.TIMER_COMPLETE, completeHandler);
_timer.start();
}
private function getSessionToken():String {
return BBB.getQueryStringParameters().getSessionToken();
}
private function timerHandler(e:TimerEvent):void{
if (getSessionToken() != "") {
_timer.stop();
BBB.getConfigManager().loadConfig();
2015-10-08 00:09:31 +08:00
}
}
private function completeHandler(e:TimerEvent):void {
trace("Failed to get session token.");
}
private var api:ExternalApiCallbacks;
private function setupAPI():void {
api = new ExternalApiCallbacks();
2017-10-31 05:28:32 +08:00
Security.allowDomain("*");
LOGGER.debug("Security.allowDomain({0});", ["*"]);
}
2014-08-14 06:31:29 +08:00
/**
* Tooltip effect
*/
private function setupTooltips() : void {
ToolTipManager.scrubDelay = 50;
ToolTipManager.showDelay = 50;
ToolTipManager.hideDelay = 3000;
ToolTipManager.showEffect = fadeIn;
ToolTipManager.hideEffect = fadeOut;
}
/**
* Shortcut Keys
*/
2015-01-30 02:03:13 +08:00
private function onAddedToStage():void {
queryForSessionToken();
2015-01-30 02:03:13 +08:00
}
private function localeChanged(e:Event):void{
loadKeyCombos(globalModifier);
}
private var keyCombos:Object;
private function loadKeyCombos(globalModifier:String):void {
keyCombos = new Object(); // always start with a fresh array
// Module-independent keys
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.flash.exit') as String)] = ShortcutEvent.FOCUS_AWAY_EVENT;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.shortcutWindow') as String)] = ShortcutEvent.REMOTE_OPEN_SHORTCUT_WIN;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.logout') as String)] = ShortcutEvent.LOGOUT;
// Module-dependent keys
if (ShortcutOptions.usersActive){
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.focus.users') as String)] = ShortcutEvent.FOCUS_USERS_WINDOW;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.raiseHand') as String)] = ShortcutEvent.RAISE_HAND;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.users.muteme') as String)] = ShortcutEvent.MUTE_ME_EVENT;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.users.muteAllButPres') as String)] = ShortcutEvent.MUTE_ALL_BUT_PRES;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.users.breakoutRooms') as String)] = ShortcutEvent.OPEN_BREAKOUT_ROOMS;
}
if (ShortcutOptions.presentationActive){
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.focus.presentation') as String)] = ShortcutEvent.FOCUS_PRESENTATION_WINDOW;
}
if (ShortcutOptions.chatActive){
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.focus.chat') as String)] = ShortcutEvent.FOCUS_CHAT_WINDOW;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.chat.chatinput') as String)] = ShortcutEvent.FOCUS_CHAT_INPUT;
}
if (ShortcutOptions.pollingActive){
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.focus.pollingCreate') as String)] = ShortcutEvent.FOCUS_POLLING_WINDOW_CREATE;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.focus.pollingStats') as String)] = ShortcutEvent.FOCUS_POLLING_WINDOW_STATS;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.focus.voting') as String)] = ShortcutEvent.FOCUS_VOTING_WINDOW;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.polling.buttonClick') as String)] = ShortcutEvent.POLL_BUTTON_CLICK;
}
if (ShortcutOptions.webcamActive){
2017-02-13 22:13:02 +08:00
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.focus.video') as String)] = ShortcutEvent.FOCUS_VIDEO_WINDOW;
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.share.webcam') as String)] = ShortcutEvent.SHARE_WEBCAM;
}
if (ShortcutOptions.closedCaptionActive){
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.focus.caption') as String)] = ShortcutEvent.FOCUS_CAPTION_WINDOW;
}
if (ShortcutOptions.deskshareActive){
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.share.desktop') as String)] = ShortcutEvent.SHARE_DESKTOP;
}
}
public function hotkeyCapture():void{
LOGGER.debug("Entering hotkeyCapture");
stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);
ResourceUtil.getInstance().addEventListener(Event.CHANGE, localeChanged); // Listen for locale changing
LOGGER.debug("Leaving hotkeyCapture");
}
// Handle general-access hotkeys, regardless of what window the user is focused in
private function handleKeyDown(e:KeyboardEvent) :void {
if (keyCombos == null) loadKeyCombos(globalModifier);
var keyPress:String = KeyboardUtil.buildPressedKeys(e);
if (e.keyCode < 64 || e.keyCode > 90){
LOGGER.debug("Keypress debugging: KeyCode {0} is nonalphabetic (probably)", [e.keyCode]);
}
if (keyCombos[keyPress]) {
//LogUtil.debug("Caught shortcut: " + keyCombos[keyPress]);
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 {
ExternalInterface.call("stopFlashFocus");
}
]]>
</fx:Script>
<fx:Declarations>
<mx:Fade id="fadeIn" alphaFrom="0" alphaTo="1" duration="250"/>
<mx:Fade id="fadeOut" alphaFrom="1" alphaTo="0" duration="250"/>
<apimap:ExternalApiEventMap/>
<coreMap:BbbCoreEventMap/>
<userMap:UsersMainEventMap />
<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>
<!--
<toaster:Toaster id="toasterContainer" width="100%" height="100%"/>
-->
</mx:Canvas>