diff --git a/bigbluebutton-client/branding/default/style/css/BBBDefault.css b/bigbluebutton-client/branding/default/style/css/BBBDefault.css index 867b85da80..3f5d30d621 100755 --- a/bigbluebutton-client/branding/default/style/css/BBBDefault.css +++ b/bigbluebutton-client/branding/default/style/css/BBBDefault.css @@ -985,6 +985,14 @@ Alert { icon: Embed('assets/images/ic_file_upload_16px.png'); } +.overwriteLayoutConfirmStyle{ + icon: Embed('assets/images/status_success_16px.png'); +} + +.overwriteLayoutDenyStyle{ + icon: Embed('assets/images/status_fail_16px.png'); +} + .broadcastLayoutButtonStyle { icon: Embed('assets/images/ic_send_16px.png'); } diff --git a/bigbluebutton-client/branding/default/style/css/assets/images/status_fail_16px.png b/bigbluebutton-client/branding/default/style/css/assets/images/status_fail_16px.png new file mode 100644 index 0000000000..9409038505 Binary files /dev/null and b/bigbluebutton-client/branding/default/style/css/assets/images/status_fail_16px.png differ diff --git a/bigbluebutton-client/branding/default/style/css/assets/images/status_success_16px.png b/bigbluebutton-client/branding/default/style/css/assets/images/status_success_16px.png new file mode 100644 index 0000000000..89ed57c06f Binary files /dev/null and b/bigbluebutton-client/branding/default/style/css/assets/images/status_success_16px.png differ diff --git a/bigbluebutton-client/locale/en_US/bbbResources.properties b/bigbluebutton-client/locale/en_US/bbbResources.properties index 4853b25dc3..117991bf6c 100755 --- a/bigbluebutton-client/locale/en_US/bbbResources.properties +++ b/bigbluebutton-client/locale/en_US/bbbResources.properties @@ -354,6 +354,9 @@ bbb.toolbar.video.toolTip.start = Share Your Webcam bbb.toolbar.video.toolTip.stop = Stop Sharing Your Webcam bbb.toolbar.video.unknownCameraName = Unknown Device bbb.layout.addButton.toolTip = Add the custom layout to the list +bbb.layout.confirmOverwrite.toolTip = Confirm overwriting of the layout +bbb.layout.denyOverwrite.toolTip = Deny overwriting of the layout +bbb.layout.overwriteText = Name already in use. Do you want to overwrite? bbb.layout.broadcastButton.toolTip = Apply Current Layout to All Viewers bbb.layout.combo.toolTip = Change Your Layout bbb.layout.loadButton.toolTip = Load layouts from a file diff --git a/bigbluebutton-client/locale/pt_BR/bbbResources.properties b/bigbluebutton-client/locale/pt_BR/bbbResources.properties index af45603ebd..148ce500d5 100755 --- a/bigbluebutton-client/locale/pt_BR/bbbResources.properties +++ b/bigbluebutton-client/locale/pt_BR/bbbResources.properties @@ -354,6 +354,9 @@ bbb.toolbar.video.toolTip.start = Transmitir sua câmera bbb.toolbar.video.toolTip.stop = Interromper compartilhamento da sua câmera bbb.toolbar.video.unknownCameraName = Dispositivo desconhecido bbb.layout.addButton.toolTip = Adicionar layout atual à lista +bbb.layout.confirmOverwrite.toolTip = Confirmar sobrescrita do layout +bbb.layout.denyOverwrite.toolTip = Negar sobrescrita do layout +bbb.layout.overwriteText = O nome já está em uso. Você quer sobrescrever? bbb.layout.broadcastButton.toolTip = Aplicar layout atual a todos os participantes bbb.layout.combo.toolTip = Modificar seu layout bbb.layout.loadButton.toolTip = Carregar layouts de um arquivo diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/events/LayoutEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/events/LayoutEvent.as index 181f9db2a3..899935df15 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/events/LayoutEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/events/LayoutEvent.as @@ -37,6 +37,7 @@ package org.bigbluebutton.modules.layout.events public static const INVALIDATE_LAYOUT_EVENT:String = 'INVALIDATE_LAYOUT_EVENT'; public var layoutName:String = ""; + public var overwrite:Boolean = false; public function LayoutEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false) { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/events/LayoutNameInUseEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/events/LayoutNameInUseEvent.as new file mode 100644 index 0000000000..d7bccf6917 --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/events/LayoutNameInUseEvent.as @@ -0,0 +1,37 @@ +/** +* 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 . +* +*/ +package org.bigbluebutton.modules.layout.events +{ + import flash.events.Event; + import org.bigbluebutton.modules.layout.model.LayoutDefinitionFile; + + public class LayoutNameInUseEvent extends Event + { + public static const LAYOUT_NAME_IN_USE_EVENT:String = "LAYOUT_NAME_IN_USE_EVENT"; + + public var inUse:Boolean = false; + + public function LayoutNameInUseEvent(type:String = LAYOUT_NAME_IN_USE_EVENT) + { + trace("Layout name is already in use: Ask user if should overwrite"); + super(type,true,false); + } + + } +} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/managers/LayoutManager.as b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/managers/LayoutManager.as index 71eb03e177..ffcdde5e06 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/managers/LayoutManager.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/managers/LayoutManager.as @@ -19,6 +19,11 @@ package org.bigbluebutton.modules.layout.managers { import com.asfusion.mate.events.Dispatcher; + import flash.display.DisplayObject; + import mx.core.FlexGlobals; + import mx.core.IFlexDisplayObject; + import mx.managers.PopUpManager; + import org.bigbluebutton.util.i18n.ResourceUtil; import flash.events.Event; import flash.events.EventDispatcher; import flash.events.TimerEvent; @@ -48,6 +53,7 @@ package org.bigbluebutton.modules.layout.managers import org.bigbluebutton.modules.layout.events.LockLayoutEvent; import org.bigbluebutton.modules.layout.events.LayoutFromRemoteEvent; import org.bigbluebutton.modules.layout.events.RemoteSyncLayoutEvent; + import org.bigbluebutton.modules.layout.events.LayoutNameInUseEvent; import org.bigbluebutton.modules.layout.events.SyncLayoutEvent; import org.bigbluebutton.modules.layout.model.LayoutDefinition; import org.bigbluebutton.modules.layout.model.LayoutDefinitionFile; @@ -55,6 +61,7 @@ package org.bigbluebutton.modules.layout.managers import org.bigbluebutton.modules.layout.model.LayoutModel; import org.bigbluebutton.modules.layout.model.WindowLayout; import org.bigbluebutton.util.i18n.ResourceUtil; + import org.bigbluebutton.modules.layout.views.OverwriteWindow; public class LayoutManager extends EventDispatcher { private static const LOG:String = "Layout::LayoutManager - "; @@ -135,17 +142,45 @@ package org.bigbluebutton.modules.layout.managers loader.loadFromLocalFile(); } - public function addCurrentLayoutToList(layoutName:String):void { + public function addCurrentLayoutToList(e:LayoutEvent):void { // Layout Name Window Popup calls this function var newLayout:LayoutDefinition; - if (layoutName != "") { - newLayout = LayoutDefinition.getLayout(_canvas, layoutName); + if (e.layoutName != "") { + newLayout = LayoutDefinition.getLayout(_canvas, e.layoutName); + + // This is true when the name given is already in use + // Or when the user picks a name from their preferred location + if(_layoutModel.hasLayout(e.layoutName)|| + e.layoutName == ResourceUtil.getInstance().getString('bbb.layout.name.defaultlayout')|| + e.layoutName == ResourceUtil.getInstance().getString('bbb.layout.name.videochat')|| + e.layoutName == ResourceUtil.getInstance().getString('bbb.layout.name.webcamsfocus')|| + e.layoutName == ResourceUtil.getInstance().getString('bbb.layout.name.presentfocus')){ + + if(!e.overwrite){ + var nameAlreadyInUse:LayoutNameInUseEvent = new LayoutNameInUseEvent(); + nameAlreadyInUse.inUse = true; + _globalDispatcher.dispatchEvent(nameAlreadyInUse); + + var overwriteWindow:OverwriteWindow; + overwriteWindow = OverwriteWindow(PopUpManager.createPopUp(FlexGlobals.topLevelApplication as DisplayObject, OverwriteWindow, true)); + PopUpManager.centerPopUp(overwriteWindow); + overwriteWindow.layoutNameOverwrite = e.layoutName; + + return; + } + if(e.overwrite){ + _layoutModel.removeLayout(newLayout); + } + + } + } else { // if the user set the name empty newLayout = LayoutDefinition.getLayout(_canvas, ResourceUtil.getInstance().getString('bbb.layout.combo.customName')); newLayout.name += " " + (++_customLayoutsCount); } + _layoutModel.addLayout(newLayout); updateCurrentLayout(newLayout); broadcastLayouts(); @@ -155,6 +190,10 @@ package org.bigbluebutton.modules.layout.managers // this is to force LayoutCombo to update the current label redefineLayout.remote = true; _globalDispatcher.dispatchEvent(redefineLayout); + //EVENTO QUE FAZ FECHAR + var nameNotInUse:LayoutNameInUseEvent = new LayoutNameInUseEvent(); + nameNotInUse.inUse = false; + _globalDispatcher.dispatchEvent(nameNotInUse); } public function setCanvas(canvas:MDICanvas):void { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMap.mxml index a7328784a0..9e90e8935c 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/maps/LayoutEventMap.mxml @@ -122,7 +122,7 @@ with BigBlueButton; if not, see . - + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutDefinitionFile.as b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutDefinitionFile.as index 24d6bdb544..653d8de635 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutDefinitionFile.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutDefinitionFile.as @@ -55,7 +55,16 @@ package org.bigbluebutton.modules.layout.model public function push(layoutDefinition:LayoutDefinition):void { _layouts.push(layoutDefinition); } + + public function splice(position:int):void{ + _layouts.splice(position,1); + } + public function indexOf(layoutDefinition:LayoutDefinition):int{ + return _layouts.indexOf(layoutDefinition); + } + + public function getDefault():LayoutDefinition { for each (var value:LayoutDefinition in _layouts) { if (value.defaultLayout) diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutModel.as b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutModel.as index e5b28b6bb9..466e1daa02 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutModel.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/model/LayoutModel.as @@ -47,6 +47,10 @@ package org.bigbluebutton.modules.layout.model public function addLayout(layout: LayoutDefinition):void { _layouts.push(layout); } + + public function removeLayout(layout: LayoutDefinition):void{ + _layouts.splice(_layouts.indexOf(layout)); + } public function getLayoutNames():Array { if (_layouts == null) return new Array(); diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/CustomLayoutNameWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/CustomLayoutNameWindow.mxml index 810ce21849..da52b472ce 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/CustomLayoutNameWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/CustomLayoutNameWindow.mxml @@ -30,14 +30,20 @@ with BigBlueButton; if not, see . width="250" title="{ResourceUtil.getInstance().getString('bbb.layout.window.name')}"> + + . } var dispatcher:Dispatcher = new Dispatcher(); dispatcher.dispatchEvent(e); + } - PopUpManager.removePopUp(this); + private function handleLayoutNameInUse(event:LayoutNameInUseEvent):void { + if(!event.inUse){ + PopUpManager.removePopUp(this); + }else{ + trace("The name is already in use, waiting for overwrite command or rename"); + } } private function onCreationComplete():void { @@ -64,4 +76,5 @@ with BigBlueButton; if not, see . + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/OverwriteWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/OverwriteWindow.mxml new file mode 100644 index 0000000000..68a66e4802 --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/OverwriteWindow.mxml @@ -0,0 +1,78 @@ + + + + + + + + + + + + + + + + +