Refactoring to bbb-090
This commit is contained in:
parent
2c5ff4f7cd
commit
1de0756aac
@ -19,7 +19,8 @@
|
||||
package org.bigbluebutton.conference.service.presentation;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.red5.logging.Red5LoggerFactory;
|
||||
import org.red5.logging.Red5LoggerFactory;
|
||||
|
||||
public class ConversionUpdatesProcessor {
|
||||
private static Logger log = Red5LoggerFactory.getLogger(ConversionUpdatesProcessor.class, "bigbluebutton");
|
||||
|
||||
@ -48,9 +49,9 @@ public class ConversionUpdatesProcessor {
|
||||
|
||||
public void sendConversionCompleted(String messageKey, String conference,
|
||||
String code, String presId, Integer numberOfPages, String presName,
|
||||
String presBaseUrl) {
|
||||
String presBaseUrl, Boolean presDownloadable) {
|
||||
presentationApplication.sendConversionCompleted(messageKey, conference,
|
||||
code, presId, numberOfPages, presName, presBaseUrl);
|
||||
code, presId, numberOfPages, presName, presBaseUrl, presDownloadable);
|
||||
}
|
||||
|
||||
public void setPresentationApplication(PresentationApplication a) {
|
||||
|
@ -49,10 +49,10 @@ public class PresentationMessageListener implements MessageHandler {
|
||||
|
||||
private void sendConversionCompleted(String messageKey, String conference,
|
||||
String code, String presId, Integer numberOfPages,
|
||||
String filename, String presBaseUrl) {
|
||||
String filename, String presBaseUrl, Boolean presDownloadable) {
|
||||
|
||||
conversionUpdatesProcessor.sendConversionCompleted(messageKey, conference,
|
||||
code, presId, numberOfPages, filename, presBaseUrl);
|
||||
code, presId, numberOfPages, filename, presBaseUrl, presDownloadable);
|
||||
}
|
||||
|
||||
|
||||
@ -96,8 +96,9 @@ public class PresentationMessageListener implements MessageHandler {
|
||||
} else if(messageKey.equalsIgnoreCase(CONVERSION_COMPLETED_KEY)){
|
||||
Integer numberOfPages = new Integer((String) map.get("numberOfPages"));
|
||||
String presBaseUrl = (String) map.get("presentationBaseUrl");
|
||||
Boolean presDownloadable = new Boolean((String) map.get("presDownloadable"));
|
||||
sendConversionCompleted(messageKey, conference, code,
|
||||
presId, numberOfPages, filename, presBaseUrl);
|
||||
presId, numberOfPages, filename, presBaseUrl, presDownloadable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public interface IBigBlueButtonInGW {
|
||||
int pagesCompleted, String presName);
|
||||
|
||||
void sendConversionCompleted(String messageKey, String meetingId,
|
||||
String code, String presId, int numPages, String presName, String presBaseUrl);
|
||||
String code, String presId, int numPages, String presName, String presBaseUrl, boolean presDownloadable);
|
||||
|
||||
// Polling
|
||||
void getPolls(String meetingID, String requesterID);
|
||||
|
@ -247,11 +247,11 @@ class BigBlueButtonInGW(bbbGW: BigBlueButtonGateway, presUtil: PreuploadedPresen
|
||||
|
||||
def sendConversionCompleted(messageKey: String, meetingId: String,
|
||||
code: String, presentationId: String, numPages: Int,
|
||||
presName: String, presBaseUrl: String) {
|
||||
presName: String, presBaseUrl: String, presDownloadable: Boolean) {
|
||||
// println("******************** PRESENTATION CONVERSION COMPLETED MESSAGE ***************************** ")
|
||||
val pages = generatePresentationPages(presentationId, numPages, presBaseUrl)
|
||||
|
||||
val presentation = new Presentation(id=presentationId, name=presName, pages=pages)
|
||||
val presentation = new Presentation(id=presentationId, name=presName, pages=pages, downloadable=presDownloadable)
|
||||
bbbGW.accept(new PresentationConversionCompleted(meetingId, messageKey,
|
||||
code, presentation))
|
||||
|
||||
|
@ -36,6 +36,7 @@ object Constants {
|
||||
val FORCE = "force"
|
||||
val RESPONSE = "response"
|
||||
val PRESENTATION_ID = "presentation_id"
|
||||
val DOWNLOADABLE = "downloadable"
|
||||
val X_OFFSET = "x_offset"
|
||||
val Y_OFFSET = "y_offset"
|
||||
val WIDTH_RATIO = "width_ratio"
|
||||
|
@ -1,7 +1,8 @@
|
||||
package org.bigbluebutton.core.apps.presentation
|
||||
|
||||
case class Presentation(id: String, name: String, current: Boolean = false,
|
||||
pages: scala.collection.immutable.HashMap[String, Page])
|
||||
pages: scala.collection.immutable.HashMap[String, Page],
|
||||
downloadable: Boolean)
|
||||
|
||||
case class Page(id: String, num: Int,
|
||||
thumbUri: String = "",
|
||||
|
@ -113,6 +113,7 @@ class PresentationClientMessageSender(service: ConnectionInvokerService) extends
|
||||
presentation.put("id", msg.presentation.id)
|
||||
presentation.put("name", msg.presentation.name)
|
||||
presentation.put("current", msg.presentation.current:java.lang.Boolean)
|
||||
presentation.put("downloadable", msg.presentation.downloadable:java.lang.Boolean)
|
||||
|
||||
val pages = new ArrayList[Page]()
|
||||
|
||||
@ -169,6 +170,7 @@ class PresentationClientMessageSender(service: ConnectionInvokerService) extends
|
||||
presentation.put("id", pres.id)
|
||||
presentation.put("name", pres.name)
|
||||
presentation.put("current", pres.current:java.lang.Boolean)
|
||||
presentation.put("downloadable", pres.downloadable:java.lang.Boolean)
|
||||
|
||||
// Get the pages for a presentation
|
||||
val pages = new ArrayList[Page]()
|
||||
@ -259,6 +261,7 @@ class PresentationClientMessageSender(service: ConnectionInvokerService) extends
|
||||
presentation.put("id", msg.presentation.id)
|
||||
presentation.put("name", msg.presentation.name)
|
||||
presentation.put("current", msg.presentation.current:java.lang.Boolean)
|
||||
presentation.put("downloadable", msg.presentation.downloadable:java.lang.Boolean)
|
||||
|
||||
// Get the pages for a presentation
|
||||
val pages = new ArrayList[Page]()
|
||||
|
@ -64,7 +64,8 @@ object PesentationMessageToJsonConverter {
|
||||
presentation.put(Constants.ID, pres.id)
|
||||
presentation.put(Constants.NAME, pres.name)
|
||||
presentation.put(Constants.CURRENT, pres.current:java.lang.Boolean)
|
||||
|
||||
presentation.put(Constants.DOWNLOADABLE, pres.downloadable:java.lang.Boolean)
|
||||
|
||||
// Get the pages for a presentation
|
||||
val pages = new java.util.ArrayList[java.util.Map[String, Any]]()
|
||||
pres.pages.values foreach {p =>
|
||||
@ -120,7 +121,8 @@ object PesentationMessageToJsonConverter {
|
||||
presentation.put(Constants.ID, msg.presentation.id)
|
||||
presentation.put(Constants.NAME, msg.presentation.name)
|
||||
presentation.put(Constants.CURRENT, msg.presentation.current:java.lang.Boolean)
|
||||
|
||||
presentation.put(Constants.DOWNLOADABLE, msg.presentation.downloadable:java.lang.Boolean)
|
||||
|
||||
// Get the pages for a presentation
|
||||
val pages = new java.util.ArrayList[java.util.Map[String, Any]]()
|
||||
msg.presentation.pages.values foreach {p =>
|
||||
@ -204,7 +206,8 @@ object PesentationMessageToJsonConverter {
|
||||
presentation.put(Constants.ID, msg.presentation.id)
|
||||
presentation.put(Constants.NAME, msg.presentation.name)
|
||||
presentation.put(Constants.CURRENT, msg.presentation.current:java.lang.Boolean)
|
||||
|
||||
presentation.put(Constants.DOWNLOADABLE, msg.presentation.downloadable:java.lang.Boolean)
|
||||
|
||||
val pages = new java.util.ArrayList[java.util.Map[String, Any]]()
|
||||
msg.presentation.pages.values foreach {p =>
|
||||
pages.add(pageToMap(p))
|
||||
@ -225,7 +228,8 @@ object PesentationMessageToJsonConverter {
|
||||
presentation.put(Constants.ID, msg.presentation.id)
|
||||
presentation.put(Constants.NAME, msg.presentation.name)
|
||||
presentation.put(Constants.CURRENT, msg.presentation.current:java.lang.Boolean)
|
||||
|
||||
presentation.put(Constants.DOWNLOADABLE, msg.presentation.downloadable:java.lang.Boolean)
|
||||
|
||||
val pages = new java.util.ArrayList[java.util.Map[String, Any]]()
|
||||
msg.presentation.pages.values foreach {p =>
|
||||
pages.add(pageToMap(p))
|
||||
@ -246,7 +250,8 @@ object PesentationMessageToJsonConverter {
|
||||
presentation.put(Constants.ID, msg.current.id)
|
||||
presentation.put(Constants.NAME, msg.current.name)
|
||||
presentation.put(Constants.CURRENT, msg.current.current:java.lang.Boolean)
|
||||
|
||||
presentation.put(Constants.DOWNLOADABLE, msg.current.downloadable:java.lang.Boolean)
|
||||
|
||||
val pages = new java.util.ArrayList[java.util.Map[String, Any]]()
|
||||
|
||||
msg.current.pages.values foreach {p =>
|
||||
|
@ -9,6 +9,7 @@ package org.bigbluebutton.modules.present.commands
|
||||
|
||||
public var filename:String;
|
||||
public var file:FileReference;
|
||||
public var isDownloadable:Boolean;
|
||||
|
||||
public function UploadFileCommand()
|
||||
{
|
||||
|
@ -10,12 +10,14 @@ package org.bigbluebutton.modules.present.model
|
||||
private var _pages:ArrayCollection;
|
||||
|
||||
private var _current:Boolean = false;
|
||||
private var _downloadable:Boolean = false;
|
||||
|
||||
public function Presentation(id: String, name: String, current: Boolean, pages: ArrayCollection) {
|
||||
public function Presentation(id: String, name: String, current: Boolean, pages: ArrayCollection, downloadable: Boolean) {
|
||||
_id = id;
|
||||
_name = name;
|
||||
_current = current;
|
||||
_pages = pages
|
||||
_downloadable = downloadable;
|
||||
}
|
||||
|
||||
public function get id():String {
|
||||
@ -66,5 +68,9 @@ package org.bigbluebutton.modules.present.model
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
public function get downloadable():Boolean {
|
||||
return _downloadable;
|
||||
}
|
||||
}
|
||||
}
|
@ -183,6 +183,19 @@ package org.bigbluebutton.modules.present.model
|
||||
trace(LOG + "Could not find presentation [" + presId + "].");
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getDownloadablePresentations():ArrayCollection {
|
||||
var presos:ArrayCollection = new ArrayCollection();
|
||||
|
||||
for (var i:int = 0; i < _presentations.length; i++) {
|
||||
var pres: Presentation = _presentations.getItemAt(i) as Presentation;
|
||||
if (pres.downloadable) {
|
||||
presos.addItem(pres);
|
||||
}
|
||||
}
|
||||
|
||||
return presos;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ package org.bigbluebutton.modules.present.services
|
||||
presoPages.addItem(pg);
|
||||
}
|
||||
|
||||
var presentation: Presentation = new Presentation(presVO.id, presVO.name, presVO.isCurrent(), presoPages);
|
||||
var presentation: Presentation = new Presentation(presVO.id, presVO.name, presVO.isCurrent(), presoPages, presVO.downloadable);
|
||||
return presentation;
|
||||
}
|
||||
|
||||
|
@ -7,12 +7,14 @@ package org.bigbluebutton.modules.present.services.messages
|
||||
private var _name:String;
|
||||
private var _current:Boolean = false;
|
||||
private var _pages:ArrayCollection;
|
||||
private var _downloadable:Boolean = false;
|
||||
|
||||
public function PresentationVO(id: String, name: String, current: Boolean, pages: ArrayCollection) {
|
||||
public function PresentationVO(id: String, name: String, current: Boolean, pages: ArrayCollection, downloadable: Boolean) {
|
||||
_id = id;
|
||||
_name = name;
|
||||
_current = current;
|
||||
_pages = pages
|
||||
_downloadable = downloadable;
|
||||
}
|
||||
|
||||
public function get id():String {
|
||||
@ -36,5 +38,9 @@ package org.bigbluebutton.modules.present.services.messages
|
||||
|
||||
return pages;
|
||||
}
|
||||
|
||||
public function get downloadable():Boolean {
|
||||
return _downloadable;
|
||||
}
|
||||
}
|
||||
}
|
@ -228,7 +228,7 @@ package org.bigbluebutton.modules.present.services.messaging
|
||||
}
|
||||
|
||||
var preso:PresentationVO = new PresentationVO(presentation.id, presentation.name,
|
||||
presentation.current, presoPages);
|
||||
presentation.current, presoPages, presentation.downloadable);
|
||||
return preso;
|
||||
}
|
||||
|
||||
|
@ -12,16 +12,16 @@
|
||||
private function downloadPresentation():void {
|
||||
LogUtil.debug("FileDownloadWindow::downloadPresentation() " + data);
|
||||
var downloadEvent:DownloadEvent = new DownloadEvent(DownloadEvent.DOWNLOAD_PRESENTATION);
|
||||
downloadEvent.fileNameToDownload = data as String;
|
||||
downloadEvent.fileNameToDownload = data.id as String;
|
||||
globalDispatch.dispatchEvent(downloadEvent);
|
||||
}
|
||||
|
||||
]]>
|
||||
</mx:Script>
|
||||
<mx:Label id="presentationNameLabel" text="{data as String}" styleName="presentationNameLabelStyle" width="80%"/>
|
||||
<mx:Label id="presentationNameLabel" text="{data.name as String}" styleName="presentationNameLabelStyle" width="80%"/>
|
||||
<mx:Button id="downloadBtn" label="{ResourceUtil.getInstance().getString('bbb.filedownload.downloadBtn')}"
|
||||
toolTip="{ResourceUtil.getInstance().getString('bbb.filedownload.downloadBtn')}"
|
||||
styleName="presentationUploadShowButtonStyle"
|
||||
click="downloadPresentation()" enabled="true"/>
|
||||
click="downloadPresentation()" enabled="{data.downloadable as Boolean}"/>
|
||||
|
||||
</mx:HBox>
|
||||
|
@ -42,7 +42,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
||||
[Bindable] public var fileNamesToDownload:ArrayCollection;
|
||||
[Bindable] private var downloadablePresentations:ArrayCollection;
|
||||
|
||||
override public function move(x:Number, y:Number):void
|
||||
{
|
||||
@ -50,7 +50,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
}
|
||||
|
||||
private function initData():void {
|
||||
|
||||
downloadablePresentations = PresentationModel.getInstance().getDownloadablePresentations();
|
||||
}
|
||||
|
||||
]]>
|
||||
@ -72,7 +72,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<mx:Spacer width="10"/>
|
||||
<mx:List id="presentationNamesList" width="90%" height="200" alternatingItemColors="[#EFEFEF, #FEFEFE]" allowMultipleSelection="false"
|
||||
itemRenderer="org.bigbluebutton.modules.present.ui.views.DownloadPresentationRenderer"
|
||||
dragEnabled="false" dataProvider="{fileNamesToDownload}">
|
||||
dragEnabled="false" dataProvider="{downloadablePresentations}">
|
||||
</mx:List>
|
||||
</mx:HBox>
|
||||
<mx:Spacer height="5"/>
|
||||
|
@ -28,4 +28,12 @@ public final class Util {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static File downloadPresentationDirectory(String uploadDirectory) {
|
||||
File dir = new File(uploadDirectory + File.separatorChar + "download");
|
||||
if (dir.mkdirs()) {
|
||||
return dir;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user