From 39fa4f2db1eca9519cd0a329e5b374791b57ef65 Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Fri, 30 May 2014 11:08:47 -0700 Subject: [PATCH] - modify how we send lock and broadcast layout from client --- .../service/layout/LayoutApplication.java | 16 ++--- .../service/layout/LayoutService.java | 48 ++++++++++--- .../core/api/IBigBlueButtonInGW.java | 9 +-- .../core/BigBlueButtonInGW.scala | 24 +++---- .../bigbluebutton/core/CollectorActor.scala | 30 ++------ .../org/bigbluebutton/core/MeetingActor.scala | 20 ++++-- .../bigbluebutton/core/api/Constants.scala | 1 + .../bigbluebutton/core/api/InMessages.scala | 22 +++--- .../bigbluebutton/core/api/OutMessages.scala | 4 +- .../bigbluebutton/core/api/ValueObjects.scala | 4 -- .../core/apps/layout/LayoutApp.scala | 71 +++++++++---------- .../core/apps/layout/LayoutInGateway.scala | 14 ++-- .../red5/LayoutClientMessageSender.scala | 13 ++-- .../core/apps/users/UsersApp.scala | 20 ++---- .../users/red5/UsersClientMessageSender.scala | 10 +-- .../redis/UsersMessageToJsonConverter.scala | 10 +-- .../main/views/MainApplicationShell.mxml | 22 ++---- .../modules/layout/views/BroadcastButton.mxml | 7 +- .../modules/users/views/UsersWindow.mxml | 6 +- 19 files changed, 169 insertions(+), 182 deletions(-) mode change 100755 => 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala mode change 100755 => 100644 bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java index 9d8f03c901..ea62ccfee6 100644 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutApplication.java @@ -20,6 +20,8 @@ package org.bigbluebutton.conference.service.layout; import org.bigbluebutton.core.api.IBigBlueButtonInGW; +import scala.Option; + public class LayoutApplication { private IBigBlueButtonInGW bbbInGW; @@ -27,16 +29,14 @@ public class LayoutApplication { bbbInGW = inGW; } - public void syncLayout(String meetingID, String requesterID, String layoutID) { - bbbInGW.syncLayout(meetingID, requesterID, layoutID); - } - - public void broadcastLayout(String meetingID, String requesterID, String layoutID, Boolean locked) { - bbbInGW.broadcastLayout(meetingID, requesterID, layoutID, locked); + public void broadcastLayout(String meetingID, String requesterID, String layout) { + bbbInGW.broadcastLayout(meetingID, requesterID, layout); } - public void unlockLayout(String meetingID, String requesterID) { - bbbInGW.unlockLayout(meetingID, requesterID); + public void lockLayout(String meetingId, String setById, + Boolean lock, Boolean viewersOnly, + Option layout) { + bbbInGW.lockLayout(meetingId, setById, lock, viewersOnly, layout); } public void getCurrentLayout(String meetingID, String requesterID) { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java index 5a428540a0..66f12e2ad1 100644 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/conference/service/layout/LayoutService.java @@ -25,6 +25,7 @@ import org.bigbluebutton.conference.Constants; import org.red5.logging.Red5LoggerFactory; import org.red5.server.api.Red5; import org.slf4j.Logger; +import scala.Option; public class LayoutService { @@ -37,20 +38,49 @@ public class LayoutService { log.debug("Received get current layout request"); application.getCurrentLayout(meetingID, getBbbSession().getInternalUserID()); } - - public void sync(Map message) { - String meetingID = Red5.getConnectionLocal().getScope().getName(); - application.syncLayout(meetingID, getBbbSession().getInternalUserID(), (String) message.get("layout")); - } - + public void broadcast(Map message) { String meetingID = Red5.getConnectionLocal().getScope().getName(); - application.broadcastLayout(meetingID, (String) message.get("setByUserID"), (String) message.get("layout"), (Boolean) message.get("locked")); + String newlayout = (String) message.get("layout"); + Boolean lock = (Boolean) message.get("lock"); + + if (newlayout == null || newlayout.isEmpty()) { + log.error("Invalid Broadcast Layout message. layout is null or empty."); + return; + } + + if (lock == null) { + log.error("Invalid Broadcast Layout message. lock in null."); + return; + } + + application.broadcastLayout(meetingID, getBbbSession().getInternalUserID(), newlayout); } - public void unlock() { + public void lock(Map message) { String meetingID = Red5.getConnectionLocal().getScope().getName(); - application.unlockLayout(meetingID, getBbbSession().getInternalUserID()); + String newlayout = (String) message.get("layout"); + Boolean lock = (Boolean) message.get("lock"); + Boolean viewersOnly = (Boolean) message.get("viewersOnly"); + + Option layout; + if (newlayout == null || newlayout.isEmpty()) { + layout = Option.empty(); + } else { + layout = scala.Option.apply(newlayout); + } + + if (lock == null) { + log.error("Invalid Lock Layout message. lock in null."); + return; + } + + if (viewersOnly == null) { + log.error("Invalid Lock Layout message. viewersOnly is null"); + return; + } + + application.lockLayout(meetingID, getBbbSession().getInternalUserID(), lock, viewersOnly, layout); } public void setLayoutApplication(LayoutApplication a) { diff --git a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java b/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java index a1abc333b9..0ff50d5a6f 100644 --- a/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java +++ b/bigbluebutton-apps/src/main/java/org/bigbluebutton/core/api/IBigBlueButtonInGW.java @@ -3,6 +3,7 @@ package org.bigbluebutton.core.api; import java.util.ArrayList; import java.util.Map; + public interface IBigBlueButtonInGW { void isAliveAudit(String aliveID); @@ -93,10 +94,10 @@ public interface IBigBlueButtonInGW { // Layout void getCurrentLayout(String meetingID, String requesterID); - void setLayout(String meetingID, String requesterID, String layoutID); - void syncLayout(String meetingID, String requesterID, String layoutID); - void broadcastLayout(String meetingID, String requesterID, String layoutID, Boolean locked); - void unlockLayout(String meetingID, String requesterID); + void broadcastLayout(String meetingID, String requesterID, String layout); + void lockLayout(String meetingID, String setById, + boolean lock, boolean viewersOnly, + scala.Option layout); // Chat void getChatHistory(String meetingID, String requesterID, String replyTo); diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala index 3c2dd33315..f419298a80 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/BigBlueButtonInGW.scala @@ -98,8 +98,7 @@ class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway) extends IBigBlueButtonInGW disablePubChat = disablePubChat, lockedLayout = lockedLayout) - val ls = new PermissionsSetting(permissions) - bbbGW.accept(new SetLockSettings(meetingID, userId, ls)) + bbbGW.accept(new SetLockSettings(meetingID, userId, permissions)) } def initLockSettings(meetingID: String, locked: Boolean, settings: java.util.Map[String, java.lang.Boolean]) { @@ -119,8 +118,7 @@ class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway) extends IBigBlueButtonInGW disablePubChat = disablePubChat, lockedLayout = lockedLayout) - val ls = new PermissionsSetting(permissions) - bbbGW.accept(new InitLockSettings(meetingID, locked, ls)) + bbbGW.accept(new InitLockSettings(meetingID, locked, permissions)) } def getLockSettings(meetingId: String, userId: String) { @@ -341,20 +339,14 @@ class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway) extends IBigBlueButtonInGW layoutGW.getCurrentLayout(meetingID, requesterID) } - def setLayout(meetingID: String, requesterID: String, layoutID: String) { - layoutGW.setLayout(meetingID, requesterID, layoutID) - } - - def syncLayout(meetingID: String, requesterID: String, layoutID: String) { - layoutGW.setLayout(meetingID, requesterID, layoutID) - } - - def broadcastLayout(meetingID: String, requesterID: String, layoutID: String, locked: java.lang.Boolean) { - layoutGW.broadcastLayout(meetingID, requesterID, layoutID, locked) + def broadcastLayout(meetingID: String, requesterID: String, layout: String) { + layoutGW.broadcastLayout(meetingID, requesterID, layout) } - def unlockLayout(meetingID: String, requesterID: String) { - layoutGW.unlockLayout(meetingID, requesterID) + def lockLayout(meetingId: String, setById: String, + lock: Boolean, viewersOnly: Boolean, + layout: scala.Option[String]) { + layoutGW.lockLayout(meetingId, setById, lock, viewersOnly, layout) } /********************************************************************* diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala index 0bf1159cfb..c2776ec937 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/CollectorActor.scala @@ -51,9 +51,7 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { case msg: SendPublicMessageRequest => handleSendPublicMessageRequest(msg) case msg: SendPrivateMessageRequest => handleSendPrivateMessageRequest(msg) case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) - case msg: SetLayoutRequest => handleSetLayoutRequest(msg) case msg: BroadcastLayoutRequest => handleBroadcastLayoutRequest(msg) - case msg: UnlockLayoutRequest => handleUnlockLayoutRequest(msg) case msg: PreCreatedPoll => handlePreCreatedPoll(msg) case msg: CreatePoll => handleCreatePoll(msg) case msg: UpdatePoll => handleUpdatePoll(msg) @@ -631,44 +629,28 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { dispatcher.dispatch(buildJson(header, payload)) } - private def handleSetLayoutRequest(msg: SetLayoutRequest) { - val payload = new java.util.HashMap[String, Any]() - payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) - - val header = new java.util.HashMap[String, Any]() - header.put(Constants.NAME, MessageNames.SET_LAYOUT) - header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - - println("***** DISPATCHING SET LAYOUT REQUEST *****************") - dispatcher.dispatch(buildJson(header, payload)) - } - private def handleBroadcastLayoutRequest(msg: BroadcastLayoutRequest) { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) payload.put(Constants.REQUESTER_ID, msg.requesterID) - payload.put(Constants.LAYOUT_ID, msg.layoutID) - payload.put(Constants.LOCKED, msg.locked) - + payload.put(Constants.LAYOUT, msg.layout) + val header = new java.util.HashMap[String, Any]() header.put(Constants.NAME, MessageNames.BROADCAST_LAYOUT) header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - println("***** DISPATCHING BROADCAST LAYOUT REQUEST *****************") dispatcher.dispatch(buildJson(header, payload)) } - private def handleUnlockLayoutRequest(msg: UnlockLayoutRequest) { + private def handleLockLayoutRequest(msg: LockLayoutRequest) { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.REQUESTER_ID, msg.requesterID) + payload.put(Constants.USER_ID, msg.setById) val header = new java.util.HashMap[String, Any]() header.put(Constants.NAME, MessageNames.UNLOCK_LAYOUT) header.put(Constants.TIMESTAMP, TimestampGenerator.generateTimestamp) - println("***** DISPATCHING UNLOCK LAYOUT REQUEST *****************") dispatcher.dispatch(buildJson(header, payload)) } @@ -1390,7 +1372,7 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) payload.put(Constants.LOCKED, msg.locked) - payload.put(Constants.SETTINGS, msg.settings.toString()) //#todo not tested + payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested val header = new java.util.HashMap[String, Any]() header.put(Constants.NAME, MessageNames.PERMISSION_SETTING_INITIALIZED) @@ -1403,7 +1385,7 @@ class CollectorActor(dispatcher: IDispatcher) extends Actor { private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put(Constants.SETTINGS, msg.settings.toString()) //#todo not tested + payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested val header = new java.util.HashMap[String, Any]() header.put(Constants.NAME, MessageNames.NEW_PERMISSION_SETTINGS) diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala index 4f72a273ca..fe5c48fd91 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/MeetingActor.scala @@ -22,10 +22,11 @@ class MeetingActor(val meetingID: String, meetingName: String, val recorded: Boo with WhiteboardApp { var permissionsInited = false - var permissions = new PermissionsSetting(new Permissions()) + var permissions = new Permissions() var recording = false; var muted = false; var meetingEnded = false + class TimerActor(val timeout: Long, val who: Actor, val reply: String) extends Actor { def act { @@ -72,8 +73,6 @@ class MeetingActor(val meetingID: String, meetingName: String, val recorded: Boo case msg: UserConnectedToGlobalAudio => handleUserConnectedToGlobalAudio(msg) case msg: UserDisconnectedFromGlobalAudio => handleUserDisconnectedFromGlobalAudio(msg) case msg: GetCurrentLayoutRequest => handleGetCurrentLayoutRequest(msg) - case msg: SetLayoutRequest => handleSetLayoutRequest(msg) - case msg: LayoutLockSettings => handleLayoutLockSettings(msg) case msg: BroadcastLayoutRequest => handleBroadcastLayoutRequest(msg) case msg: InitializeMeeting => handleInitializeMeeting(msg) case msg: ClearPresentation => handleClearPresentation(msg) @@ -165,5 +164,18 @@ class MeetingActor(val meetingID: String, meetingName: String, val recorded: Boo private def handleGetRecordingStatus(msg: GetRecordingStatus) { outGW.send(new GetRecordingStatusReply(meetingID, recorded, msg.userId, recording.booleanValue())) - } + } + + def lockLayout(lock: Boolean) { + permissions = permissions.copy(lockedLayout=lock) + } + + def newPermissions(np: Permissions) { + permissions = np + } + + def permissionsEqual(other: Permissions):Boolean = { + permissions == other + } + } \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala old mode 100755 new mode 100644 index 434743bcc0..6c3ff2dd14 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/Constants.scala @@ -29,6 +29,7 @@ object Constants { val ASSIGNED_BY = "assigned_by" val RECORDING = "recording" val LAYOUT_ID = "layout_id" + val LAYOUT = "layout" val POLL = "poll" val POLL_ID = "poll_id" val FORCE = "force" diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala index f908e98bee..83e10dbb43 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/InMessages.scala @@ -53,12 +53,12 @@ case class LockAllUsers( case class InitLockSettings( meetingID: String, locked: Boolean, - settings: PermissionsSetting) extends InMessage + settings: Permissions) extends InMessage case class SetLockSettings( meetingID: String, setByUser: String, - settings: PermissionsSetting + settings: Permissions ) extends InMessage case class GetLockSettings( @@ -195,24 +195,20 @@ case class SetLayoutRequest( layoutID: String ) extends InMessage -case class LayoutLockSettings( - meetingID: String, - requesterId: String, - locked: Boolean +case class LockLayoutRequest( + meetingID: String, + setById: String, + lock: Boolean, + viewersOnly: Boolean, + layout: Option[String] ) extends InMessage case class BroadcastLayoutRequest( meetingID: String, requesterID: String, - layoutID: String, - locked: Boolean + layout: String ) extends InMessage -case class UnlockLayoutRequest( - meetingID: String, - requesterID: String -) extends InMessage - // Poll case class PreCreatedPoll( meetingID: String, diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala index 9dc652742e..dc7056f89f 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/OutMessages.scala @@ -89,7 +89,7 @@ case object IsAliveMessage extends IOutMessage case class PermissionsSettingInitialized( meetingID: String, locked: Boolean, - settings: PermissionsSetting, + permissions: Permissions, applyTo: Array[UserVO], version:String = Versions.V_0_0_1 ) extends IOutMessage @@ -97,7 +97,7 @@ case class PermissionsSettingInitialized( case class NewPermissionsSetting( meetingID: String, setByUser: String, - settings: PermissionsSetting, + permissions: Permissions, applyTo: Array[UserVO], version:String = Versions.V_0_0_1 ) extends IOutMessage diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala index c0ac890036..fc95079998 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/api/ValueObjects.scala @@ -39,10 +39,6 @@ case class Permissions( lockedLayout:Boolean = false ) -case class PermissionsSetting( - permissions: Permissions -) - case class RegisteredUser ( id: String, externId: String, diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala index d54e21ede9..016ab35d18 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutApp.scala @@ -9,51 +9,46 @@ trait LayoutApp { val outGW: MessageOutGateway - private var _locked:Boolean = false; - private var _setByUserID:String = "system"; - private var _currentLayoutID = ""; - + private var setByUser:String = "system"; + private var currentLayout = ""; + private var layoutLocked = false + private var viewersOnly = false + def handleGetCurrentLayoutRequest(msg: GetCurrentLayoutRequest) { - outGW.send(new GetCurrentLayoutReply(msg.meetingID, recorded, msg.requesterID, _currentLayoutID, _locked, _setByUserID)) - } - - def handleSetLayoutRequest(msg: SetLayoutRequest) { - _currentLayoutID = msg.layoutID - outGW.send(new SetLayoutEvent(msg.meetingID, recorded, msg.requesterID, _currentLayoutID, _locked, _setByUserID, affectedUsers)) - } - - def handleLayoutLockSettings(msg: LayoutLockSettings) { - if (msg.locked) { - _locked = true - _setByUserID = msg.requesterId - outGW.send(new LockLayoutEvent(msg.meetingID, recorded, msg.requesterId, _currentLayoutID, _locked, _setByUserID, affectedUsers)) - } else { - _locked = false - _setByUserID = msg.requesterId - outGW.send(new UnlockLayoutEvent(msg.meetingID, recorded, msg.requesterId, _currentLayoutID, _locked, _setByUserID, affectedUsers)) - } + outGW.send(new GetCurrentLayoutReply(msg.meetingID, recorded, msg.requesterID, currentLayout, permissions.lockedLayout, setByUser)) } + def handleLockLayoutRequest(msg: LockLayoutRequest) { + viewersOnly = msg.viewersOnly + lockLayout(msg.lock) + msg.layout foreach {l=> + currentLayout = l + broadcastSyncLayout(msg.meetingID, msg.setById) + } + } + + private def broadcastSyncLayout(meetingId: String, setById: String) { + outGW.send(new BroadcastLayoutEvent(meetingId, recorded, setById, currentLayout, permissions.lockedLayout, setByUser, affectedUsers)) + } + def handleBroadcastLayoutRequest(msg: BroadcastLayoutRequest) { - _locked = msg.locked - _currentLayoutID = msg.layoutID - outGW.send(new BroadcastLayoutEvent(msg.meetingID, recorded, msg.requesterID, _currentLayoutID, _locked, _setByUserID, affectedUsers)) + currentLayout = msg.layout + broadcastSyncLayout(msg.meetingID, msg.requesterID) } - - def handleUnlockLayoutRequest(msg: UnlockLayoutRequest) { - _locked = false - _setByUserID = msg.requesterID - outGW.send(new UnlockLayoutEvent(msg.meetingID, recorded, msg.requesterID, _currentLayoutID, _locked, _setByUserID, affectedUsers)) - } - + def affectedUsers():Array[UserVO] = { - val au = ArrayBuffer[UserVO]() - users.getUsers foreach {u => - if (! u.presenter && u.role != Role.MODERATOR) { - au += u - } + if (viewersOnly) { + val au = ArrayBuffer[UserVO]() + users.getUsers foreach {u => + if (! u.presenter && u.role != Role.MODERATOR) { + au += u + } + } + au.toArray + } else { + users.getUsers } - au.toArray + } } diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala old mode 100755 new mode 100644 index eb7209758d..c26255644c --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/LayoutInGateway.scala @@ -9,15 +9,13 @@ class LayoutInGateway(bbbGW: BigBlueButtonGateway) { bbbGW.accept(new GetCurrentLayoutRequest(meetingID, requesterID)) } - def setLayout(meetingID: String, requesterID: String, layoutID: String) { - bbbGW.accept(new SetLayoutRequest(meetingID, requesterID, layoutID)) + def broadcastLayout(meetingID: String, requesterID: String, layout: String) { + bbbGW.accept(new BroadcastLayoutRequest(meetingID, requesterID, layout)) } - def broadcastLayout(meetingID: String, requesterID: String, layoutID: String, locked: Boolean) { - bbbGW.accept(new BroadcastLayoutRequest(meetingID, requesterID, layoutID, locked)) - } - - def unlockLayout(meetingID: String, requesterID: String) { - bbbGW.accept(new UnlockLayoutRequest(meetingID, requesterID)) + def lockLayout(meetingID: String, setById: String, + lock: Boolean, viewersOnly: Boolean, + layout: Option[String]) { + bbbGW.accept(new LockLayoutRequest(meetingID, setById, lock, viewersOnly, layout)) } } \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/red5/LayoutClientMessageSender.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/red5/LayoutClientMessageSender.scala index ee4b0f23f6..35b18e5f1b 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/red5/LayoutClientMessageSender.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/layout/red5/LayoutClientMessageSender.scala @@ -44,8 +44,11 @@ class LayoutClientMessageSender(service: ConnectionInvokerService) extends OutMe message.put("setByUserID", msg.setByUserID); message.put("layout", msg.layoutID); - var m = new BroadcastClientMessage(msg.meetingID, "remoteUpdateLayout", message); - service.sendMessage(m); + msg.applyTo foreach {u => + var m = new DirectClientMessage(msg.meetingID, u.userID, "remoteUpdateLayout", message); + service.sendMessage(m); + } + } private def handleUnlockLayoutEvent(msg: UnlockLayoutEvent) { @@ -54,7 +57,9 @@ class LayoutClientMessageSender(service: ConnectionInvokerService) extends OutMe message.put("setByUserID", msg.setByUserID); message.put("layout", msg.layoutID); - var m = new BroadcastClientMessage(msg.meetingID, "remoteUpdateLayout", message); - service.sendMessage(m); + msg.applyTo foreach {u => + var m = new DirectClientMessage(msg.meetingID, u.userID, "remoteUpdateLayout", message); + service.sendMessage(m); + }; } } \ No newline at end of file diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala index e84fcf84e2..fee8ee1ecb 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/UsersApp.scala @@ -126,19 +126,13 @@ trait UsersApp { def handleSetLockSettings(msg: SetLockSettings) { println("*************** Received new lock settings ********************") - if (permissions != msg.settings) { - permissions = msg.settings + if (!permissionsEqual(msg.settings)) { + newPermissions(msg.settings) val au = affectedUsers(msg.settings) outGW.send(new NewPermissionsSetting(meetingID, msg.setByUser, permissions, au)) - - changeLayout(msg) } } - - private def changeLayout(msg: SetLockSettings) { - this ! new LayoutLockSettings(msg.meetingID, msg.setByUser, permissions.permissions.lockedLayout) - } - + def handleInitLockSettings(msg: InitLockSettings) { if (! permissionsInited) { permissionsInited = true @@ -151,11 +145,11 @@ trait UsersApp { } } - def affectedUsers(settings: PermissionsSetting):Array[UserVO] = { + def affectedUsers(settings: Permissions):Array[UserVO] = { val au = ArrayBuffer[UserVO]() users.getUsers foreach {u => - val nu = u.copy(permissions=settings.permissions) + val nu = u.copy(permissions=permissions) users.addUser(nu) if (! u.presenter && u.role != Role.MODERATOR) { au += nu @@ -215,7 +209,7 @@ trait UsersApp { val uvo = new UserVO(msg.userID, ru.externId, ru.name, ru.role, raiseHand=false, presenter=false, hasStream=false, locked=false, webcamStream="", - phoneUser=false, vu, listenOnly=false, permissions.permissions) + phoneUser=false, vu, listenOnly=false, permissions) users.addUser(uvo) @@ -260,7 +254,7 @@ trait UsersApp { val uvo = new UserVO(webUserId, webUserId, msg.voiceUser.callerName, Role.VIEWER, raiseHand=false, presenter=false, hasStream=false, locked=false, webcamStream="", - phoneUser=true, vu, listenOnly=false, permissions.permissions) + phoneUser=true, vu, listenOnly=false, permissions) users.addUser(uvo) println("New user joined voice for user [" + uvo.name + "] userid=[" + msg.voiceUser.webUserId + "]") diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/red5/UsersClientMessageSender.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/red5/UsersClientMessageSender.scala index 7f5459fe4c..3e9aaed063 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/red5/UsersClientMessageSender.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/red5/UsersClientMessageSender.scala @@ -84,11 +84,11 @@ class UsersClientMessageSender(service: ConnectionInvokerService) extends OutMes private def handleNewPermissionsSetting(msg: NewPermissionsSetting) { val args = new java.util.HashMap[String, Object](); - args.put("disableCam", msg.settings.permissions.disableCam:java.lang.Boolean); - args.put("disableMic", msg.settings.permissions.disableMic:java.lang.Boolean); - args.put("disablePrivChat", msg.settings.permissions.disablePrivChat:java.lang.Boolean); - args.put("disablePubChat", msg.settings.permissions.disablePubChat:java.lang.Boolean); - args.put("lockedLayout", msg.settings.permissions.lockedLayout:java.lang.Boolean); + args.put("disableCam", msg.permissions.disableCam:java.lang.Boolean); + args.put("disableMic", msg.permissions.disableMic:java.lang.Boolean); + args.put("disablePrivChat", msg.permissions.disablePrivChat:java.lang.Boolean); + args.put("disablePubChat", msg.permissions.disablePubChat:java.lang.Boolean); + args.put("lockedLayout", msg.permissions.lockedLayout:java.lang.Boolean); var users = new ArrayList[java.util.HashMap[String, Object]]; msg.applyTo.foreach(uvo => { diff --git a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala index 85657a206b..c54816b68e 100644 --- a/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala +++ b/bigbluebutton-apps/src/main/scala/org/bigbluebutton/core/apps/users/redis/UsersMessageToJsonConverter.scala @@ -80,7 +80,7 @@ object UsersMessageToJsonConverter { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) payload.put(Constants.LOCKED, msg.locked) - payload.put(Constants.SETTINGS, msg.settings.toString()) //#todo not tested + payload.put(Constants.SETTINGS, msg.permissions.toString()) //#todo not tested val header = Util.buildHeader(MessageNames.PERMISSION_SETTING_INITIALIZED, msg.version, None) Util.buildJson(header, payload) @@ -89,10 +89,10 @@ object UsersMessageToJsonConverter { def newPermissionsSettingToJson(msg: NewPermissionsSetting):String = { val payload = new java.util.HashMap[String, Any]() payload.put(Constants.MEETING_ID, msg.meetingID) - payload.put("disableCam", msg.settings.permissions.disableCam) - payload.put("disableMic", msg.settings.permissions.disableMic) - payload.put("disablePrivChat", msg.settings.permissions.disablePrivChat) - payload.put("disablePubChat", msg.settings.permissions.disablePubChat) + payload.put("disableCam", msg.permissions.disableCam) + payload.put("disableMic", msg.permissions.disableMic) + payload.put("disablePrivChat", msg.permissions.disablePrivChat) + payload.put("disablePubChat", msg.permissions.disablePubChat) val users = new java.util.ArrayList[java.util.Map[String, Any]] msg.applyTo.foreach(uvo => { diff --git a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml index 46110ea907..48c46a9399 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/main/views/MainApplicationShell.mxml @@ -58,14 +58,11 @@ with BigBlueButton; if not, see . . import mx.core.IFlexDisplayObject; import mx.core.UIComponent; import mx.events.CloseEvent; - import mx.managers.PopUpManager; - + import mx.managers.PopUpManager; import org.bigbluebutton.common.IBbbModuleWindow; import org.bigbluebutton.common.Images; import org.bigbluebutton.common.LogUtil; @@ -166,9 +162,7 @@ with BigBlueButton; if not, see . showFooterOpt = layoutOptions.showFooter; if (!showFooterOpt) { footerHeight = 0; - } - - + } } protected function initializeShell():void { @@ -319,9 +313,7 @@ with BigBlueButton; if not, see . } } - private function handleFlashMicSettingsEvent(event:FlashMicSettingsEvent):void { -// showEarbudsHeadsetRequired(); - + private function handleFlashMicSettingsEvent(event:FlashMicSettingsEvent):void { var micSettings:FlashMicSettings = PopUpManager.createPopUp(mdiCanvas, FlashMicSettings, true) as FlashMicSettings; micSettings.addEventListener(FlexEvent.CREATION_COMPLETE, function(e:Event):void { var point1:Point = new Point(); @@ -428,8 +420,6 @@ with BigBlueButton; if not, see . } private function handleAskMicPermissionEvent(event:WebRtcAskMicPermissionEvent):void { - // showEarbudsHeadsetRequired(); - var browser:String = event.browser; if (browser == "Firefox") { var ffBrowser:FirefoxMicPermissionImage = PopUpManager.createPopUp(mdiCanvas, FirefoxMicPermissionImage, true) as FirefoxMicPermissionImage; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/BroadcastButton.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/BroadcastButton.mxml index e821465f4b..13ad11798a 100644 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/BroadcastButton.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/layout/views/BroadcastButton.mxml @@ -30,15 +30,12 @@ with BigBlueButton; if not, see .