work on remove presentation from pod. WIP
This commit is contained in:
parent
d888af2583
commit
ebdaedd3ae
@ -9,7 +9,6 @@ import org.bigbluebutton.core.running.LiveMeeting
|
||||
class PresentationApp2x(implicit val context: ActorContext)
|
||||
extends NewPresentationMsgHdlr
|
||||
with ResizeAndMovePagePubMsgHdlr
|
||||
with RemovePresentationPubMsgHdlr
|
||||
with PresentationUploadTokenReqMsgHdlr
|
||||
with PreuploadedPresentationsPubMsgHdlr
|
||||
with PresentationConversionUpdatePubMsgHdlr
|
||||
|
@ -1,32 +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 }
|
||||
|
||||
trait RemovePresentationPubMsgHdlr {
|
||||
this: PresentationApp2x =>
|
||||
|
||||
def handle(
|
||||
msg: RemovePresentationPubMsg,
|
||||
liveMeeting: LiveMeeting, bus: MessageBus
|
||||
): Unit = {
|
||||
|
||||
def broadcastEvent(msg: RemovePresentationPubMsg): Unit = {
|
||||
val routing = Routing.addMsgToClientRouting(MessageTypes.BROADCAST_TO_MEETING, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
val envelope = BbbCoreEnvelope(RemovePresentationEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(RemovePresentationEvtMsg.NAME, liveMeeting.props.meetingProp.intId, msg.header.userId)
|
||||
|
||||
val body = RemovePresentationEvtMsgBody(msg.body.presentationId)
|
||||
val event = RemovePresentationEvtMsg(header, body)
|
||||
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
|
||||
bus.outGW.send(msgEvent)
|
||||
}
|
||||
|
||||
for {
|
||||
presentation <- removePresentation(liveMeeting, msg.body.presentationId)
|
||||
} yield {
|
||||
broadcastEvent(msg)
|
||||
}
|
||||
}
|
||||
}
|
@ -11,6 +11,7 @@ class PresentationPodHdlrs(implicit val context: ActorContext)
|
||||
with PresentationConversionCompletedSysPubMsgHdlr
|
||||
with SetCurrentPagePubMsgHdlr
|
||||
with SetPresenterInPodReqMsgHdlr
|
||||
with RemovePresentationPubMsgHdlr
|
||||
with RemovePresentationPodPubMsgHdlr {
|
||||
|
||||
val log = Logging(context.system, getClass)
|
||||
|
@ -0,0 +1,50 @@
|
||||
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 RemovePresentationPubMsgHdlr {
|
||||
this: PresentationPodHdlrs =>
|
||||
|
||||
def handle(
|
||||
msg: RemovePresentationPubMsg, state: MeetingState2x,
|
||||
liveMeeting: LiveMeeting, bus: MessageBus
|
||||
): MeetingState2x = {
|
||||
|
||||
def broadcastRemovePresentationEvtMsg(podId: String, userId: String, presentationId: String): Unit = {
|
||||
val routing = Routing.addMsgToClientRouting(
|
||||
MessageTypes.BROADCAST_TO_MEETING,
|
||||
liveMeeting.props.meetingProp.intId, userId
|
||||
)
|
||||
val envelope = BbbCoreEnvelope(RemovePresentationEvtMsg.NAME, routing)
|
||||
val header = BbbClientMsgHeader(RemovePresentationEvtMsg.NAME, liveMeeting.props.meetingProp.intId, userId)
|
||||
|
||||
val body = RemovePresentationEvtMsgBody(podId, presentationId)
|
||||
val event = RemovePresentationEvtMsg(header, body)
|
||||
val msgEvent = BbbCommonEnvCoreMsg(envelope, event)
|
||||
bus.outGW.send(msgEvent)
|
||||
}
|
||||
|
||||
val podId = msg.body.podId
|
||||
val presentationId = msg.body.presentationId
|
||||
|
||||
val newState = for {
|
||||
pod <- PresentationPodsApp.getPresentationPod(state, podId)
|
||||
} yield {
|
||||
broadcastRemovePresentationEvtMsg(pod.id, msg.header.userId, presentationId)
|
||||
|
||||
val pods = state.presentationPodManager.removePresentationInPod(pod.id, presentationId)
|
||||
log.warning("_____ RemovePresentationPubMsgHdlr _ " + pods.printPods())
|
||||
state.update(pods)
|
||||
}
|
||||
|
||||
newState match {
|
||||
case Some(ns) => ns
|
||||
case None => state
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -132,6 +132,19 @@ case class PresentationPodManager(presentationPods: collection.immutable.Map[Str
|
||||
}
|
||||
}
|
||||
|
||||
def removePresentationInPod(podId: String, presentationId: String): PresentationPodManager = {
|
||||
val updatedManager = for {
|
||||
pod <- getPod(podId)
|
||||
} yield {
|
||||
updatePresentationPod(pod.removePresentation(presentationId))
|
||||
}
|
||||
|
||||
updatedManager match {
|
||||
case Some(ns) => ns
|
||||
case None => this
|
||||
}
|
||||
}
|
||||
|
||||
def printPods(): String = {
|
||||
var a = s"printPods (${presentationPods.values.size}):"
|
||||
presentationPods.values.foreach(pod => a = a.concat(pod.printPod()))
|
||||
|
@ -290,7 +290,6 @@ class MeetingActor(
|
||||
|
||||
// Presentation
|
||||
case m: ResizeAndMovePagePubMsg => presentationApp2x.handle(m, liveMeeting, msgBus)
|
||||
case m: RemovePresentationPubMsg => presentationApp2x.handle(m, liveMeeting, msgBus)
|
||||
case m: PresentationUploadTokenReqMsg => presentationApp2x.handle(m, liveMeeting, msgBus)
|
||||
case m: PreuploadedPresentationsSysPubMsg => presentationApp2x.handle(m, liveMeeting, msgBus)
|
||||
case m: PresentationConversionUpdateSysPubMsg => presentationApp2x.handle(m, liveMeeting, msgBus)
|
||||
@ -307,6 +306,7 @@ class MeetingActor(
|
||||
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)
|
||||
case m: RemovePresentationPubMsg => state = presentationPodsApp.handle(m, state, liveMeeting, msgBus)
|
||||
|
||||
// Caption
|
||||
case m: EditCaptionHistoryPubMsg => captionApp2x.handle(m, liveMeeting, msgBus)
|
||||
|
@ -12,9 +12,6 @@ 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)
|
||||
|
||||
object RemovePresentationPubMsg { val NAME = "RemovePresentationPubMsg"}
|
||||
case class RemovePresentationPubMsg(header: BbbClientMsgHeader, body: RemovePresentationPubMsgBody) extends StandardMsg
|
||||
case class RemovePresentationPubMsgBody(presentationId: String)
|
||||
// ------------ client to akka-apps ------------
|
||||
|
||||
|
||||
@ -46,10 +43,6 @@ 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)
|
||||
|
||||
object RemovePresentationEvtMsg { val NAME = "RemovePresentationEvtMsg"}
|
||||
case class RemovePresentationEvtMsg(header: BbbClientMsgHeader, body: RemovePresentationEvtMsgBody) extends BbbCoreMsg
|
||||
case class RemovePresentationEvtMsgBody(presentationId: String)
|
||||
|
||||
|
||||
// html5 client only
|
||||
object SyncGetPresentationInfoRespMsg { val NAME = "SyncGetPresentationInfoRespMsg"}
|
||||
|
@ -31,6 +31,10 @@ case class SetCurrentPagePubMsgBody(podId: String, presentationId: String, pageI
|
||||
object SetPresenterInPodReqMsg { val NAME = "SetPresenterInPodReqMsg"}
|
||||
case class SetPresenterInPodReqMsg(header: BbbClientMsgHeader, body: SetPresenterInPodReqMsgBody) extends StandardMsg
|
||||
case class SetPresenterInPodReqMsgBody(podId: String, nextPresenterId: String)
|
||||
|
||||
object RemovePresentationPubMsg { val NAME = "RemovePresentationPubMsg"}
|
||||
case class RemovePresentationPubMsg(header: BbbClientMsgHeader, body: RemovePresentationPubMsgBody) extends StandardMsg
|
||||
case class RemovePresentationPubMsgBody(podId: String, presentationId: String)
|
||||
// ------------ client to akka-apps ------------
|
||||
|
||||
|
||||
@ -112,6 +116,10 @@ case class SetCurrentPageEvtMsgBody(podId: String, presentationId: String, pageI
|
||||
object SetPresenterInPodRespMsg { val NAME = "SetPresenterInPodRespMsg"}
|
||||
case class SetPresenterInPodRespMsg(header: BbbClientMsgHeader, body: SetPresenterInPodRespMsgBody) extends StandardMsg
|
||||
case class SetPresenterInPodRespMsgBody(podId: String, nextPresenterId: String)
|
||||
|
||||
object RemovePresentationEvtMsg { val NAME = "RemovePresentationEvtMsg"}
|
||||
case class RemovePresentationEvtMsg(header: BbbClientMsgHeader, body: RemovePresentationEvtMsgBody) extends BbbCoreMsg
|
||||
case class RemovePresentationEvtMsgBody(podId: String, presentationId: String)
|
||||
// ------------ akka-apps to client ------------
|
||||
|
||||
|
||||
|
@ -128,7 +128,7 @@ package org.bigbluebutton.main.api
|
||||
}
|
||||
|
||||
private function handleDeletePresentationRequest(presentationID:String):void {
|
||||
var rEvent:RemovePresentationEvent = new RemovePresentationEvent(RemovePresentationEvent.REMOVE_PRESENTATION_EVENT);
|
||||
var rEvent:RemovePresentationEvent = new RemovePresentationEvent(RemovePresentationEvent.REMOVE_PRESENTATION_EVENT, "unknown");
|
||||
rEvent.presentationName = presentationID;
|
||||
_dispatcher.dispatchEvent(rEvent);
|
||||
}
|
||||
|
@ -252,7 +252,7 @@ package org.bigbluebutton.modules.present.business
|
||||
}
|
||||
|
||||
public function removePresentation(e:RemovePresentationEvent):void {
|
||||
sender.removePresentation(e.presentationName);
|
||||
sender.removePresentation(e.podId, e.presentationName);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -32,10 +32,12 @@ package org.bigbluebutton.modules.present.events
|
||||
public static const UPDATE_DOWNLOADABLE_FILES_EVENT:String = "Update Downloadable Files Event";
|
||||
|
||||
public var presentationName:String;
|
||||
|
||||
public function RemovePresentationEvent(type:String, bubbles:Boolean=true, cancelable:Boolean=false)
|
||||
public var podId: String;
|
||||
|
||||
public function RemovePresentationEvent(type:String, _podId: String, bubbles:Boolean=true, cancelable:Boolean=false)
|
||||
{
|
||||
super(type, bubbles, cancelable);
|
||||
this.podId = _podId;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -144,25 +144,25 @@ package org.bigbluebutton.modules.present.services
|
||||
}
|
||||
}
|
||||
|
||||
public function removeAllPresentations():void {
|
||||
// model.removeAllPresentations();
|
||||
public function removeAllPresentations(podId: String):void {
|
||||
podManager.getPod(podId).removeAllPresentations();
|
||||
}
|
||||
|
||||
public function removePresentation(presentationID:String):void {
|
||||
// var removedEvent:RemovePresentationEvent = new RemovePresentationEvent(RemovePresentationEvent.PRESENTATION_REMOVED_EVENT);
|
||||
// removedEvent.presentationName = presentationID;
|
||||
// dispatcher.dispatchEvent(removedEvent);
|
||||
//
|
||||
// var currPresentation:Presentation = model.getCurrentPresentation();
|
||||
//
|
||||
// if(currPresentation && presentationID == currPresentation.id) {
|
||||
// var uploadEvent:UploadEvent = new UploadEvent(UploadEvent.CLEAR_PRESENTATION);
|
||||
// dispatcher.dispatchEvent(uploadEvent);
|
||||
// }
|
||||
//
|
||||
// model.removePresentation(presentationID);
|
||||
// var updateEvent:RemovePresentationEvent = new RemovePresentationEvent(RemovePresentationEvent.UPDATE_DOWNLOADABLE_FILES_EVENT);
|
||||
// dispatcher.dispatchEvent(updateEvent); // this event will trigger the disabling of the download button.
|
||||
public function removePresentation(podId: String, presentationID:String):void {
|
||||
var removedEvent:RemovePresentationEvent = new RemovePresentationEvent(RemovePresentationEvent.PRESENTATION_REMOVED_EVENT, podId);
|
||||
removedEvent.presentationName = presentationID;
|
||||
dispatcher.dispatchEvent(removedEvent);
|
||||
|
||||
var currPresentation:Presentation = podManager.getPod(podId).getCurrentPresentation();
|
||||
|
||||
if(currPresentation && presentationID == currPresentation.id) {
|
||||
var uploadEvent:UploadEvent = new UploadEvent(UploadEvent.CLEAR_PRESENTATION);
|
||||
dispatcher.dispatchEvent(uploadEvent);
|
||||
}
|
||||
|
||||
podManager.getPod(podId).removePresentation(presentationID);
|
||||
var updateEvent:RemovePresentationEvent = new RemovePresentationEvent(RemovePresentationEvent.UPDATE_DOWNLOADABLE_FILES_EVENT, podId);
|
||||
dispatcher.dispatchEvent(updateEvent); // this event will trigger the disabling of the download button.
|
||||
}
|
||||
}
|
||||
}
|
@ -175,10 +175,13 @@ package org.bigbluebutton.modules.present.services.messaging
|
||||
}
|
||||
|
||||
private function handleRemovePresentationEvtMsg(msg:Object):void {
|
||||
service.removePresentation(msg.body.presentationId);
|
||||
var podId: String = msg.body.podId as String;
|
||||
var presentationId: String = msg.body.presentationId as String;
|
||||
service.removePresentation(podId, presentationId);
|
||||
}
|
||||
|
||||
private function handlePresentationConversionCompletedEvtMsg(msg:Object):void {
|
||||
|
||||
var presVO: PresentationVO = processUploadedPresentation(msg.body.presentation);
|
||||
var podId: String = msg.body.podId as String;
|
||||
|
||||
@ -263,14 +266,15 @@ package org.bigbluebutton.modules.present.services.messaging
|
||||
private function handleGetPresentationInfoRespMsg(msg:Object):void {
|
||||
var presos:ArrayCollection = new ArrayCollection();
|
||||
var presentations:Array = msg.body.presentations as Array;
|
||||
var podId:String = msg.body.podId as String;
|
||||
for (var j:int = 0; j < presentations.length; j++) {
|
||||
var presentation:Object = presentations[j] as Object;
|
||||
var presVO: PresentationVO = processUploadedPresentation(presentation);
|
||||
presos.addItem(presVO);
|
||||
}
|
||||
|
||||
service.removeAllPresentations();
|
||||
// service.addPresentations(presos, podId); // TODO -- are they all on the same pod?
|
||||
service.removeAllPresentations(podId);
|
||||
service.addPresentations(podId, presos);
|
||||
}
|
||||
|
||||
private function handlePresentationUploadTokenPassRespMsg(msg:Object):void {
|
||||
|
@ -102,10 +102,10 @@ package org.bigbluebutton.modules.present.services.messaging
|
||||
);
|
||||
}
|
||||
|
||||
public function removePresentation(presentationId:String):void {
|
||||
public function removePresentation(podId: String, presentationId:String):void {
|
||||
var message:Object = {
|
||||
header: {name: "RemovePresentationPubMsg", meetingId: UsersUtil.getInternalMeetingID(), userId: UsersUtil.getMyUserID()},
|
||||
body: {presentationId: presentationId}
|
||||
body: {podId: podId, presentationId: presentationId}
|
||||
};
|
||||
|
||||
var _nc:ConnectionManager = BBB.initConnectionManager();
|
||||
|
@ -352,7 +352,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
private function handlePresentationRemoved(e:RemovePresentationEvent):void {
|
||||
for(var i:int = 0; i < presentationNamesAC.length; i++) {
|
||||
if(e.presentationName == presentationNamesAC.getItemAt(i).presId) {
|
||||
if(e.presentationName == presentationNamesAC.getItemAt(i).presId && e.podId == this.podId) {
|
||||
presentationNamesAC.removeItemAt(i);
|
||||
return;
|
||||
}
|
||||
|
@ -1016,6 +1016,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function handleUpdateDownloadableFilesEvent(e:RemovePresentationEvent):void {
|
||||
if (e.podId == null || e.podId != this.podId) {
|
||||
return;
|
||||
}
|
||||
updateDownloadBtn();
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@
|
||||
private function deletePresentation():void {
|
||||
LOGGER.debug("FileUploadWindow.mxml::deletePresentation() {0}", [data.presId]);
|
||||
|
||||
var rEvent:RemovePresentationEvent = new RemovePresentationEvent(RemovePresentationEvent.REMOVE_PRESENTATION_EVENT);
|
||||
var rEvent:RemovePresentationEvent = new RemovePresentationEvent(RemovePresentationEvent.REMOVE_PRESENTATION_EVENT, data.podId);
|
||||
rEvent.presentationName = data.presId as String;
|
||||
dispatchEvent(rEvent);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user