use of org.olat.core.gui.media.MediaResource in project OpenOLAT by OpenOLAT.
the class TableOfContentController method doExportBinderAsCP.
private void doExportBinderAsCP(UserRequest ureq) {
MediaResource resource = new ExportBinderAsCPResource(binder, ureq, getLocale());
ureq.getDispatchResult().setResultingMediaResource(resource);
}
use of org.olat.core.gui.media.MediaResource in project OpenOLAT by OpenOLAT.
the class DirectoryController method doBulkdownload.
private void doBulkdownload(UserRequest ureq) {
MediaResource mdr = new ZippedDirectoryMediaResource(zipName, documentsDir);
ureq.getDispatchResult().setResultingMediaResource(mdr);
}
use of org.olat.core.gui.media.MediaResource in project OpenOLAT by OpenOLAT.
the class DirectoryController method doDownload.
private void doDownload(UserRequest ureq, File file) {
if (file.getName().endsWith(".html")) {
previewCtrl = new SinglePageController(ureq, getWindowControl(), documentsContainer, file.getName(), false);
listenTo(previewCtrl);
cmc = new CloseableModalController(getWindowControl(), translate("close"), previewCtrl.getInitialComponent(), true, file.getName());
listenTo(cmc);
cmc.activate();
} else {
MediaResource mdr = new FileMediaResource(file, true);
ureq.getDispatchResult().setResultingMediaResource(mdr);
}
}
use of org.olat.core.gui.media.MediaResource in project OpenOLAT by OpenOLAT.
the class GTAAssignedTaskController method event.
@Override
protected void event(UserRequest ureq, Component source, Event event) {
if (downloadLink == source) {
if (taskFile.getName().endsWith(".html")) {
doPreview(ureq);
} else {
MediaResource mdr = new FileMediaResource(taskFile, true);
ureq.getDispatchResult().setResultingMediaResource(mdr);
}
} else if (downloadButton == source) {
MediaResource mdr;
if (taskFile.getName().endsWith(".html")) {
File taskDir = gtaManager.getTasksDirectory(courseEnv, gtaNode);
mdr = new HTMLZippedMediaResource(taskFile.getName(), taskDir);
} else {
mdr = new FileMediaResource(taskFile, true);
}
ureq.getDispatchResult().setResultingMediaResource(mdr);
}
}
use of org.olat.core.gui.media.MediaResource in project OpenOLAT by OpenOLAT.
the class WikiWebServiceHelper method serve.
/**
* exports the wiki-Resource and serves the zip file. The given
* OLATResourceable can be the repository-entry of the wiki or the
* businessGroup (if it is a group-wiki)
*
* @param wikiResource
* @param request
* @param response
* @return
*/
public static Response serve(OLATResourceable wikiResource, HttpServletRequest request, HttpServletResponse response) {
Identity ident = RestSecurityHelper.getIdentity(request);
Translator translator = Util.createPackageTranslator(WikiMainController.class, new Locale(ident.getUser().getPreferences().getLanguage()));
// make mediaResource
MediaResource cpMediaResource = new WikiToCPResource(wikiResource, ident, translator);
// use servletUtil, so file gets deleted afterwards
ServletUtil.serveResource(request, response, cpMediaResource);
return Response.ok().build();
}
Aggregations