Search in sources :

Example 1 with VFSItemFilter

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

the class LinkFileCombiCalloutController method doOpenFileChanger.

public void doOpenFileChanger(UserRequest ureq, String tool) {
    // close callout and open appropriate file changer controller
    calloutCtr.deactivate();
    Controller toolCtr = null;
    if (tool.equals("chooseLink")) {
        VFSItemFilter filter = new SystemItemFilter();
        FileChooserController fileChooserCtr = FileChooserUIFactory.createFileChooserController(ureq, getWindowControl(), baseContainer, filter, true);
        fileChooserCtr.setShowTitle(true);
        fileChooserCtr.selectPath(relFilePath);
        toolCtr = fileChooserCtr;
    }
    if (tool.equals("createLink")) {
        String folderPath = null;
        if (StringHelper.containsNonWhitespace(relFilePath)) {
            // remove file name from relFilePath to represent directory path
            folderPath = relFilePath.substring(0, relFilePath.lastIndexOf("/"));
        }
        toolCtr = new FileCreatorController(ureq, getWindowControl(), baseContainer, folderPath);
    }
    if (tool.equals("uploadLink")) {
        long quotaLeftKB = VFSManager.getQuotaLeftKB(baseContainer);
        String folderPath = null;
        if (StringHelper.containsNonWhitespace(relFilePath)) {
            // remove file name from relFilePath to represent directory path
            folderPath = relFilePath.substring(0, relFilePath.lastIndexOf("/"));
        }
        toolCtr = new FileUploadController(getWindowControl(), baseContainer, ureq, quotaLeftKB, quotaLeftKB, null, false, true, false, false, true, true, folderPath);
    }
    displayModal(toolCtr);
}
Also used : VFSItemFilter(org.olat.core.util.vfs.filters.VFSItemFilter) FileUploadController(org.olat.core.commons.modules.bc.FileUploadController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) LayoutMain3ColsPreviewController(org.olat.core.commons.fullWebApp.LayoutMain3ColsPreviewController) HTMLEditorController(org.olat.core.commons.editor.htmleditor.HTMLEditorController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) SinglePageController(org.olat.core.commons.modules.singlepage.SinglePageController) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) SystemItemFilter(org.olat.core.util.vfs.filters.SystemItemFilter) FileUploadController(org.olat.core.commons.modules.bc.FileUploadController)

Example 2 with VFSItemFilter

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

the class CPFile method deleteIfEmpty.

/**
 * Deletes the container if it is empty (excluding files with '.' prefix).
 *
 * @param parentContainer
 */
private void deleteIfEmpty(VFSContainer container) {
    String[] unwantedPrefixes = { "." };
    VFSItemFilter filter = new VFSItemExcludePrefixFilter(unwantedPrefixes);
    if (container != null) {
        List<VFSItem> items = container.getItems(filter);
        if (items == null || items.size() == 0) {
            container.delete();
        }
    }
}
Also used : VFSItemFilter(org.olat.core.util.vfs.filters.VFSItemFilter) VFSItemExcludePrefixFilter(org.olat.core.util.vfs.filters.VFSItemExcludePrefixFilter) VFSItem(org.olat.core.util.vfs.VFSItem)

Example 3 with VFSItemFilter

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

the class LinkFileCombiCalloutController method doOpenFileChanger.

public void doOpenFileChanger(UserRequest ureq, String tool) {
    // close callout and open appropriate file changer controller
    calloutCtr.deactivate();
    Controller toolCtr = null;
    if (tool.equals("chooseLink")) {
        VFSItemFilter filter = new SystemItemFilter();
        FileChooserController fileChooserCtr = FileChooserUIFactory.createFileChooserController(ureq, getWindowControl(), baseContainer, filter, true);
        fileChooserCtr.setShowTitle(true);
        fileChooserCtr.selectPath(relFilePath);
        toolCtr = fileChooserCtr;
    }
    if (tool.equals("createLink")) {
        String folderPath = null;
        if (StringHelper.containsNonWhitespace(relFilePath)) {
            // remove file name from relFilePath to represent directory path
            folderPath = relFilePath.substring(0, relFilePath.lastIndexOf("/"));
        }
        toolCtr = new FileCreatorController(ureq, getWindowControl(), baseContainer, folderPath);
    }
    if (tool.equals("uploadLink")) {
        long quotaLeftKB = VFSManager.getQuotaLeftKB(baseContainer);
        String folderPath = null;
        if (StringHelper.containsNonWhitespace(relFilePath)) {
            // remove file name from relFilePath to represent directory path
            folderPath = relFilePath.substring(0, relFilePath.lastIndexOf("/"));
        }
        toolCtr = new FileUploadController(getWindowControl(), baseContainer, ureq, quotaLeftKB, quotaLeftKB, null, false, true, false, false, true, true, folderPath);
    }
    displayModal(toolCtr);
}
Also used : VFSItemFilter(org.olat.core.util.vfs.filters.VFSItemFilter) FileUploadController(org.olat.core.commons.modules.bc.FileUploadController) CloseableModalController(org.olat.core.gui.control.generic.closablewrapper.CloseableModalController) LayoutMain3ColsPreviewController(org.olat.core.commons.fullWebApp.LayoutMain3ColsPreviewController) HTMLEditorController(org.olat.core.commons.editor.htmleditor.HTMLEditorController) Controller(org.olat.core.gui.control.Controller) BasicController(org.olat.core.gui.control.controller.BasicController) SinglePageController(org.olat.core.commons.modules.singlepage.SinglePageController) CloseableCalloutWindowController(org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController) SystemItemFilter(org.olat.core.util.vfs.filters.SystemItemFilter) FileUploadController(org.olat.core.commons.modules.bc.FileUploadController)

Example 4 with VFSItemFilter

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

the class CPFile method deleteIfEmpty.

/**
 * Deletes the container if it is empty (excluding files with '.' prefix).
 *
 * @param parentContainer
 */
private void deleteIfEmpty(VFSContainer container) {
    String[] unwantedPrefixes = { "." };
    VFSItemFilter filter = new VFSItemExcludePrefixFilter(unwantedPrefixes);
    if (container != null) {
        List<VFSItem> items = container.getItems(filter);
        if (items == null || items.size() == 0) {
            container.delete();
        }
    }
}
Also used : VFSItemFilter(org.olat.core.util.vfs.filters.VFSItemFilter) VFSItemExcludePrefixFilter(org.olat.core.util.vfs.filters.VFSItemExcludePrefixFilter) VFSItem(org.olat.core.util.vfs.VFSItem)

Aggregations

VFSItemFilter (org.olat.core.util.vfs.filters.VFSItemFilter)4 HTMLEditorController (org.olat.core.commons.editor.htmleditor.HTMLEditorController)2 LayoutMain3ColsPreviewController (org.olat.core.commons.fullWebApp.LayoutMain3ColsPreviewController)2 FileUploadController (org.olat.core.commons.modules.bc.FileUploadController)2 SinglePageController (org.olat.core.commons.modules.singlepage.SinglePageController)2 Controller (org.olat.core.gui.control.Controller)2 BasicController (org.olat.core.gui.control.controller.BasicController)2 CloseableCalloutWindowController (org.olat.core.gui.control.generic.closablewrapper.CloseableCalloutWindowController)2 CloseableModalController (org.olat.core.gui.control.generic.closablewrapper.CloseableModalController)2 VFSItem (org.olat.core.util.vfs.VFSItem)2 SystemItemFilter (org.olat.core.util.vfs.filters.SystemItemFilter)2 VFSItemExcludePrefixFilter (org.olat.core.util.vfs.filters.VFSItemExcludePrefixFilter)2