use of org.olat.modules.forms.ui.model.FileUploadCompareWrapper 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.modules.forms.ui.model.FileUploadCompareWrapper in project OpenOLAT by OpenOLAT.
the class CompareEvaluationsFormController method forgeFileUpload.
private List<EvaluationFormElementWrapper> forgeFileUpload(UserRequest ureq, FileUpload element) {
List<EvaluationFormResponse> responses = identifierToResponses.get(element.getId());
if (responses == null) {
return new ArrayList<>();
}
List<EvaluationFormElementWrapper> fileUploadWrappers = new ArrayList<>(responses.size());
for (EvaluationFormResponse response : responses) {
if (response.getFileResponse() != null) {
FileUploadCompareWrapper fileUploadWrapper = createFileUploadCompareWrapper(ureq, element, response);
EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(element);
wrapper.setFileUploadCompareWrapper(fileUploadWrapper);
fileUploadWrappers.add(wrapper);
}
}
return fileUploadWrappers;
}
use of org.olat.modules.forms.ui.model.FileUploadCompareWrapper 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);
}
use of org.olat.modules.forms.ui.model.FileUploadCompareWrapper in project openolat by klemens.
the class CompareEvaluationsFormController method forgeFileUpload.
private List<EvaluationFormElementWrapper> forgeFileUpload(UserRequest ureq, FileUpload element) {
List<EvaluationFormResponse> responses = identifierToResponses.get(element.getId());
if (responses == null) {
return new ArrayList<>();
}
List<EvaluationFormElementWrapper> fileUploadWrappers = new ArrayList<>(responses.size());
for (EvaluationFormResponse response : responses) {
if (response.getFileResponse() != null) {
FileUploadCompareWrapper fileUploadWrapper = createFileUploadCompareWrapper(ureq, element, response);
EvaluationFormElementWrapper wrapper = new EvaluationFormElementWrapper(element);
wrapper.setFileUploadCompareWrapper(fileUploadWrapper);
fileUploadWrappers.add(wrapper);
}
}
return fileUploadWrappers;
}
Aggregations