Search in sources :

Example 1 with VFSMediaMapper

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);
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) VFSMediaMapper(org.olat.core.util.vfs.VFSMediaMapper) MetaTagged(org.olat.core.commons.modules.bc.meta.tagged.MetaTagged) MetaInfo(org.olat.core.commons.modules.bc.meta.MetaInfo) FileUploadCompareWrapper(org.olat.modules.forms.ui.model.FileUploadCompareWrapper) Identity(org.olat.core.id.Identity)

Example 2 with VFSMediaMapper

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);
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) VFSMediaMapper(org.olat.core.util.vfs.VFSMediaMapper) MetaTagged(org.olat.core.commons.modules.bc.meta.tagged.MetaTagged) MetaInfo(org.olat.core.commons.modules.bc.meta.MetaInfo) FileUploadCompareWrapper(org.olat.modules.forms.ui.model.FileUploadCompareWrapper) Identity(org.olat.core.id.Identity)

Aggregations

MetaInfo (org.olat.core.commons.modules.bc.meta.MetaInfo)2 MetaTagged (org.olat.core.commons.modules.bc.meta.tagged.MetaTagged)2 Identity (org.olat.core.id.Identity)2 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)2 VFSMediaMapper (org.olat.core.util.vfs.VFSMediaMapper)2 FileUploadCompareWrapper (org.olat.modules.forms.ui.model.FileUploadCompareWrapper)2