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);
}
}
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();
}
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);
}
}
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);
}
}
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);
}
}
}
Aggregations