independent pods, visible slide on presenter side

This commit is contained in:
Anton Georgiev 2017-10-03 11:06:54 -04:00
parent 60904989b3
commit 0866bc01ce
15 changed files with 261 additions and 217 deletions

View File

@ -3,6 +3,7 @@ package org.bigbluebutton.core.apps.presentation
import org.bigbluebutton.common2.msgs._
import org.bigbluebutton.core.bus.MessageBus
import org.bigbluebutton.core.running.LiveMeeting
import org.bigbluebutton.core.util.RandomStringGenerator
trait PresentationUploadTokenReqMsgHdlr {
this: PresentationApp2x =>
@ -14,7 +15,7 @@ trait PresentationUploadTokenReqMsgHdlr {
// TODO move these in Pods
def generateToken(podId: String, userId: String): String = {
"LALA-" + podId + "-" + userId
"LALA-" + RandomStringGenerator.randomAlphanumericString(8) + podId + "-" + userId
}
def userIsAllowedToUploadInPod(podId: String, userId: String): Boolean = {

View File

@ -178,6 +178,9 @@ package org.bigbluebutton.modules.present.business
if (currentUploadCommand != null && currentUploadCommand.filename == e.filename) {
uploadService.upload(currentUploadCommand.podId, currentUploadCommand.filename, currentUploadCommand.file, currentUploadCommand.isDownloadable);
currentUploadCommand = null;
// TODO
uploadService = null; // reset upload service so we can use new token for consecutive upload
} else {
}
@ -243,9 +246,7 @@ package org.bigbluebutton.modules.present.business
* @param e
*
*/
public function sharePresentation(e:PresenterCommands):void{
JSLog.warn("+++ PresentProxy:: sharePresentation1: " + e.presentationName, {});
JSLog.warn("+++ PresentProxy:: sharePresentation2: " + e.podId, {});
public function sharePresentation(e:PresenterCommands):void {
sender.sharePresentation(e.podId, e.presentationName);
}

View File

@ -6,12 +6,14 @@ package org.bigbluebutton.modules.present.commands
{
public static const CHANGE_PAGE_COMMAND:String = "presentation change page command";
public var podId:String;
public var pageId:String;
public var preloadCount:uint
public var preloadCount:uint;
public function ChangePageCommand(pageId: String, preloadCount:uint)
public function ChangePageCommand(podId: String, pageId: String, preloadCount:uint)
{
super(CHANGE_PAGE_COMMAND, true, false);
this.podId = podId;
this.pageId = pageId;
this.preloadCount = preloadCount;
}

View File

@ -6,12 +6,14 @@ package org.bigbluebutton.modules.present.events
{
public static const PRESENTATION_PAGE_CHANGED_EVENT:String = "presentation page changed event";
public var podId: String;
public var pageId: String;
public function PageChangedEvent(pageId: String)
public function PageChangedEvent(podId: String, pageId: String)
{
super(PRESENTATION_PAGE_CHANGED_EVENT, true, false);
this.pageId = pageId;
this.podId = podId;
}
}
}

View File

@ -7,11 +7,13 @@ package org.bigbluebutton.modules.present.events
public static const PAGE_LOADED_EVENT:String = "presentation page loaded event";
public var pageId: String;
public var podId: String;
public function PageLoadedEvent(pageId: String)
public function PageLoadedEvent(podId: String, pageId: String)
{
super(PAGE_LOADED_EVENT, true, false);
this.pageId = pageId;
this.podId = podId;
}
}
}

View File

@ -6,12 +6,14 @@ package org.bigbluebutton.modules.present.events
{
public static const PRESENTATION_CHANGED_EVENT: String = "presentation changed event";
public var podId: String;
public var presentationId: String;
public function PresentationChangedEvent(id: String)
public function PresentationChangedEvent(_podId: String, _presid: String)
{
super(PRESENTATION_CHANGED_EVENT, true, false);
presentationId = id;
podId = _podId;
presentationId = _presid;
}
}
}

View File

@ -18,9 +18,10 @@ package org.bigbluebutton.modules.present.model
public var xOffset: Number;
public var yOffset: Number;
public var widthRatio: Number;
public var heightRatio: Number
public var heightRatio: Number;
private var _pageLoadedListener:Function;
private var _parentPodId: String;
private var _swfLoader:URLLoader;
private var _swfLoaded:Boolean = false;
private var _txtLoader:URLLoader;
@ -73,13 +74,14 @@ package org.bigbluebutton.modules.present.model
return _txtUri;
}
public function loadPage(pageLoadedListener:Function, preloadCount:uint):void {
public function loadPage(pageLoadedListener:Function, podId: String, preloadCount:uint):void {
if (_swfLoaded && _txtLoaded) {
pageLoadedListener(_id, preloadCount);
pageLoadedListener(podId, _id, preloadCount);
return;
}
_pageLoadedListener = pageLoadedListener;
_parentPodId = podId;
_preloadCount = preloadCount;
if (!_swfLoaded) loadSwf();
@ -101,7 +103,7 @@ package org.bigbluebutton.modules.present.model
_swfLoaded = true;
if (_txtLoaded) {
if (_pageLoadedListener != null) {
_pageLoadedListener(_id, _preloadCount);
_pageLoadedListener(_parentPodId, _id, _preloadCount);
}
_preloadCount = 0;
}
@ -122,7 +124,7 @@ package org.bigbluebutton.modules.present.model
_txtLoaded = true;
if (_swfLoaded) {
if (_pageLoadedListener != null) {
_pageLoadedListener(_id, _preloadCount);
_pageLoadedListener(_parentPodId, _id, _preloadCount);
}
_preloadCount = 0;
}

View File

@ -52,6 +52,7 @@ package org.bigbluebutton.modules.present.model
}
public function addPresentation(p: Presentation):void {
JSLog.warn("+++ PresentationModel:: addPresentation: ", {});
_presentations.addItem(p);
}

View File

@ -65,7 +65,7 @@ package org.bigbluebutton.modules.present.model {
for (var i:int = 0; i < _presentationPods.length; i++) {
var pod: PresentationModel = _presentationPods.getItemAt(i) as PresentationModel;
JSLog.warn("+++ PresentationPodManager:: getPod podId=" + podId + " getPodId=" + pod.getPodId(), {});
// JSLog.warn("+++ PresentationPodManager:: getPod podId=" + podId + " getPodId=" + pod.getPodId(), {});
if (pod.getPodId() == podId) {
return pod;
}

View File

@ -8,6 +8,8 @@ package org.bigbluebutton.modules.present.services
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;
import org.bigbluebutton.main.api.JSLog;
public class PageLoaderService
{
@ -15,32 +17,35 @@ package org.bigbluebutton.modules.present.services
private var dispatcher:Dispatcher = new Dispatcher();
public function loadPage(cmd: ChangePageCommand):void {
// var page:Page = PresentationModel.getInstance().getPage(cmd.pageId);
// if (page != null) {
// LOGGER.debug("Loading page [{0}]", [cmd.pageId]);
// page.loadPage(pageLoadedListener, cmd.preloadCount);
// }
var page:Page = PresentationPodManager.getInstance().getPod(cmd.podId).getPage(cmd.pageId);
JSLog.warn("+++ PageLoaderService:: loadPage1: " + cmd.podId + "_____" + cmd.pageId, page != null);
if (page != null) {
LOGGER.debug("Loading page [{0}]", [cmd.pageId]);
page.loadPage(pageLoadedListener, cmd.podId, cmd.preloadCount);
}
}
public function pageLoadedListener(pageId:String, preloadCount:uint):void {
// var page: Page = PresentationModel.getInstance().getPage(pageId);
// if (page != null) {
// if (page.current) {
// // The page has been loaded and still the current displayed page.
// LOGGER.debug("Loaded page [{0}]. Dispatching event to display it.", [pageId]);
// var event: PageLoadedEvent = new PageLoadedEvent(page.id);
// dispatcher.dispatchEvent(event);
// }
//
// if (preloadCount > 0) {
// var pageIdParts:Array = pageId.split("/");
// LOGGER.debug("after split: {0}", [pageIdParts]);
// LOGGER.debug("trying to preload next page with id: {0}", [(parseInt(pageIdParts[1],10) + 1).toString()]);
// var changePageCommand: ChangePageCommand = new ChangePageCommand(pageIdParts[0]+"/"+(parseInt(pageIdParts[1], 10) + 1), preloadCount-1);
// dispatcher.dispatchEvent(changePageCommand);
// }
// }
public function pageLoadedListener(podId: String, pageId:String, preloadCount:uint):void {
var page: Page = PresentationPodManager.getInstance().getPod(podId).getPage(pageId);
JSLog.warn("+++ PageLoaderService:: pageLoadedListener1: " + podId + "_____" + pageId, {});
if (page != null) {
if (page.current) {
// The page has been loaded and still the current displayed page.
LOGGER.debug("Loaded page [{0}]. Dispatching event to display it.", [pageId]);
var event: PageLoadedEvent = new PageLoadedEvent(podId, page.id);
dispatcher.dispatchEvent(event);
}
if (preloadCount > 0) {
var pageIdParts:Array = pageId.split("/");
LOGGER.debug("after split: {0}", [pageIdParts]);
LOGGER.debug("trying to preload next page with id: {0}", [(parseInt(pageIdParts[1],10) + 1).toString()]);
var changePageCommand: ChangePageCommand = new ChangePageCommand(podId, pageIdParts[0]+"/"+(parseInt(pageIdParts[1], 10) + 1), preloadCount-1);
dispatcher.dispatchEvent(changePageCommand);
}
}
}
}
}

View File

@ -25,43 +25,41 @@ package org.bigbluebutton.modules.present.services
{
private static const LOGGER:ILogger = getClassLogger(PresentationService);
private static const NUM_PRELOAD:uint = 3;
private var model:PresentationModel;
private var podManager: PresentationPodManager;
private var sender:MessageSender;
private var receiver:MessageReceiver;
private var dispatcher:Dispatcher;
public function PresentationService() {
model = PresentationModel.getInstance();
podManager = PresentationPodManager.getInstance();
receiver = new MessageReceiver(this);
dispatcher = new Dispatcher();
}
public function pageChanged(pageId:String):void {
// var np: Page = model.getPage(pageId);
// if (np != null) {
// var oldPage: Page = PresentationModel.getInstance().getCurrentPage();
// if (oldPage != null) oldPage.current = false;
//
// np.current = true
//// trace(LOG + "Sending page changed event. page [" + np.id + "] oldpage current=[" + oldPage.current + "] newPage current=[" + np.current + "]");
// var changePageCommand: ChangePageCommand = new ChangePageCommand(np.id, NUM_PRELOAD);
// dispatcher.dispatchEvent(changePageCommand);
// }
public function pageChanged(podId: String, pageId:String):void {
var np: Page = podManager.getPod(podId).getPage(pageId);
if (np != null) {
var oldPage: Page = podManager.getPod(podId).getCurrentPage();
if (oldPage != null) oldPage.current = false;
np.current = true;
// 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);
}
}
public function pageMoved(pageId:String, xOffset:Number, yOffset:Number, widthRatio:Number, heightRatio:Number):void {
var np: Page = model.getPage(pageId);
if (np != null) {
np.xOffset = xOffset;
np.yOffset = yOffset;
np.widthRatio = widthRatio;
np.heightRatio = heightRatio;
// trace(LOG + "Sending page moved event. page [" + np.id + "] current=[" + np.current + "]");
var event: PageChangedEvent = new PageChangedEvent(np.id);
dispatcher.dispatchEvent(event);
}
// var np: Page = model.getPage(pageId);
// if (np != null) {
// np.xOffset = xOffset;
// np.yOffset = yOffset;
// np.widthRatio = widthRatio;
// np.heightRatio = heightRatio;
//// trace(LOG + "Sending page moved event. page [" + np.id + "] current=[" + np.current + "]");
// var event: PageChangedEvent = new PageChangedEvent(np.id);
// dispatcher.dispatchEvent(event);
// }
}
private function copyPageVOToPage(p: PageVO):Page {
@ -73,8 +71,6 @@ package org.bigbluebutton.modules.present.services
}
public function addPresentations(podId: String, presos:ArrayCollection):void {
JSLog.warn("+++ PresentationService:: addPresentations1: " + podId, {});
JSLog.warn("+++ PresentationService:: addPresentations2: " + presos.length, {});
for (var i:int = 0; i < presos.length; i++) {
var pres:PresentationVO = presos.getItemAt(i) as PresentationVO;
addPresentation(podId, pres);
@ -89,16 +85,16 @@ package org.bigbluebutton.modules.present.services
if (presentation.current) {
LOGGER.debug("Making presentation [{0}] current [{1}]", [presentation.id, presentation.current]);
var event: PresentationChangedEvent = new PresentationChangedEvent(pres.id);
var event: PresentationChangedEvent = new PresentationChangedEvent(podId, pres.id);
dispatcher.dispatchEvent(event);
var curPage:Page = presentation.getCurrentPage();
if (curPage != null) {
var changePageCommand: ChangePageCommand = new ChangePageCommand(curPage.id, NUM_PRELOAD);
var changePageCommand: ChangePageCommand = new ChangePageCommand(podId, curPage.id, NUM_PRELOAD);
dispatcher.dispatchEvent(changePageCommand);
LOGGER.debug("Sending page moved event to position page [{0}] current=[{1}]", [curPage.id, curPage.current]);
var pageChangedEvent: PageChangedEvent = new PageChangedEvent(curPage.id);
var pageChangedEvent: PageChangedEvent = new PageChangedEvent(podId, curPage.id);
dispatcher.dispatchEvent(pageChangedEvent);
}
}
@ -109,7 +105,7 @@ package org.bigbluebutton.modules.present.services
var pages:ArrayCollection = presVO.getPages() as ArrayCollection;
for (var k:int = 0; k < pages.length; k++) {
var page:PageVO = pages[k] as PageVO;
var pg:Page = copyPageVOToPage(page)
var pg:Page = copyPageVOToPage(page);
presoPages.addItem(pg);
}
@ -131,12 +127,14 @@ package org.bigbluebutton.modules.present.services
LOGGER.debug("Making presentation [{0}] the active presentation.", [presentationId]);
newPres.current = true;
var event: PresentationChangedEvent = new PresentationChangedEvent(presentationId);
var event: PresentationChangedEvent = new PresentationChangedEvent(podId, presentationId);
dispatcher.dispatchEvent(event);
var curPage:Page = podManager.getPod(podId).getCurrentPage();
JSLog.warn("+++ PresentationService:: changeCurrentPresentation3: " + curPage.id, curPage != null);
if (curPage != null) {
var changePageCommand: ChangePageCommand = new ChangePageCommand(curPage.id, NUM_PRELOAD);
var changePageCommand: ChangePageCommand = new ChangePageCommand(podId, curPage.id, NUM_PRELOAD);
dispatcher.dispatchEvent(changePageCommand);
}
} else {
@ -145,24 +143,24 @@ package org.bigbluebutton.modules.present.services
}
public function removeAllPresentations():void {
model.removeAllPresentations();
// model.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.
// 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.
}
}
}

View File

@ -70,6 +70,7 @@ package org.bigbluebutton.modules.present.services.messaging
messageName == "SendCaptionHistoryRespMsg" ||
messageName == "GetGroupChatMsgsRespMsg" ||
messageName == "DoLatencyTracerMsg" ||
messageName == "PresentationConversionUpdateEvtMsg" ||
messageName == "ServerToClientLatencyTracerMsg") {
} else {
@ -124,7 +125,10 @@ package org.bigbluebutton.modules.present.services.messaging
}
private function handleSetCurrentPageEvtMsg(msg:Object):void {
service.pageChanged(msg.body.pageId);
JSLog.warn("__--__Presentation received: handleSetCurrentPageEvtMsg" + msg.body.podId, {});
JSLog.warn("__--__Presentation received: handleSetCurrentPageEvtMsg" + msg.body.pageId, {});
service.pageChanged(msg.body.podId, msg.body.pageId);
}
private function validatePage(map:Object):Boolean {
@ -192,9 +196,6 @@ package org.bigbluebutton.modules.present.services.messaging
var presVO: PresentationVO = processUploadedPresentation(msg.body.presentation);
var podId: String = msg.body.podId as String;
JSLog.warn("+++ Receiver:: handlePresentationConversionCompletedEvtMsg1: " + podId, {});
JSLog.warn("+++ Receiver:: handlePresentationConversionCompletedEvtMsg2: " + presVO.id, {});
JSLog.warn("+++ Receiver:: handlePresentationConversionCompletedEvtMsg3: " + presVO.name, {});
service.addPresentation(podId, presVO);
var uploadEvent:ConversionCompletedEvent = new ConversionCompletedEvent(podId, presVO.id, presVO.name);

View File

@ -141,9 +141,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function initData():void {
presentOptions = Options.getOptions(PresentOptions) as PresentOptions;
JSLog.warn("+++ FileUploadWindow:: initData: " + podId, {});
}
private function handleThumbnailsProgressEvent(event:CreatingThumbnailsEvent):void {
@ -230,9 +227,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
uploadCmd.isDownloadable = isDownloadable;
uploadCmd.podId = podId;
JSLog.warn("+++ FileUploadWindow:: startUpload: " + podId, {});
globalDispatch.dispatchEvent(uploadCmd);
letUserDownload.visible = false;
}
@ -326,8 +320,6 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function handleConversionCompleted(e:ConversionCompletedEvent):void{
JSLog.warn("+++ FileUploadWindow:: handleConversionCompleted1: " + e.presId, {});
JSLog.warn("+++ FileUploadWindow:: handleConversionCompleted2: " + e.podId, {});
enableClosing();
globalDispatch.dispatchEvent(new ChangePresentationCommand(e.podId, e.presId));
globalDispatch.dispatchEvent(new UploadEvent(UploadEvent.CLOSE_UPLOAD_WINDOW));

View File

@ -339,7 +339,8 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function handleDisplaySlideEvent(event:DisplaySlideEvent):void {
var presentationModel: PresentationModel = PresentationPodManager.getInstance().getPod(podId); // GOOD
var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId);
if (presentationModel != null) {
var curPage:Page = presentationModel.getCurrentPage();
if (curPage != null) {
displaySlideNumber(curPage.num);
@ -348,6 +349,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
fitSlideToWindowMaintainingAspectRatio();
}
}
}
public function getPrefferedPosition():String{
return MainCanvas.MIDDLE;
@ -386,33 +388,43 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
uploadPres.visible = isPresenter;
downloadPres.visible = !isPresenter;
// var page:Page = PresentationModel.getInstance().getCurrentPage();
// if (page != null) {
// displaySlideNumber(page.num);
// }
// displaySlideNavigationControls(isPresenter, !!page);
//
// setControlBarState("presenter");
var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId);
if (presentationModel != null) {
var page:Page = presentationModel.getCurrentPage();
if (page != null) {
displaySlideNumber(page.num);
}
displaySlideNavigationControls(isPresenter, !!page);
setControlBarState("presenter");
}
}
private function handlePresentationChangedEvent(e:PresentationChangedEvent) : void {
// currentPresentation = PresentationModel.getInstance().getCurrentPresentationName();
//
// slideView.setSlides();
// slideView.visible = true;
// var page : Page = PresentationModel.getInstance().getCurrentPage();
// if (page != null) {
// displaySlideNumber(page.num);
// }
//
// if (UsersUtil.amIPresenter()) {
// displaySlideNavigationControls(true, !!page);
// }
// else {
// displaySlideNavigationControls(false, !!page)
// }
// onResetZoom();
// updateDownloadBtn();
if (podId != e.podId) {
return;
}
var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId);
if (presentationModel != null) {
currentPresentation = presentationModel.getCurrentPresentationName();
slideView.setSlides(podId);
slideView.visible = true;
var page : Page = presentationModel.getCurrentPage();
if (page != null) {
displaySlideNumber(page.num);
}
if (UsersUtil.amIPresenter()) {
displaySlideNavigationControls(true, !!page);
}
else {
displaySlideNavigationControls(false, !!page)
}
onResetZoom();
updateDownloadBtn();
}
}
@ -472,21 +484,27 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
backButton.styleName = "presentationBackButtonDisabledStyle" + styleNameExt;
}
// if (pageNumber < PresentationModel.getInstance().getNumberOfPages()) {
// forwardButton.mouseEnabled = true;
// forwardButton.styleName = "presentationForwardButtonStyle" + styleNameExt;
// } else {
// forwardButton.mouseEnabled = false;
// forwardButton.styleName = "presentationForwardButtonDisabledStyle" + styleNameExt;
// }
var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId);
if (presentationModel != null) {
if (pageNumber < presentationModel.getNumberOfPages()) {
forwardButton.mouseEnabled = true;
forwardButton.styleName = "presentationForwardButtonStyle" + styleNameExt;
} else {
forwardButton.mouseEnabled = false;
forwardButton.styleName = "presentationForwardButtonDisabledStyle" + styleNameExt;
}
}
}
private function displaySlideNumber(currentSlide:int):void {
disableSlideNavigationButtons(currentSlide);
// btnSlideNum.label = "" + currentSlide + '/' + PresentationModel.getInstance().getNumberOfPages();
// btnSlideNum.accessibilityName = ResourceUtil.getInstance().getString('bbb.presentation.btnSlideNum.accessibilityName', [currentSlide, PresentationModel.getInstance().getNumberOfPages()])
var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId);
if (presentationModel != null) {
btnSlideNum.label = "" + currentSlide + '/' + presentationModel.getNumberOfPages();
btnSlideNum.accessibilityName = ResourceUtil.getInstance().getString('bbb.presentation.btnSlideNum.accessibilityName',
[currentSlide, presentationModel.getNumberOfPages()])
}
}
private function clearPresentation(e:UploadEvent):void{
slideView.visible = false;
@ -505,15 +523,17 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function goToPreviousSlide():void {
// if (PresentationModel.getInstance().getCurrentPage().num > 1) {
// dispatchEvent(new GoToPrevPageCommand());
// }
var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId);
if (presentationModel != null && presentationModel.getCurrentPage().num > 1) {
dispatchEvent(new GoToPrevPageCommand());
}
}
private function goToNextSlide():void {
// if (PresentationModel.getInstance().getCurrentPage().num < PresentationModel.getInstance().getNumberOfPages()) {
// dispatchEvent(new GoToNextPageCommand());
// }
var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId);
if (presentationModel != null && presentationModel.getCurrentPage().num < presentationModel.getNumberOfPages()) {
dispatchEvent(new GoToNextPageCommand());
}
}
private function showPercentageInDataTip(val:String):String {
@ -664,9 +684,10 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function updateStyles():void {
// if (PresentationModel.getInstance().getCurrentPage()) {
// disableSlideNavigationButtons(PresentationModel.getInstance().getCurrentPage().num);
// }
var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId);
if (presentationModel != null && presentationModel.getCurrentPage()) {
disableSlideNavigationButtons(presentationModel.getCurrentPage().num);
}
}
private function onPollStartButtonClicked():void {
@ -850,14 +871,17 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
return;
}
// var downloadablePresentations:ArrayCollection = PresentationModel.getInstance().getDownloadablePresentations();
// if (presentOptions.enableDownload && downloadablePresentations.length > 0 && !UsersUtil.amIPresenter()) {
// LOGGER.debug("Enabling download presentation button. There are {0} presentations available for downloading.", [downloadablePresentations.length]);
// downloadPres.visible = true;
// } else {
// LOGGER.debug("Disabling download presentation button. There are {0} presentations available for downloading.", [downloadablePresentations.length]);
// downloadPres.visible = false;
// }
var presentationModel:PresentationModel = PresentationPodManager.getInstance().getPod(podId);
if (presentationModel != null) {
var downloadablePresentations:ArrayCollection = presentationModel.getDownloadablePresentations();
if (presentOptions.enableDownload && downloadablePresentations.length > 0 && !UsersUtil.amIPresenter()) {
LOGGER.debug("Enabling download presentation button. There are {0} presentations available for downloading.", [downloadablePresentations.length]);
downloadPres.visible = true;
} else {
LOGGER.debug("Disabling download presentation button. There are {0} presentations available for downloading.", [downloadablePresentations.length]);
downloadPres.visible = false;
}
}
}
public function receiveToolbars(wt:WhiteboardToolbar, wtt:WhiteboardTextToolbar):void {

View File

@ -64,10 +64,12 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
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;
import org.bigbluebutton.modules.whiteboard.views.WhiteboardCanvas;
import org.bigbluebutton.util.i18n.ResourceUtil;
import org.bigbluebutton.main.api.JSLog;
private static const LOGGER:ILogger = getClassLogger(SlideView);
@ -112,24 +114,24 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
}
public function setSlides():void {
// var pres: Presentation = PresentationModel.getInstance().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. */
// var dataSortField:SortField = new SortField();
// dataSortField.name = "num";
// dataSortField.numeric = true;
//
// /* Create the Sort object and add the SortField object created earlier to the array of fields to sort on. */
// var numericDataSort:Sort = new Sort();
// numericDataSort.fields = [dataSortField];
//
// /* Set the ArrayCollection object's sort property to our custom sort, and refresh the ArrayCollection. */
// pageCache.sort = numericDataSort;
// pageCache.refresh();
// thumbnailView.dataProvider = pageCache;
// }
public function setSlides(podId: String):void {
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. */
var dataSortField:SortField = new SortField();
dataSortField.name = "num";
dataSortField.numeric = true;
/* Create the Sort object and add the SortField object created earlier to the array of fields to sort on. */
var numericDataSort:Sort = new Sort();
numericDataSort.fields = [dataSortField];
/* Set the ArrayCollection object's sort property to our custom sort, and refresh the ArrayCollection. */
pageCache.sort = numericDataSort;
pageCache.refresh();
thumbnailView.dataProvider = pageCache;
}
}
public function setSelectedSlide(slideNum:int):void {
@ -287,14 +289,15 @@ 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 {
JSLog.warn("+++--- SlideView:: handlePageChangedEvent: " + e.podId, {});
LOGGER.debug("Got a page changed event for page [{0}]", [e.pageId]);
// var page:Page = PresentationModel.getInstance().getPage(e.pageId);
// if (page != null) {
// if (! UsersUtil.amIPresenter()) {
// // if we are presenter, we don't need to reposition our view of the page
// positionPage(page);
// }
// }
var page:Page = PresentationPodManager.getInstance().getPod(e.podId).getPage(e.pageId);
if (page != null) {
if (! UsersUtil.amIPresenter()) {
// if we are presenter, we don't need to reposition our view of the page
positionPage(page);
}
}
}
private function positionPage(page:Page):void {
@ -315,22 +318,24 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
private function handlePageLoadedEvent(e:PageLoadedEvent):void {
LOGGER.debug("Got a page loaded event for page [{0}]", [e.pageId]);
// var page:Page = PresentationModel.getInstance().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");
// }
JSLog.warn("+++--- SlideView:: handlePageLoadedEvent: " + e.pageId + " " + e.podId, {});
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 {
@ -377,12 +382,18 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
}
private function handleSlideLoadedCompleteEvent(event:Event):void {
JSLog.warn("+++--- SlideView:: handleSlideLoadedCompleteEvent: ", {});
LOGGER.debug("Page has been loaded by swfLoader.");
slideModel.resetForNewSlide(slideLoader.contentWidth, slideLoader.contentHeight);
dispatchNewSlideDisplayedEvent(slideModel.pageOrigW, slideModel.pageOrigH);
}
private function dispatchNewSlideDisplayedEvent(slideRealWidth:int, slideRealHeight:int):void {
JSLog.warn("+++--- SlideView:: dispatchNewSlideDisplayedEvent: ", {});
var dispEvent:DisplaySlideEvent = new DisplaySlideEvent(DisplaySlideEvent.DISPLAY_SLIDE_EVENT);
dispEvent.slideWidth = slideRealWidth;
dispEvent.slideHeight = slideRealHeight;