use of org.olat.core.gui.components.download.DownloadComponent in project OpenOLAT by OpenOLAT.
the class FileArtefactDetailsController method initFileView.
private void initFileView(VFSItem file, UserRequest ureq) {
vC = createVelocityContainer("fileDetails");
DownloadComponent downlC = new DownloadComponent("download", (VFSLeaf) file);
vC.put("download", downlC);
vC.contextPut("filename", fArtefact.getFilename());
if (file instanceof MetaTagged) {
MetaInfo meta = ((MetaTagged) file).getMetaInfo();
vC.contextPut("meta", meta);
// show a preview thumbnail if possible
if (meta.isThumbnailAvailable()) {
VFSLeaf thumb = meta.getThumbnail(200, 200, false);
if (thumb != null) {
mr = new VFSMediaResource(thumb);
}
if (mr != null) {
String thumbMapper = registerMapper(ureq, new Mapper() {
@Override
public MediaResource handle(String relPath, HttpServletRequest request) {
return mr;
}
});
vC.contextPut("thumbMapper", thumbMapper);
}
}
}
if (!readOnlyMode) {
// allow to delete
delLink = LinkFactory.createLink("delete.file", vC, this);
delLink.setUserObject(file);
}
viewPanel.setContent(vC);
}
use of org.olat.core.gui.components.download.DownloadComponent in project openolat by klemens.
the class FileArtefactDetailsController method initFileView.
private void initFileView(VFSItem file, UserRequest ureq) {
vC = createVelocityContainer("fileDetails");
DownloadComponent downlC = new DownloadComponent("download", (VFSLeaf) file);
vC.put("download", downlC);
vC.contextPut("filename", fArtefact.getFilename());
if (file instanceof MetaTagged) {
MetaInfo meta = ((MetaTagged) file).getMetaInfo();
vC.contextPut("meta", meta);
// show a preview thumbnail if possible
if (meta.isThumbnailAvailable()) {
VFSLeaf thumb = meta.getThumbnail(200, 200, false);
if (thumb != null) {
mr = new VFSMediaResource(thumb);
}
if (mr != null) {
String thumbMapper = registerMapper(ureq, new Mapper() {
@Override
public MediaResource handle(String relPath, HttpServletRequest request) {
return mr;
}
});
vC.contextPut("thumbMapper", thumbMapper);
}
}
}
if (!readOnlyMode) {
// allow to delete
delLink = LinkFactory.createLink("delete.file", vC, this);
delLink.setUserObject(file);
}
viewPanel.setContent(vC);
}
Aggregations