From 3b44d0eac2281276fe15db71e35e79be468e603f Mon Sep 17 00:00:00 2001 From: Richard Alam Date: Tue, 1 Aug 2017 14:50:44 -0700 Subject: [PATCH] - fix issue where late joiners displays the wrong slide --- .../core/apps/PresentationModel.scala | 12 ++++------- .../presentation/NewPresentationMsgHdlr.scala | 2 -- .../apps/presentation/PresentationApp2x.scala | 5 +++++ ...ntationConversionCompletedPubMsgHdlr.scala | 4 ---- .../SetCurrentPresentationPubMsgHdlr.scala | 2 -- .../DocumentConversionServiceImp.java | 2 +- .../PresentationUrlDownloadService.java | 6 +++--- .../presentation/UploadedPresentation.java | 13 ++++++++++-- .../SwfSlidesGenerationProgressNotifier.java | 2 +- .../messages/DocPageCompletedProgress.java | 4 +++- .../org/bigbluebutton/api2/MsgBuilder.scala | 7 ++++--- .../services/messaging/MessageReceiver.as | 3 --- .../views/UploadedPresentationRenderer.mxml | 1 - .../web/controllers/ApiController.groovy | 20 ++++++++++--------- .../controllers/PresentationController.groovy | 3 ++- 15 files changed, 45 insertions(+), 41 deletions(-) mode change 100644 => 100755 bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/UploadedPresentationRenderer.mxml 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 0cf5ee018b..c01b54467c 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 @@ -56,11 +56,10 @@ class PresentationModel { }) presentations.get(presId) match { - case Some(pres) => { + case Some(pres) => val cp = pres.copy(current = true) savePresentation(cp) Some(cp) - } case None => None } } @@ -98,17 +97,14 @@ class PresentationModel { private def makePageCurrent(pres: Presentation, pageId: String): Option[Presentation] = { pres.pages.get(pageId) match { - case Some(newCurPage) => { + case Some(newCurPage) => val page = newCurPage.copy(current = true) val newPages = pres.pages + (page.id -> page) val newPres = pres.copy(pages = newPages) Some(newPres) - // println("Making page[" + page.id + "] current[" + page.current + "]") - } - case None => { - // println("Could not find page[" + page + "] in presentation [" + pres.id + "]") + case None => None - } + } } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/NewPresentationMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/NewPresentationMsgHdlr.scala index 71cbcaf57b..67120c59d3 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/NewPresentationMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/NewPresentationMsgHdlr.scala @@ -18,7 +18,5 @@ trait NewPresentationMsgHdlr { val event = NewPresentationEvtMsg(header, body) val msgEvent = BbbCommonEnvCoreMsg(envelope, event) outGW.send(msgEvent) - - //record(event) } } 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 22bf62cae6..9ec3ca312d 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 @@ -29,6 +29,11 @@ class PresentationApp2x( presentations.foreach(presentation => { liveMeeting.presModel.addPresentation(presentation) }) + + liveMeeting.presModel.getCurrentPresentation() match { + case Some(p) => // do nothing + case None => setCurrentPresentation(presentations.head.id) + } } def presentationConversionCompleted(presentation: Presentation) { diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationConversionCompletedPubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationConversionCompletedPubMsgHdlr.scala index f9497fa4e1..64f62b6131 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationConversionCompletedPubMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/PresentationConversionCompletedPubMsgHdlr.scala @@ -20,8 +20,6 @@ trait PresentationConversionCompletedPubMsgHdlr { val event = PresentationConversionCompletedEvtMsg(header, body) val msgEvent = BbbCommonEnvCoreMsg(envelope, event) outGW.send(msgEvent) - - //record(event) } val pages = new collection.mutable.HashMap[String, PageVO] @@ -35,8 +33,6 @@ trait PresentationConversionCompletedPubMsgHdlr { val pres = new Presentation(msg.body.presentation.id, msg.body.presentation.name, msg.body.presentation.current, pages.toMap, msg.body.presentation.downloadable) - log.debug("PresentationConversionCompletedPubMsg name={}", pres.name) - presentationConversionCompleted(pres) broadcastEvent(msg) } diff --git a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SetCurrentPresentationPubMsgHdlr.scala b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SetCurrentPresentationPubMsgHdlr.scala index 319bdaf1b4..1d75a8a29d 100755 --- a/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SetCurrentPresentationPubMsgHdlr.scala +++ b/akka-bbb-apps/src/main/scala/org/bigbluebutton/core/apps/presentation/SetCurrentPresentationPubMsgHdlr.scala @@ -19,8 +19,6 @@ trait SetCurrentPresentationPubMsgHdlr { val event = SetCurrentPresentationEvtMsg(header, body) val msgEvent = BbbCommonEnvCoreMsg(envelope, event) outGW.send(msgEvent) - - //record(event) } for { diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionServiceImp.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionServiceImp.java index e2c3130cb1..48cfe0b2a0 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionServiceImp.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/DocumentConversionServiceImp.java @@ -39,7 +39,7 @@ public class DocumentConversionServiceImp implements DocumentConversionService { public void processDocument(UploadedPresentation pres) { SupportedDocumentFilter sdf = new SupportedDocumentFilter(gw); log.info("Start presentation conversion. meetingId=" + pres.getMeetingId() - + " presId=" + pres.getId() + " name=" + pres.getName()); + + " presId=" + pres.getId() + " name=" + pres.getName() + " current=" + pres.isCurrent()); if (sdf.isSupported(pres)) { String fileType = pres.getFileType(); diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/PresentationUrlDownloadService.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/PresentationUrlDownloadService.java index 07fc0258e2..dc4ec3c5a6 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/PresentationUrlDownloadService.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/PresentationUrlDownloadService.java @@ -59,9 +59,9 @@ public class PresentationUrlDownloadService { } public void processUploadedFile(String meetingId, String presId, - String filename, File presFile) { + String filename, File presFile, Boolean current) { UploadedPresentation uploadedPres = new UploadedPresentation(meetingId, - presId, filename, presentationBaseURL); + presId, filename, presentationBaseURL, current); uploadedPres.setUploadedFile(presFile); processUploadedPresentation(uploadedPres); } @@ -145,7 +145,7 @@ public class PresentationUrlDownloadService { processUploadedFile(destinationMeetingId, presId, "default-" + presentationSlide.toString() + "." + filenameExt, - newPresentation); + newPresentation, true); } public String generatePresentationId(String name) { diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/UploadedPresentation.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/UploadedPresentation.java index 3aff2d8456..4105b00d91 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/UploadedPresentation.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/UploadedPresentation.java @@ -31,14 +31,15 @@ public final class UploadedPresentation { private String conversionStatus; private final String baseUrl; private boolean isDownloadable = false; + private boolean current = false; - public UploadedPresentation(String meetingId, String id, String name, - String baseUrl) { + public UploadedPresentation(String meetingId, String id, String name, String baseUrl, Boolean current) { this.meetingId = meetingId; this.id = id; this.name = name; this.baseUrl = baseUrl; this.isDownloadable = false; + this.current = current; } public File getUploadedFile() { @@ -96,4 +97,12 @@ public final class UploadedPresentation { public void setDownloadable() { this.isDownloadable = true; } + + public boolean isCurrent() { + return current; + } + + public void setCurrent(Boolean value) { + this.current = value; + } } diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SwfSlidesGenerationProgressNotifier.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SwfSlidesGenerationProgressNotifier.java index 5320353781..55513b90c8 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SwfSlidesGenerationProgressNotifier.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/imp/SwfSlidesGenerationProgressNotifier.java @@ -69,7 +69,7 @@ public class SwfSlidesGenerationProgressNotifier { pres.getId(), pres.getId(), pres.getName(), "notUsedYet", "notUsedYet", pres.isDownloadable(), ConversionMessageConstants.CONVERSION_COMPLETED_KEY, - pres.getNumberOfPages(), generateBasePresUrl(pres)); + pres.getNumberOfPages(), generateBasePresUrl(pres), pres.isCurrent()); messagingService.sendDocConversionMsg(progress); } diff --git a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/DocPageCompletedProgress.java b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/DocPageCompletedProgress.java index 9a8d64f906..b885016521 100755 --- a/bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/DocPageCompletedProgress.java +++ b/bbb-common-web/src/main/java/org/bigbluebutton/presentation/messages/DocPageCompletedProgress.java @@ -11,11 +11,12 @@ public class DocPageCompletedProgress implements IDocConversionMsg { public final String key; public final Integer numPages; public final String presBaseUrl; + public final Boolean current; public DocPageCompletedProgress(String meetingId, String presId, String presInstance, String filename, String uploaderId, String authzToken, Boolean downloadable, String key, - Integer numPages, String presBaseUrl) { + Integer numPages, String presBaseUrl, Boolean current) { this.meetingId = meetingId; this.presId = presId; this.presInstance = presInstance; @@ -26,5 +27,6 @@ public class DocPageCompletedProgress implements IDocConversionMsg { this.key = key; this.numPages = numPages; this.presBaseUrl = presBaseUrl; + this.current = current; } } diff --git a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala index 2705f79f74..6d470f4d58 100755 --- a/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala +++ b/bbb-common-web/src/main/scala/org/bigbluebutton/api2/MsgBuilder.scala @@ -73,7 +73,8 @@ object MsgBuilder { val header = BbbClientMsgHeader(PresentationConversionCompletedSysPubMsg.NAME, msg.meetingId, msg.authzToken) val pages = generatePresentationPages(msg.presId, msg.numPages.intValue(), msg.presBaseUrl) - val presentation = PresentationVO(msg.presId, msg.filename, current=true, pages.values.toVector, msg.downloadable) + val presentation = PresentationVO(msg.presId, msg.filename, + current=msg.current.booleanValue(), pages.values.toVector, msg.downloadable.booleanValue()) val body = PresentationConversionCompletedSysPubMsgBody(messageKey = msg.key, code = msg.key, presentation) @@ -85,7 +86,7 @@ object MsgBuilder { var pages = new scala.collection.mutable.HashMap[String, PageVO] for (i <- 1 to numPages) { val id = presId + "/" + i - val num = i; + val num = i val current = if (i == 1) true else false val thumbnail = presBaseUrl + "/thumbnail/" + i val swfUri = presBaseUrl + "/slide/" + i @@ -93,7 +94,7 @@ object MsgBuilder { val txtUri = presBaseUrl + "/textfiles/" + i val svgUri = presBaseUrl + "/svg/" + i - val p = new PageVO(id = id, num = num, thumbUri = thumbnail, swfUri = swfUri, + val p = PageVO(id = id, num = num, thumbUri = thumbnail, swfUri = swfUri, txtUri = txtUri, svgUri = svgUri, current = current) pages += p.id -> p diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as b/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as index adb759f942..0752fbd78b 100755 --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/services/messaging/MessageReceiver.as @@ -155,8 +155,6 @@ package org.bigbluebutton.modules.present.services.messaging private function handlePresentationConversionCompletedEvtMsg(msg:Object):void { var presVO: PresentationVO = processUploadedPresentation(msg.body.presentation); - LOGGER.debug("Adding presentation name=" + presVO.name); - service.addPresentation(presVO); var uploadEvent:ConversionCompletedEvent = new ConversionCompletedEvent(presVO.id, presVO.name); @@ -182,7 +180,6 @@ package org.bigbluebutton.modules.present.services.messaging } private function handlePresentationPageCountErrorEvtMsg(msg:Object):void { - LOGGER.debug("handlePageCountExceededUpdateMessageCallback " + msg); dispatcher.dispatchEvent(new ConversionPageCountMaxed(msg.body.maxNumberPages as Number)); } diff --git a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/UploadedPresentationRenderer.mxml b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/UploadedPresentationRenderer.mxml old mode 100644 new mode 100755 index 6bd0bf3043..c10a183eae --- a/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/UploadedPresentationRenderer.mxml +++ b/bigbluebutton-client/src/org/bigbluebutton/modules/present/ui/views/UploadedPresentationRenderer.mxml @@ -22,7 +22,6 @@ private var globalDispatch:Dispatcher = new Dispatcher(); private function showPresentation():void { - LOGGER.debug("FileUploadWindow::showPresentation() {0}", [data.id]); var changePresCommand:ChangePresentationCommand = new ChangePresentationCommand(data.id); globalDispatch.dispatchEvent(changePresCommand); diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy index cd3435bc83..88a3bd2e68 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/ApiController.groovy @@ -1825,7 +1825,8 @@ class ApiController { requestBody = StringUtils.isEmpty(requestBody) ? null : requestBody; if (requestBody == null) { - downloadAndProcessDocument(presentationService.defaultUploadedPresentation, conf.getInternalId()); + downloadAndProcessDocument(presentationService.defaultUploadedPresentation, conf.getInternalId(), + true /* default presentation */ ); } else { log.debug "Request body: \n" + requestBody; def xml = new XmlSlurper().parseText(requestBody); @@ -1836,11 +1837,12 @@ class ApiController { // need to iterate over presentation files and process them module.children().each { document -> if (!StringUtils.isEmpty(document.@url.toString())) { - downloadAndProcessDocument(document.@url.toString(), conf.getInternalId()); + downloadAndProcessDocument(document.@url.toString(), conf.getInternalId(), true /* default presentation */); } else if (!StringUtils.isEmpty(document.@name.toString())) { def b64 = new Base64() def decodedBytes = b64.decode(document.text().getBytes()) - processDocumentFromRawBytes(decodedBytes, document.@name.toString(), conf.getInternalId()); + processDocumentFromRawBytes(decodedBytes, document.@name.toString(), + conf.getInternalId(), true /* default presentation */); } else { log.debug("presentation module config found, but it did not contain url or name attributes"); } @@ -1850,7 +1852,7 @@ class ApiController { } } - def processDocumentFromRawBytes(bytes, presFilename, meetingId) { + def processDocumentFromRawBytes(bytes, presFilename, meetingId, current) { def filenameExt = FilenameUtils.getExtension(presFilename); String presentationDir = presentationService.getPresentationDir() def presId = Util.generatePresentationId(presFilename) @@ -1864,12 +1866,12 @@ class ApiController { fos.flush() fos.close() - processUploadedFile(meetingId, presId, presFilename, pres); + processUploadedFile(meetingId, presId, presFilename, pres, current); } } - def downloadAndProcessDocument(address, meetingId) { + def downloadAndProcessDocument(address, meetingId, current) { log.debug("ApiController#downloadAndProcessDocument(${address}, ${meetingId})"); String presFilename = address.tokenize("/")[-1]; def filenameExt = FilenameUtils.getExtension(presFilename); @@ -1883,7 +1885,7 @@ class ApiController { if (presDownloadService.savePresentation(meetingId, newFilePath, address)) { def pres = new File(newFilePath) - processUploadedFile(meetingId, presId, presFilename, pres); + processUploadedFile(meetingId, presId, presFilename, pres, current); } else { log.error("Failed to download presentation=[${address}], meeting=[${meetingId}]") } @@ -1891,9 +1893,9 @@ class ApiController { } - def processUploadedFile(meetingId, presId, filename, presFile) { + def processUploadedFile(meetingId, presId, filename, presFile, current) { def presentationBaseUrl = presentationService.presentationBaseUrl - UploadedPresentation uploadedPres = new UploadedPresentation(meetingId, presId, filename, presentationBaseUrl); + UploadedPresentation uploadedPres = new UploadedPresentation(meetingId, presId, filename, presentationBaseUrl, current); uploadedPres.setUploadedFile(presFile); presentationService.processUploadedPresentation(uploadedPres); } diff --git a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy index 5ec325d617..0612451351 100755 --- a/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy +++ b/bigbluebutton-web/grails-app/controllers/org/bigbluebutton/web/controllers/PresentationController.groovy @@ -74,7 +74,8 @@ class PresentationController { } def presentationBaseUrl = presentationService.presentationBaseUrl - UploadedPresentation uploadedPres = new UploadedPresentation(meetingId, presId, presFilename, presentationBaseUrl); + UploadedPresentation uploadedPres = new UploadedPresentation(meetingId, presId, + presFilename, presentationBaseUrl, false /* default presentation */); if(isDownloadable) { log.debug "@Setting file to be downloadable..."