diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/PresentationModel.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/PresentationModel.scala index 1418929706a0931a951c46acb904cd05333f4bd3..613bcdef65677b418e6f1393f30d408e4584114d 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/PresentationModel.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/PresentationModel.scala @@ -80,6 +80,7 @@ class PresentationModel { } } + // TODO remove private def deactivateCurrentPage(pres: Presentation, pageIdToIgnore: String): Presentation = { var updatedPres = pres pres.pages.values.find(p => p.current && p.id != pageIdToIgnore).foreach { cp => @@ -91,6 +92,7 @@ class PresentationModel { updatedPres } + // TODO remove private def makePageCurrent(pres: Presentation, pageId: String): Option[Presentation] = { pres.pages.get(pageId) match { case Some(newCurPage) => @@ -104,6 +106,7 @@ class PresentationModel { } } + // TODO remove def changeCurrentPage(presentationId: String, pageId: String): Boolean = { var foundPage: Boolean = false diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp2x.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp2x.scala index 5081e583f7504d0c342236d1d8681c13160f6927..549368a07e42a8be5bc849351c6e5730d644d48b 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp2x.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationApp2x.scala @@ -8,7 +8,6 @@ import org.bigbluebutton.core.running.LiveMeeting class PresentationApp2x(implicit val context: ActorContext) extends NewPresentationMsgHdlr - with SetCurrentPagePubMsgHdlr with ResizeAndMovePagePubMsgHdlr with RemovePresentationPubMsgHdlr with PresentationUploadTokenReqMsgHdlr diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SetCurrentPagePubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SetCurrentPagePubMsgHdlr.scala deleted file mode 100755 index 4bf950e706b668ab6ecfbe94171e4dda0cf06050..0000000000000000000000000000000000000000 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SetCurrentPagePubMsgHdlr.scala +++ /dev/null @@ -1,33 +0,0 @@ -package org.bigbluebutton.core.apps.presentation - -import org.bigbluebutton.common2.msgs._ -import org.bigbluebutton.core.bus.MessageBus -import org.bigbluebutton.core.running.{ LiveMeeting, OutMsgRouter } -import org.bigbluebutton.core.models.Users2x - -trait SetCurrentPagePubMsgHdlr { - this: PresentationApp2x => - - def handle( - msg: SetCurrentPagePubMsg, - liveMeeting: LiveMeeting, bus: MessageBus - ): Unit = { - - def broadcastEvent(msg: SetCurrentPagePubMsg): Unit = { - val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId) - val envelope = BbbCoreEnvelope(SetCurrentPageEvtMsg.NAME, routing) - val header = BbbClientMsgHeader(SetCurrentPageEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId) - - val body = SetCurrentPageEvtMsgBody(msg.body.presentationId, msg.body.pageId) - val event = SetCurrentPageEvtMsg(header, body) - val msgEvent = BbbCommonEnvCoreMsg(envelope, event) - bus.outGW.send(msgEvent) - } - - if (Users2x.isPresenter(msg.header.userId, liveMeeting.users2x)) { - if (setCurrentPage(liveMeeting, msg.body.presentationId, msg.body.pageId)) { - broadcastEvent(msg) - } - } - } -} diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationConversionCompletedSysPubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationConversionCompletedSysPubMsgHdlr.scala index 315caf581f24ae9d707098e1140cce1cf8312170..cc17dc17a5049793c0e8bcb2ca7c8621b0b9df78 100644 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationConversionCompletedSysPubMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/PresentationConversionCompletedSysPubMsgHdlr.scala @@ -5,7 +5,7 @@ import org.bigbluebutton.core.bus.MessageBus import org.bigbluebutton.core.domain.MeetingState2x import org.bigbluebutton.core.running.LiveMeeting import org.bigbluebutton.common2.domain.{ PageVO, PresentationVO } -import org.bigbluebutton.core.apps.Presentation +import org.bigbluebutton.core.models.PresentationInPod trait PresentationConversionCompletedSysPubMsgHdlr { @@ -39,7 +39,7 @@ trait PresentationConversionCompletedSysPubMsgHdlr { pages += page.id -> page } - val pres = new Presentation(msg.body.presentation.id, msg.body.presentation.name, msg.body.presentation.current, + val pres = new PresentationInPod(msg.body.presentation.id, msg.body.presentation.name, msg.body.presentation.current, pages.toMap, msg.body.presentation.downloadable) val presVO = PresentationPodsApp.translatePresentationToPresentationVO(pres) val podId = msg.body.podId 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 3c3f904803654128776366acd8ecaa8d79d42999..d7dd85ebc19b5e604edbf7a2e32ad4022de27fd5 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 @@ -9,6 +9,7 @@ class PresentationPodHdlrs(implicit val context: ActorContext) with GetAllPresentationPodsReqMsgHdlr with SetCurrentPresentationPubMsgHdlr with PresentationConversionCompletedSysPubMsgHdlr + with SetCurrentPagePubMsgHdlr 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 7bee9b4a1aadacafa0249037fe38112cea841726..b4306a9743993b3bfb1763a053358c8feda00240 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 @@ -1,10 +1,8 @@ package org.bigbluebutton.core.apps.presentationpod import org.bigbluebutton.common2.domain._ -import org.bigbluebutton.core.apps.Presentation import org.bigbluebutton.core.domain._ import org.bigbluebutton.core.models._ -import org.bigbluebutton.core.running.LiveMeeting object PresentationPodsApp { @@ -47,9 +45,14 @@ object PresentationPodsApp { state.update(podManager) } - def translatePresentationToPresentationVO(pres: Presentation): PresentationVO = { + def translatePresentationToPresentationVO(pres: PresentationInPod): PresentationVO = { PresentationVO(pres.id, pres.name, pres.current, pres.pages.values.toVector, pres.downloadable) } + def verifyPresenterStatus(state: MeetingState2x, podId: String, userId: String): Option[String] = { + // TODO check if the user belongs in the presenter group + Some(userId) + } + } 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 new file mode 100644 index 0000000000000000000000000000000000000000..909a7c20d785cb3176b93e5c77b026f3eb8e3f94 --- /dev/null +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentationpod/SetCurrentPagePubMsgHdlr.scala @@ -0,0 +1,62 @@ +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 + +trait SetCurrentPagePubMsgHdlr { + + this: PresentationPodHdlrs => + + def handle( + msg: SetCurrentPagePubMsg, state: MeetingState2x, + liveMeeting: LiveMeeting, bus: MessageBus + ): MeetingState2x = { + + def broadcastSetCurrentPageEvtMsg(podId: String, presentationId: String, pageId: String, userId: String): Unit = { + val routing = Routing.addMsgToClientRouting( + MessageTypes.BROADCAST_TO_MEETING, + liveMeeting.props.meetingProp.intId, userId + ) + val envelope = BbbCoreEnvelope(SetCurrentPageEvtMsg.NAME, routing) + val header = BbbClientMsgHeader(SetCurrentPageEvtMsg.NAME, liveMeeting.props.meetingProp.intId, userId) + + val body = SetCurrentPageEvtMsgBody(podId, presentationId, pageId) + val event = SetCurrentPageEvtMsg(header, body) + val msgEvent = BbbCommonEnvCoreMsg(envelope, event) + bus.outGW.send(msgEvent) + } + + // if (Users2x.isPresenter(msg.header.userId, liveMeeting.users2x)) { + // if (setCurrentPage(liveMeeting, msg.body.presentationId, msg.body.pageId)) { + // broadcastEvent(msg) + // } + // } + + val podId = msg.body.podId + val userId = msg.header.userId + val presentationId = msg.body.presentationId + val pageId = msg.body.pageId + + val newState = for { + pod <- PresentationPodsApp.getPresentationPod(state, podId) + presenter <- PresentationPodsApp.verifyPresenterStatus(state, pod.id, userId) + presentationToModify <- pod.getPresentation(presentationId) + updatedPod <- pod.setCurrentPage(presentationId, pageId) + } yield { + + // if user is in the presenter group // TODO + // if (Users2x.isPresenter(userId, liveMeeting.users2x)) { + broadcastSetCurrentPageEvtMsg(pod.id, presentationId, pageId, userId) + + val pods = state.presentationPodManager.addPod(updatedPod) + state.update(pods) + } + + 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 0f62f63e4859886b3f5928ec1ff40b5c2876cd85..45ab637a76ffd8eceeb212aaa0e1416160cce1f5 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 @@ -1,6 +1,6 @@ package org.bigbluebutton.core.models -import org.bigbluebutton.core.apps.Presentation +import org.bigbluebutton.common2.domain.PageVO import org.bigbluebutton.core.util.RandomStringGenerator object PresentationPodFactory { @@ -11,9 +11,29 @@ object PresentationPodFactory { } } +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) => + val page = newCurPage.copy(current = true) + val newPages = pres.pages + (page.id -> page) + val newPres = pres.copy(pages = newPages) + Some(newPres) + case None => + None + + } + } + +} + case class PresentationPod(id: String, ownerId: String, currentPresenter: String, authorizedPresenters: Vector[String], - presentations: collection.immutable.Map[String, Presentation]) { - def addPresentation(presentation: Presentation): PresentationPod = { + presentations: collection.immutable.Map[String, PresentationInPod]) { + def addPresentation(presentation: PresentationInPod): PresentationPod = { copy(presentations = presentations + (presentation.id -> presentation)) } @@ -26,8 +46,12 @@ case class PresentationPod(id: String, ownerId: String, currentPresenter: String def setCurrentPresenter(userId: String): PresentationPod = copy(currentPresenter = userId) // def getCurrentPresenter(): String = currentPresenter - def getCurrentPresentation(): Option[Presentation] = presentations.values find (p => p.current) - def setCurrentPresentation(presId: String): Option[Presentation] = { // copy(currentPresenter = userId) // **** + def getCurrentPresentation(): Option[PresentationInPod] = presentations.values find (p => p.current) + + def getPresentation(presentationId: String): Option[PresentationInPod] = + presentations.values find (p => p.id == presentationId) + + def setCurrentPresentation(presId: String): Option[PresentationInPod] = { // copy(currentPresenter = userId) // **** presentations.values foreach (curPres => { // unset previous current presentation if (curPres.id != presId) { val newPres = curPres.copy(current = false) @@ -45,6 +69,26 @@ case class PresentationPod(id: String, ownerId: String, currentPresenter: String } + def setCurrentPage(presentationId: String, pageId: String): Option[PresentationPod] = { + for { + pres <- presentations.get(presentationId) + newPres <- pres.makePageCurrent(pres, pageId) + } yield { + addPresentation(deactivateCurrentPage(newPres, pageId)) + } + } + + private def deactivateCurrentPage(pres: PresentationInPod, pageIdToIgnore: String): PresentationInPod = { + var updatedPres = pres + pres.pages.values.find(p => p.current && p.id != pageIdToIgnore).foreach { cp => + val page = cp.copy(current = false) + val nPages = pres.pages + (page.id -> page) + val newPres = pres.copy(pages = nPages) + updatedPres = newPres + } + updatedPres + } + def getPresentationsSize(): Int = { presentations.values.size } @@ -65,7 +109,7 @@ case class PresentationPodManager(presentationPods: collection.immutable.Map[Str def getAllPresentationPodsInMeeting(): Vector[PresentationPod] = presentationPods.values.toVector def updatePresentationPod(presPod: PresentationPod): PresentationPodManager = addPod(presPod) - def addPresentationToPod(podId: String, pres: Presentation): PresentationPodManager = { + def addPresentationToPod(podId: String, pres: PresentationInPod): PresentationPodManager = { val updatedManager = for { pod <- getPod(podId) } yield { 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 47db1d493970c1f23b1b30688a547a3538effc67..e8ee9da54397d92d28fc775d50c5193913f71d21 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 @@ -284,10 +284,6 @@ class MeetingActor( case m: GetLockSettingsReqMsg => handleGetLockSettingsReqMsg(m) // Presentation - // case m: SetCurrentPresentationPubMsg => presentationApp2x.handle(m, liveMeeting, msgBus, state) - // case m: SetCurrentPresentationPubMsg => presentationApp2x.handle(m, liveMeeting, msgBus) - // case m: GetPresentationInfoReqMsg => presentationApp2x.handle(m, liveMeeting, msgBus) - case m: SetCurrentPagePubMsg => presentationApp2x.handle(m, liveMeeting, msgBus) case m: ResizeAndMovePagePubMsg => presentationApp2x.handle(m, liveMeeting, msgBus) case m: RemovePresentationPubMsg => presentationApp2x.handle(m, liveMeeting, msgBus) case m: PresentationUploadTokenReqMsg => presentationApp2x.handle(m, liveMeeting, msgBus) @@ -304,6 +300,7 @@ class MeetingActor( case m: GetAllPresentationPodsReqMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus) 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) // Caption case m: EditCaptionHistoryPubMsg => captionApp2x.handle(m, liveMeeting, msgBus) diff --git a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationMsgs.scala b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationMsgs.scala index 8cdbdfdb7a381c1f2f503a5bfdeb5a8a463a209a..99b042f09420d6a5d4a124cabe8ec01b521cad44 100755 --- a/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationMsgs.scala +++ b/bbb-common-message/src/main/scala/org/bigbluebutton/common2/msgs/PresentationMsgs.scala @@ -8,10 +8,6 @@ object SetCurrentPresentationPubMsg { val NAME = "SetCurrentPresentationPubMsg"} case class SetCurrentPresentationPubMsg(header: BbbClientMsgHeader, body: SetCurrentPresentationPubMsgBody) extends StandardMsg case class SetCurrentPresentationPubMsgBody(podId: String, presentationId: String) -object SetCurrentPagePubMsg { val NAME = "SetCurrentPagePubMsg"} -case class SetCurrentPagePubMsg(header: BbbClientMsgHeader, body: SetCurrentPagePubMsgBody) extends StandardMsg -case class SetCurrentPagePubMsgBody(presentationId: String, pageId: String) - object ResizeAndMovePagePubMsg { val NAME = "ResizeAndMovePagePubMsg"} case class ResizeAndMovePagePubMsg(header: BbbClientMsgHeader, body: ResizeAndMovePagePubMsgBody) extends StandardMsg case class ResizeAndMovePagePubMsgBody(presentationId: String, pageId: String, xOffset: Double, yOffset: Double, widthRatio: Double, heightRatio: Double) @@ -46,10 +42,6 @@ object SetCurrentPresentationEvtMsg { val NAME = "SetCurrentPresentationEvtMsg"} case class SetCurrentPresentationEvtMsg(header: BbbClientMsgHeader, body: SetCurrentPresentationEvtMsgBody) extends BbbCoreMsg case class SetCurrentPresentationEvtMsgBody(podId: String, presentationId: String) -object SetCurrentPageEvtMsg { val NAME = "SetCurrentPageEvtMsg"} -case class SetCurrentPageEvtMsg(header: BbbClientMsgHeader, body: SetCurrentPageEvtMsgBody) extends BbbCoreMsg -case class SetCurrentPageEvtMsgBody(presentationId: String, pageId: String) - object ResizeAndMovePageEvtMsg { val NAME = "ResizeAndMovePageEvtMsg"} case class ResizeAndMovePageEvtMsg(header: BbbClientMsgHeader, body: ResizeAndMovePageEvtMsgBody) extends BbbCoreMsg case class ResizeAndMovePageEvtMsgBody(presentationId: String, pageId: String, xOffset: Double, yOffset: Double, widthRatio: Double, heightRatio: Double) 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 dcea3f5674c468223c3c83789fbb788d5d805f15..c20ab6b352381e710ae11eda2b4de18774a23573 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 @@ -23,6 +23,11 @@ case class PresentationUploadTokenReqMsgBody(podId: String, filename: String) object GetAllPresentationPodsReqMsg { val NAME = "GetAllPresentationPodsReqMsg"} case class GetAllPresentationPodsReqMsg(header: BbbClientMsgHeader, body: GetAllPresentationPodsReqMsgBody) extends StandardMsg case class GetAllPresentationPodsReqMsgBody(requesterId: String) + +object SetCurrentPagePubMsg { val NAME = "SetCurrentPagePubMsg"} +case class SetCurrentPagePubMsg(header: BbbClientMsgHeader, body: SetCurrentPagePubMsgBody) extends StandardMsg +case class SetCurrentPagePubMsgBody(podId: String, presentationId: String, pageId: String) + // ------------ client to akka-apps ------------ @@ -96,6 +101,11 @@ case class PresentationConversionCompletedEvtMsgBody(podId: String, messageKey: object GetAllPresentationPodsRespMsg { val NAME = "GetAllPresentationPodsRespMsg"} case class GetAllPresentationPodsRespMsg(header: BbbClientMsgHeader, body: GetAllPresentationPodsRespMsgBody) extends StandardMsg case class GetAllPresentationPodsRespMsgBody(pods: Vector[PresentationPodVO]) + +object SetCurrentPageEvtMsg { val NAME = "SetCurrentPageEvtMsg"} +case class SetCurrentPageEvtMsg(header: BbbClientMsgHeader, body: SetCurrentPageEvtMsgBody) extends BbbCoreMsg +case class SetCurrentPageEvtMsgBody(podId: String, presentationId: String, pageId: 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 fd37d3fa27b5307a98b9459336433a27852e20d5..c912f53702eb2cd319727bd4c131a7e3b4ed5945 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/business/PresentProxy.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/business/PresentProxy.as @@ -129,33 +129,36 @@ package org.bigbluebutton.modules.present.business } public function handleGoToPageCommand(cmd:GoToPageCommand):void { -// var pageChangeVO:PageChangeVO = PresentationModel.getInstance().getSpecificPageIds(cmd.pageId); -// if (pageChangeVO != null) { -// LOGGER.debug("Going to page[{0}] from presentation[{1}]", [pageChangeVO.pageId, pageChangeVO.presentationId]); -// sender.goToPage(pageChangeVO.presentationId, pageChangeVO.pageId); -// } else { -// LOGGER.debug("Could not go to selected page. Might not exist or is already current"); -// } + var presModel: PresentationModel = podManager.getPod(cmd.podId); + var pageChangeVO:PageChangeVO = presModel.getSpecificPageIds(cmd.pageId); + if (pageChangeVO != null) { + LOGGER.debug("Going to page[{0}] from presentation[{1}]", [pageChangeVO.pageId, pageChangeVO.presentationId]); + sender.goToPage(cmd.podId, pageChangeVO.presentationId, pageChangeVO.pageId); + } else { + LOGGER.debug("Could not go to selected page. Might not exist or is already current"); + } } public function handleGoToPreviousPageCommand(cmd:GoToPrevPageCommand):void { -// var pageChangeVO:PageChangeVO = PresentationModel.getInstance().getPrevPageIds(); -// if (pageChangeVO != null) { -// LOGGER.debug("Going to prev page[{0}] from presentation[{1}]", [pageChangeVO.pageId, pageChangeVO.presentationId]); -// sender.goToPage(pageChangeVO.presentationId, pageChangeVO.pageId); -// } else { -// LOGGER.debug("Could not find previous page to change to"); -// } + var presModel: PresentationModel = podManager.getPod(cmd.podId); + var pageChangeVO:PageChangeVO = presModel.getPrevPageIds(); + if (pageChangeVO != null) { + LOGGER.debug("Going to prev page[{0}] from presentation[{1}]", [pageChangeVO.pageId, pageChangeVO.presentationId]); + sender.goToPage(cmd.podId, pageChangeVO.presentationId, pageChangeVO.pageId); + } else { + LOGGER.debug("Could not find previous page to change to"); + } } public function handleGoToNextPageCommand(cmd:GoToNextPageCommand):void { -// var pageChangeVO:PageChangeVO = PresentationModel.getInstance().getNextPageIds(); -// if (pageChangeVO != null) { -// LOGGER.debug("Going to prev page[{0}] from presentation[{1}]", [pageChangeVO.pageId, pageChangeVO.presentationId]); -// sender.goToPage(pageChangeVO.presentationId, pageChangeVO.pageId); -// } else { -// LOGGER.debug("Could not find previous page to change to"); -// } + var presModel: PresentationModel = podManager.getPod(cmd.podId); + var pageChangeVO:PageChangeVO = presModel.getNextPageIds(); + if (pageChangeVO != null) { + LOGGER.debug("Going to prev page[{0}] from presentation[{1}]", [pageChangeVO.pageId, pageChangeVO.presentationId]); + sender.goToPage(cmd.podId, pageChangeVO.presentationId, pageChangeVO.pageId); + } else { + LOGGER.debug("Could not find next page to change to"); + } } /** diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToNextPageCommand.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToNextPageCommand.as index 5137f26bda700a7f4a88867451cbaefa94ea441e..03f2cee05638359574e49da530d37191779c0146 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToNextPageCommand.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToNextPageCommand.as @@ -5,10 +5,12 @@ package org.bigbluebutton.modules.present.commands public class GoToNextPageCommand extends Event { public static const GO_TO_NEXT_PAGE:String = "presentation go to next page"; - - public function GoToNextPageCommand() - { + + public var podId: String; + + public function GoToNextPageCommand(podId: String){ + this.podId = podId; super(GO_TO_NEXT_PAGE, true, false); } } -} \ No newline at end of file +} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPageCommand.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPageCommand.as index cae705c257ec7461beeb96ecb21f0963bf12c32c..7a1889881ea1f1b682da8b69d37938abe8544d64 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPageCommand.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPageCommand.as @@ -7,11 +7,13 @@ package org.bigbluebutton.modules.present.commands public static const GO_TO_PAGE:String = "presentation go to page command"; public var pageId:String; + public var podId: String; - public function GoToPageCommand(page:String) + public function GoToPageCommand(podId: String, page:String) { super(GO_TO_PAGE, true, false); pageId = page; + this.podId = podId; } } -} \ No newline at end of file +} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPageLocalCommand.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPageLocalCommand.as new file mode 100644 index 0000000000000000000000000000000000000000..1dac6fc52a192c46454dfb78b76e2dc5463dbca5 --- /dev/null +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPageLocalCommand.as @@ -0,0 +1,16 @@ +package org.bigbluebutton.modules.present.commands +{ + import flash.events.Event; + + public class GoToPageLocalCommand extends Event { + public static const GO_TO_PAGE_LOCAL:String = "presentation go to page command within pod"; + + public var pageId:String; + + public function GoToPageLocalCommand(page:String) + { + super(GO_TO_PAGE_LOCAL, true, false); + pageId = page; + } + } +} diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPrevPageCommand.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPrevPageCommand.as index f793622e257ed05deeb3043218f7260ebf85321d..d623b0e460e1f4418baac110defb889bddc00b50 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPrevPageCommand.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/commands/GoToPrevPageCommand.as @@ -5,10 +5,12 @@ package org.bigbluebutton.modules.present.commands public class GoToPrevPageCommand extends Event { public static const GO_TO_PREV_PAGE:String = "presentation go to previous page"; - - public function GoToPrevPageCommand() - { + + public var podId: String; + + public function GoToPrevPageCommand(podId: String){ + this.podId = podId; super(GO_TO_PREV_PAGE, true, false); } } -} \ No newline at end of file +} 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 6df48b4d29150f5e08b2141efb1fa4af15e89de7..24665468bb170e5da376fb891d2591d959ac5a5a 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 @@ -60,10 +60,10 @@ package org.bigbluebutton.modules.present.services.messaging ); } - public function goToPage(presentationId: String, pageId: String):void { + public function goToPage(podId: String, presentationId: String, pageId: String):void { var message:Object = { header: {name: "SetCurrentPagePubMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()}, - body: {presentationId: presentationId, pageId: pageId} + body: {podId: podId, presentationId: presentationId, pageId: pageId} }; var _nc:ConnectionManager = BBB.initConnectionManager(); 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 9d2027166e97086de3d7aaea9bfcb5bdd9fed43c..0aa7ebc371babf4bbd67143740689d969c0aad0c 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 @@ -61,6 +61,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. <mate:Listener type="{PollStartedEvent.POLL_STARTED}" method="pollStartedHandler" /> <mate:Listener type="{PollStoppedEvent.POLL_STOPPED}" method="pollStoppedHandler" /> <mate:Listener type="{PollShowResultEvent.SHOW_RESULT}" method="pollShowResultHandler" /> + <mate:Listener type="{GoToPageLocalCommand.GO_TO_PAGE_LOCAL}" method="handleGoToPageLocalCommand" /> </fx:Declarations> <fx:Script> @@ -99,6 +100,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. import org.bigbluebutton.modules.polling.views.PollResultsModal; import org.bigbluebutton.modules.present.commands.GoToNextPageCommand; import org.bigbluebutton.modules.present.commands.GoToPrevPageCommand; + import org.bigbluebutton.modules.present.commands.GoToPageLocalCommand; + import org.bigbluebutton.modules.present.commands.GoToPageCommand; import org.bigbluebutton.modules.present.events.DisplaySlideEvent; import org.bigbluebutton.modules.present.events.DownloadEvent; import org.bigbluebutton.modules.present.events.ExportEvent; @@ -373,7 +376,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. setupPresenter(true); addContextMenuItems(); } - + + // Intercept command from SlideView, add podId and forward the command to PresentProxy + // on its way out to server + private function handleGoToPageLocalCommand(cmd: GoToPageLocalCommand): void { + // JSLog.warn("PresentationWindow::handleGoToPageLocalCommand " + podId + " " + cmd.pageId , {}); + dispatchEvent(new GoToPageCommand(podId, cmd.pageId)); + } + private function handleBecomeViewer(e:MadePresenterEvent):void{ becomeViewer(); } @@ -524,14 +534,14 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. private function goToPreviousSlide():void { var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId); if (presentationModel != null && presentationModel.getCurrentPage().num > 1) { - dispatchEvent(new GoToPrevPageCommand()); + dispatchEvent(new GoToPrevPageCommand(podId)); } } private function goToNextSlide():void { var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId); if (presentationModel != null && presentationModel.getCurrentPage().num < presentationModel.getNumberOfPages()) { - dispatchEvent(new GoToNextPageCommand()); + dispatchEvent(new GoToNextPageCommand(podId)); } } 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 82114b839d18770eeefbacceba04c9cf9767ede8..12af6e5d653a833ea956ca61147a0b72a8cfbbe1 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 @@ -56,7 +56,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. import org.bigbluebutton.core.UsersUtil; import org.bigbluebutton.main.events.MadePresenterEvent; import org.bigbluebutton.main.events.ShortcutEvent; - import org.bigbluebutton.modules.present.commands.GoToPageCommand; + import org.bigbluebutton.modules.present.commands.GoToPageLocalCommand; import org.bigbluebutton.modules.present.events.DisplaySlideEvent; import org.bigbluebutton.modules.present.events.PageChangedEvent; import org.bigbluebutton.modules.present.events.PageLoadedEvent; @@ -149,7 +149,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. private function changeSlide():void { var data:Page = thumbnailView.selectedItem as Page; LOGGER.debug("Change page from thumbnail. Selected page [{0}]", [data.id]); - dispatchEvent(new GoToPageCommand(data.id)); + + dispatchEvent(new GoToPageLocalCommand(data.id)); thumbnailView.visible = false; }