Search in sources :

Example 1 with UploadMedia

use of org.olat.modules.portfolio.ui.media.UploadMedia in project openolat by klemens.

the class MediaUploadController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (mediaReference == null) {
        String title = titleEl.getValue();
        String description = descriptionEl.getValue();
        File uploadedFile = fileEl.getUploadFile();
        String uploadedFilename = fileEl.getUploadFileName();
        MediaHandler mediaHandler = getHandler();
        if (mediaHandler != null) {
            UploadMedia mObject = new UploadMedia(uploadedFile, uploadedFilename, fileEl.getUploadMimeType());
            mediaReference = mediaHandler.createMedia(title, description, mObject, businessPath, getIdentity());
        }
    } else {
    // TODO can we update an artefact?
    }
    List<String> updatedCategories = categoriesEl.getValueList();
    portfolioService.updateCategories(mediaReference, updatedCategories);
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : MediaHandler(org.olat.modules.portfolio.MediaHandler) UploadMedia(org.olat.modules.portfolio.ui.media.UploadMedia) File(java.io.File)

Example 2 with UploadMedia

use of org.olat.modules.portfolio.ui.media.UploadMedia in project OpenOLAT by OpenOLAT.

the class MediaUploadController method formOK.

@Override
protected void formOK(UserRequest ureq) {
    if (mediaReference == null) {
        String title = titleEl.getValue();
        String description = descriptionEl.getValue();
        File uploadedFile = fileEl.getUploadFile();
        String uploadedFilename = fileEl.getUploadFileName();
        MediaHandler mediaHandler = getHandler();
        if (mediaHandler != null) {
            UploadMedia mObject = new UploadMedia(uploadedFile, uploadedFilename, fileEl.getUploadMimeType());
            mediaReference = mediaHandler.createMedia(title, description, mObject, businessPath, getIdentity());
        }
    } else {
    // TODO can we update an artefact?
    }
    List<String> updatedCategories = categoriesEl.getValueList();
    portfolioService.updateCategories(mediaReference, updatedCategories);
    fireEvent(ureq, Event.DONE_EVENT);
}
Also used : MediaHandler(org.olat.modules.portfolio.MediaHandler) UploadMedia(org.olat.modules.portfolio.ui.media.UploadMedia) File(java.io.File)

Aggregations

File (java.io.File)2 MediaHandler (org.olat.modules.portfolio.MediaHandler)2 UploadMedia (org.olat.modules.portfolio.ui.media.UploadMedia)2