making components consistent with the user's role: if the user is a participant, he won't see the control buttons (add, save, load), the lock button will be always disabled and the layouts combo will be enable only when the layouts aren't locked

This commit is contained in:
Felipe Cecagno 2012-06-15 15:47:55 -03:00
parent 85aa046010
commit cb96e55137
2 changed files with 16 additions and 13 deletions

View File

@ -26,13 +26,15 @@
toolTip="{ResourceUtil.getInstance().getString('bbb.layout.combo.toolTip')}"
prompt="{ResourceUtil.getInstance().getString('bbb.layout.combo.prompt')}"
height="{LayoutButton.BUTTON_SIZE}"
change="onSelectedItemChanged(event)">
change="onSelectedItemChanged(event)"
disabledColor="{getStyle('color')}">
<mate:Listener type="{LayoutsLoadedEvent.LAYOUTS_LOADED_EVENT}" method="populateLayoutsList" />
<mate:Listener type="{LayoutEvent.APPLY_DEFAULT_LAYOUT_EVENT}" method="onApplyDefaultLayout" />
<mate:Listener type="{RedefineLayoutEvent.REDEFINE_LAYOUT_EVENT}" method="onRedefineLayout" />
<mate:Listener type="{LayoutEvent.REMOTE_LOCK_LAYOUT_EVENT}" receive="{enabled=false || UserManager.getInstance().getConference().amIModerator()}" />
<mate:Listener type="{LayoutEvent.REMOTE_UNLOCK_LAYOUT_EVENT}" receive="{enabled=true}" />
<mate:Listener type="{LayoutEvent.INVALIDATE_LAYOUT_EVENT}" method="invalidadeLayout" />
<mate:Listener type="{LayoutsLoadedEvent.LAYOUTS_LOADED_EVENT}" method="populateLayoutsList" />
<mate:Listener type="{RedefineLayoutEvent.REDEFINE_LAYOUT_EVENT}" method="onRedefineLayout" />
<mx:Script>
<![CDATA[

View File

@ -32,28 +32,22 @@
import flexlib.mdi.containers.MDICanvas;
import org.bigbluebutton.core.managers.UserManager;
import org.bigbluebutton.main.views.MainToolbar;
import org.bigbluebutton.modules.layout.events.ViewInitializedEvent;
import org.bigbluebutton.modules.layout.model.WindowLayout;
private var _dispatcher:Dispatcher = new Dispatcher();
private var _enableEdit:Boolean;
[Bindable] private var _enableEdit:Boolean = false;
private function init():void {
if (_enableEdit) {
addChild(new AddButton());
addChild(new SaveButton());
addChild(new LoadButton());
}
addChild(new LockButton());
var evt:ViewInitializedEvent = new ViewInitializedEvent();
evt.canvas = getMdiCanvas(parent) as MDICanvas;
_dispatcher.dispatchEvent(evt);
}
public function set enableEdit(arg:Boolean):void {
_enableEdit = arg;
_enableEdit = arg && UserManager.getInstance().getConference().amIModerator();
}
private function getMdiCanvas(p:DisplayObjectContainer):DisplayObject {
@ -80,4 +74,11 @@
</mx:Script>
<views:LayoutsCombo id="comboBox" />
<views:AddButton id="addButton"
includeInLayout="{_enableEdit}" visible="{_enableEdit}" />
<views:SaveButton id="saveButton"
includeInLayout="{_enableEdit}" visible="{_enableEdit}" />
<views:LoadButton id="loadButton"
includeInLayout="{_enableEdit}" visible="{_enableEdit}" />
<views:LockButton id="lockButton" />
</mx:HBox>