Search in sources :

Example 36 with LocalFolderImpl

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

the class VideoModule method getTranscodingBaseContainer.

/**
 * The base container where the transcoded videos are stored. This config can only be set in
 * olat.localproperties, see "video.transcoding.dir"
 * @return
 */
public VFSContainer getTranscodingBaseContainer() {
    if (transcodingDir != null) {
        File base = new File(transcodingDir);
        if (base.exists() || base.mkdirs()) {
            return new LocalFolderImpl(base);
        }
    }
    if (transcodingEnabled) {
        log.error("Error, no valid transcoding dir. Disabling transcoding. video.transcoding.dir=" + transcodingDir);
        // only disable variable, don't store it in persisted properties
        transcodingEnabled = false;
    }
    return null;
}
Also used : File(java.io.File) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 37 with LocalFolderImpl

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

the class CourseLayoutHelper method getOLATThemeCourseLayoutFolder.

/**
 * returns the Folder with the additional courselayouts from the current
 * OLAT-Theme this is e.g. : /static/themes/frentix/courselayouts/<br />
 * If no courselayouts exist in the current OLAT-Theme, null is returned!
 *
 * @return the courselayouts-folder or null
 */
public static VFSContainer getOLATThemeCourseLayoutFolder() {
    VFSContainer courseLayoutFolder = null;
    File themeDir = null;
    // first attempt is to use custom theme path
    if (Settings.getGuiCustomThemePath() != null) {
        themeDir = new File(Settings.getGuiCustomThemePath(), CoreSpringFactory.getImpl(GUISettings.class).getGuiThemeIdentifyer());
        if (themeDir.exists() && themeDir.isDirectory()) {
            VFSContainer themeContainer = new LocalFolderImpl(themeDir);
            courseLayoutFolder = (VFSContainer) themeContainer.resolve("/courselayouts");
        }
    }
    // fallback is to use the standards themes directory in the web app
    if (themeDir == null || !themeDir.exists() || !themeDir.isDirectory()) {
        File themesDir = new File(WebappHelper.getContextRealPath("/static/themes/"));
        themeDir = new File(themesDir, CoreSpringFactory.getImpl(GUISettings.class).getGuiThemeIdentifyer());
    }
    // resolve now
    if (themeDir != null && themeDir.exists() && themeDir.isDirectory()) {
        VFSContainer themeContainer = new LocalFolderImpl(themeDir);
        courseLayoutFolder = (VFSContainer) themeContainer.resolve("/courselayouts");
    }
    return courseLayoutFolder;
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) File(java.io.File) GUISettings(org.olat.core.helpers.GUISettings) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 38 with LocalFolderImpl

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

the class CourseLayoutHelper method getCourseThemeTemplates.

/**
 * get a list of system wide course theme templates
 * they need to be in webapp/static/coursethemes/XY
 * @return
 */
public static List<VFSItem> getCourseThemeTemplates() {
    List<VFSItem> courseThemes = new ArrayList<VFSItem>();
    // 1. add the system-defaults
    String staticAbsPath = WebappHelper.getContextRealPath("/static");
    File themesFile = new File(staticAbsPath);
    VFSContainer cThemeCont = new LocalFolderImpl(themesFile);
    cThemeCont = (VFSContainer) cThemeCont.resolve("/coursethemes");
    if (cThemeCont != null) {
        courseThemes = cThemeCont.getItems(themeNamesFilter);
    }
    // 2. now add the additional Templates from the current Theme
    VFSContainer addThCont = CourseLayoutHelper.getOLATThemeCourseLayoutFolder();
    if (addThCont != null) {
        List<VFSItem> additionalThemes = addThCont.getItems(themeNamesFilter);
        courseThemes.addAll(additionalThemes);
    }
    return courseThemes;
}
Also used : VFSContainer(org.olat.core.util.vfs.VFSContainer) ArrayList(java.util.ArrayList) VFSItem(org.olat.core.util.vfs.VFSItem) File(java.io.File) LocalFolderImpl(org.olat.core.util.vfs.LocalFolderImpl)

Example 39 with LocalFolderImpl

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

the class DialogCourseNodeRunController method doUploadFile.

private void doUploadFile(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 40 with LocalFolderImpl

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

the class CPRunController method doLaunch.

private void doLaunch(UserRequest ureq) {
    DeliveryOptions deliveryOptions = (DeliveryOptions) config.get(CPEditController.CONFIG_DELIVERYOPTIONS);
    if (cpRoot == null) {
        // it is the first time we start the contentpackaging from this instance
        // of this controller.
        // need to be strict when launching -> "true"
        RepositoryEntry re = CPEditController.getCPReference(config, false);
        if (re == null) {
            showError(CPEditController.NLS_ERROR_CPREPOENTRYMISSING);
            return;
        }
        cpRoot = FileResourceManager.getInstance().unzipFileResource(re.getOlatResource());
        // nodes reference them
        if (cpRoot == null) {
            showError(CPEditController.NLS_ERROR_CPREPOENTRYMISSING);
            return;
        }
        if (deliveryOptions != null && deliveryOptions.getInherit() != null && deliveryOptions.getInherit().booleanValue()) {
            CPPackageConfig packageConfig = CPManager.getInstance().getCPPackageConfig(re.getOlatResource());
            if (packageConfig != null && packageConfig.getDeliveryOptions() != null) {
                deliveryOptions = packageConfig.getDeliveryOptions();
            }
        }
    }
    // else cpRoot is already set (save some db access if the user opens /
    // closes / reopens the cp from the same CPRuncontroller instance)
    boolean activateFirstPage = true;
    if ((nodecmd != null) && !nodecmd.equals("")) {
        activateFirstPage = false;
    }
    boolean showNavigation = !config.getBooleanSafe(NodeEditController.CONFIG_COMPONENT_MENU);
    cpDispC = CPUIFactory.getInstance().createContentOnlyCPDisplayController(ureq, getWindowControl(), new LocalFolderImpl(cpRoot), activateFirstPage, showNavigation, deliveryOptions, nodecmd, courseResource, cpNode.getIdent(), preview);
    cpDispC.setContentEncoding(deliveryOptions.getContentEncoding());
    cpDispC.setJSEncoding(deliveryOptions.getJavascriptEncoding());
    cpDispC.addControllerListener(this);
    main.setContent(cpDispC.getInitialComponent());
    if (isExternalMenuConfigured()) {
        treeModel = cpDispC.getTreeModel();
        treeNodeClickListener = this;
        if (activateFirstPage) {
            selNodeId = cpDispC.getInitialSelectedNodeId();
        } else {
            String uri = nodecmd;
            if (uri.startsWith("/")) {
                uri = uri.substring(1, uri.length());
            }
            selNodeId = cpDispC.getNodeByUri(uri);
        }
    }
}
Also used : CPPackageConfig(org.olat.ims.cp.ui.CPPackageConfig) RepositoryEntry(org.olat.repository.RepositoryEntry) DeliveryOptions(org.olat.core.gui.control.generic.iframe.DeliveryOptions) 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