use of org.olat.core.gui.media.FileMediaResource in project OpenOLAT by OpenOLAT.
the class ReturnboxFullAccessCallback method event.
/**
* @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.components.Component, org.olat.core.gui.control.Event)
*/
@Override
public void event(UserRequest ureq, Component source, Event event) {
if (source == taskLaunchButton) {
File fTaskfolder = new File(FolderConfig.getCanonicalRoot() + TACourseNode.getTaskFolderPathRelToFolderRoot(userCourseEnv.getCourseEnvironment(), node));
if (assignedTask.toLowerCase().endsWith(".html") || assignedTask.toLowerCase().endsWith(".htm") || assignedTask.toLowerCase().endsWith(".txt")) {
// render content for other users always in iframe
removeAsListenerAndDispose(iFrameCtr);
iFrameCtr = new IFrameDisplayController(ureq, getWindowControl(), fTaskfolder);
listenTo(iFrameCtr);
iFrameCtr.setCurrentURI(assignedTask);
removeAsListenerAndDispose(cmc);
cmc = new CloseableModalController(getWindowControl(), translate("close"), iFrameCtr.getInitialComponent());
listenTo(cmc);
cmc.activate();
} else {
ureq.getDispatchResult().setResultingMediaResource(new FileMediaResource(new File(fTaskfolder, assignedTask)));
}
} else if (source == cancelTaskButton) {
// confirm cancel task assignment
dialogBoxController = this.activateYesNoDialog(ureq, "", translate("task.cancel.reassign"), dialogBoxController);
}
}
use of org.olat.core.gui.media.FileMediaResource 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.FileMediaResource 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.FileMediaResource in project OpenOLAT by OpenOLAT.
the class DisplayPortraitManager method getPortraitResource.
/**
* Get the portrait media resource by identity name (username)
* @param identity
* @return imageResource portrait
*/
private MediaResource getPortraitResource(String username, String portraitName) {
MediaResource imageResource = null;
File imgFile = getPortraitFile(username, portraitName);
if (imgFile != null && imgFile.exists()) {
imageResource = new FileMediaResource(imgFile);
}
return imageResource;
}
use of org.olat.core.gui.media.FileMediaResource in project openolat by klemens.
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);
}
}
Aggregations