Search in sources :

Example 11 with LocalFolderImpl

use of org.olat.core.util.vfs.LocalFolderImpl 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 12 with LocalFolderImpl

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

the class DialogElementsEditController method doUpload.

private void doUpload(UserRequest ureq) {
    removeAsListenerAndDispose(fileUplCtr);
    VFSContainer tmpContainer = new LocalFolderImpl(new File(WebappHelper.getTmpDir(), "poster_" + UUID.randomUUID()));
    fileUplCtr = new FileUploadController(getWindowControl(), tmpContainer, ureq, FolderConfig.getLimitULKB(), Quota.UNLIMITED, null, false, false, false, false, true, false);
    listenTo(fileUplCtr);
    cmc = new CloseableModalController(getWindowControl(), "close", fileUplCtr.getInitialComponent(), true, translate("dialog.upload.file"));
    listenTo(cmc);
    cmc.activate();
}
Also used : CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) VFSContainer(org.olat.core.util.vfs.VFSContainer) File(java.io.File) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl) FileUploadController(org.olat.core.commons.modules.bc.FileUploadController)

Example 13 with LocalFolderImpl

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

the class CPManagerImpl method createNewCP.

/**
 * @see org.olat.ims.cp.CPManager#createNewCP(org.olat.core.id.OLATResourceable)
 */
public ContentPackage createNewCP(OLATResourceable ores, String initalPageTitle) {
    // copy template cp to new repo-location
    if (copyTemplCP(ores)) {
        File cpRoot = FileResourceManager.getInstance().unzipFileResource(ores);
        logDebug("createNewCP: cpRoot=" + cpRoot);
        logDebug("createNewCP: cpRoot.getAbsolutePath()=" + cpRoot.getAbsolutePath());
        LocalFolderImpl vfsWrapper = new LocalFolderImpl(cpRoot);
        ContentPackage cp = load(vfsWrapper, ores);
        // Modify the copy of the template to get a unique identifier
        CPOrganization orga = setUniqueOrgaIdentifier(cp);
        setOrgaTitleToRepoEntryTitle(ores, orga);
        // Also set the translated title of the inital page.
        orga.getItems().get(0).setTitle(initalPageTitle);
        writeToFile(cp);
        // set the default settings for file delivery
        DeliveryOptions defOptions = DeliveryOptions.defaultWithGlossary();
        CPPackageConfig config = new CPPackageConfig();
        config.setDeliveryOptions(defOptions);
        setCPPackageConfig(ores, config);
        return cp;
    } else {
        logError("CP couldn't be created. Error when copying template. Ores: " + ores.getResourceableId(), null);
        throw new OLATRuntimeException("ERROR while creating new empty cp. an error occured while trying to copy template CP", null);
    }
}
Also used : OLATRuntimeException(org.olat.core.logging.OLATRuntimeException) CPPackageConfig(org.olat.ims.cp.ui.CPPackageConfig) File(java.io.File) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions) CPOrganization(org.olat.ims.cp.objects.CPOrganization) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 14 with LocalFolderImpl

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

the class ScormRepositoryIndexer method doIndex.

protected void doIndex(SearchResourceContext resourceContext, OlatFullIndexer indexWriter, File cpRoot) throws IOException, InterruptedException {
    VFSContainer container = new LocalFolderImpl(cpRoot);
    VFSLeaf fManifest = (VFSLeaf) container.resolve("imsmanifest.xml");
    if (fManifest != null) {
        Element rootElement = IMSLoader.loadIMSDocument(fManifest).getRootElement();
        Document manfiestDoc = createManifestDocument(fManifest, rootElement, resourceContext);
        indexWriter.addDocument(manfiestDoc);
        ScormFileAccess accessRule = new ScormFileAccess();
        doIndexVFSContainer(resourceContext, container, indexWriter, "", accessRule);
    }
}
Also used : VFSLeaf(org.olat.core.util.vfs.VFSLeaf) VFSContainer(org.olat.core.util.vfs.VFSContainer) Element(org.dom4j.Element) Document(org.apache.lucene.document.Document) IMSMetadataDocument(org.olat.search.service.document.file.IMSMetadataDocument) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 15 with LocalFolderImpl

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

the class ImsCPRepositoryIndexer method doIndex.

/**
 * @see org.olat.repository.handlers.RepositoryHandler#supportsDownload()
 */
@Override
public void doIndex(SearchResourceContext resourceContext, Object parentObject, OlatFullIndexer indexWriter) throws IOException, InterruptedException {
    RepositoryEntry repositoryEntry = (RepositoryEntry) parentObject;
    if (isLogDebugEnabled())
        logDebug("Analyse IMS CP RepositoryEntry...");
    resourceContext.setDocumentType(TYPE);
    if (repositoryEntry != null) {
        File cpRoot = FileResourceManager.getInstance().unzipFileResource(repositoryEntry.getOlatResource());
        if (cpRoot != null) {
            SearchResourceContext cpContext = new SearchResourceContext(resourceContext);
            VFSContainer rootContainer = new LocalFolderImpl(cpRoot);
            doIndexVFSContainer(cpContext, rootContainer, indexWriter, "", FolderIndexerAccess.FULL_ACCESS);
        }
    }
}
Also used : SearchResourceContext(org.olat.search.service.SearchResourceContext) VFSContainer(org.olat.core.util.vfs.VFSContainer) RepositoryEntry(org.olat.repository.RepositoryEntry) File(java.io.File) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Aggregations

LocalFolderImpl (org.olat.core.util.vfs.LocalFolderImpl)122 File (java.io.File)82 VFSContainer (org.olat.core.util.vfs.VFSContainer)76 VFSItem (org.olat.core.util.vfs.VFSItem)38 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)30 ArrayList (java.util.ArrayList)14 IOException (java.io.IOException)10 Document (org.dom4j.Document)10 RepositoryEntry (org.olat.repository.RepositoryEntry)10 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)8 DeliveryOptions (org.olat.core.gui.control.generic.iframe.DeliveryOptions)8 OLATResource (org.olat.resource.OLATResource)8 Date (java.util.Date)6 Document (org.apache.lucene.document.Document)6 Element (org.dom4j.Element)6 OlatRootFolderImpl (org.olat.core.commons.modules.bc.vfs.OlatRootFolderImpl)6 LocalFileImpl (org.olat.core.util.vfs.LocalFileImpl)6 CourseEnvironment (org.olat.course.run.environment.CourseEnvironment)6 CPPackageConfig (org.olat.ims.cp.ui.CPPackageConfig)6 SearchResourceContext (org.olat.search.service.SearchResourceContext)6