use of org.olat.core.util.vfs.JavaIOItem in project OpenOLAT by OpenOLAT.
the class VFSResource method getCreation.
@Override
public long getCreation() {
try {
if (item instanceof JavaIOItem) {
JavaIOItem ioItem = (JavaIOItem) item;
BasicFileAttributes attrs = Files.readAttributes(ioItem.getBasefile().toPath(), BasicFileAttributes.class);
return attrs.creationTime().toMillis();
}
return 0;
} catch (IOException e) {
log.warn("getCreationFail" + item, e);
return 0;
}
}
use of org.olat.core.util.vfs.JavaIOItem in project OpenOLAT by OpenOLAT.
the class CollectVideoMediaController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
String title = mediaReference == null ? null : mediaReference.getTitle();
titleEl = uifactory.addTextElement("artefact.title", "artefact.title", 255, title, formLayout);
titleEl.setMandatory(true);
String desc = mediaReference == null ? null : mediaReference.getDescription();
descriptionEl = uifactory.addRichTextElementForStringDataMinimalistic("artefact.descr", "artefact.descr", desc, 8, 60, formLayout, getWindowControl());
descriptionEl.getEditorConfiguration().setPathInStatusBar(false);
fileEl = uifactory.addFileElement(getWindowControl(), "artefact.file", "artefact.file", formLayout);
fileEl.addActionListener(FormEvent.ONCHANGE);
fileEl.setMaxUploadSizeKB(250000, null, null);
fileEl.setPreview(ureq.getUserSession(), true);
fileEl.setDeleteEnabled(true);
if (mediaReference != null) {
fileEl.setEnabled(false);
VFSItem item = fileHandler.getVideoItem(mediaReference);
if (item instanceof JavaIOItem) {
fileEl.setInitialFile(((JavaIOItem) item).getBasefile());
}
}
categoriesEl = uifactory.addTextBoxListElement("categories", "categories", "categories.hint", categories, formLayout, getTranslator());
categoriesEl.setHelpText(translate("categories.hint"));
categoriesEl.setElementCssClass("o_sel_ep_tagsinput");
categoriesEl.setAllowDuplicates(false);
Date collectDate = mediaReference == null ? new Date() : mediaReference.getCollectionDate();
String date = Formatter.getInstance(getLocale()).formatDate(collectDate);
uifactory.addStaticTextElement("artefact.collect.date", "artefact.collect.date", date, formLayout);
if (StringHelper.containsNonWhitespace(businessPath)) {
String link = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath);
uifactory.addStaticTextElement("artefact.collect.link", "artefact.collect.link", link, formLayout);
}
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsCont);
uifactory.addFormSubmitButton("save", "save", buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
use of org.olat.core.util.vfs.JavaIOItem in project OpenOLAT by OpenOLAT.
the class CollectFileMediaController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_pf_collect_document_form");
String title = mediaReference == null ? null : mediaReference.getTitle();
titleEl = uifactory.addTextElement("artefact.title", "artefact.title", 255, title, formLayout);
titleEl.setElementCssClass("o_sel_pf_collect_title");
titleEl.setMandatory(true);
String desc = mediaReference == null ? null : mediaReference.getTitle();
descriptionEl = uifactory.addRichTextElementForStringDataMinimalistic("artefact.descr", "artefact.descr", desc, 8, 60, formLayout, getWindowControl());
descriptionEl.getEditorConfiguration().setPathInStatusBar(false);
fileEl = uifactory.addFileElement(getWindowControl(), "artefact.file", "artefact.file", formLayout);
fileEl.addActionListener(FormEvent.ONCHANGE);
if (mediaReference != null) {
fileEl.setEnabled(false);
VFSItem item = fileHandler.getItem(mediaReference);
if (item instanceof JavaIOItem) {
fileEl.setInitialFile(((JavaIOItem) item).getBasefile());
}
}
categoriesEl = uifactory.addTextBoxListElement("categories", "categories", "categories.hint", categories, formLayout, getTranslator());
categoriesEl.setHelpText(translate("categories.hint"));
categoriesEl.setElementCssClass("o_sel_ep_tagsinput");
categoriesEl.setAllowDuplicates(false);
// String source = "Forum";
// uifactory.addStaticTextElement("artefact.source", "artefact.source", source, formLayout);
Date collectDate = mediaReference == null ? new Date() : mediaReference.getCollectionDate();
String date = Formatter.getInstance(getLocale()).formatDate(collectDate);
uifactory.addStaticTextElement("artefact.collect.date", "artefact.collect.date", date, formLayout);
if (StringHelper.containsNonWhitespace(businessPath)) {
String link = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath);
uifactory.addStaticTextElement("artefact.collect.link", "artefact.collect.link", link, formLayout);
}
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsCont);
uifactory.addFormSubmitButton("save", "save", buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
use of org.olat.core.util.vfs.JavaIOItem in project openolat by klemens.
the class CollectImageMediaController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
formLayout.setElementCssClass("o_sel_pf_collect_image_form");
String title = mediaReference == null ? null : mediaReference.getTitle();
titleEl = uifactory.addTextElement("artefact.title", "artefact.title", 255, title, formLayout);
titleEl.setElementCssClass("o_sel_pf_collect_title");
titleEl.setMandatory(true);
String desc = mediaReference == null ? null : mediaReference.getDescription();
descriptionEl = uifactory.addRichTextElementForStringDataMinimalistic("artefact.descr", "artefact.descr", desc, 8, 60, formLayout, getWindowControl());
descriptionEl.getEditorConfiguration().setPathInStatusBar(false);
fileEl = uifactory.addFileElement(getWindowControl(), "artefact.file", "artefact.file", formLayout);
fileEl.limitToMimeType(imageMimeTypes, null, null);
fileEl.addActionListener(FormEvent.ONCHANGE);
fileEl.setMaxUploadSizeKB(10000, null, null);
fileEl.setPreview(ureq.getUserSession(), true);
if (mediaReference != null) {
fileEl.setEnabled(false);
VFSItem item = fileHandler.getImage(mediaReference);
if (item instanceof JavaIOItem) {
fileEl.setInitialFile(((JavaIOItem) item).getBasefile());
}
}
categoriesEl = uifactory.addTextBoxListElement("categories", "categories", "categories.hint", categories, formLayout, getTranslator());
categoriesEl.setHelpText(translate("categories.hint"));
categoriesEl.setElementCssClass("o_sel_ep_tagsinput");
categoriesEl.setAllowDuplicates(false);
Date collectDate = mediaReference == null ? new Date() : mediaReference.getCollectionDate();
String date = Formatter.getInstance(getLocale()).formatDate(collectDate);
uifactory.addStaticTextElement("artefact.collect.date", "artefact.collect.date", date, formLayout);
if (StringHelper.containsNonWhitespace(businessPath)) {
String link = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath);
uifactory.addStaticTextElement("artefact.collect.link", "artefact.collect.link", link, formLayout);
}
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsCont);
uifactory.addFormSubmitButton("save", "save", buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
use of org.olat.core.util.vfs.JavaIOItem in project openolat by klemens.
the class CollectVideoMediaController method initForm.
@Override
protected void initForm(FormItemContainer formLayout, Controller listener, UserRequest ureq) {
String title = mediaReference == null ? null : mediaReference.getTitle();
titleEl = uifactory.addTextElement("artefact.title", "artefact.title", 255, title, formLayout);
titleEl.setMandatory(true);
String desc = mediaReference == null ? null : mediaReference.getDescription();
descriptionEl = uifactory.addRichTextElementForStringDataMinimalistic("artefact.descr", "artefact.descr", desc, 8, 60, formLayout, getWindowControl());
descriptionEl.getEditorConfiguration().setPathInStatusBar(false);
fileEl = uifactory.addFileElement(getWindowControl(), "artefact.file", "artefact.file", formLayout);
fileEl.addActionListener(FormEvent.ONCHANGE);
fileEl.setMaxUploadSizeKB(250000, null, null);
fileEl.setPreview(ureq.getUserSession(), true);
fileEl.setDeleteEnabled(true);
if (mediaReference != null) {
fileEl.setEnabled(false);
VFSItem item = fileHandler.getVideoItem(mediaReference);
if (item instanceof JavaIOItem) {
fileEl.setInitialFile(((JavaIOItem) item).getBasefile());
}
}
categoriesEl = uifactory.addTextBoxListElement("categories", "categories", "categories.hint", categories, formLayout, getTranslator());
categoriesEl.setHelpText(translate("categories.hint"));
categoriesEl.setElementCssClass("o_sel_ep_tagsinput");
categoriesEl.setAllowDuplicates(false);
Date collectDate = mediaReference == null ? new Date() : mediaReference.getCollectionDate();
String date = Formatter.getInstance(getLocale()).formatDate(collectDate);
uifactory.addStaticTextElement("artefact.collect.date", "artefact.collect.date", date, formLayout);
if (StringHelper.containsNonWhitespace(businessPath)) {
String link = BusinessControlFactory.getInstance().getURLFromBusinessPathString(businessPath);
uifactory.addStaticTextElement("artefact.collect.link", "artefact.collect.link", link, formLayout);
}
FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons", getTranslator());
formLayout.add(buttonsCont);
uifactory.addFormSubmitButton("save", "save", buttonsCont);
uifactory.addFormCancelButton("cancel", buttonsCont, ureq, getWindowControl());
}
Aggregations