Merge branch 'capilkey-add-presentwin-to-layout'

This commit is contained in:
Richard Alam 2017-10-29 13:06:05 -07:00
commit 73a3cbe85f
5 changed files with 148 additions and 24 deletions

View File

@ -108,6 +108,7 @@
baseTabIndex="501"
maxFileSize="30"
enableDownload="true"
maxNumWindows="9"
/>
<module name="CaptionModule" url="http://HOST/client/CaptionModule.swf?v=VERSION"

View File

@ -19,29 +19,30 @@
package org.bigbluebutton.modules.present.managers
{
import com.asfusion.mate.events.Dispatcher;
import flash.display.DisplayObject;
import flash.geom.Point;
import mx.core.FlexGlobals;
import mx.collections.ArrayCollection;
import mx.core.FlexGlobals;
import org.bigbluebutton.common.IBbbModuleWindow;
import org.bigbluebutton.common.events.CloseWindowEvent;
import org.bigbluebutton.common.events.OpenWindowEvent;
import org.bigbluebutton.common.events.CloseWindowEvent;
import org.bigbluebutton.core.Options;
import org.bigbluebutton.core.PopUpUtil;
import org.bigbluebutton.main.model.users.events.RequestPresenterGroupEvent;
import org.bigbluebutton.modules.present.events.ExportEvent;
import org.bigbluebutton.modules.present.events.PresentModuleEvent;
import org.bigbluebutton.modules.present.events.UploadEvent;
import org.bigbluebutton.modules.present.events.GetAllPodsRespEvent;
import org.bigbluebutton.modules.present.events.NewPresentationPodCreated;
import org.bigbluebutton.modules.present.events.PresentModuleEvent;
import org.bigbluebutton.modules.present.events.PresentationPodRemoved;
import org.bigbluebutton.modules.present.events.RequestAllPodsEvent;
import org.bigbluebutton.modules.present.events.GetAllPodsRespEvent;
import org.bigbluebutton.modules.present.events.RequestNewPresentationPodEvent;
import org.bigbluebutton.modules.present.events.UploadEvent;
import org.bigbluebutton.modules.present.model.PresentOptions;
import org.bigbluebutton.modules.present.model.PresentationPodManager;
import org.bigbluebutton.modules.present.model.PresentationWindowManager;
import org.bigbluebutton.modules.present.ui.views.FileDownloadWindow;
import org.bigbluebutton.modules.present.ui.views.FileExportWindow;
import org.bigbluebutton.modules.present.ui.views.FileUploadWindow;
@ -49,20 +50,28 @@ package org.bigbluebutton.modules.present.managers
public class PresentManager
{
private const DEFAULT_POD_ID:String = "DEFAULT_PRESENTATION_POD";
private var globalDispatcher:Dispatcher;
private var windows: Array = [];
private var winManager:PresentationWindowManager;
private var podsManager: PresentationPodManager;
private var presentOptions:PresentOptions;
public function PresentManager() {
globalDispatcher = new Dispatcher();
podsManager = PresentationPodManager.getInstance();
winManager = new PresentationWindowManager;
}
public function handleStartModuleEvent(e:PresentModuleEvent):void{
if (windows.length >= 1) {
if (winManager.isEmpty()) {
return;
}
presentOptions = Options.getOptions(PresentOptions) as PresentOptions;
winManager.initCollection(presentOptions.maxNumWindows);
var requestAllPodsEvent:RequestAllPodsEvent = new RequestAllPodsEvent(RequestAllPodsEvent.REQUEST_ALL_PODS);
globalDispatcher.dispatchEvent(requestAllPodsEvent);
@ -74,26 +83,28 @@ package org.bigbluebutton.modules.present.managers
var podId: String = e.podId;
var ownerId: String = e.ownerId;
if(windows.hasOwnProperty(podId)) {
if(winManager.containsPodId(podId)) {
// remove pod and replace with the updated version
handlePresentationPodRemovedHelper(podId, ownerId);
}
var newWindow:PresentationWindow = new PresentationWindow();
newWindow.onPodCreated(podId, ownerId);
var presentOptions:PresentOptions = Options.getOptions(PresentOptions) as PresentOptions;
newWindow.visible = true; // TODO
// newWindow.visible = presentOptions.showPresentWindow;
newWindow.showControls = presentOptions.showWindowControls;
windows[podId] = newWindow;
var selectedWinId:String = winManager.addWindow(podId, newWindow, podId == DEFAULT_POD_ID);
if (selectedWinId != null) {
newWindow.setWindowId(selectedWinId);
var openEvent:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
openEvent.window = newWindow;
globalDispatcher.dispatchEvent(openEvent);
var openEvent:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
openEvent.window = newWindow;
globalDispatcher.dispatchEvent(openEvent);
podsManager.handleAddPresentationPod(podId, ownerId);
podsManager.handleAddPresentationPod(podId, ownerId);
}
}
public function handlePresentationPodRemoved(e: PresentationPodRemoved): void {
@ -106,13 +117,13 @@ package org.bigbluebutton.modules.present.managers
private function handlePresentationPodRemovedHelper(podId: String, ownerId: String): void {
podsManager.handlePresentationPodRemoved(podId, ownerId);
var destroyWindow:PresentationWindow = windows[podId];
var destroyWindow:PresentationWindow = winManager.findWindowByPodId(podId);
if (destroyWindow != null) {
var closeEvent:CloseWindowEvent = new CloseWindowEvent(CloseWindowEvent.CLOSE_WINDOW_EVENT);
closeEvent.window = destroyWindow;
globalDispatcher.dispatchEvent(closeEvent);
delete windows[podId];
winManager.removeWindow(podId);
}
}
@ -122,8 +133,9 @@ package org.bigbluebutton.modules.present.managers
}
public function handleStopModuleEvent():void{
for (var key: String in windows) {
windows[key].close();
var openWindows:Array = winManager.findAllWindows();
for (var i:int=0; i<openWindows.length; i++) {
openWindows[i].close();
}
// var event:CloseWindowEvent = new CloseWindowEvent(CloseWindowEvent.CLOSE_WINDOW_EVENT);

View File

@ -38,6 +38,9 @@ package org.bigbluebutton.modules.present.model {
[Bindable]
public var enableDownload:Boolean = true;
[Bindable]
public var maxNumWindows:uint = 9;
public function PresentOptions() {
name = "PresentModule";

View File

@ -0,0 +1,102 @@
/**
* 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/>.
*
*/
package org.bigbluebutton.modules.present.model {
import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
public class PresentationWindowManager {
private var windows: Array = [];
public function PresentationWindowManager() {
}
public function initCollection(numWindows:int):void {
for (var i:int=0; i<numWindows; i++) {
windows.push({windowId:"PresentationWindow"+i, podId: "", window: null});
}
}
private function findEmptyWinId():Object {
for (var i:int=1; i<windows.length; i++) {
if (windows[i].window == null) {
return windows[i];
}
}
return null;
}
public function containsPodId(podId:String):Boolean {
for (var i:int=0; i<windows.length; i++) {
if (windows[i].podId == podId) {
return true;
}
}
return false;
}
public function findWindowByPodId(podId:String):PresentationWindow {
for (var i:int=0; i<windows.length; i++) {
if (windows[i].podId == podId) {
return windows[i].window;
}
}
return null;
}
public function findAllWindows():Array {
var foundWindows:Array = [];
for (var i:int=0; i<windows.length; i++) {
if (windows[i].window != null) {
foundWindows.push(windows[i].window);
}
}
return foundWindows;
}
public function addWindow(podId:String, window:PresentationWindow, defaultWin:Boolean):String {
var selectedWinId:Object;
if (defaultWin) {
selectedWinId = windows[0];
} else {
selectedWinId = findEmptyWinId();
}
if (selectedWinId != null) {
selectedWinId.podId = podId;
selectedWinId.window = window;
return selectedWinId.windowId;
}
return null;
}
public function removeWindow(podId:String):void {
for (var i:int=0; i<windows.length; i++) {
if (windows[i].podId == podId) {
windows[i].podId = "";
windows[i].window = null;
}
}
}
public function isEmpty():Boolean {
return windows.length > 0;
}
}
}

View File

@ -165,6 +165,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private var pollMenuData:Array;
private var pollMenu:Menu;
private var windowId:String;
[Bindable]
private var podId: String = "";
private var ownerId: String = "";
@ -231,6 +233,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
this.currentPresenterInPod = this.ownerId;
populatePodDropdown();
}
public function setWindowId(windowId:String):void {
this.windowId = windowId;
}
public function getPodId(): String { return this.podId; }
@ -448,7 +454,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
public function getName():String {
return podId;
return windowId;
}
private function onSliderZoom():void {