Search in sources :

Example 11 with FileSelection

use of org.olat.core.commons.modules.bc.FileSelection in project openolat by klemens.

the class CmdDelete method execute.

public Controller execute(FolderComponent fc, UserRequest ureq, WindowControl wContr, Translator trans) {
    this.translator = trans;
    this.folderComponent = fc;
    this.fileSelection = new FileSelection(ureq, fc.getCurrentContainerPath());
    VFSContainer currentContainer = folderComponent.getCurrentContainer();
    List<String> lockedFiles = hasLockedFiles(currentContainer, fileSelection);
    if (lockedFiles.isEmpty()) {
        String msg = trans.translate("del.confirm") + "<p>" + fileSelection.renderAsHtml() + "</p>";
        // create dialog controller
        dialogCtr = activateYesNoDialog(ureq, trans.translate("del.header"), msg, dialogCtr);
    } else {
        String msg = FolderCommandHelper.renderLockedMessageAsHtml(trans, lockedFiles);
        List<String> buttonLabels = Collections.singletonList(trans.translate("ok"));
        lockedFiledCtr = activateGenericDialog(ureq, trans.translate("lock.title"), msg, buttonLabels, lockedFiledCtr);
    }
    return this;
}
Also used : FileSelection(org.olat.core.commons.modules.bc.FileSelection) VFSContainer(org.olat.core.util.vfs.VFSContainer)

Example 12 with FileSelection

use of org.olat.core.commons.modules.bc.FileSelection in project openolat by klemens.

the class CmdDownloadZip method execute.

@Override
public Controller execute(FolderComponent folderComponent, UserRequest ureq, WindowControl wControl, Translator trans) {
    currentContainer = folderComponent.getCurrentContainer();
    status = FolderCommandHelper.sanityCheck(wControl, folderComponent);
    if (status == FolderCommandStatus.STATUS_FAILED) {
        return null;
    }
    selection = new FileSelection(ureq, folderComponent.getCurrentContainerPath());
    status = FolderCommandHelper.sanityCheck3(wControl, folderComponent, selection);
    if (status == FolderCommandStatus.STATUS_FAILED) {
        return null;
    }
    MediaResource mr = new ZipMediaResource(currentContainer, selection);
    ureq.getDispatchResult().setResultingMediaResource(mr);
    return null;
}
Also used : FileSelection(org.olat.core.commons.modules.bc.FileSelection) MediaResource(org.olat.core.gui.media.MediaResource)

Aggregations

FileSelection (org.olat.core.commons.modules.bc.FileSelection)12 VFSContainer (org.olat.core.util.vfs.VFSContainer)6 ArrayList (java.util.ArrayList)4 AssertException (org.olat.core.logging.AssertException)4 VFSItem (org.olat.core.util.vfs.VFSItem)4 VFSLeaf (org.olat.core.util.vfs.VFSLeaf)4 SubscriptionContext (org.olat.core.commons.services.notifications.SubscriptionContext)2 MenuTree (org.olat.core.gui.components.tree.MenuTree)2 VelocityContainer (org.olat.core.gui.components.velocity.VelocityContainer)2 FolderTreeModel (org.olat.core.gui.control.generic.folder.FolderTreeModel)2 MediaResource (org.olat.core.gui.media.MediaResource)2 Roles (org.olat.core.id.Roles)2 VFSSecurityCallback (org.olat.core.util.vfs.callbacks.VFSSecurityCallback)2