Search in sources :

Example 1 with ForumStreamedRTFFormatter

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

the class ForumNodeForumCallback method archiveNodeData.

@Override
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String charset) {
    CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    Property forumKeyProperty = cpm.findCourseNodeProperty(this, null, null, FORUM_KEY);
    if (forumKeyProperty == null) {
        return false;
    }
    Long forumKey = forumKeyProperty.getLongValue();
    if (ForumManager.getInstance().countThreadsByForumID(forumKey) <= 0) {
        return false;
    }
    String forumName = "forum_" + Formatter.makeStringFilesystemSave(getShortTitle()) + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
    ForumStreamedRTFFormatter rtff = new ForumStreamedRTFFormatter(exportStream, forumName, false, locale);
    ForumArchiveManager.getInstance().applyFormatter(rtff, forumKey, null);
    return true;
}
Also used : ForumStreamedRTFFormatter(org.olat.modules.fo.archiver.formatters.ForumStreamedRTFFormatter) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager) Date(java.util.Date)

Example 2 with ForumStreamedRTFFormatter

use of org.olat.modules.fo.archiver.formatters.ForumStreamedRTFFormatter 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)

Example 3 with ForumStreamedRTFFormatter

use of org.olat.modules.fo.archiver.formatters.ForumStreamedRTFFormatter 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, 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)

Example 4 with ForumStreamedRTFFormatter

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

the class ForumNodeForumCallback method archiveNodeData.

@Override
public boolean archiveNodeData(Locale locale, ICourse course, ArchiveOptions options, ZipOutputStream exportStream, String charset) {
    CoursePropertyManager cpm = course.getCourseEnvironment().getCoursePropertyManager();
    Property forumKeyProperty = cpm.findCourseNodeProperty(this, null, null, FORUM_KEY);
    if (forumKeyProperty == null) {
        return false;
    }
    Long forumKey = forumKeyProperty.getLongValue();
    if (ForumManager.getInstance().countThreadsByForumID(forumKey) <= 0) {
        return false;
    }
    String forumName = "forum_" + Formatter.makeStringFilesystemSave(getShortTitle()) + "_" + Formatter.formatDatetimeFilesystemSave(new Date(System.currentTimeMillis()));
    ForumStreamedRTFFormatter rtff = new ForumStreamedRTFFormatter(exportStream, forumName, false, locale);
    ForumArchiveManager.getInstance().applyFormatter(rtff, forumKey, null);
    return true;
}
Also used : ForumStreamedRTFFormatter(org.olat.modules.fo.archiver.formatters.ForumStreamedRTFFormatter) Property(org.olat.properties.Property) CoursePropertyManager(org.olat.course.properties.CoursePropertyManager) PersistingCoursePropertyManager(org.olat.course.properties.PersistingCoursePropertyManager) Date(java.util.Date)

Aggregations

Date (java.util.Date)4 ForumStreamedRTFFormatter (org.olat.modules.fo.archiver.formatters.ForumStreamedRTFFormatter)4 VFSContainer (org.olat.core.util.vfs.VFSContainer)2 VFSItem (org.olat.core.util.vfs.VFSItem)2 VFSLeafFilter (org.olat.core.util.vfs.filters.VFSLeafFilter)2 DialogElementsManager (org.olat.course.nodes.dialog.DialogElementsManager)2 CoursePropertyManager (org.olat.course.properties.CoursePropertyManager)2 PersistingCoursePropertyManager (org.olat.course.properties.PersistingCoursePropertyManager)2 ForumArchiveManager (org.olat.modules.fo.archiver.ForumArchiveManager)2 ForumFormatter (org.olat.modules.fo.archiver.formatters.ForumFormatter)2 Property (org.olat.properties.Property)2