Merge pull request #582 from bigbluebutton/fix-issue-1849

Fix issue 1849
This commit is contained in:
Fred Dixon 2015-03-23 18:40:14 -04:00
commit 2b265f7082
4 changed files with 59 additions and 39 deletions

View File

@ -89,13 +89,15 @@ package org.bigbluebutton.modules.layout.managers
public function LayoutManager() {
_applyCurrentLayoutTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
//trace(LOG + " timerEvent layout [" + _currentLayout.name + "]");
applyLayout(_currentLayout);
trace(LOG + "Applied layout after user resized browser");
//trace(LOG + "Applied layout after user resized browser");
});
_sendCurrentLayoutUpdateTimer.addEventListener(TimerEvent.TIMER, function(e:TimerEvent):void {
trace(LOG + "Applying layout due to window resize");
//trace(LOG + "Applying layout due to window resize");
if (_autoSync)
sendLayoutUpdate(updateCurrentLayout());
//trace(LOG + "Applying layout on autoSync");
sendLayoutUpdate(updateCurrentLayout(_currentLayout));
});
}
@ -107,7 +109,7 @@ package org.bigbluebutton.modules.layout.managers
* the layouts to populate the list when both are created.
*/
public function loadServerLayouts(layoutUrl:String):void {
trace(LOG + " loading server layouts from " + layoutUrl);
//trace(LOG + " loading server layouts from " + layoutUrl);
var loader:LayoutLoader = new LayoutLoader();
loader.addEventListener(LayoutsLoadedEvent.LAYOUTS_LOADED_EVENT, function(e:LayoutsLoadedEvent):void {
if (e.success) {
@ -116,7 +118,7 @@ package org.bigbluebutton.modules.layout.managers
broadcastLayouts();
_serverLayoutsLoaded = true;
trace(LOG + " layouts loaded successfully");
//trace(LOG + " layouts loaded successfully");
} else {
trace(LOG + " layouts not loaded (" + e.error.message + ")");
}
@ -162,6 +164,7 @@ package org.bigbluebutton.modules.layout.managers
_canvas.windowManager.addEventListener(MDIManagerEvent.WINDOW_RESTORE, onActionOverWindowFinished);
_canvas.windowManager.addEventListener(MDIManagerEvent.WINDOW_ADD, function(e:MDIManagerEvent):void {
checkPermissionsOverWindow(e.window);
//trace(LOG + " setCanvas layout [" + _currentLayout.name + "]");
applyLayout(_currentLayout);
});
@ -174,11 +177,11 @@ package org.bigbluebutton.modules.layout.managers
}
public function switchToLayout(name:String):void {
trace(LOG + " switching to layout [" + name + "] ");
//trace(LOG + " switching to layout [" + name + "] ");
var newLayout:LayoutDefinition = _layoutModel.getLayout(name);
if (newLayout == null) return;
trace(LOG + " applying layout [" + newLayout.name + "] to windows.");
//trace(LOG + " applying layout [" + newLayout.name + "] to windows.");
applyLayout(newLayout);
}
@ -200,14 +203,14 @@ package org.bigbluebutton.modules.layout.managers
defaultLayout = _layoutModel.getDefaultLayout();
}
trace("************** USING [" + defaultLayout.name + "] as default LAYOUT ***************************");
//trace(LOG + " Using [" + defaultLayout.name + "] as default LAYOUT.");
applyLayout(defaultLayout);
}
private function dispatchSwitchedLayoutEvent(layoutID:String):void {
if (_currentLayout != null && _currentLayout.name == layoutID) return;
trace("************** DISPATCHING [" + layoutID + "] as new LAYOUT ***************************");
//trace(LOG + " Dispatch [" + layoutID + "] as new LAYOUT");
var layoutEvent:SwitchedLayoutEvent = new SwitchedLayoutEvent();
layoutEvent.layoutID = layoutID;
_globalDispatcher.dispatchEvent(layoutEvent);
@ -221,19 +224,19 @@ package org.bigbluebutton.modules.layout.managers
public function lockLayout():void {
_locked = true;
trace(LOG + " layout locked by myself");
//trace(LOG + " layout locked by myself");
sendLayoutUpdate(_currentLayout);
}
public function broadcastLayout():void {
trace(LOG + " layout changed by me. Sync others to this new layout.");
//trace(LOG + " layout changed by me. Sync others to this new layout.");
var e:SyncLayoutEvent = new SyncLayoutEvent(_currentLayout);
_globalDispatcher.dispatchEvent(e);
}
private function sendLayoutUpdate(layout:LayoutDefinition):void {
if (UsersUtil.amIModerator() || UsersUtil.amIPresenter()) {
trace("LayoutManager: synching layout to remote users");
//trace("LayoutManager: synching layout to remote users");
var e:SyncLayoutEvent = new SyncLayoutEvent(layout);
_globalDispatcher.dispatchEvent(e);
}
@ -245,7 +248,7 @@ package org.bigbluebutton.modules.layout.managers
layout.applyToCanvas(_canvas);
dispatchSwitchedLayoutEvent(layout.name);
}
//trace(LOG + " applyLayout layout [" + layout.name + "]");
updateCurrentLayout(layout);
_detectContainerChange = true;
}
@ -262,23 +265,24 @@ package org.bigbluebutton.modules.layout.managers
public function applyRemoteLayout(e:LayoutFromRemoteEvent):void {
var layout:LayoutDefinition = e.layout;
//trace(LOG + " applyRemoteLayout layout [" + layout.name + "]");
applyLayout(layout);
}
public function remoteLockLayout():void {
trace(LOG + " remote lock received");
//trace(LOG + " remote lock received");
_locked = true;
checkPermissionsOverWindow();
}
public function remoteSyncLayout(event:RemoteSyncLayoutEvent):void {
trace(LOG + " remote lock received");
//trace(LOG + " remote lock received");
checkPermissionsOverWindow();
}
public function remoteUnlockLayout():void {
trace(LOG + " remote unlock received");
//trace(LOG + " remote unlock received");
_locked = false;
checkPermissionsOverWindow();
}
@ -300,7 +304,7 @@ package org.bigbluebutton.modules.layout.managers
}
private function onContainerResized(e:ResizeEvent):void {
trace(LOG + "Canvas is changing as user is resizing browser");
//trace(LOG + "Canvas is changing as user is resizing browser");
/*
* the main canvas has been resized
* while the user is resizing the window, this event is dispatched
@ -316,8 +320,8 @@ package org.bigbluebutton.modules.layout.managers
return;
checkPermissionsOverWindow(e.window);
trace(LOG + "Window is being resized. Event=[" + e.type + "]");
updateCurrentLayout();
//trace(LOG + "Window is being resized. Event=[" + e.type + "]");
updateCurrentLayout(_currentLayout);
/*
* some events related to animated actions must be delayed because if it's not, the
* current layout doesn't get properly updated
@ -328,13 +332,16 @@ package org.bigbluebutton.modules.layout.managers
}
}
private function updateCurrentLayout(layout:LayoutDefinition=null):LayoutDefinition {
private function updateCurrentLayout(layout:LayoutDefinition):LayoutDefinition {
//trace(LOG + "updateCurrentLayout");
if (layout != null) {
if (_currentLayout) _currentLayout.currentLayout = false;
_currentLayout = layout;
//trace(LOG + "updateCurrentLayout - currentLayout = [" + layout.name + "]");
layout.currentLayout = true;
} else {
_currentLayout = LayoutDefinition.getLayout(_canvas, ResourceUtil.getInstance().getString('bbb.layout.combo.customName'));
//trace(LOG + "updateCurrentLayout - layout is NULL! Setting currentLayout = [" + _currentLayout.name + "]");
}
return _currentLayout;
@ -345,8 +352,11 @@ package org.bigbluebutton.modules.layout.managers
* on the role of the participant
*/
public function presenterChanged():void {
if (_canvas != null)
applyLayout(_currentLayout);
if (_canvas != null) {
//trace(LOG + " presenterChanged layout [" + _currentLayout.name + "]");
applyLayout(_currentLayout);
}
}
}
}

View File

@ -28,6 +28,8 @@ package org.bigbluebutton.modules.layout.model {
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.modules.layout.managers.OrderManager;
private static const LOG:String = "Layout::LayoutDefinition - ";
[Bindable] public var name:String;
// default is a reserved word in actionscript
[Bindable] public var defaultLayout:Boolean = false;
@ -90,7 +92,7 @@ package org.bigbluebutton.modules.layout.model {
return _layoutsPerRole[Role.PRESENTER];
} else {
LogUtil.error("There's no layout that fits the participants profile");
trace("LayoutDefinition::getMyLayout There's no layout that fits the participants profile");
//trace(LOG + "getMyLayout There's no layout that fits the participants profile");
return null;
}
}
@ -187,10 +189,14 @@ package org.bigbluebutton.modules.layout.model {
var type:String;
for each (var window:MDIWindow in windows) {
type = WindowLayout.getType(window);
if (!ignoreWindowByType(type))
type = WindowLayout.getType(window);
//trace(LOG + "Determine if we need to apply layout [" + name + "] for window [" + type + "]");
if (!ignoreWindowByType(type)) {
//trace(LOG + "Applying layout [" + name + "] to window [" + type + "]");
WindowLayout.setLayout(canvas, window, transformedLayout[type]);
} else {
//trace(LOG + "Ignoring layout [" + name + "] to window [" + type + "]");
}
}
}

View File

@ -136,21 +136,25 @@ package org.bigbluebutton.modules.layout.model {
layout.hidden = !window.visible;
layout.order = OrderManager.getInstance().getOrderByRef(window);
// trace("WindowLayout::getLayout for " + layout.name + " [minimized=" + layout.minimized + ",maximized=" + layout.maximized + ",hidden=" + layout.hidden
// + ",drag=" + layout.draggable + ",resize=" + layout.resizable + "]");
//trace("WindowLayout::getLayout for " + layout.name + " [minimized=" + layout.minimized + ",maximized=" + layout.maximized + ",hidden=" + layout.hidden
// + ",drag=" + layout.draggable + ",resize=" + layout.resizable + "]");
return layout;
}
static public function setLayout(canvas:MDICanvas, window:MDIWindow, layout:WindowLayout):void {
// trace("WindowLayout::setLayout for " + window.name + ",layout=" + layout.name + "]");
//if (window == null) trace("WindowLayout::setLayout - window is NULL!!!");
//if (layout == null) trace("WindowLayout::setLayout - layout is NULL!!!");
//if (layout.name == null) trace("WindowLayout::setLayout - layout.name is NULL!!!");
//trace("WindowLayout::setLayout for " + getType(window) + ",layout=" + layout.name + "]");
if (layout == null) {
return;
}
// trace("WindowLayout::setLayout [minimized=" + layout.minimized + ",maximized=" + layout.maximized + ",hidden=" + layout.hidden
// + ",drag=" + layout.draggable + ",resize=" + layout.resizable + "]");
//trace("WindowLayout::setLayout [minimized=" + layout.minimized + ",maximized=" + layout.maximized + ",hidden=" + layout.hidden
// + ",drag=" + layout.draggable + ",resize=" + layout.resizable + "]");
layout.applyToWindow(canvas, window);
}

View File

@ -84,7 +84,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
[Bindable] private var layoutNames:ArrayCollection = new ArrayCollection();
private function init():void {
trace(LOG + "initing");
//trace(LOG + "initing");
dataProvider = layoutNames;
populateComboBox();
}
@ -96,12 +96,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function populateLayoutsList(e:LayoutsReadyEvent):void {
trace(LOG + " handling layout ready event.");
//trace(LOG + " handling layout ready event.");
populateComboBox();
}
private function populateComboBox():void {
trace(LOG + " populating layout combo.");
//trace(LOG + " populating layout combo.");
layoutNames = new ArrayCollection();
var layouts:Array = LayoutModel.getInstance().getLayoutNames();
@ -110,7 +110,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
var translatedName:String = ResourceUtil.getInstance().getString(lay.name)
if (translatedName == "undefined") translatedName = lay.name;
var item:Object = {index: idx, label: translatedName, localeKey: lay.name, currentLayout: lay.currentLayout };
trace(LOG + " layout [" + lay.name + ", current=" + lay.currentLayout + "]");
//trace(LOG + " layout [" + lay.name + ", current=" + lay.currentLayout + "]");
layoutNames.addItem(item);
if (lay.currentLayout) {
currentLayoutIndex = idx;
@ -123,9 +123,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function onLayoutChanged(e:SwitchedLayoutEvent):void {
trace(LOG + " handling SwitchedLayoutEvent layout=[" + e.layoutID + "]");
//trace(LOG + " handling SwitchedLayoutEvent layout=[" + e.layoutID + "]");
populateComboBox();
trace(LOG + " selected layout coming in is: " + selectedIndex);
//trace(LOG + " selected layout coming in is: " + selectedIndex);
var idx:int = -1;
for each (var obj:Object in dataProvider) {
if (obj.localeKey == e.layoutID)
@ -139,11 +139,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
invalidateDisplayList();
trace(LOG + " selected layout afterwards is: " + selectedIndex);
//trace(LOG + " selected layout afterwards is: " + selectedIndex);
}
private function localeChanged(e:LocaleChangeEvent):void {
trace(LOG + " locale change recieved");
//trace(LOG + " locale change recieved");
populateComboBox();
}