use of org.olat.core.util.vfs.VFSMediaMapper in project OpenOLAT by OpenOLAT.
the class CompareEvaluationsFormController method createFileUploadCompareWrapper.
private FileUploadCompareWrapper createFileUploadCompareWrapper(UserRequest ureq, FileUpload element, EvaluationFormResponse response) {
Identity evaluator = response.getSession().getIdentity();
String color = evaluatorToColors.get(evaluator);
String evaluatorName = getLegend(evaluator);
String filename = response.getStringuifiedResponse();
String filesize = null;
String mapperUri = null;
String iconCss = null;
String thumbUri = null;
VFSLeaf leaf = evaluationFormManager.loadResponseLeaf(response);
if (leaf != null) {
filename = leaf.getName();
filesize = Formatter.formatBytes((leaf).getSize());
mapperUri = registerCacheableMapper(ureq, "file-upload-" + element.getId() + "-" + leaf.getLastModified(), new VFSMediaMapper(leaf));
iconCss = CSSHelper.createFiletypeIconCssClassFor(leaf.getName());
if (leaf instanceof MetaTagged) {
MetaTagged metaTaggedLeaf = (MetaTagged) leaf;
MetaInfo meta = metaTaggedLeaf.getMetaInfo();
if (meta != null && meta.isThumbnailAvailable()) {
VFSLeaf thumb = meta.getThumbnail(200, 200, false);
if (thumb != null) {
thumbUri = registerCacheableMapper(ureq, "file-upload-thumb" + element.getId() + "-" + leaf.getLastModified(), new VFSMediaMapper(thumb));
;
}
}
}
}
return new FileUploadCompareWrapper(color, evaluatorName, filename, filesize, mapperUri, iconCss, thumbUri);
}
use of org.olat.core.util.vfs.VFSMediaMapper in project openolat by klemens.
the class CompareEvaluationsFormController method createFileUploadCompareWrapper.
private FileUploadCompareWrapper createFileUploadCompareWrapper(UserRequest ureq, FileUpload element, EvaluationFormResponse response) {
Identity evaluator = response.getSession().getIdentity();
String color = evaluatorToColors.get(evaluator);
String evaluatorName = getLegend(evaluator);
String filename = response.getStringuifiedResponse();
String filesize = null;
String mapperUri = null;
String iconCss = null;
String thumbUri = null;
VFSLeaf leaf = evaluationFormManager.loadResponseLeaf(response);
if (leaf != null) {
filename = leaf.getName();
filesize = Formatter.formatBytes((leaf).getSize());
mapperUri = registerCacheableMapper(ureq, "file-upload-" + element.getId() + "-" + leaf.getLastModified(), new VFSMediaMapper(leaf));
iconCss = CSSHelper.createFiletypeIconCssClassFor(leaf.getName());
if (leaf instanceof MetaTagged) {
MetaTagged metaTaggedLeaf = (MetaTagged) leaf;
MetaInfo meta = metaTaggedLeaf.getMetaInfo();
if (meta != null && meta.isThumbnailAvailable()) {
VFSLeaf thumb = meta.getThumbnail(200, 200, false);
if (thumb != null) {
thumbUri = registerCacheableMapper(ureq, "file-upload-thumb" + element.getId() + "-" + leaf.getLastModified(), new VFSMediaMapper(thumb));
;
}
}
}
}
return new FileUploadCompareWrapper(color, evaluatorName, filename, filesize, mapperUri, iconCss, thumbUri);
}
Aggregations