Search in sources :

Example 1 with MetaInfoController

use of org.olat.core.commons.modules.bc.meta.MetaInfoController in project OpenOLAT by OpenOLAT.

the class CmdEditMeta method execute.

/**
 * Checks if the file/folder name is not null and valid,
 * checks if the FolderComponent is ok,
 * checks if the item exists and is not locked.
 *
 * @see org.olat.core.commons.modules.bc.commands.FolderCommand#execute(org.olat.core.commons.modules.bc.components.FolderComponent, org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl, org.olat.core.gui.translator.Translator)
 */
@Override
public Controller execute(FolderComponent fComponent, UserRequest ureq, WindowControl wControl, Translator trans) {
    this.translator = trans;
    this.folderComponent = fComponent;
    String pos = ureq.getParameter(ListRenderer.PARAM_EDTID);
    if (!StringHelper.containsNonWhitespace(pos)) {
        // somehow parameter did not make it to us
        status = FolderCommandStatus.STATUS_FAILED;
        getWindowControl().setError(translator.translate("failed"));
        return null;
    }
    status = FolderCommandHelper.sanityCheck(wControl, fComponent);
    if (status == FolderCommandStatus.STATUS_SUCCESS) {
        currentItem = fComponent.getCurrentContainerChildren().get(Integer.parseInt(pos));
    }
    if (status == FolderCommandStatus.STATUS_FAILED) {
        return null;
    }
    removeAsListenerAndDispose(metaCtr);
    removeAsListenerAndDispose(metaInfoCtr);
    if (vfsLockManager.isLockedForMe(currentItem, getIdentity(), ureq.getUserSession().getRoles())) {
        // readonly
        String resourceUrl = getResourceURL(wControl);
        metaCtr = new MetaInfoController(ureq, wControl, currentItem, resourceUrl);
        listenTo(metaCtr);
        putInitialPanel(metaCtr.getInitialComponent());
    } else {
        String resourceUrl = getResourceURL(wControl);
        metaInfoCtr = new MetaInfoFormController(ureq, wControl, currentItem, resourceUrl);
        listenTo(metaInfoCtr);
        putInitialPanel(metaInfoCtr.getInitialComponent());
    }
    return this;
}
Also used : MetaInfoController(org.olat.core.commons.modules.bc.meta.MetaInfoController) MetaInfoFormController(org.olat.core.commons.modules.bc.meta.MetaInfoFormController)

Example 2 with MetaInfoController

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

the class CmdEditMeta method execute.

/**
 * Checks if the file/folder name is not null and valid,
 * checks if the FolderComponent is ok,
 * checks if the item exists and is not locked.
 *
 * @see org.olat.core.commons.modules.bc.commands.FolderCommand#execute(org.olat.core.commons.modules.bc.components.FolderComponent, org.olat.core.gui.UserRequest, org.olat.core.gui.control.WindowControl, org.olat.core.gui.translator.Translator)
 */
@Override
public Controller execute(FolderComponent fComponent, UserRequest ureq, WindowControl wControl, Translator trans) {
    this.translator = trans;
    this.folderComponent = fComponent;
    String pos = ureq.getParameter(ListRenderer.PARAM_EDTID);
    if (!StringHelper.containsNonWhitespace(pos)) {
        // somehow parameter did not make it to us
        status = FolderCommandStatus.STATUS_FAILED;
        getWindowControl().setError(translator.translate("failed"));
        return null;
    }
    status = FolderCommandHelper.sanityCheck(wControl, fComponent);
    if (status == FolderCommandStatus.STATUS_SUCCESS) {
        currentItem = fComponent.getCurrentContainerChildren().get(Integer.parseInt(pos));
    }
    if (status == FolderCommandStatus.STATUS_FAILED) {
        return null;
    }
    removeAsListenerAndDispose(metaCtr);
    removeAsListenerAndDispose(metaInfoCtr);
    if (vfsLockManager.isLockedForMe(currentItem, getIdentity(), ureq.getUserSession().getRoles())) {
        // readonly
        String resourceUrl = getResourceURL(wControl);
        metaCtr = new MetaInfoController(ureq, wControl, currentItem, resourceUrl);
        listenTo(metaCtr);
        putInitialPanel(metaCtr.getInitialComponent());
    } else {
        String resourceUrl = getResourceURL(wControl);
        metaInfoCtr = new MetaInfoFormController(ureq, wControl, currentItem, resourceUrl);
        listenTo(metaInfoCtr);
        putInitialPanel(metaInfoCtr.getInitialComponent());
    }
    return this;
}
Also used : MetaInfoController(org.olat.core.commons.modules.bc.meta.MetaInfoController) MetaInfoFormController(org.olat.core.commons.modules.bc.meta.MetaInfoFormController)

Aggregations

MetaInfoController (org.olat.core.commons.modules.bc.meta.MetaInfoController)2 MetaInfoFormController (org.olat.core.commons.modules.bc.meta.MetaInfoFormController)2