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

181 lines
8.7 KiB
Plaintext
Raw Normal View History

<?xml version="1.0" encoding="utf-8"?>
<mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml"
xmlns:views="org.bigbluebutton.main.views.*"
xmlns:maps="org.bigbluebutton.main.maps.*"
xmlns:apimap="org.bigbluebutton.main.api.maps.*"
xmlns:coreMap="org.bigbluebutton.core.controllers.maps.*"
xmlns:mate="http://mate.asfusion.com/"
layout="absolute"
width="100%" height="100%"
borderStyle="none" horizontalAlign="center"
headerHeight="0" borderThicknessBottom="0" borderThicknessLeft="0"
borderThicknessRight="0" borderThicknessTop="0"
creationComplete="init()">
<mx:Script>
<![CDATA[
import com.asfusion.mate.events.Dispatcher;
import flash.events.Event;
import mx.controls.Alert;
import mx.managers.HistoryManager;
import mx.utils.URLUtil;
import org.bigbluebutton.common.LogUtil;
import org.bigbluebutton.common.events.AddUIComponentToMainCanvas;
import org.bigbluebutton.core.BBB;
import org.bigbluebutton.core.EventBroadcaster;
import org.bigbluebutton.core.managers.ConfigManager2;
import org.bigbluebutton.main.api.ExternalApiCallbacks;
import org.bigbluebutton.main.events.BBBEvent;
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 var langResources:ResourceUtil = null;
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/
*/
import mx.managers.IDragManager;
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();
protected function init():void {
setupAPI();
EventBroadcaster.getInstance().addEventListener("configLoadedEvent", configLoadedEventHandler);
BBB.initConfigManager();
globalModifier = ExternalInterface.call("determineGlobalModifier");
}
private function configLoadedEventHandler(e:Event):void {
LogUtil.debug("***** Config Loaded ****");
mainShell.initOptions(null);
ShortcutOptions.initialize();
}
private function appComplete():void{
hotkeyCapture();
}
private var api:ExternalApiCallbacks;
private function setupAPI():void {
langResources = ResourceUtil.getInstance();
api = new ExternalApiCallbacks();
Security.allowDomain(determineHTMLURL());
LogUtil.debug("Security.allowDomain(" + determineHTMLURL() + ");");
}
private function determineHTMLURL():String {
var serverName:String = "*";
if(ExternalInterface.available) {
try {
var htmlURL:String = String(ExternalInterface.call("window.location.href.toString"));
serverName = URLUtil.getServerName(htmlURL);
trace("HTML URL [" + htmlURL + "]");
} catch(s:Error) {
trace("Cannot determine HTML URL");
}
}
return serverName;
}
/**
* Shortcut Keys
*/
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;
}
if (ShortcutOptions.videoDockActive){
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.focus.video') as String)] = ShortcutEvent.FOCUS_VIDEO_WINDOW;
}
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){
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.share.webcam') as String)] = ShortcutEvent.SHARE_WEBCAM;
}
if (ShortcutOptions.deskshareActive){
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.share.desktop') as String)] = ShortcutEvent.SHARE_DESKTOP;
}
if (ShortcutOptions.audioActive){
keyCombos[globalModifier+(ResourceUtil.getInstance().getString('bbb.shortcutkey.share.microphone') as String)] = ShortcutEvent.SHARE_MICROPHONE;
}
}
public function hotkeyCapture():void{
trace("Entering hotkeyCapture");
stage.addEventListener(KeyboardEvent.KEY_DOWN, handleKeyDown);
ResourceUtil.getInstance().addEventListener(Event.CHANGE, localeChanged); // Listen for locale changing
trace("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 = (e.ctrlKey ? "control+" : "") + (e.shiftKey ? "shift+" : "") + (e.altKey ? "alt+" : "") + e.keyCode;
if (e.keyCode < 64 || e.keyCode > 90){
trace("Keypress debugging: KeyCode " + e.keyCode + " is nonalphabetic (probably)");
}
if (keyCombos[keyPress]) {
//LogUtil.debug("Caught shortcut: " + keyCombos[keyPress]);
globalDispatcher.dispatchEvent(new ShortcutEvent(keyCombos[keyPress]));
}
}
// Moves page focus outside and past the Flash content
private function loseFocusFromApp(e:Event):void {
ExternalInterface.call("stopFlashFocus");
}
]]>
</mx:Script>
<apimap:ExternalApiEventMap/>
<coreMap:BbbCoreEventMap/>
<maps:ApplicationEventMap />
<views:MainApplicationShell id="mainShell"/>
<mate:Listener type="{ShortcutEvent.FOCUS_AWAY_EVENT}" method="loseFocusFromApp" />
</mx:Panel>