From 31ce060896d6f99189acd6b5433ebd4ccf1c62f2 Mon Sep 17 00:00:00 2001 From: Anton Georgiev Date: Mon, 23 Oct 2017 16:30:25 -0400 Subject: [PATCH 1/3] added podId to SlideView to isolate events --- .../core/models/PresentationPods.scala | 7 +-- .../services/messaging/MessageReceiver.as | 10 ++-- .../present/ui/views/PresentationWindow.mxml | 3 +- .../modules/present/ui/views/SlideView.mxml | 57 ++++++++++++------- 4 files changed, 44 insertions(+), 33 deletions(-) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala index 45ab637a76..73bf940733 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala @@ -25,13 +25,12 @@ case class PresentationInPod(id: String, name: String, current: Boolean = false, Some(newPres) case None => None - } } } -case class PresentationPod(id: String, ownerId: String, currentPresenter: String, authorizedPresenters: Vector[String], +case class PresentationPod(id: String, ownerId: String, currentPresenter: String, presentations: collection.immutable.Map[String, PresentationInPod]) { def addPresentation(presentation: PresentationInPod): PresentationPod = { copy(presentations = presentations + (presentation.id -> presentation)) @@ -39,10 +38,6 @@ case class PresentationPod(id: String, ownerId: String, currentPresenter: String def removePresentation(id: String): PresentationPod = copy(presentations = presentations - id) - def addAuthorizedPresenter(userId: String): PresentationPod = copy(authorizedPresenters = authorizedPresenters :+ userId) - def removeAuthorizedPresenter(userId: String): PresentationPod = copy(authorizedPresenters = - authorizedPresenters.filterNot(u => u == userId)) - def setCurrentPresenter(userId: String): PresentationPod = copy(currentPresenter = userId) // def getCurrentPresenter(): String = currentPresenter diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as index b9fcfca5ca..4a01b1ce26 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as @@ -33,19 +33,19 @@ package org.bigbluebutton.modules.present.services.messaging import org.bigbluebutton.modules.present.events.ConversionUnsupportedDocEvent; import org.bigbluebutton.modules.present.events.ConversionUpdateEvent; import org.bigbluebutton.modules.present.events.CreatingThumbnailsEvent; + import org.bigbluebutton.modules.present.events.GetAllPodsRespEvent; + import org.bigbluebutton.modules.present.events.NewPresentationPodCreated; import org.bigbluebutton.modules.present.events.OfficeDocConvertFailedEvent; import org.bigbluebutton.modules.present.events.OfficeDocConvertInvalidEvent; import org.bigbluebutton.modules.present.events.OfficeDocConvertSuccessEvent; - import org.bigbluebutton.modules.present.events.PresentationUploadTokenPass; - import org.bigbluebutton.modules.present.events.PresentationUploadTokenFail; - import org.bigbluebutton.modules.present.events.NewPresentationPodCreated; import org.bigbluebutton.modules.present.events.PresentationPodRemoved; - import org.bigbluebutton.modules.present.events.GetAllPodsRespEvent; + import org.bigbluebutton.modules.present.events.PresentationUploadTokenFail; + import org.bigbluebutton.modules.present.events.PresentationUploadTokenPass; import org.bigbluebutton.modules.present.services.Constants; import org.bigbluebutton.modules.present.services.PresentationService; import org.bigbluebutton.modules.present.services.messages.PageVO; - import org.bigbluebutton.modules.present.services.messages.PresentationVO; import org.bigbluebutton.modules.present.services.messages.PresentationPodVO; + import org.bigbluebutton.modules.present.services.messages.PresentationVO; public class MessageReceiver implements IMessageListener { diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml index 3f5ae29e42..e3bd245672 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml @@ -161,6 +161,7 @@ with BigBlueButton; if not, see . private var pollMenuData:Array; private var pollMenu:Menu; + [Bindable] private var podId: String = ""; private var ownerId: String = ""; @@ -1004,7 +1005,7 @@ with BigBlueButton; if not, see . - + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/SlideView.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/SlideView.mxml index 12af6e5d65..e196a4474f 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/SlideView.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/SlideView.mxml @@ -82,7 +82,10 @@ with BigBlueButton; if not, see . [Bindable] public var slideModel:SlideViewModel = new SlideViewModel(); - + + + public var podId:String; + private var pageCache:ArrayCollection = new ArrayCollection(); private function onCreationComplete():void { @@ -113,8 +116,12 @@ with BigBlueButton; if not, see . } } - public function setSlides(podId: String):void { - var pres: Presentation = PresentationPodManager.getInstance().getPod(podId).getCurrentPresentation(); + public function setSlides(_podId: String):void { + if (_podId != this.podId) { + return; + } + + var pres: Presentation = PresentationPodManager.getInstance().getPod(_podId).getCurrentPresentation(); if (pres != null) { pageCache = pres.getPages(); /* Create the SortField object for the "num" field in the ArrayCollection object, and make sure we do a numeric sort. */ @@ -289,6 +296,10 @@ with BigBlueButton; if not, see . * Handles notification from presenter that the slide has moved. */ private function handlePageChangedEvent(e:PageChangedEvent):void { + if (e.podId != this.podId) { + return; + } + LOGGER.debug("Got a page changed event for page [{0}]", [e.pageId]); var page:Page = PresentationPodManager.getInstance().getPod(e.podId).getPage(e.pageId); if (page != null) { @@ -316,25 +327,29 @@ with BigBlueButton; if not, see . } private function handlePageLoadedEvent(e:PageLoadedEvent):void { - LOGGER.debug("Got a page loaded event for page [{0}]", [e.pageId]); - var page:Page = PresentationPodManager.getInstance().getPod(e.podId).getPage(e.pageId); - if (page != null) { - setSelectedSlide(page.num); - slideLoader.source = page.swfData; - LOGGER.debug("Displaying page [{0}]", [e.pageId]); -// positionPage(page); - if (whiteboardCanvas != null) { - whiteboardCanvas.displayWhiteboardById(page.id); - } - - //slideLoader.accessibilityProperties.description = "Slide text start: " + e.slideText + " Slide text end"; - slideLoader.accessibilityDescription = ResourceUtil.getInstance().getString("bbb.presentation.slideloader.starttext") + - page.txtData + ResourceUtil.getInstance().getString("bbb.presentation.slideloader.endtext"); - slideLoader.accessibilityName = ResourceUtil.getInstance().getString("bbb.presentation.slideloader.starttext") + - page.txtData + ResourceUtil.getInstance().getString("bbb.presentation.slideloader.endtext"); - } + if (e.podId != this.podId) { + return; + } + + LOGGER.debug("Got a page loaded event for page [{0}]", [e.pageId]); + var page:Page = PresentationPodManager.getInstance().getPod(e.podId).getPage(e.pageId); + if (page != null) { + setSelectedSlide(page.num); + slideLoader.source = page.swfData; + LOGGER.debug("Displaying page [{0}]", [e.pageId]); + // positionPage(page); + if (whiteboardCanvas != null) { + whiteboardCanvas.displayWhiteboardById(page.id); + } + + //slideLoader.accessibilityProperties.description = "Slide text start: " + e.slideText + " Slide text end"; + slideLoader.accessibilityDescription = ResourceUtil.getInstance().getString("bbb.presentation.slideloader.starttext") + + page.txtData + ResourceUtil.getInstance().getString("bbb.presentation.slideloader.endtext"); + slideLoader.accessibilityName = ResourceUtil.getInstance().getString("bbb.presentation.slideloader.starttext") + + page.txtData + ResourceUtil.getInstance().getString("bbb.presentation.slideloader.endtext"); + } } - + private function becomeViewer():void { removeEventListener(MouseEvent.MOUSE_WHEEL, onMouseWheelZoomEvent); this.removeEventListener(MouseEvent.MOUSE_DOWN, onMouseDown); From 8e06408a33a5e03c8989a787f22cef756c111746 Mon Sep 17 00:00:00 2001 From: Anton Georgiev Date: Tue, 24 Oct 2017 15:49:57 -0400 Subject: [PATCH 2/3] set current presenter in pod --- .../PresentationPodHdlrs.scala | 1 + .../presentationpod/PresentationPodsApp.scala | 3 +- .../SetCurrentPagePubMsgHdlr.scala | 2 +- .../SetPresenterInPodReqMsgHdlr.scala | 56 +++++++++++++++++++ .../core/models/PresentationPods.scala | 3 +- .../senders/ReceivedJsonMsgHandlerActor.scala | 2 + .../core/running/MeetingActor.scala | 1 + .../common2/domain/Presentation.scala | 1 - .../common2/msgs/PresentationPodsMsgs.scala | 6 ++ .../modules/present/business/PresentProxy.as | 6 ++ .../events/RequestNewPresentationPodEvent.as | 1 - .../events/SetPresenterInPodReqEvent.as | 38 +++++++++++++ .../events/SetPresenterInPodRespEvent.as | 17 ++++++ .../modules/present/maps/PresentEventMap.mxml | 9 +++ .../services/messaging/MessageReceiver.as | 10 ++++ .../services/messaging/MessageSender.as | 19 +++++++ .../present/ui/views/PresentationWindow.mxml | 55 +++++++++++++++--- 17 files changed, 216 insertions(+), 14 deletions(-) create mode 100644 akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetPresenterInPodReqMsgHdlr.scala mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/present/events/RequestNewPresentationPodEvent.as create mode 100755 bigbluebutton-client/src/org/bigbluebutton/modules/present/events/SetPresenterInPodReqEvent.as create mode 100644 bigbluebutton-client/src/org/bigbluebutton/modules/present/events/SetPresenterInPodRespEvent.as diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala index d7dd85ebc1..664db65f0c 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodHdlrs.scala @@ -10,6 +10,7 @@ class PresentationPodHdlrs(implicit val context: ActorContext) with SetCurrentPresentationPubMsgHdlr with PresentationConversionCompletedSysPubMsgHdlr with SetCurrentPagePubMsgHdlr + with SetPresenterInPodReqMsgHdlr with RemovePresentationPodPubMsgHdlr { val log = Logging(context.system, getClass) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala index 85570aa404..e0a13b2fda 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala @@ -36,8 +36,7 @@ object PresentationPodsApp { val presentationVOs = presentationObjects.values.map(p => PresentationVO(p.id, p.name, p.current, p.pages.values.toVector, p.downloadable)).toVector - PresentationPodVO(pod.id, pod.ownerId, pod.currentPresenter, - pod.authorizedPresenters, presentationVOs) + PresentationPodVO(pod.id, pod.ownerId, pod.currentPresenter, presentationVOs) } def updatePresentationPod(state: MeetingState2x, pod: PresentationPod): MeetingState2x = { diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPagePubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPagePubMsgHdlr.scala index 27c51e2bb7..b7bb49a520 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPagePubMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPagePubMsgHdlr.scala @@ -40,7 +40,7 @@ trait SetCurrentPagePubMsgHdlr { updatedPod <- pod.setCurrentPage(presentationId, pageId) } yield { - if (Users2x.userIsInPresenterGroup(liveMeeting.users2x, userId)) { + if (Users2x.userIsInPresenterGroup(liveMeeting.users2x, userId) || userId.equals(pod.ownerId)) { broadcastSetCurrentPageEvtMsg(pod.id, presentationId, pageId, userId) val pods = state.presentationPodManager.addPod(updatedPod) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetPresenterInPodReqMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetPresenterInPodReqMsgHdlr.scala new file mode 100644 index 0000000000..b8bdca4724 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetPresenterInPodReqMsgHdlr.scala @@ -0,0 +1,56 @@ +package org.bigbluebutton.core.apps.presentationpod + +import org.bigbluebutton.common2.msgs._ +import org.bigbluebutton.core.bus.MessageBus +import org.bigbluebutton.core.domain.MeetingState2x +import org.bigbluebutton.core.running.LiveMeeting +import org.bigbluebutton.core.models.Users2x + +trait SetPresenterInPodReqMsgHdlr { + this: PresentationPodHdlrs => + + def handle( + msg: SetPresenterInPodReqMsg, state: MeetingState2x, + liveMeeting: LiveMeeting, bus: MessageBus + ): MeetingState2x = { + + def broadcastSetPresenterInPodRespMsg(podId: String, nextPresenterId: String, requesterId: String): Unit = { + val routing = Routing.addMsgToClientRouting( + MessageTypes.BROADCAST_TO_MEETING, + liveMeeting.props.meetingProp.intId, requesterId + ) + val envelope = BbbCoreEnvelope(SetPresenterInPodRespMsg.NAME, routing) + val header = BbbClientMsgHeader(SetPresenterInPodRespMsg.NAME, liveMeeting.props.meetingProp.intId, requesterId) + + val body = SetPresenterInPodRespMsgBody(podId, nextPresenterId) + val event = SetPresenterInPodRespMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + bus.outGW.send(msgEvent) + } + + val podId: String = msg.body.podId + val requesterId: String = msg.header.userId + val nextPresenterId: String = msg.body.nextPresenterId + + val newState = for { + pod <- PresentationPodsApp.getPresentationPod(state, podId) + } yield { + + if (Users2x.userIsInPresenterGroup(liveMeeting.users2x, requesterId) || requesterId.equals(pod.ownerId)) { + val updatedPod = pod.setCurrentPresenter(nextPresenterId) + + broadcastSetPresenterInPodRespMsg(pod.id, nextPresenterId, requesterId) + + val pods = state.presentationPodManager.addPod(updatedPod) + state.update(pods) + } else { + state + } + } + + newState match { + case Some(ns) => ns + case None => state + } + } +} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala index 73bf940733..7a69eb2038 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala @@ -7,7 +7,7 @@ object PresentationPodFactory { private def genId(): String = System.currentTimeMillis() + "-" + RandomStringGenerator.randomAlphanumericString(8) def create(ownerId: String): PresentationPod = { val currentPresenter = ownerId // default - new PresentationPod(genId(), ownerId, currentPresenter, Vector.empty, Map.empty) + new PresentationPod(genId(), ownerId, currentPresenter, Map.empty) } } @@ -39,7 +39,6 @@ case class PresentationPod(id: String, ownerId: String, currentPresenter: String def removePresentation(id: String): PresentationPod = copy(presentations = presentations - id) def setCurrentPresenter(userId: String): PresentationPod = copy(currentPresenter = userId) - // def getCurrentPresenter(): String = currentPresenter def getCurrentPresentation(): Option[PresentationInPod] = presentations.values find (p => p.current) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala index dd1867f956..26c19d2110 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/pubsub/senders/ReceivedJsonMsgHandlerActor.scala @@ -214,6 +214,8 @@ class ReceivedJsonMsgHandlerActor( routeGenericMsg[CreateNewPresentationPodPubMsg](envelope, jsonNode) case RemovePresentationPodPubMsg.NAME => routeGenericMsg[RemovePresentationPodPubMsg](envelope, jsonNode) + case SetPresenterInPodReqMsg.NAME => + routeGenericMsg[SetPresenterInPodReqMsg](envelope, jsonNode) // Caption case EditCaptionHistoryPubMsg.NAME => diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala index 893a150fa5..964b60fa12 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/running/MeetingActor.scala @@ -305,6 +305,7 @@ class MeetingActor( case m: SetCurrentPresentationPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) case m: PresentationConversionCompletedSysPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) case m: SetCurrentPagePubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) + case m: SetPresenterInPodReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) // Caption case m: EditCaptionHistoryPubMsg => captionApp2x.handle(m, liveMeeting, msgBus) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/domain/Presentation.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/domain/Presentation.scala index 5713c4a5de..7e4fbbf5d2 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/domain/Presentation.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/domain/Presentation.scala @@ -8,5 +8,4 @@ case class PageVO(id: String, num: Int, thumbUri: String = "", swfUri: String, yOffset: Double = 0, widthRatio: Double = 100D, heightRatio: Double = 100D) case class PresentationPodVO(id: String, ownerId: String, currentPresenter: String, - authorizedPresenters: Vector[String], presentations: Vector[PresentationVO]) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala index c20ab6b352..19327349b4 100644 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationPodsMsgs.scala @@ -28,6 +28,9 @@ object SetCurrentPagePubMsg { val NAME = "SetCurrentPagePubMsg"} case class SetCurrentPagePubMsg(header: BbbClientMsgHeader, body: SetCurrentPagePubMsgBody) extends StandardMsg case class SetCurrentPagePubMsgBody(podId: String, presentationId: String, pageId: String) +object SetPresenterInPodReqMsg { val NAME = "SetPresenterInPodReqMsg"} +case class SetPresenterInPodReqMsg(header: BbbClientMsgHeader, body: SetPresenterInPodReqMsgBody) extends StandardMsg +case class SetPresenterInPodReqMsgBody(podId: String, nextPresenterId: String) // ------------ client to akka-apps ------------ @@ -106,6 +109,9 @@ object SetCurrentPageEvtMsg { val NAME = "SetCurrentPageEvtMsg"} case class SetCurrentPageEvtMsg(header: BbbClientMsgHeader, body: SetCurrentPageEvtMsgBody) extends BbbCoreMsg case class SetCurrentPageEvtMsgBody(podId: String, presentationId: String, pageId: String) +object SetPresenterInPodRespMsg { val NAME = "SetPresenterInPodRespMsg"} +case class SetPresenterInPodRespMsg(header: BbbClientMsgHeader, body: SetPresenterInPodRespMsgBody) extends StandardMsg +case class SetPresenterInPodRespMsgBody(podId: String, nextPresenterId: String) // ------------ akka-apps to client ------------ diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/business/PresentProxy.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/business/PresentProxy.as index c912f53702..811abe95e3 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/business/PresentProxy.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/business/PresentProxy.as @@ -43,6 +43,7 @@ package org.bigbluebutton.modules.present.business import org.bigbluebutton.modules.present.events.RequestClosePresentationPodEvent; import org.bigbluebutton.modules.present.events.RequestNewPresentationPodEvent; import org.bigbluebutton.modules.present.events.RequestPresentationInfoPodEvent; + import org.bigbluebutton.modules.present.events.SetPresenterInPodReqEvent; import org.bigbluebutton.modules.present.events.RequestAllPodsEvent; import org.bigbluebutton.modules.present.managers.PresentationSlides; import org.bigbluebutton.modules.present.model.Page; @@ -283,5 +284,10 @@ package org.bigbluebutton.modules.present.business public function handleRequestClosePresentationPod(e: RequestClosePresentationPodEvent): void { sender.requestClosePresentationPod(e.requesterId, e.podId); } + + public function handleSetPresenterInPodReqEvent(e: SetPresenterInPodReqEvent): void { + sender.handleSetPresenterInPodReqEvent(e.podId, e.nextPresenterId); + } + } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/events/RequestNewPresentationPodEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/events/RequestNewPresentationPodEvent.as old mode 100644 new mode 100755 index 1f19fe4e32..25c84b32f3 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/events/RequestNewPresentationPodEvent.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/events/RequestNewPresentationPodEvent.as @@ -21,7 +21,6 @@ package org.bigbluebutton.modules.present.events { import flash.events.Event; -import flash.net.FileReference; public class RequestNewPresentationPodEvent extends Event { public static const REQUEST_NEW_PRES_POD:String = "REQUEST_NEW_PRES_POD"; diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/events/SetPresenterInPodReqEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/events/SetPresenterInPodReqEvent.as new file mode 100755 index 0000000000..48985eef9b --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/events/SetPresenterInPodReqEvent.as @@ -0,0 +1,38 @@ +/** + * BigBlueButton open source conferencing system - http://www.bigbluebutton.org/ + * + * Copyright (c) 2017 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.present.events +{ + + import flash.events.Event; + + public class SetPresenterInPodReqEvent extends Event { + public static const SET_PRESENTER_IN_POD_REQ:String = "SET_PRESENTER_IN_POD_REQ"; + + public var podId: String; + public var nextPresenterId: String; + + public function SetPresenterInPodReqEvent(podId :String, nextPresenterId: String) { + this.podId = podId; + this.nextPresenterId = nextPresenterId; + super(SET_PRESENTER_IN_POD_REQ, true, false); + } + + } +} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/events/SetPresenterInPodRespEvent.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/events/SetPresenterInPodRespEvent.as new file mode 100644 index 0000000000..69e6740953 --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/events/SetPresenterInPodRespEvent.as @@ -0,0 +1,17 @@ +package org.bigbluebutton.modules.present.events +{ + import flash.events.Event; + + public class SetPresenterInPodRespEvent extends Event { + public static const SET_PRESENTER_IN_POD_RESP:String = "SET_PRESENTER_IN_POD_RESP"; + + public var podId: String; + public var nextPresenterId: String; + + public function SetPresenterInPodRespEvent(podId: String, nextPresenterId: String) { + super(SET_PRESENTER_IN_POD_RESP, true, false); + this.podId = podId; + this.nextPresenterId = nextPresenterId; + } + } +} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/maps/PresentEventMap.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/present/maps/PresentEventMap.mxml index 7fb17a0d56..c1a6a0678a 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/maps/PresentEventMap.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/maps/PresentEventMap.mxml @@ -48,6 +48,8 @@ with BigBlueButton; if not, see . import org.bigbluebutton.modules.present.events.RequestPresentationInfoPodEvent; import org.bigbluebutton.modules.present.events.GetAllPodsRespEvent; import org.bigbluebutton.modules.present.events.RequestAllPodsEvent; + import org.bigbluebutton.modules.present.events.SetPresenterInPodReqEvent; +// import org.bigbluebutton.modules.present.events.SetPresenterInPodRespEvent; import org.bigbluebutton.modules.present.managers.PresentManager; import org.bigbluebutton.modules.present.model.PresentationPodManager; import org.bigbluebutton.modules.present.services.PageLoaderService; @@ -187,5 +189,12 @@ with BigBlueButton; if not, see . + + + + + + + diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as index 4a01b1ce26..a396f1c418 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as @@ -41,6 +41,7 @@ package org.bigbluebutton.modules.present.services.messaging import org.bigbluebutton.modules.present.events.PresentationPodRemoved; import org.bigbluebutton.modules.present.events.PresentationUploadTokenFail; import org.bigbluebutton.modules.present.events.PresentationUploadTokenPass; + import org.bigbluebutton.modules.present.events.SetPresenterInPodRespEvent; import org.bigbluebutton.modules.present.services.Constants; import org.bigbluebutton.modules.present.services.PresentationService; import org.bigbluebutton.modules.present.services.messages.PageVO; @@ -106,6 +107,9 @@ package org.bigbluebutton.modules.present.services.messaging case "GetAllPresentationPodsRespMsg": handleGetAllPresentationPodsRespMsg(message); break; + case "SetPresenterInPodRespMsg": + handleSetPresenterInPodRespMsg(message); + break; } } @@ -308,5 +312,11 @@ package org.bigbluebutton.modules.present.services.messaging event.pods = podsAC; dispatcher.dispatchEvent(event); } + + private function handleSetPresenterInPodRespMsg(msg: Object): void { + var podId: String = msg.body.podId as String; + var nextPresenterId: String = msg.body.nextPresenterId as String; + dispatcher.dispatchEvent(new SetPresenterInPodRespEvent(podId, nextPresenterId)); + } } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageSender.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageSender.as index 24665468bb..01fd16c4c0 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageSender.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageSender.as @@ -157,5 +157,24 @@ package org.bigbluebutton.modules.present.services.messaging JSON.stringify(message) ); } + + public function handleSetPresenterInPodReqEvent(podId: String, nextPresenterId: String):void { + var message:Object = { + header: {name: "SetPresenterInPodReqMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()}, + body: {nextPresenterId: nextPresenterId, podId: podId} + }; + + var _nc:ConnectionManager = BBB.initConnectionManager(); + _nc.sendMessage2x( + function(result:String):void { }, + function(status:String):void { LOGGER.error("Error while setting presenter for pod." + status); }, + JSON.stringify(message) + ); + } + + + + + } } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml index e3bd245672..1c9305d5c4 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/PresentationWindow.mxml @@ -64,6 +64,7 @@ with BigBlueButton; if not, see . + @@ -113,6 +114,8 @@ with BigBlueButton; if not, see . import org.bigbluebutton.modules.present.events.UploadEvent; import org.bigbluebutton.modules.present.events.RequestNewPresentationPodEvent; import org.bigbluebutton.modules.present.events.RequestClosePresentationPodEvent; + import org.bigbluebutton.modules.present.events.SetPresenterInPodRespEvent; + import org.bigbluebutton.modules.present.events.SetPresenterInPodReqEvent; import org.bigbluebutton.main.model.users.events.UserAddedToPresenterGroupEvent; import org.bigbluebutton.main.model.users.events.UserRemovedFromPresenterGroupEvent; import org.bigbluebutton.modules.present.model.Page; @@ -124,6 +127,7 @@ with BigBlueButton; if not, see . import org.bigbluebutton.modules.whiteboard.views.WhiteboardTextToolbar; import org.bigbluebutton.modules.whiteboard.views.WhiteboardToolbar; import org.bigbluebutton.util.i18n.ResourceUtil; + import org.bigbluebutton.main.api.JSLog; private static const LOGGER:ILogger = getClassLogger(PresentationWindow); @@ -164,6 +168,7 @@ with BigBlueButton; if not, see . [Bindable] private var podId: String = ""; private var ownerId: String = ""; + private var currentPresenterInPod: String = ""; [Bindable] private var listOfPodControls:Array = []; @@ -192,7 +197,10 @@ with BigBlueButton; if not, see . private function populatePodDropdown(): void { listOfPodControls = []; listOfPodControls.push({label: this.podId, - icon: getStyle('iconClearStatus'), handler: setPresenterInPodHandler}); + icon: getStyle('iconClearStatus'), handler: function (): void {} }); + + listOfPodControls.push({label: UsersUtil.getUserName(this.ownerId), + icon: getStyle('iconClearStatus'), handler: requestPodPresenterChange, data: this.ownerId}); listOfPodControls.push({label: ResourceUtil.getInstance().getString('bbb.presentation.multipod.controls.newPresentationWindowOpen'), icon: getStyle('iconClearStatus'), handler: newPresentationWindowHandler}); @@ -203,8 +211,9 @@ with BigBlueButton; if not, see . var presGroup: ArrayCollection = UsersUtil.getPresenterGroup(); for (var j:int = 0; j < presGroup.length; j++) { - listOfPodControls.push({label: UsersUtil.getUserName(presGroup.getItemAt(j) as String), - icon: getStyle('iconClearStatus'), handler: setPresenterInPodHandler}); + var nextPresenterId: String = presGroup.getItemAt(j) as String; + listOfPodControls.push({label: UsersUtil.getUserName(nextPresenterId), + icon: getStyle('iconClearStatus'), handler: requestPodPresenterChange, data: nextPresenterId}); } } @@ -213,6 +222,9 @@ with BigBlueButton; if not, see . this.podId = _podId; this.ownerId = _ownerId; populatePodDropdown(); + + // the owner is the default currentPresenter for the pod + setPresenterInPodHelper(this.ownerId); } public function getPodId(): String { return this.podId; } @@ -220,7 +232,9 @@ with BigBlueButton; if not, see . public function getOwnerId(): String { return this.ownerId; } private function onPresentationPodControlsClicked():void { - presentationPodControls.selectedItem.handler(); + if(presentationPodControls.selectedItem != null) { + presentationPodControls.selectedItem.handler(); + } } private function newPresentationWindowHandler(): void { @@ -236,8 +250,34 @@ with BigBlueButton; if not, see . localDispatcher.dispatchEvent(event); } - private function setPresenterInPodHandler(): void { - // TODO + private function requestPodPresenterChange(): void { + if (presentationPodControls.selectedItem == null || presentationPodControls.selectedItem.data == null) { + return; + } + + var nextPresenterId: String = presentationPodControls.selectedItem.data as String; + JSLog.warn("__ PresentationWindow::requestPodPresenterChange: " + nextPresenterId, {}); + setPresenterInPodHelper(nextPresenterId); + } + + private function setPresenterInPodHelper(nextPresenterId: String): void { + localDispatcher.dispatchEvent(new SetPresenterInPodReqEvent(this.podId, nextPresenterId)); + } + + private function handleSetPresenterInPodRespEvent(event: SetPresenterInPodRespEvent): void { + if (event.podId != this.podId) { + return; + } + + // set the dropdown current value? // TODO + this.currentPresenterInPod = event.nextPresenterId as String; + + var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId); + var page : Page = presentationModel.getCurrentPage(); + + displaySlideNavigationControls(false, !!page); + setupPresenter(this.currentPresenterInPod == UsersUtil.getMyUserID()); + } private function onCreationComplete():void{ @@ -461,7 +501,8 @@ with BigBlueButton; if not, see . private function displaySlideNavigationControls(isPresenter:Boolean, activePresentation:Boolean):void { - var showButtons:Boolean = isPresenter && activePresentation; + var showButtons:Boolean = (UsersUtil.getMyUserID() == this.currentPresenterInPod) && activePresentation; + // var showButtons:Boolean = (isPresenter || UsersUtil.getMyUserID() == this.currentPresenterInPod) && activePresentation; pollStartBtn.visible = showButtons; quickPollBtn.visible = showButtons; From ff1aac2698e9831798eacfe4b4e7c966ad0e89cf Mon Sep 17 00:00:00 2001 From: Anton Georgiev Date: Tue, 24 Oct 2017 16:54:55 -0400 Subject: [PATCH 3/3] hardcode podId for first pod (for default.pdf) --- .../CreateNewPresentationPodPubMsgHdlr.scala | 7 ++++++- .../presentationpod/PresentationPodsApp.scala | 12 ++++++++---- .../core/models/PresentationPods.scala | 17 ++++++++++++----- .../web/controllers/ApiController.groovy | 2 +- 4 files changed, 27 insertions(+), 11 deletions(-) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/CreateNewPresentationPodPubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/CreateNewPresentationPodPubMsgHdlr.scala index f4a772e889..6e3dd9f048 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/CreateNewPresentationPodPubMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/CreateNewPresentationPodPubMsgHdlr.scala @@ -23,7 +23,12 @@ trait CreateNewPresentationPodPubMsgHdlr { } val ownerId = msg.body.ownerId - val pod = PresentationPodsApp.createPresentationPod(ownerId) + val pod = if (state.presentationPodManager.getNumberOfPods() == 0) { + PresentationPodsApp.createDefaultPresentationPod(ownerId) + } else { + PresentationPodsApp.createPresentationPod(ownerId) + } + val respMsg = buildCreateNewPresentationPodEvtMsg( liveMeeting.props.meetingProp.intId, ownerId, pod.id diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala index e0a13b2fda..34ba559b99 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationPodsApp.scala @@ -10,12 +10,16 @@ object PresentationPodsApp { PresentationPodFactory.create(ownerId) } - def createDefaultPresentationPod(state: MeetingState2x): MeetingState2x = { - val defaultPresPod = PresentationPodFactory.create("the-owner-id") - val podManager = state.presentationPodManager.addPod(defaultPresPod) - state.update(podManager) + def createDefaultPresentationPod(ownerId: String): PresentationPod = { + PresentationPodFactory.createDefaultPod(ownerId) } + // def createDefaultPresentationPod(state: MeetingState2x): MeetingState2x = { + // val defaultPresPod = PresentationPodFactory.create("the-owner-id") + // val podManager = state.presentationPodManager.addPod(defaultPresPod) + // state.update(podManager) + // } + def removePresentationPod(state: MeetingState2x, podId: String): MeetingState2x = { val podManager = state.presentationPodManager.removePod(podId) state.update(podManager) diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala index 7a69eb2038..fa8e83e2fb 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/models/PresentationPods.scala @@ -5,17 +5,24 @@ import org.bigbluebutton.core.util.RandomStringGenerator object PresentationPodFactory { private def genId(): String = System.currentTimeMillis() + "-" + RandomStringGenerator.randomAlphanumericString(8) + def create(ownerId: String): PresentationPod = { - val currentPresenter = ownerId // default - new PresentationPod(genId(), ownerId, currentPresenter, Map.empty) + val currentPresenter = ownerId + PresentationPod(genId(), ownerId, currentPresenter, Map.empty) + } + + def createDefaultPod(ownerId: String): PresentationPod = { + val currentPresenter = ownerId + + // we hardcode the podId of the default presentation pod for the purposes of having bbb-web know the podId + // in advance (so we can fully process default.pdf) // TODO change to a generated podId + PresentationPod("DEFAULT_PRESENTATION_POD", ownerId, currentPresenter, Map.empty) } } case class PresentationInPod(id: String, name: String, current: Boolean = false, pages: scala.collection.immutable.Map[String, PageVO], downloadable: Boolean) { - // TODO remove org.bigbluebutton.core.apps.Presentation - def makePageCurrent(pres: PresentationInPod, pageId: String): Option[PresentationInPod] = { pres.pages.get(pageId) match { case Some(newCurPage) => @@ -53,7 +60,7 @@ case class PresentationPod(id: String, ownerId: String, currentPresenter: String } }) - presentations.get(presId) match { // set new current presenter + presentations.get(presId) match { // set new current presentation case Some(pres) => val cp = pres.copy(current = true) addPresentation(cp) diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy index 21d544cc5f..947a85e243 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy @@ -2052,7 +2052,7 @@ class ApiController { if (presDownloadService.savePresentation(meetingId, newFilePath, address)) { def pres = new File(newFilePath) - processUploadedFile("ONE", meetingId, presId, presFilename, pres, current); + processUploadedFile("DEFAULT_PRESENTATION_POD", meetingId, presId, presFilename, pres, current); } else { log.error("Failed to download presentation=[${address}], meeting=[${meetingId}]") }