Merge pull request #4587 from antobinary/pods_vol4
Improvements on Presentation Pods
This commit is contained in:
commit
20eab4c3cf
@ -3,6 +3,7 @@ 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.models.PresentationPod
|
||||
import org.bigbluebutton.core.running.LiveMeeting
|
||||
|
||||
trait CreateNewPresentationPodPubMsgHdlr {
|
||||
@ -23,21 +24,28 @@ trait CreateNewPresentationPodPubMsgHdlr {
|
||||
}
|
||||
|
||||
val ownerId = msg.body.ownerId
|
||||
val pod = if (state.presentationPodManager.getNumberOfPods() == 0) {
|
||||
PresentationPodsApp.createDefaultPresentationPod(ownerId)
|
||||
} else {
|
||||
PresentationPodsApp.createPresentationPod(ownerId)
|
||||
|
||||
val resultPod: PresentationPod = PresentationPodsApp.getPresentationPod(state, "DEFAULT_PRESENTATION_POD") match {
|
||||
case None => PresentationPodsApp.createDefaultPresentationPod(ownerId)
|
||||
case Some(pod) => {
|
||||
if (pod.ownerId == "") {
|
||||
PresentationPodsApp.changeOwnershipOfDefaultPod(state, ownerId).get
|
||||
} else {
|
||||
PresentationPodsApp.createPresentationPod(ownerId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val respMsg = buildCreateNewPresentationPodEvtMsg(
|
||||
liveMeeting.props.meetingProp.intId,
|
||||
ownerId, pod.id
|
||||
ownerId, resultPod.id
|
||||
)
|
||||
bus.outGW.send(respMsg)
|
||||
|
||||
val pods = state.presentationPodManager.addPod(pod)
|
||||
val pods = state.presentationPodManager.addPod(resultPod)
|
||||
|
||||
log.warning("_____ pres pod add, after:" + pods.getNumberOfPods())
|
||||
log.warning("_____ CreateNewPresentationPodPubMsgHdlr _" + pods.printPods())
|
||||
|
||||
state.update(pods)
|
||||
|
||||
|
@ -49,7 +49,12 @@ trait PresentationConversionCompletedSysPubMsgHdlr {
|
||||
} yield {
|
||||
broadcastPresentationConversionCompletedEvtMsg(pod.id, msg.header.userId, msg.body.messageKey, msg.body.code, presVO)
|
||||
|
||||
val pods = state.presentationPodManager.addPresentationToPod(pod.id, pres)
|
||||
var pods = state.presentationPodManager.addPod(pod)
|
||||
pods = pods.addPresentationToPod(pod.id, pres)
|
||||
pods = pods.setCurrentPresentation(pod.id, pres.id)
|
||||
|
||||
log.warning("_____PresentationConversionCompletedSysPubMsgHdlr_ " + pods.printPods())
|
||||
|
||||
state.update(pods)
|
||||
}
|
||||
|
||||
|
@ -14,11 +14,11 @@ object PresentationPodsApp {
|
||||
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 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)
|
||||
@ -26,7 +26,13 @@ object PresentationPodsApp {
|
||||
}
|
||||
|
||||
def getPresentationPod(state: MeetingState2x, podId: String): Option[PresentationPod] = {
|
||||
state.presentationPodManager.getPod(podId)
|
||||
if (getNumberOfPresentationPods(state) == 0) {
|
||||
val defPod = createDefaultPresentationPod("") // ownerId is to be assigned later
|
||||
state.presentationPodManager.addPod(defPod)
|
||||
Some(defPod)
|
||||
} else {
|
||||
state.presentationPodManager.getPod(podId)
|
||||
}
|
||||
}
|
||||
|
||||
def getAllPresentationPodsInMeeting(state: MeetingState2x): Vector[PresentationPod] = {
|
||||
@ -52,5 +58,23 @@ object PresentationPodsApp {
|
||||
PresentationVO(pres.id, pres.name, pres.current, pres.pages.values.toVector, pres.downloadable)
|
||||
}
|
||||
|
||||
def setCurrentPresentationInPod(state: MeetingState2x, podId: String, nextCurrentPresId: String): Option[PresentationPod] = {
|
||||
for {
|
||||
pod <- getPresentationPod(state, podId)
|
||||
updatedPod <- pod.setCurrentPresentation(nextCurrentPresId)
|
||||
} yield {
|
||||
updatedPod
|
||||
}
|
||||
}
|
||||
|
||||
// add ownerId to default presentation pod -- in some cases we add it before first user is available
|
||||
def changeOwnershipOfDefaultPod(state: MeetingState2x, newOwnerId: String): Option[PresentationPod] = {
|
||||
for {
|
||||
defPod <- getPresentationPod(state, "DEFAULT_PRESENTATION_POD")
|
||||
} yield {
|
||||
println(s"\n\n\n changeOwnershipOfDefaultPod $newOwnerId \n\n\n")
|
||||
defPod.copy(ownerId = newOwnerId)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,20 +28,20 @@ trait SetCurrentPresentationPubMsgHdlr {
|
||||
val presId = msg.body.presentationId
|
||||
|
||||
val newState = for {
|
||||
pod <- PresentationPodsApp.getPresentationPod(state, podId)
|
||||
// presentation <- setCurrentPresentation(liveMeeting, pod.id, presId)
|
||||
updatedPod <- PresentationPodsApp.setCurrentPresentationInPod(state, podId, presId)
|
||||
} yield {
|
||||
|
||||
// unset old current
|
||||
PresentationPodsApp.getPresentationPod(state, podId)
|
||||
// TODO
|
||||
|
||||
// set new current
|
||||
// TODO
|
||||
|
||||
broadcastSetCurrentPresentationEvent(podId, msg.header.userId, presId)
|
||||
|
||||
log.warning("_____ SetCurrentPresentationPubMsgHdlr before_ " + state.presentationPodManager.printPods())
|
||||
val pods = state.presentationPodManager.addPod(updatedPod)
|
||||
log.warning("_____ SetCurrentPresentationPubMsgHdlr after_ " + pods.printPods())
|
||||
state.update(pods)
|
||||
}
|
||||
|
||||
newState match {
|
||||
case Some(ns) => ns
|
||||
case None => state
|
||||
}
|
||||
state
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -40,6 +40,7 @@ case class PresentationInPod(id: String, name: String, current: Boolean = false,
|
||||
case class PresentationPod(id: String, ownerId: String, currentPresenter: String,
|
||||
presentations: collection.immutable.Map[String, PresentationInPod]) {
|
||||
def addPresentation(presentation: PresentationInPod): PresentationPod = {
|
||||
println(s" 1 PresentationPods::addPresentation ${presentation.id} presName=${presentation.name} current=${presentation.current} ")
|
||||
copy(presentations = presentations + (presentation.id -> presentation))
|
||||
}
|
||||
|
||||
@ -52,22 +53,23 @@ case class PresentationPod(id: String, ownerId: String, currentPresenter: String
|
||||
def getPresentation(presentationId: String): Option[PresentationInPod] =
|
||||
presentations.values find (p => p.id == presentationId)
|
||||
|
||||
def setCurrentPresentation(presId: String): Option[PresentationInPod] = { // copy(currentPresenter = userId) // ****
|
||||
def setCurrentPresentation(presId: String): Option[PresentationPod] = {
|
||||
var tempPod: PresentationPod = this
|
||||
presentations.values foreach (curPres => { // unset previous current presentation
|
||||
if (curPres.id != presId) {
|
||||
val newPres = curPres.copy(current = false)
|
||||
addPresentation(newPres)
|
||||
tempPod = tempPod.addPresentation(newPres)
|
||||
}
|
||||
})
|
||||
|
||||
presentations.get(presId) match { // set new current presentation
|
||||
case Some(pres) =>
|
||||
val cp = pres.copy(current = true)
|
||||
addPresentation(cp)
|
||||
Some(cp)
|
||||
tempPod = tempPod.addPresentation(cp)
|
||||
case None => None
|
||||
}
|
||||
|
||||
Some(tempPod)
|
||||
}
|
||||
|
||||
def setCurrentPage(presentationId: String, pageId: String): Option[PresentationPod] = {
|
||||
@ -93,6 +95,13 @@ case class PresentationPod(id: String, ownerId: String, currentPresenter: String
|
||||
def getPresentationsSize(): Int = {
|
||||
presentations.values.size
|
||||
}
|
||||
|
||||
def printPod(): String = {
|
||||
val b = s"printPod (${presentations.values.size}):"
|
||||
var d = ""
|
||||
presentations.values.foreach(p => d += s"\nPRES_ID=${p.id} NAME=${p.name} CURRENT=${p.current}\n")
|
||||
b.concat(s"PODID=$id OWNERID=$ownerId CURRENTPRESENTER=$currentPresenter PRESENTATIONS={{{$d}}}\n")
|
||||
}
|
||||
}
|
||||
|
||||
case class PresentationPodManager(presentationPods: collection.immutable.Map[String, PresentationPod]) {
|
||||
@ -114,8 +123,28 @@ case class PresentationPodManager(presentationPods: collection.immutable.Map[Str
|
||||
val updatedManager = for {
|
||||
pod <- getPod(podId)
|
||||
} yield {
|
||||
val updatedPod = pod.addPresentation(pres)
|
||||
updatePresentationPod(updatedPod)
|
||||
updatePresentationPod(pod.addPresentation(pres))
|
||||
}
|
||||
|
||||
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()))
|
||||
a
|
||||
}
|
||||
|
||||
def setCurrentPresentation(podId: String, presId: String): PresentationPodManager = {
|
||||
val updatedManager = for {
|
||||
pod <- getPod(podId)
|
||||
podWithAdjustedCurrentPresentation <- pod.setCurrentPresentation(presId)
|
||||
|
||||
} yield {
|
||||
updatePresentationPod(podWithAdjustedCurrentPresentation)
|
||||
}
|
||||
|
||||
updatedManager match {
|
||||
|
@ -118,7 +118,7 @@ package org.bigbluebutton.main.api
|
||||
}
|
||||
|
||||
private function handleQueryListsOfPresentationsRequest():void {
|
||||
_dispatcher.dispatchEvent(new GetListOfPresentationsRequest());
|
||||
_dispatcher.dispatchEvent(new GetListOfPresentationsRequest("UNKNOWN"));
|
||||
}
|
||||
|
||||
private function handleDisplayPresentationRequest(presentationID:String):void {
|
||||
|
@ -28,7 +28,7 @@ package org.bigbluebutton.modules.polling.service
|
||||
import org.bigbluebutton.modules.polling.model.PollingModel;
|
||||
import org.bigbluebutton.modules.polling.model.SimplePoll;
|
||||
import org.bigbluebutton.modules.present.model.Presentation;
|
||||
import org.bigbluebutton.modules.present.model.PresentationModel;
|
||||
import org.bigbluebutton.modules.present.model.PresentationPodManager;
|
||||
|
||||
public class PollingService
|
||||
{
|
||||
@ -54,7 +54,8 @@ package org.bigbluebutton.modules.polling.service
|
||||
|
||||
|
||||
private function generatePollId():String {
|
||||
// var curPres:Presentation = PresentationModel.getInstance().getCurrentPresentation();
|
||||
// TODO podId is currently not set (the call assumes only one presentation pod
|
||||
// var curPres:Presentation = PresentationPodManager.getPod(this.podId).getCurrentPresentation();
|
||||
// if (curPres != null) {
|
||||
// var date:Date = new Date();
|
||||
//
|
||||
|
@ -45,6 +45,7 @@ package org.bigbluebutton.modules.present.business
|
||||
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.events.GetListOfPresentationsRequest;
|
||||
import org.bigbluebutton.modules.present.managers.PresentationSlides;
|
||||
import org.bigbluebutton.modules.present.model.Page;
|
||||
import org.bigbluebutton.modules.present.model.Presentation;
|
||||
@ -101,8 +102,9 @@ package org.bigbluebutton.modules.present.business
|
||||
userid = a.userid as Number;
|
||||
}
|
||||
|
||||
public function handleGetListOfPresentationsRequest():void {
|
||||
var presos:ArrayCollection = PresentationModel.getInstance().getPresentations();
|
||||
public function handleGetListOfPresentationsRequest(event: GetListOfPresentationsRequest):void {
|
||||
// TODO podId is currently not set (the call is from bbb api and assumes only one presentation pod
|
||||
var presos:ArrayCollection = podManager.getPod(event.podId).getPresentations();
|
||||
var idAndName:Array = new Array();
|
||||
for (var i:int = 0; i < presos.length; i++) {
|
||||
var pres:Presentation = presos.getItemAt(i) as Presentation;
|
||||
@ -258,13 +260,13 @@ package org.bigbluebutton.modules.present.business
|
||||
* @param e
|
||||
*
|
||||
*/
|
||||
public function zoomSlide(e:PresenterCommands):void{
|
||||
// var currentPresentation:Presentation = PresentationModel.getInstance().getCurrentPresentation();
|
||||
// if (currentPresentation == null) return;
|
||||
//
|
||||
// var currentPage:Page = PresentationModel.getInstance().getCurrentPage();
|
||||
//
|
||||
// sender.move(currentPresentation.id, currentPage.id, e.xOffset, e.yOffset, e.slideToCanvasWidthRatio, e.slideToCanvasHeightRatio);
|
||||
public function zoomSlide(e:PresenterCommands):void {
|
||||
var currentPresentation:Presentation = podManager.getPod(e.podId).getCurrentPresentation();
|
||||
if (currentPresentation == null) return;
|
||||
|
||||
var currentPage:Page = podManager.getPod(e.podId).getCurrentPage();
|
||||
|
||||
sender.move(currentPresentation.id, currentPage.id, e.xOffset, e.yOffset, e.slideToCanvasWidthRatio, e.slideToCanvasHeightRatio);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -6,11 +6,11 @@ package org.bigbluebutton.modules.present.commands
|
||||
{
|
||||
public static const GO_TO_NEXT_PAGE:String = "presentation go to next page";
|
||||
|
||||
public var podId: String;
|
||||
public var podId: String;
|
||||
|
||||
public function GoToNextPageCommand(podId: String){
|
||||
this.podId = podId;
|
||||
super(GO_TO_NEXT_PAGE, true, false);
|
||||
this.podId = podId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9,8 +9,8 @@ package org.bigbluebutton.modules.present.commands
|
||||
public var podId: String;
|
||||
|
||||
public function GoToPrevPageCommand(podId: String){
|
||||
this.podId = podId;
|
||||
super(GO_TO_PREV_PAGE, true, false);
|
||||
this.podId = podId;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,9 +6,12 @@ package org.bigbluebutton.modules.present.events
|
||||
{
|
||||
public static const GET_LIST_OF_PRESENTATIONS:String = "presentation get list of presentations request";
|
||||
|
||||
public function GetListOfPresentationsRequest()
|
||||
public var podId:String;
|
||||
|
||||
public function GetListOfPresentationsRequest(_podId: String)
|
||||
{
|
||||
super(GET_LIST_OF_PRESENTATIONS, true, false);
|
||||
this.podId = _podId;
|
||||
}
|
||||
}
|
||||
}
|
48
bigbluebutton-client/src/org/bigbluebutton/modules/present/managers/PresentManager.as
Normal file → Executable file
48
bigbluebutton-client/src/org/bigbluebutton/modules/present/managers/PresentManager.as
Normal file → Executable file
@ -32,12 +32,10 @@ package org.bigbluebutton.modules.present.managers
|
||||
import org.bigbluebutton.common.events.CloseWindowEvent;
|
||||
import org.bigbluebutton.core.Options;
|
||||
import org.bigbluebutton.core.PopUpUtil;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
import org.bigbluebutton.modules.present.events.ExportEvent;
|
||||
import org.bigbluebutton.modules.present.events.PresentModuleEvent;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.modules.present.events.NewPresentationPodCreated;
|
||||
import org.bigbluebutton.modules.present.events.RequestNewPresentationPodEvent;
|
||||
import org.bigbluebutton.modules.present.events.PresentationPodRemoved;
|
||||
import org.bigbluebutton.modules.present.events.RequestAllPodsEvent;
|
||||
import org.bigbluebutton.modules.present.events.GetAllPodsRespEvent;
|
||||
@ -48,14 +46,12 @@ package org.bigbluebutton.modules.present.managers
|
||||
import org.bigbluebutton.modules.present.ui.views.FileUploadWindow;
|
||||
import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
|
||||
|
||||
|
||||
public class PresentManager
|
||||
{
|
||||
private var globalDispatcher:Dispatcher;
|
||||
private var windows: Array = [];
|
||||
private var podsManager: PresentationPodManager;
|
||||
|
||||
|
||||
public function PresentManager() {
|
||||
globalDispatcher = new Dispatcher();
|
||||
podsManager = PresentationPodManager.getInstance();
|
||||
@ -74,30 +70,37 @@ package org.bigbluebutton.modules.present.managers
|
||||
var podId: String = e.podId;
|
||||
var ownerId: String = e.ownerId;
|
||||
|
||||
if(!windows.hasOwnProperty(podId)) {
|
||||
var newWindow:PresentationWindow = new PresentationWindow();
|
||||
newWindow.onPodCreated(podId, ownerId);
|
||||
|
||||
var presentOptions:PresentOptions = Options.getOptions(PresentOptions) as PresentOptions;
|
||||
newWindow.visible = true; // TODO
|
||||
// newWindow.visible = presentOptions.showPresentWindow;
|
||||
newWindow.showControls = presentOptions.showWindowControls;
|
||||
|
||||
windows[podId] = newWindow;
|
||||
|
||||
var openEvent:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
|
||||
openEvent.window = newWindow;
|
||||
globalDispatcher.dispatchEvent(openEvent);
|
||||
|
||||
podsManager.handleAddPresentationPod(podId, ownerId);
|
||||
if(windows.hasOwnProperty(podId)) {
|
||||
// remove pod and replace with the updated version
|
||||
handlePresentationPodRemovedHelper(podId, ownerId);
|
||||
}
|
||||
|
||||
var newWindow:PresentationWindow = new PresentationWindow();
|
||||
newWindow.onPodCreated(podId, ownerId);
|
||||
|
||||
var presentOptions:PresentOptions = Options.getOptions(PresentOptions) as PresentOptions;
|
||||
newWindow.visible = true; // TODO
|
||||
// newWindow.visible = presentOptions.showPresentWindow;
|
||||
newWindow.showControls = presentOptions.showWindowControls;
|
||||
|
||||
windows[podId] = newWindow;
|
||||
|
||||
var openEvent:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
|
||||
openEvent.window = newWindow;
|
||||
globalDispatcher.dispatchEvent(openEvent);
|
||||
|
||||
podsManager.handleAddPresentationPod(podId, ownerId);
|
||||
}
|
||||
|
||||
public function handlePresentationPodRemoved(e: PresentationPodRemoved): void {
|
||||
var podId: String = e.podId;
|
||||
var ownerId: String = e.ownerId;
|
||||
|
||||
podsManager.handlePresentationPodRemoved(podId, ownerId); // GOOD
|
||||
handlePresentationPodRemovedHelper(podId, ownerId);
|
||||
}
|
||||
|
||||
private function handlePresentationPodRemovedHelper(podId: String, ownerId: String): void {
|
||||
podsManager.handlePresentationPodRemoved(podId, ownerId);
|
||||
|
||||
var destroyWindow:PresentationWindow = windows[podId];
|
||||
if (destroyWindow != null) {
|
||||
@ -178,5 +181,8 @@ package org.bigbluebutton.modules.present.managers
|
||||
PopUpUtil.removePopUp(FileExportWindow);
|
||||
}
|
||||
|
||||
// public function handleSetPresenterInPodRespEvent(event: SetPresenterInPodRespEvent): void {
|
||||
//
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{GetListOfPresentationsRequest.GET_LIST_OF_PRESENTATIONS}" >
|
||||
<MethodInvoker generator="{PresentProxy}" method="handleGetListOfPresentationsRequest" />
|
||||
<MethodInvoker generator="{PresentProxy}" method="handleGetListOfPresentationsRequest" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{PresenterCommands.RESIZE}" >
|
||||
|
@ -5,6 +5,7 @@ package org.bigbluebutton.modules.present.model
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.modules.present.services.messages.PageChangeVO;
|
||||
import org.bigbluebutton.main.api.JSLog;
|
||||
|
||||
public class PresentationModel
|
||||
{
|
||||
@ -30,6 +31,24 @@ package org.bigbluebutton.modules.present.model
|
||||
_ownerId = ownerId;
|
||||
}
|
||||
|
||||
private function whichPageIsCurrent(presId: String): String {
|
||||
var result: String = "[";
|
||||
var pres:Presentation = getPresentation(presId);
|
||||
if (pres == null) {
|
||||
} else {
|
||||
var curPage: Page = pres.getCurrentPage();
|
||||
result = result + curPage.num;
|
||||
}
|
||||
return result + "]";
|
||||
}
|
||||
|
||||
public function printPresentations(calledFrom: String): void {
|
||||
for (var i:int = 0; i < _presentations.length; i++) {
|
||||
var pres: Presentation = _presentations.getItemAt(i) as Presentation;
|
||||
JSLog.warn("2001 " + calledFrom +" " + i + " " + pres.name + " " + pres.id + " " + pres.current.toString() + " " + whichPageIsCurrent(pres.id) , {});
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * Return the single instance of the PresentationModel class
|
||||
// */
|
||||
@ -50,7 +69,9 @@ package org.bigbluebutton.modules.present.model
|
||||
}
|
||||
|
||||
public function addPresentation(p: Presentation):void {
|
||||
printPresentations("PresentationModel::addPresentation bef total=" + _presentations.length);
|
||||
_presentations.addItem(p);
|
||||
printPresentations("PresentationModel::addPresentation aft total=" + _presentations.length);
|
||||
}
|
||||
|
||||
public function removePresentation(presId:String):Presentation {
|
||||
@ -205,5 +226,3 @@ package org.bigbluebutton.modules.present.model
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class SingletonEnforcer{}
|
36
bigbluebutton-client/src/org/bigbluebutton/modules/present/model/PresentationPodManager.as
Normal file → Executable file
36
bigbluebutton-client/src/org/bigbluebutton/modules/present/model/PresentationPodManager.as
Normal file → Executable file
@ -3,17 +3,18 @@ package org.bigbluebutton.modules.present.model {
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.modules.present.services.messages.PageChangeVO;
|
||||
import org.bigbluebutton.modules.present.services.messages.PresentationPodVO;
|
||||
import org.bigbluebutton.modules.present.model.PresentationModel;
|
||||
import org.bigbluebutton.modules.present.events.RequestNewPresentationPodEvent;
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import org.bigbluebutton.core.UsersUtil;
|
||||
|
||||
|
||||
import org.bigbluebutton.modules.present.services.PresentationService;
|
||||
import org.bigbluebutton.modules.present.services.messages.PageChangeVO;
|
||||
import org.bigbluebutton.modules.present.services.messages.PresentationPodVO;
|
||||
import org.bigbluebutton.modules.present.services.messages.PresentationVO;
|
||||
import org.bigbluebutton.modules.present.model.PresentationModel;
|
||||
import org.bigbluebutton.modules.present.events.RequestNewPresentationPodEvent;
|
||||
import org.bigbluebutton.modules.present.events.NewPresentationPodCreated;
|
||||
import org.bigbluebutton.modules.present.events.PresentationPodRemoved;
|
||||
import org.bigbluebutton.modules.present.events.RequestPresentationInfoPodEvent;
|
||||
import org.bigbluebutton.main.api.JSLog;
|
||||
|
||||
|
||||
public class PresentationPodManager {
|
||||
@ -23,6 +24,7 @@ package org.bigbluebutton.modules.present.model {
|
||||
|
||||
private var _presentationPods: ArrayCollection = new ArrayCollection();
|
||||
private var globalDispatcher:Dispatcher;
|
||||
private var presentationService: PresentationService;
|
||||
|
||||
|
||||
/**
|
||||
@ -52,6 +54,10 @@ package org.bigbluebutton.modules.present.model {
|
||||
return instance;
|
||||
}
|
||||
|
||||
public function setPresentationService(service: PresentationService): void {
|
||||
this.presentationService = service;
|
||||
}
|
||||
|
||||
public function requestDefaultPresentationPod(): void {
|
||||
var event:RequestNewPresentationPodEvent = new RequestNewPresentationPodEvent(RequestNewPresentationPodEvent.REQUEST_NEW_PRES_POD);
|
||||
event.requesterId = UsersUtil.getMyUserID();
|
||||
@ -83,7 +89,6 @@ package org.bigbluebutton.modules.present.model {
|
||||
}
|
||||
|
||||
public function handlePresentationPodRemoved(podId: String, ownerId: String): void {
|
||||
|
||||
for (var i:int = 0; i < _presentationPods.length; i++) {
|
||||
var pod: PresentationModel = _presentationPods.getItemAt(i) as PresentationModel;
|
||||
|
||||
@ -92,7 +97,6 @@ package org.bigbluebutton.modules.present.model {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function requestAllPodsPresentationInfo(): void {
|
||||
@ -105,19 +109,27 @@ package org.bigbluebutton.modules.present.model {
|
||||
}
|
||||
}
|
||||
|
||||
public function handleGetAllPodsResp(podsAC: ArrayCollection): void {
|
||||
// flush pod manager and add these pods instead
|
||||
|
||||
public function removeAllPresentationPods(): void {
|
||||
for (var i:int = 0; i < _presentationPods.length; i++) {
|
||||
var oldPod: PresentationModel = _presentationPods.getItemAt(i) as PresentationModel;
|
||||
globalDispatcher.dispatchEvent(new PresentationPodRemoved(oldPod.getPodId(), oldPod.getOwnerId()));
|
||||
// globalDispatcher.dispatchEvent(new PresentationPodRemoved(oldPod.getPodId(), oldPod.getOwnerId()));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function handleGetAllPodsResp(podsAC: ArrayCollection): void {
|
||||
// removeAllPresentationPods();
|
||||
|
||||
for (var j:int = 0; j < podsAC.length; j++) {
|
||||
JSLog.warn("__ PresentationPodManager::handleGetAllPodsResp A: " , podsAC.length);
|
||||
var podVO: PresentationPodVO = podsAC.getItemAt(j) as PresentationPodVO;
|
||||
var newPod: PresentationModel = new PresentationModel(podVO.id, podVO.ownerId);
|
||||
|
||||
globalDispatcher.dispatchEvent(new NewPresentationPodCreated(newPod.getPodId(), newPod.getOwnerId()));
|
||||
|
||||
var presentationsToAdd:ArrayCollection = podVO.getPresentations();
|
||||
presentationService.addPresentations(podVO.id, presentationsToAdd);
|
||||
}
|
||||
|
||||
if (podsAC.length == 0) { // If there are no pods, request the creation of a default one
|
||||
|
@ -1,13 +1,11 @@
|
||||
package org.bigbluebutton.modules.present.services
|
||||
{
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
|
||||
import org.as3commons.logging.api.ILogger;
|
||||
import org.as3commons.logging.api.getClassLogger;
|
||||
import org.bigbluebutton.modules.present.commands.ChangePageCommand;
|
||||
import org.bigbluebutton.modules.present.events.PageLoadedEvent;
|
||||
import org.bigbluebutton.modules.present.model.Page;
|
||||
import org.bigbluebutton.modules.present.model.PresentationModel;
|
||||
import org.bigbluebutton.modules.present.model.PresentationPodManager;
|
||||
|
||||
public class PageLoaderService
|
||||
|
@ -18,24 +18,24 @@ package org.bigbluebutton.modules.present.services
|
||||
import org.bigbluebutton.modules.present.services.messages.PageVO;
|
||||
import org.bigbluebutton.modules.present.services.messages.PresentationVO;
|
||||
import org.bigbluebutton.modules.present.services.messaging.MessageReceiver;
|
||||
import org.bigbluebutton.modules.present.services.messaging.MessageSender;
|
||||
|
||||
public class PresentationService
|
||||
{
|
||||
private static const LOGGER:ILogger = getClassLogger(PresentationService);
|
||||
private static const NUM_PRELOAD:uint = 3;
|
||||
private var podManager: PresentationPodManager;
|
||||
private var sender:MessageSender;
|
||||
private var receiver:MessageReceiver;
|
||||
private var dispatcher:Dispatcher;
|
||||
|
||||
public function PresentationService() {
|
||||
podManager = PresentationPodManager.getInstance();
|
||||
podManager.setPresentationService(this);
|
||||
receiver = new MessageReceiver(this);
|
||||
dispatcher = new Dispatcher();
|
||||
}
|
||||
|
||||
public function pageChanged(podId: String, pageId:String):void {
|
||||
podManager.getPod(podId).printPresentations("PresentationService::pageChanged bef");
|
||||
var np: Page = podManager.getPod(podId).getPage(pageId);
|
||||
if (np != null) {
|
||||
var oldPage: Page = podManager.getPod(podId).getCurrentPage();
|
||||
@ -45,6 +45,7 @@ package org.bigbluebutton.modules.present.services
|
||||
// trace(LOG + "Sending page changed event. page [" + np.id + "] oldpage current=[" + oldPage.current + "] newPage current=[" + np.current + "]");
|
||||
var changePageCommand: ChangePageCommand = new ChangePageCommand(podId, np.id, NUM_PRELOAD);
|
||||
dispatcher.dispatchEvent(changePageCommand);
|
||||
podManager.getPod(podId).printPresentations("PresentationService::pageChanged aft");
|
||||
}
|
||||
}
|
||||
|
||||
@ -121,12 +122,15 @@ package org.bigbluebutton.modules.present.services
|
||||
LOGGER.debug("No previous active presentation.");
|
||||
}
|
||||
|
||||
podManager.getPod(podId).printPresentations("PresentationService::changeCurrentPresentation bef");
|
||||
var newPres:Presentation = podManager.getPod(podId).getPresentation(presentationId);
|
||||
if (newPres != null) {
|
||||
LOGGER.debug("Making presentation [{0}] the active presentation.", [presentationId]);
|
||||
newPres.current = true;
|
||||
|
||||
|
||||
podManager.getPod(podId).printPresentations("PresentationService::changeCurrentPresentation aft");
|
||||
|
||||
var event: PresentationChangedEvent = new PresentationChangedEvent(podId, presentationId);
|
||||
dispatcher.dispatchEvent(event);
|
||||
|
||||
|
@ -199,8 +199,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
listOfPodControls.push({label: this.podId,
|
||||
icon: getStyle('iconClearStatus'), handler: function (): void {} });
|
||||
|
||||
listOfPodControls.push({label: UsersUtil.getUserName(this.ownerId),
|
||||
if (this.ownerId != null && this.ownerId != "") {
|
||||
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});
|
||||
@ -212,19 +214,20 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
var presGroup: ArrayCollection = UsersUtil.getPresenterGroup();
|
||||
for (var j:int = 0; j < presGroup.length; j++) {
|
||||
var nextPresenterId: String = presGroup.getItemAt(j) as String;
|
||||
listOfPodControls.push({label: UsersUtil.getUserName(nextPresenterId),
|
||||
icon: getStyle('iconClearStatus'), handler: requestPodPresenterChange, data: nextPresenterId});
|
||||
|
||||
if (nextPresenterId != this.ownerId) { // avoid duplication
|
||||
listOfPodControls.push({label: UsersUtil.getUserName(nextPresenterId),
|
||||
icon: getStyle('iconClearStatus'), handler: requestPodPresenterChange, data: nextPresenterId});
|
||||
}
|
||||
}
|
||||
|
||||
showCurrentPresenterInPod();
|
||||
}
|
||||
|
||||
public function onPodCreated(_podId: String, _ownerId: String):void {
|
||||
this.podId = _podId;
|
||||
this.ownerId = _ownerId;
|
||||
this.currentPresenterInPod = this.ownerId;
|
||||
populatePodDropdown();
|
||||
|
||||
// the owner is the default currentPresenter for the pod
|
||||
setPresenterInPodHelper(this.ownerId);
|
||||
}
|
||||
|
||||
public function getPodId(): String { return this.podId; }
|
||||
@ -238,7 +241,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function newPresentationWindowHandler(): void {
|
||||
presentationPodControls.selectedIndex = 0;
|
||||
var event:RequestNewPresentationPodEvent = new RequestNewPresentationPodEvent(RequestNewPresentationPodEvent.REQUEST_NEW_PRES_POD);
|
||||
|
||||
event.requesterId = UsersUtil.getMyUserID();
|
||||
localDispatcher.dispatchEvent(event);
|
||||
}
|
||||
@ -264,20 +269,36 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
localDispatcher.dispatchEvent(new SetPresenterInPodReqEvent(this.podId, nextPresenterId));
|
||||
}
|
||||
|
||||
private function showCurrentPresenterInPod(): void {
|
||||
if (this.currentPresenterInPod == null || this.currentPresenterInPod == "") {
|
||||
return;
|
||||
}
|
||||
|
||||
for (var i:int=0; i<listOfPodControls.length; i++) {
|
||||
if (listOfPodControls[i].data != null && listOfPodControls[i].data == this.currentPresenterInPod
|
||||
&& presentationPodControls != null && presentationPodControls.dataProvider != null) {
|
||||
presentationPodControls.selectedItem = presentationPodControls.dataProvider.getItemAt(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// show podId
|
||||
// presentationPodControls.selectedItem = presentationPodControls.dataProvider.getItemAt(0);
|
||||
}
|
||||
|
||||
private function handleSetPresenterInPodRespEvent(event: SetPresenterInPodRespEvent): void {
|
||||
if (event.podId != this.podId) {
|
||||
return;
|
||||
}
|
||||
|
||||
// set the dropdown current value? // TODO
|
||||
this.currentPresenterInPod = event.nextPresenterId as String;
|
||||
showCurrentPresenterInPod();
|
||||
|
||||
var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId);
|
||||
var page : Page = presentationModel.getCurrentPage();
|
||||
var page: Page = presentationModel.getCurrentPage();
|
||||
|
||||
displaySlideNavigationControls(false, !!page);
|
||||
setupPresenter(this.currentPresenterInPod == UsersUtil.getMyUserID());
|
||||
|
||||
}
|
||||
|
||||
private function onCreationComplete():void{
|
||||
@ -402,7 +423,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
* Notify the slide container telling it the available dimensions to display the slide.
|
||||
*/
|
||||
private function sendWindowResizedEvent(parentWidth:Number, parentHeight:Number):void {
|
||||
slideView.onParentResized(parentWidth, parentHeight);
|
||||
slideView.onParentResized(this.podId, parentWidth, parentHeight);
|
||||
}
|
||||
|
||||
private function handleDisplaySlideEvent(event:DisplaySlideEvent):void {
|
||||
@ -531,7 +552,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function notifyOthersOfSharingPresentation(presentationName:String):void {
|
||||
// TODO
|
||||
var shareEvent:PresenterCommands = new PresenterCommands(PresenterCommands.SHARE_PRESENTATION_COMMAND);
|
||||
shareEvent.presentationName = presentationName;
|
||||
shareEvent.podId = podId;
|
||||
@ -622,7 +642,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private function addWhiteboardCanvasToSlideView():void{
|
||||
if(whiteboardOverlay != null) {
|
||||
LOGGER.debug("addWhiteboardCanvasToSlideView: Adding whiteboard canvas to SlideView");
|
||||
slideView.acceptOverlayCanvas(whiteboardOverlay);
|
||||
slideView.acceptOverlayCanvas(this.podId, whiteboardOverlay);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.present.events.PresenterCommands;
|
||||
import org.bigbluebutton.modules.present.model.Page;
|
||||
import org.bigbluebutton.modules.present.model.Presentation;
|
||||
import org.bigbluebutton.modules.present.model.PresentationModel;
|
||||
import org.bigbluebutton.modules.present.model.PresentationPodManager;
|
||||
import org.bigbluebutton.modules.present.ui.views.models.SlideCalcUtil;
|
||||
import org.bigbluebutton.modules.present.ui.views.models.SlideViewModel;
|
||||
@ -202,9 +201,13 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
stage.removeEventListener(MouseEvent.MOUSE_UP, onMouseUp);
|
||||
}
|
||||
|
||||
public function onParentResized(parentWidth:Number, parentHeight:Number):void {
|
||||
public function onParentResized(_podId: String, parentWidth:Number, parentHeight:Number):void {
|
||||
if (slideModel == null || noSlideContentLoaded()) return;
|
||||
|
||||
if (_podId != this.podId) {
|
||||
return;
|
||||
}
|
||||
|
||||
slideModel.parentChange(parentWidth, parentHeight);
|
||||
|
||||
if (UsersUtil.amIPresenter()) {
|
||||
@ -215,11 +218,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
fitSlideToLoader();
|
||||
notifyOthersOfZoomEvent();
|
||||
} else {
|
||||
// var page:Page = PresentationModel.getInstance().getCurrentPage();
|
||||
// if (page != null) {
|
||||
// LOGGER.debug("Parent window has resized. Reposition page [{0}]", [page.id]);
|
||||
// positionPage(page);
|
||||
// }
|
||||
var page:Page = PresentationPodManager.getInstance().getPod(_podId).getCurrentPage();
|
||||
if (page != null) {
|
||||
LOGGER.debug("Parent window has resized. Reposition page [{0}]", [page.id]);
|
||||
positionPage(page);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -296,7 +299,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
* Handles notification from presenter that the slide has moved.
|
||||
*/
|
||||
private function handlePageChangedEvent(e:PageChangedEvent):void {
|
||||
LOGGER.debug("Got a page changed event for pod=" + e.podId + " page=" + e.pageId);
|
||||
if (e.podId != this.podId) {
|
||||
LOGGER.debug("Not handling page as this.podId=" + this.podId);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -311,8 +316,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function positionPage(page:Page):void {
|
||||
LOGGER.debug("Got Positioning page [{0}]", [page.id]);
|
||||
if (page != null && page.swfData != null) {
|
||||
LOGGER.debug("Positioning page [{0}]", [page.id]);
|
||||
LOGGER.debug("Handling Positioning page [{0}]", [page.id]);
|
||||
slideModel.saveViewedRegion(page.xOffset, page.yOffset, page.widthRatio, page.heightRatio);
|
||||
slideModel.calculateViewportNeededForRegion(page.widthRatio, page.heightRatio);
|
||||
slideModel.displayViewerRegion(page.xOffset, page.yOffset, page.widthRatio, page.heightRatio);
|
||||
@ -327,7 +333,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function handlePageLoadedEvent(e:PageLoadedEvent):void {
|
||||
LOGGER.debug("Got a page loaded event for pod=" + e.podId + " page=" + e.pageId);
|
||||
if (e.podId != this.podId) {
|
||||
LOGGER.debug("Not handling page as this.podId=" + this.podId);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -337,7 +345,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
setSelectedSlide(page.num);
|
||||
slideLoader.source = page.swfData;
|
||||
LOGGER.debug("Displaying page [{0}]", [e.pageId]);
|
||||
// positionPage(page);
|
||||
//positionPage(page);
|
||||
if (whiteboardCanvas != null) {
|
||||
whiteboardCanvas.displayWhiteboardById(page.id);
|
||||
}
|
||||
@ -407,14 +415,18 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
dispatcher.dispatchEvent(dispEvent);
|
||||
}
|
||||
|
||||
public function acceptOverlayCanvas(overlay:WhiteboardCanvas):void{
|
||||
public function acceptOverlayCanvas(_podId: String, overlay:WhiteboardCanvas):void{
|
||||
whiteboardCanvas = overlay;
|
||||
|
||||
// var currPage:Page = PresentationModel.getInstance().getCurrentPage();
|
||||
// if (currPage != null) {
|
||||
// whiteboardCanvas.displayWhiteboardById(currPage.id);
|
||||
// }
|
||||
//
|
||||
if (_podId != this.podId) {
|
||||
return;
|
||||
}
|
||||
|
||||
var currPage:Page = PresentationPodManager.getInstance().getPod(_podId).getCurrentPage();
|
||||
if (currPage != null) {
|
||||
whiteboardCanvas.displayWhiteboardById(currPage.id);
|
||||
}
|
||||
|
||||
this.addChildAt(whiteboardCanvas, this.getChildIndex(thumbnailView));
|
||||
fitSlideToLoader();
|
||||
whiteboardCanvas.addEventListener(MouseEvent.MOUSE_DOWN, handleWhiteboardCanvasClick);
|
||||
|
Loading…
Reference in New Issue
Block a user