refs #930
This commit is contained in:
parent
6b95448865
commit
b6e3137596
@ -89,6 +89,11 @@ public class ConversionUpdatesMessageListener {
|
||||
conversionUpdatesProcessor.process(message);
|
||||
}
|
||||
else if(messageKey.equalsIgnoreCase(CONVERSION_COMPLETED_KEY)){
|
||||
|
||||
String fileName = (String) mapMessage.get("fileName");
|
||||
message.put("fileName", fileName);
|
||||
log.debug("Came the following file name: " + fileName);
|
||||
|
||||
String slidesInfo = (String) mapMessage.get("slidesInfo");
|
||||
message.put("slidesInfo", StringEscapeUtils.unescapeXml(slidesInfo));
|
||||
conversionUpdatesProcessor.process(message);
|
||||
|
@ -22,10 +22,11 @@ import org.slf4j.Logger;
|
||||
import org.bigbluebutton.conference.ClientMessage;
|
||||
import org.bigbluebutton.conference.ConnectionInvokerService;
|
||||
import org.red5.logging.Red5LoggerFactory;
|
||||
import org.red5.server.api.Red5;
import java.util.ArrayList;
|
||||
import org.red5.server.api.Red5;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
public class PresentationApplication {
|
||||
private static Logger log = Red5LoggerFactory.getLogger( PresentationApplication.class, "bigbluebutton" );
|
||||
|
||||
@ -75,6 +76,14 @@ public class PresentationApplication {
|
||||
log.warn("Getting presentations on a non-existant room " + room);
|
||||
return null;
|
||||
}
|
||||
|
||||
public ArrayList<String> getFileNamesToDownload(String room){
|
||||
if (roomsManager.hasRoom(room)){
|
||||
return roomsManager.getFileNamesToDownload(room);
|
||||
}
|
||||
log.warn("Getting file names on a non-existant room " + room);
|
||||
return null;
|
||||
}
|
||||
|
||||
public void removePresentation(String room, String name){
|
||||
if (roomsManager.hasRoom(room)){
|
||||
|
@ -22,8 +22,12 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.red5.logging.Red5LoggerFactory;
|
||||
|
||||
import net.jcip.annotations.ThreadSafe;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.ArrayList;
|
||||
import java.util.Collections;
import java.util.Iterator;
|
||||
import net.jcip.annotations.ThreadSafe;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
/**
|
||||
@ -49,6 +53,7 @@ public class PresentationRoom {
|
||||
Double yPercent = 0D;
|
||||
|
||||
ArrayList<String> presentationNames = new ArrayList<String>();
|
||||
ArrayList<String> fileNames = new ArrayList<String>();
|
||||
|
||||
public PresentationRoom(String name) {
|
||||
this.name = name;
|
||||
@ -81,6 +86,7 @@ public class PresentationRoom {
|
||||
}
|
||||
|
||||
storePresentationNames(message);
|
||||
storeFileNames(message);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@ -89,10 +95,19 @@ public class PresentationRoom {
|
||||
String messageKey = (String) message.get("messageKey");
|
||||
|
||||
if (messageKey.equalsIgnoreCase("CONVERSION_COMPLETED")) {
|
||||
log.debug(messageKey + "[" + presentationName + "]");
|
||||
log.debug("adding presentation name: " + messageKey + "[" + presentationName + "]");
|
||||
presentationNames.add(presentationName);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private void storeFileNames(Map message){
|
||||
String fileName = (String) message.get("fileName");
|
||||
if(!fileName.equals("")) {
|
||||
fileNames.add(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
public void sendCursorUpdate(Double xPercent, Double yPercent) {
|
||||
this.xPercent = xPercent;
|
||||
@ -178,7 +193,19 @@ public class PresentationRoom {
|
||||
if (currentPresentation.equals(presentationName)) {
|
||||
log.debug("[" + remPresentation + "] is the current presentation. Unsharing that presentation.");
|
||||
sharePresentation(presentationName, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//remove the corresponding file name
|
||||
for(int i = 0 ; i < fileNames.size() ; i++) {
|
||||
|
||||
String presentationNameFromFileName = fileNames.get(i).substring(0,fileNames.get(i).lastIndexOf('.'));
|
||||
|
||||
if( presentationNameFromFileName.equals(presentationName) ) {
|
||||
log.debug("Removing file name: " + fileNames.get(i));
|
||||
fileNames.remove(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getCurrentPresentation() {
|
||||
@ -197,6 +224,10 @@ public class PresentationRoom {
|
||||
return presentationNames;
|
||||
}
|
||||
|
||||
public ArrayList<String> getFileNamesToDownload() {
|
||||
return fileNames;
|
||||
}
|
||||
|
||||
public Double getxOffset() {
|
||||
return xOffset;
|
||||
}
|
||||
|
@ -25,7 +25,7 @@ import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import net.jcip.annotations.ThreadSafe;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
/**
|
||||
* This encapsulates access to Room and messages. This class must be threadsafe.
|
||||
*/
|
||||
@ -179,7 +179,16 @@ public class PresentationRoomsManager {
|
||||
if (r != null) {
|
||||
return r.getPresentationNames();
|
||||
}
|
||||
log.warn("Getting current presentation on a non-existing room " + room);
|
||||
log.warn("Getting presentation names on a non-existing room " + room);
|
||||
return null;
|
||||
}
|
||||
|
||||
public ArrayList<String> getFileNamesToDownload(String room){
|
||||
PresentationRoom r = getRoom(room);
|
||||
if (r != null) {
|
||||
return r.getFileNamesToDownload();
|
||||
}
|
||||
log.warn("Getting file names on a non-existing room " + room);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -17,11 +17,14 @@
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.conference.service.presentation;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.slf4j.Logger;
|
||||
import org.red5.logging.Red5LoggerFactory;
import org.red5.server.api.Red5;
import org.red5.server.api.scope.IScope;
|
||||
import org.red5.logging.Red5LoggerFactory;
|
||||
import org.red5.server.api.Red5;
|
||||
import org.red5.server.api.scope.IScope;
|
||||
import org.bigbluebutton.conference.service.participants.ParticipantsApplication;
|
||||
|
||||
public class PresentationService {
|
||||
@ -82,6 +85,21 @@ public class PresentationService {
|
||||
log.info("getPresentationInfo::service - Sending presentation information...");
|
||||
return presentationInfo;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Map<String, Object> getFileNames() {
|
||||
log.debug("Getting the downloadable file names.");
|
||||
IScope scope = Red5.getConnectionLocal().getScope();
|
||||
|
||||
ArrayList<String> downloadableFileNames = presentationApplication.getFileNamesToDownload(scope.getName());
|
||||
|
||||
Map<String, Object> fileNames = new HashMap<String, Object>();
|
||||
fileNames.put("fileNames", downloadableFileNames);
|
||||
|
||||
log.info("getFileNames::service - Sending downloadable file names...");
|
||||
return fileNames;
|
||||
|
||||
}
|
||||
|
||||
public void gotoSlide(int slideNum) {
|
||||
log.debug("Request to go to slide " + slideNum);
|
||||
|
@ -83,6 +83,7 @@ bbb.presentation.quickLink.label = Presentation Window
|
||||
bbb.presentation.fitToWidth.toolTip = Fit presentation to width
|
||||
bbb.presentation.fitToPage.toolTip = Fit presentation to page
|
||||
bbb.presentation.uploadPresBtn.toolTip = Open the Upload Presentation dialog box
|
||||
bbb.presentation.downloadPresBtn.toolTip = Click here to download the presentations
|
||||
bbb.presentation.backBtn.toolTip = Previous slide
|
||||
bbb.presentation.btnSlideNum.toolTip = Select a slide
|
||||
bbb.presentation.forwardBtn.toolTip = Next slide
|
||||
@ -125,6 +126,12 @@ bbb.fileupload.okCancelBtn = Close
|
||||
bbb.fileupload.okCancelBtn.toolTip = Close the File Upload dialog box
|
||||
bbb.fileupload.genThumbText = Generating thumbnails..
|
||||
bbb.fileupload.progBarLbl = Progress:
|
||||
bbb.fileupload.letUserDownload = Let the users download the presentation
|
||||
bbb.fileupload.letUserDownload.tooltip = Check here if you want the other users to download your presentation
|
||||
bbb.filedownload.title = Download the Presentations
|
||||
bbb.filedownload.fileLbl = Choose File to Download:
|
||||
bbb.filedownload.downloadBtn = Download
|
||||
bbb.filedownload.downloadBtn.toolTip = Download Presentation
|
||||
bbb.chat.title = Chat
|
||||
bbb.chat.quickLink.label = Chat Window
|
||||
bbb.chat.cmpColorPicker.toolTip = Text Color
|
||||
|
@ -26,7 +26,7 @@ package org.bigbluebutton.modules.present.business
|
||||
import flash.net.URLRequestMethod;
|
||||
import flash.net.URLVariables;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
|
||||
public class FileUploadService {
|
||||
public static const ID:String = "FileUploadService";
|
||||
@ -60,8 +60,9 @@ package org.bigbluebutton.modules.present.business
|
||||
* @param file - The FileReference class of the file we wish to send
|
||||
*
|
||||
*/
|
||||
public function upload(presentationName:String, file:FileReference):void {
|
||||
public function upload(presentationName:String, file:FileReference, downloadable: Boolean):void {
|
||||
sendVars.presentation_name = presentationName;
|
||||
sendVars.is_downloadable = downloadable;
|
||||
var fileToUpload : FileReference = new FileReference();
|
||||
fileToUpload = file;
|
||||
|
||||
@ -74,7 +75,10 @@ package org.bigbluebutton.modules.present.business
|
||||
|
||||
request.method = URLRequestMethod.POST;
|
||||
|
||||
LogUtil.debug("@FileUploadFile: sendVars.is_downloadable: " + sendVars.is_downloadable);
|
||||
|
||||
// "fileUpload" is the variable name of the uploaded file in the server
|
||||
LogUtil.debug("fileToUpload.name = " + fileToUpload.name);
|
||||
fileToUpload.upload(request, "fileUpload", true);
|
||||
}
|
||||
|
||||
@ -130,4 +134,4 @@ package org.bigbluebutton.modules.present.business
|
||||
LogUtil.error("A security error occured while trying to upload the presentation. " + event.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -23,6 +23,7 @@ package org.bigbluebutton.modules.present.business
|
||||
import flash.events.TimerEvent;
|
||||
import flash.net.NetConnection;
|
||||
import flash.utils.Timer;
|
||||
import flash.net.navigateToURL;
|
||||
|
||||
import mx.controls.Alert;
|
||||
|
||||
@ -37,7 +38,14 @@ package org.bigbluebutton.modules.present.business
|
||||
import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
|
||||
import org.bigbluebutton.modules.present.events.SlideEvent;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent;
|
||||
import org.bigbluebutton.modules.present.managers.PresentationSlides;
|
||||
|
||||
import flash.events.*;
|
||||
import flash.net.FileReference;
|
||||
import flash.net.URLRequest;
|
||||
import flash.errors.*;
|
||||
|
||||
|
||||
public class PresentProxy
|
||||
{
|
||||
@ -77,8 +85,45 @@ package org.bigbluebutton.modules.present.business
|
||||
*/
|
||||
public function startUpload(e:UploadEvent):void{
|
||||
if (uploadService == null) uploadService = new FileUploadService(host + "/bigbluebutton/presentation/upload", conference, room);
|
||||
uploadService.upload(e.presentationName, e.fileToUpload);
|
||||
LogUtil.debug("Presentation is downloadable? " + e.isDownloadable);
|
||||
uploadService.upload(e.presentationName, e.fileToUpload, e.isDownloadable);
|
||||
}
|
||||
|
||||
/**
|
||||
* Start downloading the selected file
|
||||
* @param e
|
||||
*
|
||||
*/
|
||||
public function startDownload(e:DownloadEvent):void {
|
||||
|
||||
var presentationName:String = getPresentationName(e.fileNameToDownload)
|
||||
var downloadUri:String = host + "/bigbluebutton/presentation/" + conference + "/" + room + "/" + presentationName + "/download";
|
||||
|
||||
LogUtil.debug("PresentationApplication::downloadPresentation()... " + downloadUri);
|
||||
|
||||
var req:URLRequest = new URLRequest(downloadUri);
|
||||
navigateToURL(req,"_blank");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* return the presentation name given a file name
|
||||
* @param fileName
|
||||
*/
|
||||
private function getPresentationName(fileName:String):String {
|
||||
var filenamePattern:RegExp = /(.+)(\..+)/i;
|
||||
// Get the first match which should be the filename without the extension.
|
||||
return fileName.replace(filenamePattern, "$1")
|
||||
}
|
||||
|
||||
/**
|
||||
* updates the list of downloadable file names
|
||||
*/
|
||||
public function getFileNamesFromServer():void{
|
||||
if (soService == null) return;
|
||||
soService.getFileNamesToDownload();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* To to the specified slide
|
||||
@ -182,4 +227,4 @@ package org.bigbluebutton.modules.present.business
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -35,7 +35,8 @@ package org.bigbluebutton.modules.present.business {
|
||||
import org.bigbluebutton.modules.present.events.NavigationEvent;
|
||||
import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.modules.present.events.ZoomEvent;
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent;
|
||||
import org.bigbluebutton.modules.present.events.ZoomEvent;
|
||||
|
||||
public class PresentSOService {
|
||||
public static const NAME:String = "PresentSOService";
|
||||
@ -388,7 +389,7 @@ package org.bigbluebutton.modules.present.business {
|
||||
sendPresentationName(u as String);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Force switching the presenter.
|
||||
triggerSwitchPresenter();
|
||||
|
||||
@ -410,6 +411,37 @@ package org.bigbluebutton.modules.present.business {
|
||||
) //new Responder
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
public function getFileNamesToDownload():void {
|
||||
nc.call( "presentation.getFileNames",// Remote function name
|
||||
new Responder(
|
||||
// result - On successful result
|
||||
function(result:Object):void {
|
||||
LogUtil.debug("Getting from server: file names to download");
|
||||
if(result.fileNames) {
|
||||
for(var f:Object in result.fileNames) {
|
||||
var u:Object = result.fileNames[f]
|
||||
LogUtil.debug("Got from server the downloadable file: " + u as String);
|
||||
sendFileName(u as String);
|
||||
}
|
||||
}
|
||||
else
|
||||
LogUtil.debug("result.fileNames is FALSE...");
|
||||
},
|
||||
|
||||
// status - On error occurred
|
||||
function(status:Object):void {
|
||||
LogUtil.error("Error occurred:");
|
||||
for (var x:Object in status) {
|
||||
LogUtil.error(x + " : " + status[x]);
|
||||
}
|
||||
}
|
||||
) //new Responder
|
||||
); //_netConnection.call
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/***
|
||||
* NOTE:
|
||||
@ -453,6 +485,12 @@ package org.bigbluebutton.modules.present.business {
|
||||
uploadEvent.presentationName = presentationName;
|
||||
dispatcher.dispatchEvent(uploadEvent)
|
||||
}
|
||||
|
||||
private function sendFileName(fileName:String):void {
|
||||
var e:DownloadEvent = new DownloadEvent(DownloadEvent.ADD_NEW_FILENAME);
|
||||
e.fileNameToDownload = fileName;
|
||||
dispatcher.dispatchEvent(e);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send an event out to the server to go to a new page in the SlidesDeck
|
||||
@ -672,4 +710,4 @@ package org.bigbluebutton.modules.present.business {
|
||||
_soErrors.push(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,37 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.modules.present.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
|
||||
public class DownloadEvent extends Event {
|
||||
public static const OPEN_DOWNLOAD_WINDOW:String = "OPEN_DOWNLOAD_WINDOW";
|
||||
public static const CLOSE_DOWNLOAD_WINDOW:String = "CLOSE_DOWNLOAD_WINDOW";
|
||||
public static const DOWNLOAD_PRESENTATION:String = "DOWNLOAD_PRESENTATION";
|
||||
public static const UPDATE_FILE_NAMES:String = "UPDATE_FILE_NAMES";
|
||||
public static const ADD_NEW_FILENAME:String = "ADD_NEW_FILENAME";
|
||||
|
||||
public var fileNameToDownload:String;
|
||||
|
||||
public function DownloadEvent(type:String) {
|
||||
super(type, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
126
bigbluebutton-client/src/org/bigbluebutton/modules/present/events/UploadEvent.as
Executable file → Normal file
126
bigbluebutton-client/src/org/bigbluebutton/modules/present/events/UploadEvent.as
Executable file → Normal file
@ -1,62 +1,64 @@
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.modules.present.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.net.FileReference;
|
||||
|
||||
public class UploadEvent extends Event {
|
||||
public static const OPEN_EXTERNAL_UPLOAD_WINDOW:String = "OPEN_EXTERNAL_UPLOAD_WINDOW";
|
||||
public static const OPEN_UPLOAD_WINDOW:String = "OPEN_UPLOAD_WINDOW";
|
||||
public static const CLOSE_UPLOAD_WINDOW:String = "CLOSE_UPLOAD_WINDOW";
|
||||
public static const CLEAR_PRESENTATION:String = "CLEAR_PRESENTATION";
|
||||
public static const CONVERT_SUCCESS:String = "CONVERT_SUCCESS";
|
||||
public static const CONVERT_UPDATE:String = "CONVERT_UPDATE";
|
||||
public static const CONVERT_ERROR:String = "CONVERT_ERROR";
|
||||
public static const START_UPLOAD:String = "START_UPLOAD";
|
||||
public static const UPLOAD_PROGRESS_UPDATE:String = "UPLOAD_PROGRESS_UPDATE";
|
||||
public static const UPLOAD_COMPLETE:String = "UPLOAD_COMPLETE";
|
||||
public static const UPLOAD_IO_ERROR:String = "UPLOAD_IO_ERROR";
|
||||
public static const UPLOAD_SECURITY_ERROR:String = "UPLOAD_SECURITY_ERROR";
|
||||
public static const UPDATE_PROGRESS:String = "UPDATE_PROGRESS";
|
||||
public static const THUMBNAILS_UPDATE:String = "THUMBNAILS_UPDATE";
|
||||
public static const PRESENTATION_READY:String = "PRESENTATION_READY";
|
||||
|
||||
public static const OFFICE_DOC_CONVERSION_SUCCESS:String = "OFFICE_DOC_CONVERSION_SUCCESS";
|
||||
public static const OFFICE_DOC_CONVERSION_FAILED:String = "OFFICE_DOC_CONVERSION_FAILED";
|
||||
public static const SUPPORTED_DOCUMENT:String = "SUPPORTED_DOCUMENT";
|
||||
public static const UNSUPPORTED_DOCUMENT:String = "UNSUPPORTED_DOCUMENT";
|
||||
public static const PAGE_COUNT_FAILED:String = "PAGE_COUNT_FAILED";
|
||||
public static const PAGE_COUNT_EXCEEDED:String = "PAGE_COUNT_EXCEEDED";
|
||||
|
||||
public var presentationName:String;
|
||||
public var data:Object;
|
||||
public var completedSlides:Number;
|
||||
public var totalSlides:Number;
|
||||
public var fileToUpload:FileReference;
|
||||
public var percentageComplete:Number;
|
||||
public var maximumSupportedNumberOfSlides:int;
|
||||
public var maxFileSize:Number;
|
||||
|
||||
public function UploadEvent(type:String) {
|
||||
super(type, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
/**
|
||||
* BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
*
|
||||
* Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it under the
|
||||
* terms of the GNU Lesser General Public License as published by the Free Software
|
||||
* Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
* version.
|
||||
*
|
||||
* BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
* PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License along
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.modules.present.events
|
||||
{
|
||||
import flash.events.Event;
|
||||
import flash.net.FileReference;
|
||||
|
||||
public class UploadEvent extends Event {
|
||||
public static const OPEN_EXTERNAL_UPLOAD_WINDOW:String = "OPEN_EXTERNAL_UPLOAD_WINDOW";
|
||||
public static const OPEN_UPLOAD_WINDOW:String = "OPEN_UPLOAD_WINDOW";
|
||||
public static const CLOSE_UPLOAD_WINDOW:String = "CLOSE_UPLOAD_WINDOW";
|
||||
public static const CLEAR_PRESENTATION:String = "CLEAR_PRESENTATION";
|
||||
public static const CONVERT_SUCCESS:String = "CONVERT_SUCCESS";
|
||||
public static const CONVERT_UPDATE:String = "CONVERT_UPDATE";
|
||||
public static const CONVERT_ERROR:String = "CONVERT_ERROR";
|
||||
public static const START_UPLOAD:String = "START_UPLOAD";
|
||||
public static const UPLOAD_PROGRESS_UPDATE:String = "UPLOAD_PROGRESS_UPDATE";
|
||||
public static const UPLOAD_COMPLETE:String = "UPLOAD_COMPLETE";
|
||||
public static const UPLOAD_IO_ERROR:String = "UPLOAD_IO_ERROR";
|
||||
public static const UPLOAD_SECURITY_ERROR:String = "UPLOAD_SECURITY_ERROR";
|
||||
public static const UPDATE_PROGRESS:String = "UPDATE_PROGRESS";
|
||||
public static const THUMBNAILS_UPDATE:String = "THUMBNAILS_UPDATE";
|
||||
public static const PRESENTATION_READY:String = "PRESENTATION_READY";
|
||||
|
||||
public static const OFFICE_DOC_CONVERSION_SUCCESS:String = "OFFICE_DOC_CONVERSION_SUCCESS";
|
||||
public static const OFFICE_DOC_CONVERSION_FAILED:String = "OFFICE_DOC_CONVERSION_FAILED";
|
||||
public static const SUPPORTED_DOCUMENT:String = "SUPPORTED_DOCUMENT";
|
||||
public static const UNSUPPORTED_DOCUMENT:String = "UNSUPPORTED_DOCUMENT";
|
||||
public static const PAGE_COUNT_FAILED:String = "PAGE_COUNT_FAILED";
|
||||
public static const PAGE_COUNT_EXCEEDED:String = "PAGE_COUNT_EXCEEDED";
|
||||
|
||||
|
||||
public var presentationName:String;
|
||||
public var data:Object;
|
||||
public var completedSlides:Number;
|
||||
public var totalSlides:Number;
|
||||
public var isDownloadable:Boolean;
|
||||
public var fileToUpload:FileReference;
|
||||
public var percentageComplete:Number;
|
||||
public var maximumSupportedNumberOfSlides:int;
|
||||
public var maxFileSize:Number;
|
||||
|
||||
public function UploadEvent(type:String) {
|
||||
super(type, true, false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -33,18 +33,22 @@ package org.bigbluebutton.modules.present.managers
|
||||
import org.bigbluebutton.modules.present.events.PresentModuleEvent;
|
||||
import org.bigbluebutton.modules.present.events.QueryListOfPresentationsReplyEvent;
|
||||
import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.modules.present.ui.views.FileDownloadWindow;
|
||||
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 downloadWindow:FileDownloadWindow;
|
||||
private var uploadWindow:FileUploadWindow;
|
||||
private var presentWindow:PresentationWindow;
|
||||
|
||||
//format: presentationNames = [{label:"00"}, {label:"11"}, {label:"22"} ];
|
||||
[Bindable] public var presentationNames:ArrayCollection = new ArrayCollection();
|
||||
[Bindable] public var fileNamesToDownload:ArrayCollection = new ArrayCollection();
|
||||
|
||||
public function PresentManager() {
|
||||
globalDispatcher = new Dispatcher();
|
||||
@ -66,8 +70,23 @@ package org.bigbluebutton.modules.present.managers
|
||||
|
||||
private function openWindow(window:IBbbModuleWindow):void{
|
||||
var event:OpenWindowEvent = new OpenWindowEvent(OpenWindowEvent.OPEN_WINDOW_EVENT);
|
||||
event.window = window;
|
||||
globalDispatcher.dispatchEvent(event);
|
||||
event.window = window;
|
||||
globalDispatcher.dispatchEvent(event);
|
||||
}
|
||||
|
||||
public function handleOpenDownloadWindow():void{
|
||||
if (downloadWindow != null) return;
|
||||
|
||||
globalDispatcher.dispatchEvent(new DownloadEvent(DownloadEvent.UPDATE_FILE_NAMES));
|
||||
|
||||
downloadWindow = new FileDownloadWindow();
|
||||
downloadWindow.fileNamesToDownload = fileNamesToDownload;
|
||||
mx.managers.PopUpManager.addPopUp(downloadWindow, presentWindow, true);
|
||||
}
|
||||
|
||||
public function handleCloseDownloadWindow():void{
|
||||
PopUpManager.removePopUp(downloadWindow);
|
||||
downloadWindow = null;
|
||||
}
|
||||
|
||||
public function handleOpenUploadWindow(e:UploadEvent):void{
|
||||
@ -85,24 +104,57 @@ package org.bigbluebutton.modules.present.managers
|
||||
}
|
||||
|
||||
public function updatePresentationNames(e:UploadEvent):void{
|
||||
LogUtil.debug("Adding presentation " + e.presentationName);
|
||||
LogUtil.debug("Adding presentation NAME " + e.presentationName);
|
||||
for (var i:int = 0; i < presentationNames.length; i++) {
|
||||
if (presentationNames[i] == e.presentationName) return;
|
||||
}
|
||||
presentationNames.addItem(e.presentationName);
|
||||
presentationNames.addItem(e.presentationName);
|
||||
}
|
||||
|
||||
public function updateFileNamesToDownload(e:DownloadEvent):void{
|
||||
LogUtil.debug("Adding file to download NAME " + e.fileNameToDownload);
|
||||
for (var i:int = 0; i < fileNamesToDownload.length; i++) {
|
||||
if (fileNamesToDownload[i] == e.fileNameToDownload) return;
|
||||
}
|
||||
fileNamesToDownload.addItem(e.fileNameToDownload);
|
||||
}
|
||||
|
||||
|
||||
public function removePresentation(e:RemovePresentationEvent):void {
|
||||
LogUtil.debug("Removing presentation " + e.presentationName);
|
||||
var p:String;
|
||||
|
||||
for (var i:int = 0; i < presentationNames.length; i++) {
|
||||
p = presentationNames.getItemAt(i) as String;
|
||||
if (p == e.presentationName) {
|
||||
presentationNames.removeItemAt(i);
|
||||
}
|
||||
}
|
||||
var p:String;
|
||||
|
||||
for (var i:int = 0; i < presentationNames.length; i++) {
|
||||
p = presentationNames.getItemAt(i) as String;
|
||||
if (p == e.presentationName) {
|
||||
presentationNames.removeItemAt(i);
|
||||
}
|
||||
}
|
||||
|
||||
removeFileNameToDownload(e.presentationName);
|
||||
}
|
||||
|
||||
|
||||
public function removeFileNameToDownload(presentationName:String):void {
|
||||
var p:String;
|
||||
|
||||
for (var i:int = 0; i < fileNamesToDownload.length; i++) {
|
||||
p = getPresentationName(fileNamesToDownload.getItemAt(i) as String);
|
||||
if (p == presentationName) {
|
||||
LogUtil.debug("Removing file name to download " + presentationName);
|
||||
fileNamesToDownload.removeItemAt(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private function getPresentationName(fileName:String):String
|
||||
{
|
||||
var filenamePattern:RegExp = /(.+)(\..+)/i;
|
||||
// Get the first match which should be the filename without the extension.
|
||||
return fileName.replace(filenamePattern, "$1")
|
||||
}
|
||||
|
||||
|
||||
public function queryPresentations():void {
|
||||
var pArray:Array = new Array();
|
||||
@ -113,4 +165,4 @@ package org.bigbluebutton.modules.present.managers
|
||||
globalDispatcher.dispatchEvent(qEvent);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.present.events.QueryPresentationsListEvent;
|
||||
import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
|
||||
import org.bigbluebutton.modules.present.events.SlideEvent;
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.modules.present.managers.PresentManager;
|
||||
import org.bigbluebutton.modules.present.ui.views.PresentationWindow;
|
||||
@ -60,6 +61,26 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<EventHandlers type="{PresentModuleEvent.STOP_MODULE}" >
|
||||
<MethodInvoker generator="{PresentManager}" method="handleStopModuleEvent" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{DownloadEvent.OPEN_DOWNLOAD_WINDOW}" >
|
||||
<MethodInvoker generator="{PresentManager}" method="handleOpenDownloadWindow" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{DownloadEvent.CLOSE_DOWNLOAD_WINDOW}" >
|
||||
<MethodInvoker generator="{PresentManager}" method="handleCloseDownloadWindow" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{DownloadEvent.DOWNLOAD_PRESENTATION}" >
|
||||
<MethodInvoker generator="{PresentProxy}" method="startDownload" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{DownloadEvent.UPDATE_FILE_NAMES}" >
|
||||
<MethodInvoker generator="{PresentProxy}" method="getFileNamesFromServer" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{DownloadEvent.ADD_NEW_FILENAME}" >
|
||||
<MethodInvoker generator="{PresentManager}" method="updateFileNamesToDownload" arguments="{event}" />
|
||||
</EventHandlers>
|
||||
|
||||
<EventHandlers type="{UploadEvent.OPEN_UPLOAD_WINDOW}" >
|
||||
<MethodInvoker generator="{PresentManager}" method="handleOpenUploadWindow" arguments="{event}" />
|
||||
|
@ -0,0 +1,27 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<mx:HBox xmlns:mx="http://www.adobe.com/2006/mxml" width="90%">
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent;
|
||||
|
||||
private var globalDispatch:Dispatcher = new Dispatcher();
|
||||
|
||||
private function downloadPresentation():void {
|
||||
LogUtil.debug("FileDownloadWindow::downloadPresentation() " + data);
|
||||
var downloadEvent:DownloadEvent = new DownloadEvent(DownloadEvent.DOWNLOAD_PRESENTATION);
|
||||
downloadEvent.fileNameToDownload = data as String;
|
||||
globalDispatch.dispatchEvent(downloadEvent);
|
||||
}
|
||||
|
||||
]]>
|
||||
</mx:Script>
|
||||
<mx:Label id="presentationNameLabel" text="{data 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"/>
|
||||
|
||||
</mx:HBox>
|
@ -0,0 +1,89 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
<!--
|
||||
|
||||
BigBlueButton open source conferencing system - http://www.bigbluebutton.org/
|
||||
|
||||
Copyright (c) 2012 BigBlueButton Inc. and by respective authors (see below).
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under the
|
||||
terms of the GNU Lesser General Public License as published by the Free Software
|
||||
Foundation; either version 3.0 of the License, or (at your option) any later
|
||||
version.
|
||||
|
||||
BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License along
|
||||
with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
-->
|
||||
|
||||
<mx:TitleWindow xmlns:mx="http://www.adobe.com/2006/mxml"
|
||||
xmlns:mate="http://mate.asfusion.com/"
|
||||
x="168" y="86" layout="absolute" width="700" height="410" styleName="presentationFileUploadWindowStyle"
|
||||
initialize="initData();">
|
||||
|
||||
<mate:Dispatcher id="globalDispatch" />
|
||||
|
||||
<mx:Script>
|
||||
<![CDATA[
|
||||
import org.bigbluebutton.common.LogUtil;
|
||||
import com.asfusion.mate.events.Dispatcher;
|
||||
import mx.collections.*;
|
||||
import mx.events.FlexEvent;
|
||||
import mx.events.ValidationResultEvent;
|
||||
import mx.managers.PopUpManager;
|
||||
import mx.utils.*;
|
||||
import mx.validators.*;
|
||||
import org.bigbluebutton.common.Images;
|
||||
import org.bigbluebutton.modules.present.events.RemovePresentationEvent;
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent
|
||||
import org.bigbluebutton.util.i18n.ResourceUtil;
|
||||
|
||||
[Bindable] public var fileNamesToDownload:ArrayCollection;
|
||||
|
||||
override public function move(x:Number, y:Number):void
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
private function initData():void {
|
||||
|
||||
}
|
||||
|
||||
]]>
|
||||
|
||||
</mx:Script>
|
||||
|
||||
<mx:VBox width="100%" height="100%">
|
||||
<mx:Label text="{ResourceUtil.getInstance().getString('bbb.filedownload.title')}" styleName="presentationUploadTitleStyle"/>
|
||||
<mx:Spacer height="10"/>
|
||||
<mx:HBox width="100%">
|
||||
<mx:Spacer height="5"/>
|
||||
<mx:Label id="fileLbl" text="{ResourceUtil.getInstance().getString('bbb.filedownload.fileLbl')}" styleName="presentationUploadChooseFileLabelStyle"/>
|
||||
<mx:Spacer width="100%"/>
|
||||
</mx:HBox>
|
||||
|
||||
<mx:Spacer height="5"/>
|
||||
|
||||
<mx:HBox width="90%" height="100">
|
||||
<mx:Spacer width="10"/>
|
||||
<mx:List id="presentationNamesList" width="90%" height="100" alternatingItemColors="[#EFEFEF, #FEFEFE]" allowMultipleSelection="false"
|
||||
itemRenderer="org.bigbluebutton.modules.present.ui.views.DownloadPresentationRenderer"
|
||||
dragEnabled="false" dataProvider="{fileNamesToDownload}">
|
||||
</mx:List>
|
||||
</mx:HBox>
|
||||
<mx:Spacer height="5"/>
|
||||
<mx:HBox width="100%">
|
||||
<mx:Spacer width="100%"/>
|
||||
<mx:Button id="okCancelBtn" label="{ResourceUtil.getInstance().getString('bbb.fileupload.okCancelBtn')}"
|
||||
styleName="presentationUploadCancelButtonStyle"
|
||||
click="globalDispatch.dispatchEvent(new DownloadEvent(DownloadEvent.CLOSE_DOWNLOAD_WINDOW))"
|
||||
toolTip="{ResourceUtil.getInstance().getString('bbb.fileupload.okCancelBtn.toolTip')}"/>
|
||||
<mx:Spacer width="5"/>
|
||||
</mx:HBox>
|
||||
</mx:VBox>
|
||||
|
||||
</mx:TitleWindow>
|
@ -139,18 +139,25 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
displayAlert(ResourceUtil.getInstance().getString('bbb.presentation.maxUploadFileExceededAlert'));
|
||||
} else {
|
||||
var presentationName:String = StringUtil.trim(fileToUpload.name);
|
||||
trace("Uploading file : " + presentationName);
|
||||
LogUtil.debug("Uploading file : " + presentationName);
|
||||
|
||||
var filenamePattern:RegExp = /(.+)(\..+)/i;
|
||||
// Get the first match which should be the filename without the extension.
|
||||
presentationName = presentationName.replace(filenamePattern, "$1")
|
||||
// Replace any character other than a word character (A-Z, a-z, 0-9, or _).
|
||||
presentationName = presentationName.replace(/[^0-9a-zA-Z_\.]/g, "-");
|
||||
trace("Uploadling presentation name: " + presentationName);
|
||||
LogUtil.debug("Uploadling presentation name: " + presentationName);
|
||||
|
||||
var uploadEvent:UploadEvent = new UploadEvent(UploadEvent.START_UPLOAD);
|
||||
var isDownloadable:Boolean = new Boolean(letUserDownload.selected);
|
||||
|
||||
var uploadEvent:UploadEvent = new UploadEvent(UploadEvent.START_UPLOAD);
|
||||
uploadEvent.presentationName = presentationName;
|
||||
uploadEvent.fileToUpload = fileToUpload;
|
||||
uploadEvent.isDownloadable = isDownloadable;
|
||||
|
||||
LogUtil.debug("uploadEvent.isDownloadable = " + uploadEvent.isDownloadable);
|
||||
|
||||
|
||||
globalDispatch.dispatchEvent(uploadEvent);
|
||||
|
||||
progBarLbl.visible = true;
|
||||
@ -289,9 +296,15 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
toolTip="{ResourceUtil.getInstance().getString('bbb.fileupload.uploadBtn.toolTip')}" click="startUpload()"
|
||||
enabled="false" icon="{bulletGoIcon}"/>
|
||||
</mx:HBox>
|
||||
|
||||
<mx:Spacer height="2"/>
|
||||
<mx:HBox>
|
||||
<mx:Spacer width="3"/>
|
||||
<mx:CheckBox id="letUserDownload" label="{ResourceUtil.getInstance().getString('bbb.fileupload.letUserDownload')}" selected="true" toolTip="{ResourceUtil.getInstance().getString('bbb.fileupload.letUserDownload.tooltip')}"/>
|
||||
</mx:HBox>
|
||||
<mx:Spacer height="5"/>
|
||||
<mx:HBox width="100%">
|
||||
<mx:Spacer width="10"/>
|
||||
<mx:Spacer width="5"/>
|
||||
<mx:Label id="progBarLbl" text="{ResourceUtil.getInstance().getString('bbb.fileupload.progBarLbl')}"
|
||||
styleName="presentationUploadProgressBarLabelStyle"
|
||||
visible="false"/>
|
||||
@ -306,20 +319,19 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
</mx:HBox>
|
||||
<mx:Spacer height="5"/>
|
||||
<mx:HBox width="90%" height="100">
|
||||
<mx:Spacer width="10"/>
|
||||
<mx:Spacer width="5"/>
|
||||
<mx:List id="presentationNamesList" width="90%" height="100" alternatingItemColors="[#EFEFEF, #FEFEFE]" allowMultipleSelection="false"
|
||||
itemRenderer="org.bigbluebutton.modules.present.ui.views.UploadedPresentationRenderer"
|
||||
dragEnabled="false" dataProvider="{presentationNamesAC}">
|
||||
</mx:List>
|
||||
</mx:HBox>
|
||||
<mx:Spacer height="5"/>
|
||||
<mx:HBox width="100%">
|
||||
<mx:HBox width="90%">
|
||||
<mx:Spacer width="100%"/>
|
||||
<mx:Button id="okCancelBtn" label="{ResourceUtil.getInstance().getString('bbb.fileupload.okCancelBtn')}"
|
||||
styleName="presentationUploadCancelButtonStyle"
|
||||
click="globalDispatch.dispatchEvent(new UploadEvent(UploadEvent.CLOSE_UPLOAD_WINDOW))"
|
||||
toolTip="{ResourceUtil.getInstance().getString('bbb.fileupload.okCancelBtn.toolTip')}"/>
|
||||
<mx:Spacer width="5"/>
|
||||
</mx:HBox>
|
||||
</mx:VBox>
|
||||
|
||||
|
@ -99,6 +99,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
import org.bigbluebutton.modules.present.events.SlideEvent;
|
||||
import org.bigbluebutton.modules.present.events.SlideResizedEvent;
|
||||
import org.bigbluebutton.modules.present.events.UploadEvent;
|
||||
import org.bigbluebutton.modules.present.events.DownloadEvent;
|
||||
import org.bigbluebutton.modules.present.events.WindowResizedEvent;
|
||||
import org.bigbluebutton.modules.present.events.ZoomEvent;
|
||||
import org.bigbluebutton.modules.present.managers.Slide;
|
||||
@ -163,6 +164,9 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
minimizeBtn.tabIndex = baseIndex+1;
|
||||
maximizeRestoreBtn.tabIndex = baseIndex+2;
|
||||
closeBtn.tabIndex = baseIndex+3;
|
||||
|
||||
var images:Images = new Images();
|
||||
downloadPres.setStyle("icon", images.disk);
|
||||
|
||||
slideView.slideLoader.tabIndex = baseIndex+4;
|
||||
hotkeyCapture();
|
||||
@ -359,6 +363,7 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
private function setupPresenter(isPresenter:Boolean, presentersName:String):void {
|
||||
this.isPresenter = isPresenter;
|
||||
uploadPres.visible = isPresenter;
|
||||
downloadPres.visible = true;
|
||||
|
||||
if (presentationLoaded) {
|
||||
displaySlideNumber(slideView.selectedSlide + 1);
|
||||
@ -607,10 +612,24 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
onFitToPage(true);
|
||||
}
|
||||
}
|
||||
|
||||
private function onDownloadButtonClicked():void {
|
||||
openDownloadWindow();
|
||||
|
||||
}
|
||||
|
||||
private function openDownloadWindow():void {
|
||||
var event:DownloadEvent = new DownloadEvent(DownloadEvent.OPEN_DOWNLOAD_WINDOW);
|
||||
dispatchEvent(event);
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function onUploadButtonClicked():void {
|
||||
openUploadWindow();
|
||||
}
|
||||
|
||||
|
||||
|
||||
private function openUploadWindow():void {
|
||||
if (presentOptions.openExternalFileUploadDialog) {
|
||||
@ -635,6 +654,11 @@ with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
<views:SlideView id="slideView" width="100%" height="100%" visible="false" mouseDown="mouseDown = true"
|
||||
mouseUp="mouseDown = false" verticalScrollPolicy="off" horizontalScrollPolicy="off" tabIndex="{baseIndex+4}"/>
|
||||
<mx:ControlBar id="presCtrlBar" name="presCtrlBar" width="100%" height="{CONTROL_BAR_HEIGHT}" styleName="presentationWindowControlsStyle" >
|
||||
<mx:Button id="downloadPres" visible="true" height="30"
|
||||
toolTip="{ResourceUtil.getInstance().getString('bbb.presentation.downloadPresBtn.toolTip')}"
|
||||
click="onDownloadButtonClicked()" tabIndex="{baseIndex+5}"/>
|
||||
|
||||
|
||||
<mx:Button id="uploadPres" visible="false" height="30" styleName="presentationUploadButtonStyle"
|
||||
toolTip="{ResourceUtil.getInstance().getString('bbb.presentation.uploadPresBtn.toolTip')}"
|
||||
click="onUploadButtonClicked()" tabIndex="{baseIndex+5}"/>
|
||||
|
@ -51,6 +51,10 @@ class UrlMappings {
|
||||
"/presentation/$conference/$room/$presentation_name/textfile/$id"(controller:"presentation") {
|
||||
action = [GET:'showTextfile']
|
||||
}
|
||||
|
||||
"/presentation/$conference/$room/$presentation_name/download"(controller:"presentation") {
|
||||
action = [GET:'downloadFile']
|
||||
}
|
||||
|
||||
"/api/setConfigXML"(controller:"api") {
|
||||
action = [POST:'setConfigXML']
|
||||
|
@ -76,9 +76,26 @@ class PresentationController {
|
||||
|
||||
def newFilename = file.getOriginalFilename().replaceAll(notValidCharsRegExp, '-')
|
||||
def pres = new File( uploadDir.absolutePath + File.separatorChar + newFilename )
|
||||
file.transferTo(pres)
|
||||
file.transferTo(pres)
|
||||
|
||||
def isDownloadable = params.boolean('is_downloadable') //instead of params.is_downloadable
|
||||
|
||||
if(isDownloadable) {
|
||||
log.debug "@Creating download directory..."
|
||||
File downloadDir = presentationService.downloadPresentationDirectory(uploadDir.absolutePath)
|
||||
def downloadableFile = new File( downloadDir.absolutePath + File.separatorChar + newFilename )
|
||||
|
||||
downloadableFile << pres.newInputStream()
|
||||
}
|
||||
|
||||
UploadedPresentation uploadedPres = new UploadedPresentation(params.conference, params.room, presentationName);
|
||||
|
||||
if(isDownloadable) {
|
||||
log.debug "@Setting file to be downloadable..."
|
||||
uploadedPres.setDownloadable();
|
||||
uploadedPres.setFileNameToDownload(newFilename);
|
||||
}
|
||||
|
||||
uploadedPres.setUploadedFile(pres);
|
||||
presentationService.processUploadedPresentation(uploadedPres)
|
||||
} else {
|
||||
@ -184,6 +201,33 @@ class PresentationController {
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
def downloadFile = {
|
||||
def presentationName = params.presentation_name
|
||||
def conf = params.conference
|
||||
def rm = params.room
|
||||
println "Controller: Download request for $presentationName"
|
||||
|
||||
InputStream is = null;
|
||||
try {
|
||||
def pres = presentationService.getFile(conf, rm, presentationName)
|
||||
if (pres.exists()) {
|
||||
println "Controller: Sending pdf reply for $presentationName"
|
||||
|
||||
def bytes = pres.readBytes()
|
||||
def responseName = pres.getName();
|
||||
response.addHeader("content-disposition", "filename=$responseName")
|
||||
response.addHeader("Cache-Control", "no-cache")
|
||||
response.outputStream << bytes;
|
||||
} else {
|
||||
println "$pres does not exist."
|
||||
}
|
||||
} catch (IOException e) {
|
||||
println("Error reading file.\n" + e.getMessage());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
def show = {
|
||||
//def filename = params.id.replace('###', '.')
|
||||
|
@ -16,15 +16,15 @@
|
||||
* with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
package org.bigbluebutton.web.services
|
||||
|
||||
import java.util.concurrent.*;
|
||||
package org.bigbluebutton.web.services
|
||||
|
||||
import java.util.concurrent.*;
|
||||
import java.lang.InterruptedException
|
||||
import org.bigbluebutton.presentation.DocumentConversionService
|
||||
import org.bigbluebutton.presentation.UploadedPresentation
|
||||
|
||||
class PresentationService {
|
||||
|
||||
|
||||
class PresentationService {
|
||||
|
||||
static transactional = false
|
||||
DocumentConversionService documentConversionService
|
||||
def presentationDir
|
||||
@ -33,81 +33,89 @@ class PresentationService {
|
||||
def testPresentationName
|
||||
def testUploadedPresentation
|
||||
def defaultUploadedPresentation
|
||||
|
||||
def deletePresentation = {conf, room, filename ->
|
||||
def directory = new File(roomDirectory(conf, room).absolutePath + File.separatorChar + filename)
|
||||
deleteDirectory(directory)
|
||||
}
|
||||
|
||||
def deleteDirectory = {directory ->
|
||||
log.debug "delete = ${directory}"
|
||||
/**
|
||||
* Go through each directory and check if it's not empty.
|
||||
* We need to delete files inside a directory before a
|
||||
* directory can be deleted.
|
||||
**/
|
||||
File[] files = directory.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
if (files[i].isDirectory()) {
|
||||
deleteDirectory(files[i])
|
||||
} else {
|
||||
files[i].delete()
|
||||
}
|
||||
}
|
||||
// Now that the directory is empty. Delete it.
|
||||
directory.delete()
|
||||
}
|
||||
|
||||
def listPresentations = {conf, room ->
|
||||
def presentationsList = []
|
||||
def directory = roomDirectory(conf, room)
|
||||
log.debug "directory ${directory.absolutePath}"
|
||||
if( directory.exists() ){
|
||||
directory.eachFile(){ file->
|
||||
System.out.println(file.name)
|
||||
if( file.isDirectory() )
|
||||
presentationsList.add( file.name )
|
||||
}
|
||||
}
|
||||
return presentationsList
|
||||
}
|
||||
|
||||
public File uploadedPresentationDirectory(String conf, String room, String presentation_name) {
|
||||
File dir = new File(roomDirectory(conf, room).absolutePath + File.separatorChar + presentation_name)
|
||||
println "Uploaded presentation ${presentation_name} for conf ${conf} and room ${room} to dir ${dir.absolutePath}"
|
||||
|
||||
/* If the presentation name already exist, delete it. We should provide a check later on to notify user
|
||||
that there is already a presentation with that name. */
|
||||
if (dir.exists()) deleteDirectory(dir)
|
||||
dir.mkdirs()
|
||||
|
||||
assert dir.exists()
|
||||
return dir
|
||||
}
|
||||
|
||||
def processUploadedPresentation = {uploadedPres ->
|
||||
// Run conversion on another thread.
|
||||
new Timer().runAfter(1000)
|
||||
{
|
||||
|
||||
def deletePresentation = {conf, room, filename ->
|
||||
def directory = new File(roomDirectory(conf, room).absolutePath + File.separatorChar + filename)
|
||||
deleteDirectory(directory)
|
||||
}
|
||||
|
||||
def deleteDirectory = {directory ->
|
||||
log.debug "delete = ${directory}"
|
||||
/**
|
||||
* Go through each directory and check if it's not empty.
|
||||
* We need to delete files inside a directory before a
|
||||
* directory can be deleted.
|
||||
**/
|
||||
File[] files = directory.listFiles();
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
if (files[i].isDirectory()) {
|
||||
deleteDirectory(files[i])
|
||||
} else {
|
||||
files[i].delete()
|
||||
}
|
||||
}
|
||||
// Now that the directory is empty. Delete it.
|
||||
directory.delete()
|
||||
}
|
||||
|
||||
def listPresentations = {conf, room ->
|
||||
def presentationsList = []
|
||||
def directory = roomDirectory(conf, room)
|
||||
log.debug "directory ${directory.absolutePath}"
|
||||
if( directory.exists() ){
|
||||
directory.eachFile(){ file->
|
||||
System.out.println(file.name)
|
||||
if( file.isDirectory() )
|
||||
presentationsList.add( file.name )
|
||||
}
|
||||
}
|
||||
return presentationsList
|
||||
}
|
||||
|
||||
public File uploadedPresentationDirectory(String conf, String room, String presentation_name) {
|
||||
File dir = new File(roomDirectory(conf, room).absolutePath + File.separatorChar + presentation_name)
|
||||
println "Uploaded presentation ${presentation_name} for conf ${conf} and room ${room} to dir ${dir.absolutePath}"
|
||||
|
||||
/* If the presentation name already exist, delete it. We should provide a check later on to notify user
|
||||
that there is already a presentation with that name. */
|
||||
if (dir.exists()) deleteDirectory(dir)
|
||||
dir.mkdirs()
|
||||
|
||||
assert dir.exists()
|
||||
return dir
|
||||
}
|
||||
|
||||
public File downloadPresentationDirectory(String uploadDirectory) {
|
||||
File dir = new File(uploadDirectory + File.separatorChar + "download")
|
||||
dir.mkdirs()
|
||||
assert dir.exists()
|
||||
|
||||
return dir
|
||||
}
|
||||
|
||||
def processUploadedPresentation = {uploadedPres ->
|
||||
// Run conversion on another thread.
|
||||
new Timer().runAfter(1000)
|
||||
{
|
||||
documentConversionService.processDocument(uploadedPres)
|
||||
}
|
||||
}
|
||||
|
||||
def showSlide(String conf, String room, String presentationName, String id) {
|
||||
new File(roomDirectory(conf, room).absolutePath + File.separatorChar + presentationName + File.separatorChar + "slide-${id}.swf")
|
||||
}
|
||||
|
||||
def showPresentation = {conf, room, filename ->
|
||||
new File(roomDirectory(conf, room).absolutePath + File.separatorChar + filename + File.separatorChar + "slides.swf")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
def showSlide(String conf, String room, String presentationName, String id) {
|
||||
new File(roomDirectory(conf, room).absolutePath + File.separatorChar + presentationName + File.separatorChar + "slide-${id}.swf")
|
||||
}
|
||||
|
||||
def showPresentation = {conf, room, filename ->
|
||||
new File(roomDirectory(conf, room).absolutePath + File.separatorChar + filename + File.separatorChar + "slides.swf")
|
||||
}
|
||||
|
||||
def showThumbnail = {conf, room, presentationName, thumb ->
|
||||
println "Show thumbnails request for $presentationName $thumb"
|
||||
def thumbFile = roomDirectory(conf, room).absolutePath + File.separatorChar + presentationName + File.separatorChar +
|
||||
"thumbnails" + File.separatorChar + "thumb-${thumb}.png"
|
||||
log.debug "showing $thumbFile"
|
||||
|
||||
new File(thumbFile)
|
||||
println "Show thumbnails request for $presentationName $thumb"
|
||||
def thumbFile = roomDirectory(conf, room).absolutePath + File.separatorChar + presentationName + File.separatorChar +
|
||||
"thumbnails" + File.separatorChar + "thumb-${thumb}.png"
|
||||
log.debug "showing $thumbFile"
|
||||
|
||||
new File(thumbFile)
|
||||
}
|
||||
|
||||
def showTextfile = {conf, room, presentationName, textfile ->
|
||||
@ -117,21 +125,34 @@ class PresentationService {
|
||||
log.debug "showing $txt"
|
||||
|
||||
new File(txt)
|
||||
}
|
||||
|
||||
def numberOfThumbnails = {conf, room, name ->
|
||||
def thumbDir = new File(roomDirectory(conf, room).absolutePath + File.separatorChar + name + File.separatorChar + "thumbnails")
|
||||
thumbDir.listFiles().length
|
||||
}
|
||||
|
||||
def getFile = {conf, room, presentationName ->
|
||||
println "download request for $presentationName"
|
||||
|
||||
def fileDirectory = new File(roomDirectory(conf, room).absolutePath + File.separatorChar + presentationName + File.separatorChar +
|
||||
"download")
|
||||
|
||||
//list the files of the download directory ; it must have only 1 file to download
|
||||
def list = fileDirectory.listFiles()
|
||||
|
||||
//new File(pdfFile)
|
||||
list[0]
|
||||
}
|
||||
|
||||
def numberOfThumbnails = {conf, room, name ->
|
||||
def thumbDir = new File(roomDirectory(conf, room).absolutePath + File.separatorChar + name + File.separatorChar + "thumbnails")
|
||||
thumbDir.listFiles().length
|
||||
}
|
||||
|
||||
def numberOfTextfiles = {conf, room, name ->
|
||||
log.debug roomDirectory(conf, room).absolutePath + File.separatorChar + name + File.separatorChar + "textfiles"
|
||||
def textfilesDir = new File(roomDirectory(conf, room).absolutePath + File.separatorChar + name + File.separatorChar + "textfiles")
|
||||
textfilesDir.listFiles().length
|
||||
}
|
||||
|
||||
def roomDirectory = {conf, room ->
|
||||
return new File(presentationDir + File.separatorChar + conf + File.separatorChar + room)
|
||||
}
|
||||
|
||||
def roomDirectory = {conf, room ->
|
||||
return new File(presentationDir + File.separatorChar + conf + File.separatorChar + room)
|
||||
}
|
||||
|
||||
def testConversionProcess() {
|
||||
@ -155,14 +176,14 @@ class PresentationService {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*** Helper classes **/
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.File;
|
||||
class PngFilter implements FilenameFilter {
|
||||
public boolean accept(File dir, String name) {
|
||||
return (name.endsWith(".png"));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*** Helper classes **/
|
||||
import java.io.FilenameFilter;
|
||||
import java.io.File;
|
||||
class PngFilter implements FilenameFilter {
|
||||
public boolean accept(File dir, String name) {
|
||||
return (name.endsWith(".png"));
|
||||
}
|
||||
}
|
||||
|
@ -41,6 +41,13 @@ public class ConversionUpdateMessage {
|
||||
message.put("room", pres.getRoom());
|
||||
message.put("returnCode", "CONVERT");
|
||||
message.put("presentationName", pres.getName());
|
||||
|
||||
|
||||
|
||||
if(pres.isDownloadable())
|
||||
message.put("fileName",pres.getFileNameToDownload());
|
||||
else
|
||||
message.put("fileName","");
|
||||
}
|
||||
|
||||
public MessageBuilder entry(String key, Object value) {
|
||||
|
@ -29,11 +29,30 @@ public final class UploadedPresentation {
|
||||
private String fileType = "unknown";
|
||||
private int numberOfPages = 0;
|
||||
private boolean lastStepSuccessful = false;
|
||||
private boolean isDownloadable = false;
|
||||
private String fileNameToDownload = "";
|
||||
|
||||
public UploadedPresentation(String conference, String room, String name) {
|
||||
this.conference = conference;
|
||||
this.room = room;
|
||||
this.name = name;
|
||||
this.isDownloadable = false;
|
||||
}
|
||||
|
||||
public boolean isDownloadable() {
|
||||
return isDownloadable;
|
||||
}
|
||||
|
||||
public void setDownloadable() {
|
||||
this.isDownloadable = true;
|
||||
}
|
||||
|
||||
public void setFileNameToDownload(String name) {
|
||||
this.fileNameToDownload = name;
|
||||
}
|
||||
|
||||
public String getFileNameToDownload() {
|
||||
return fileNameToDownload;
|
||||
}
|
||||
|
||||
public File getUploadedFile() {
|
||||
|
Loading…
Reference in New Issue
Block a user