Search in sources :

Example 1 with ForumFormatter

use of org.olat.modules.fo.archiver.formatters.ForumFormatter in project OpenOLAT by OpenOLAT.

the class CollaborationTools method archiveForum.

private void archiveForum(String archivFilePath) {
    Property forumKeyProperty = NarrowedPropertyManager.getInstance(ores).findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
    if (forumKeyProperty != null) {
        VFSContainer archiveContainer = new LocalFolderImpl(new File(archivFilePath));
        String archiveForumName = "del_forum_" + forumKeyProperty.getLongValue();
        VFSContainer archiveForumContainer = archiveContainer.createChildContainer(archiveForumName);
        ForumFormatter ff = new ForumRTFFormatter(archiveForumContainer, false, I18nModule.getDefaultLocale());
        ForumArchiveManager.getInstance().applyFormatter(ff, forumKeyProperty.getLongValue(), null);
    }
}
Also used : ForumFormatter(org.olat.modules.fo.archiver.formatters.ForumFormatter) ForumRTFFormatter(org.olat.modules.fo.archiver.formatters.ForumRTFFormatter) VFSContainer(org.olat.core.util.vfs.VFSContainer) Property(org.olat.properties.Property) File(java.io.File) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 2 with ForumFormatter

use of org.olat.modules.fo.archiver.formatters.ForumFormatter 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 3 with ForumFormatter

use of org.olat.modules.fo.archiver.formatters.ForumFormatter 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 4 with ForumFormatter

use of org.olat.modules.fo.archiver.formatters.ForumFormatter in project openolat by klemens.

the class CollaborationTools method archiveForum.

private void archiveForum(String archivFilePath) {
    Property forumKeyProperty = NarrowedPropertyManager.getInstance(ores).findProperty(null, null, PROP_CAT_BG_COLLABTOOLS, KEY_FORUM);
    if (forumKeyProperty != null) {
        VFSContainer archiveContainer = new LocalFolderImpl(new File(archivFilePath));
        String archiveForumName = "del_forum_" + forumKeyProperty.getLongValue();
        VFSContainer archiveForumContainer = archiveContainer.createChildContainer(archiveForumName);
        ForumFormatter ff = new ForumRTFFormatter(archiveForumContainer, false, I18nModule.getDefaultLocale());
        ForumArchiveManager.getInstance().applyFormatter(ff, forumKeyProperty.getLongValue(), null);
    }
}
Also used : ForumFormatter(org.olat.modules.fo.archiver.formatters.ForumFormatter) ForumRTFFormatter(org.olat.modules.fo.archiver.formatters.ForumRTFFormatter) VFSContainer(org.olat.core.util.vfs.VFSContainer) Property(org.olat.properties.Property) File(java.io.File) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 5 with ForumFormatter

use of org.olat.modules.fo.archiver.formatters.ForumFormatter 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, ZipOutputStream exportStream, Locale locale) {
    DialogElementsManager depm = CoreSpringFactory.getImpl(DialogElementsManager.class);
    String exportDirName = Formatter.makeStringFilesystemSave(getShortTitle()) + "_" + element.getForum().getKey() + "_" + Formatter.formatDatetimeFilesystemSave(new Date());
    VFSContainer forumContainer = depm.getDialogContainer(element);
    for (VFSItem item : forumContainer.getItems(new VFSLeafFilter())) {
        ZipUtil.addToZip(item, exportDirName, exportStream);
    }
    ForumArchiveManager fam = ForumArchiveManager.getInstance();
    ForumFormatter ff = new ForumStreamedRTFFormatter(exportStream, exportDirName, false, locale);
    fam.applyFormatter(ff, element.getForum().getKey(), null);
}
Also used : ForumFormatter(org.olat.modules.fo.archiver.formatters.ForumFormatter) ForumStreamedRTFFormatter(org.olat.modules.fo.archiver.formatters.ForumStreamedRTFFormatter) ForumArchiveManager(org.olat.modules.fo.archiver.ForumArchiveManager) 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)

Aggregations

VFSContainer (org.olat.core.util.vfs.VFSContainer)6 ForumFormatter (org.olat.modules.fo.archiver.formatters.ForumFormatter)6 Date (java.util.Date)4 LocalFolderImpl (org.olat.core.util.vfs.LocalFolderImpl)4 VFSItem (org.olat.core.util.vfs.VFSItem)4 VFSLeafFilter (org.olat.core.util.vfs.filters.VFSLeafFilter)4 DialogElementsManager (org.olat.course.nodes.dialog.DialogElementsManager)4 ForumArchiveManager (org.olat.modules.fo.archiver.ForumArchiveManager)4 ForumRTFFormatter (org.olat.modules.fo.archiver.formatters.ForumRTFFormatter)4 File (java.io.File)2 FullAccessCallback (org.olat.core.util.vfs.callbacks.FullAccessCallback)2 ForumStreamedRTFFormatter (org.olat.modules.fo.archiver.formatters.ForumStreamedRTFFormatter)2 Property (org.olat.properties.Property)2