Search in sources :

Example 1 with FullAccessCallback

use of org.olat.core.util.vfs.callbacks.FullAccessCallback in project OpenOLAT by OpenOLAT.

the class DialogCourseNode method doArchiveElement.

/**
 * Archive a single dialog element with files and forum
 * @param element
 * @param exportDirectory
 */
public void doArchiveElement(DialogElement element, File exportDirectory, Locale locale) {
    DialogElementsManager depm = CoreSpringFactory.getImpl(DialogElementsManager.class);
    VFSContainer dialogContainer = depm.getDialogContainer(element);
    // there is only one file (leave) in the top forum container
    VFSItem dialogFile = dialogContainer.getItems(new VFSLeafFilter()).get(0);
    VFSContainer exportContainer = new LocalFolderImpl(exportDirectory);
    // append export timestamp to avoid overwriting previous export
    String exportDirName = Formatter.makeStringFilesystemSave(getShortTitle()) + "_" + element.getForum().getKey() + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
    VFSContainer diaNodeElemExportContainer = exportContainer.createChildContainer(exportDirName);
    // don't check quota
    diaNodeElemExportContainer.setLocalSecurityCallback(new FullAccessCallback());
    diaNodeElemExportContainer.copyFrom(dialogFile);
    ForumArchiveManager fam = ForumArchiveManager.getInstance();
    ForumFormatter ff = new ForumRTFFormatter(diaNodeElemExportContainer, false, locale);
    fam.applyFormatter(ff, element.getForum().getKey(), null);
}
Also used : ForumFormatter(org.olat.modules.fo.archiver.formatters.ForumFormatter) FullAccessCallback(org.olat.core.util.vfs.callbacks.FullAccessCallback) ForumArchiveManager(org.olat.modules.fo.archiver.ForumArchiveManager) ForumRTFFormatter(org.olat.modules.fo.archiver.formatters.ForumRTFFormatter) VFSContainer(org.olat.core.util.vfs.VFSContainer) VFSItem(org.olat.core.util.vfs.VFSItem) DialogElementsManager(org.olat.course.nodes.dialog.DialogElementsManager) Date(java.util.Date) VFSLeafFilter(org.olat.core.util.vfs.filters.VFSLeafFilter) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 2 with FullAccessCallback

use of org.olat.core.util.vfs.callbacks.FullAccessCallback in project openolat by klemens.

the class DialogCourseNode method doArchiveElement.

/**
 * Archive a single dialog element with files and forum
 * @param element
 * @param exportDirectory
 */
public void doArchiveElement(DialogElement element, File exportDirectory, Locale locale) {
    DialogElementsManager depm = CoreSpringFactory.getImpl(DialogElementsManager.class);
    VFSContainer dialogContainer = depm.getDialogContainer(element);
    // there is only one file (leave) in the top forum container
    VFSItem dialogFile = dialogContainer.getItems(new VFSLeafFilter()).get(0);
    VFSContainer exportContainer = new LocalFolderImpl(exportDirectory);
    // append export timestamp to avoid overwriting previous export
    String exportDirName = Formatter.makeStringFilesystemSave(getShortTitle()) + "_" + element.getForum().getKey() + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
    VFSContainer diaNodeElemExportContainer = exportContainer.createChildContainer(exportDirName);
    // don't check quota
    diaNodeElemExportContainer.setLocalSecurityCallback(new FullAccessCallback());
    diaNodeElemExportContainer.copyFrom(dialogFile);
    ForumArchiveManager fam = ForumArchiveManager.getInstance();
    ForumFormatter ff = new ForumRTFFormatter(diaNodeElemExportContainer, false, locale);
    fam.applyFormatter(ff, element.getForum().getKey(), null);
}
Also used : ForumFormatter(org.olat.modules.fo.archiver.formatters.ForumFormatter) FullAccessCallback(org.olat.core.util.vfs.callbacks.FullAccessCallback) ForumArchiveManager(org.olat.modules.fo.archiver.ForumArchiveManager) ForumRTFFormatter(org.olat.modules.fo.archiver.formatters.ForumRTFFormatter) VFSContainer(org.olat.core.util.vfs.VFSContainer) VFSItem(org.olat.core.util.vfs.VFSItem) DialogElementsManager(org.olat.course.nodes.dialog.DialogElementsManager) Date(java.util.Date) VFSLeafFilter(org.olat.core.util.vfs.filters.VFSLeafFilter) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 3 with FullAccessCallback

use of org.olat.core.util.vfs.callbacks.FullAccessCallback in project OpenOLAT by OpenOLAT.

the class DocumentPoolMainController method doSelectTemplatesDirectory.

private DocumentDirectoryController doSelectTemplatesDirectory(UserRequest ureq, TaxonomyTreeNode node) {
    content.popUpToRootController(ureq);
    VFSContainer directory = node.getDirectory();
    VFSSecurityCallback secCallback = isTaxonomyAdmin ? new FullAccessCallback() : new ReadOnlyCallback();
    directory.setLocalSecurityCallback(secCallback);
    String name = translate("document.pool.templates");
    OLATResourceable ores = OresHelper.createOLATResourceableInstance("Templates", 0l);
    WindowControl bwControl = addToHistory(ureq, ores, null);
    DocumentDirectoryController directoryCtrl = new DocumentDirectoryController(ureq, bwControl, directory, name);
    directoryCtrl.setAdditionalResourceURL("[Templates:0]");
    listenTo(directoryCtrl);
    content.pushController(name, directoryCtrl);
    return directoryCtrl;
}
Also used : FullAccessCallback(org.olat.core.util.vfs.callbacks.FullAccessCallback) ReadOnlyCallback(org.olat.core.util.vfs.callbacks.ReadOnlyCallback) OLATResourceable(org.olat.core.id.OLATResourceable) VFSContainer(org.olat.core.util.vfs.VFSContainer) WindowControl(org.olat.core.gui.control.WindowControl) VFSSecurityCallback(org.olat.core.util.vfs.callbacks.VFSSecurityCallback) TaxonomyVFSSecurityCallback(org.olat.modules.taxonomy.ui.component.TaxonomyVFSSecurityCallback)

Example 4 with FullAccessCallback

use of org.olat.core.util.vfs.callbacks.FullAccessCallback in project openolat by klemens.

the class DocumentPoolMainController method doSelectTemplatesDirectory.

private DocumentDirectoryController doSelectTemplatesDirectory(UserRequest ureq, TaxonomyTreeNode node) {
    content.popUpToRootController(ureq);
    VFSContainer directory = node.getDirectory();
    VFSSecurityCallback secCallback = isTaxonomyAdmin ? new FullAccessCallback() : new ReadOnlyCallback();
    directory.setLocalSecurityCallback(secCallback);
    String name = translate("document.pool.templates");
    OLATResourceable ores = OresHelper.createOLATResourceableInstance("Templates", 0l);
    WindowControl bwControl = addToHistory(ureq, ores, null);
    DocumentDirectoryController directoryCtrl = new DocumentDirectoryController(ureq, bwControl, directory, name);
    directoryCtrl.setAdditionalResourceURL("[Templates:0]");
    listenTo(directoryCtrl);
    content.pushController(name, directoryCtrl);
    return directoryCtrl;
}
Also used : FullAccessCallback(org.olat.core.util.vfs.callbacks.FullAccessCallback) ReadOnlyCallback(org.olat.core.util.vfs.callbacks.ReadOnlyCallback) OLATResourceable(org.olat.core.id.OLATResourceable) VFSContainer(org.olat.core.util.vfs.VFSContainer) WindowControl(org.olat.core.gui.control.WindowControl) VFSSecurityCallback(org.olat.core.util.vfs.callbacks.VFSSecurityCallback) TaxonomyVFSSecurityCallback(org.olat.modules.taxonomy.ui.component.TaxonomyVFSSecurityCallback)

Aggregations

VFSContainer (org.olat.core.util.vfs.VFSContainer)4 FullAccessCallback (org.olat.core.util.vfs.callbacks.FullAccessCallback)4 Date (java.util.Date)2 WindowControl (org.olat.core.gui.control.WindowControl)2 OLATResourceable (org.olat.core.id.OLATResourceable)2 LocalFolderImpl (org.olat.core.util.vfs.LocalFolderImpl)2 VFSItem (org.olat.core.util.vfs.VFSItem)2 ReadOnlyCallback (org.olat.core.util.vfs.callbacks.ReadOnlyCallback)2 VFSSecurityCallback (org.olat.core.util.vfs.callbacks.VFSSecurityCallback)2 VFSLeafFilter (org.olat.core.util.vfs.filters.VFSLeafFilter)2 DialogElementsManager (org.olat.course.nodes.dialog.DialogElementsManager)2 ForumArchiveManager (org.olat.modules.fo.archiver.ForumArchiveManager)2 ForumFormatter (org.olat.modules.fo.archiver.formatters.ForumFormatter)2 ForumRTFFormatter (org.olat.modules.fo.archiver.formatters.ForumRTFFormatter)2 TaxonomyVFSSecurityCallback (org.olat.modules.taxonomy.ui.component.TaxonomyVFSSecurityCallback)2