Search in sources :

Example 1 with EPMultiArtefactsController

use of org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController in project openolat by klemens.

the class EPStructureElementsController method initForm.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer, org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
protected void initForm(UserRequest ureq) {
    flc.contextPut("structElements", structElements);
    tableCtrls = new ArrayList<Controller>();
    addBtnCtrls = new ArrayList<Controller>();
    int i = 1;
    removeComponents();
    for (PortfolioStructure portStruct : structElements) {
        if (secCallback.isRestrictionsEnabled()) {
            List<CollectRestriction> restrictions = portStruct.getCollectRestrictions();
            if (!restrictions.isEmpty()) {
                boolean check = ePFMgr.checkCollectRestriction(portStruct);
                EPCollectRestrictionResultController resultCtrl = new EPCollectRestrictionResultController(ureq, getWindowControl());
                resultCtrl.setMessage(portStruct.getCollectRestrictions(), check);
                flc.put("checkResults" + i, resultCtrl.getInitialComponent());
                listenTo(resultCtrl);
            }
        }
        // get artefacts for this structure
        List<AbstractArtefact> artefacts = ePFMgr.getArtefacts(portStruct);
        if (artefacts.size() != 0) {
            EPMultiArtefactsController artefactCtrl = EPUIFactory.getConfigDependentArtefactsControllerForStructure(ureq, getWindowControl(), artefacts, portStruct, secCallback);
            flc.put("artefacts" + i, artefactCtrl.getInitialComponent());
            listenTo(artefactCtrl);
            tableCtrls.add(artefactCtrl);
        }
        if (!parentMapClosed && secCallback.canAddArtefact()) {
            // get an addElement-button for each structure
            EPAddElementsController addButton = new EPAddElementsController(ureq, getWindowControl(), portStruct);
            listenTo(addButton);
            addButton.setShowLink(EPAddElementsController.ADD_ARTEFACT);
            flc.put("addButton" + i, addButton.getInitialComponent());
            addBtnCtrls.add(addButton);
        }
        i++;
    }
    if (i != maxStructAmount)
        maxStructAmount = i;
}
Also used : EPCollectRestrictionResultController(org.olat.portfolio.ui.structel.edit.EPCollectRestrictionResultController) EPMultiArtefactsController(org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) CollectRestriction(org.olat.portfolio.model.restriction.CollectRestriction) Controller(org.olat.core.gui.control.Controller) EPMultiArtefactsController(org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController) BasicController(org.olat.core.gui.control.controller.BasicController) EPCollectRestrictionResultController(org.olat.portfolio.ui.structel.edit.EPCollectRestrictionResultController)

Example 2 with EPMultiArtefactsController

use of org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController in project OpenOLAT by OpenOLAT.

the class EPPageViewController method init.

private void init(UserRequest ureq) {
    vC.contextPut("page", page);
    PortfolioStructureMap parentOfPage = (PortfolioStructureMap) ePFMgr.loadStructureParent(page);
    boolean parentMapClosed = StructureStatusEnum.CLOSED.equals(parentOfPage.getStatus());
    vC.remove(vC.getComponent("checkResults"));
    if (secCallback.isRestrictionsEnabled()) {
        removeAsListenerAndDispose(resultCtrl);
        List<CollectRestriction> restrictions = page.getCollectRestrictions();
        if (!restrictions.isEmpty()) {
            boolean check = ePFMgr.checkCollectRestriction(page);
            resultCtrl = new EPCollectRestrictionResultController(ureq, getWindowControl());
            resultCtrl.setMessage(restrictions, check);
            vC.put("checkResults", resultCtrl.getInitialComponent());
            listenTo(resultCtrl);
        }
    }
    vC.remove(vC.getComponent("artefacts"));
    List<AbstractArtefact> artefacts = ePFMgr.getArtefacts(page);
    if (artefacts.size() != 0) {
        EPMultiArtefactsController artefactCtrl = EPUIFactory.getConfigDependentArtefactsControllerForStructure(ureq, getWindowControl(), artefacts, page, secCallback);
        vC.put("artefacts", artefactCtrl.getInitialComponent());
        listenTo(artefactCtrl);
    }
    vC.remove(vC.getComponent("structElements"));
    List<PortfolioStructure> structElements = ePFMgr.loadStructureChildren(page);
    if (structElements.size() != 0) {
        EPStructureElementsController structElCtrl = new EPStructureElementsController(ureq, getWindowControl(), structElements, secCallback, parentMapClosed);
        vC.put("structElements", structElCtrl.getInitialComponent());
        listenTo(structElCtrl);
    }
    vC.remove(vC.getComponent("addButton"));
    if (!parentMapClosed && (secCallback.canAddArtefact() || secCallback.canAddStructure())) {
        addButtonCtrl = new EPAddElementsController(ureq, getWindowControl(), page);
        listenTo(addButtonCtrl);
        if (secCallback.canAddArtefact()) {
            addButtonCtrl.setShowLink(EPAddElementsController.ADD_ARTEFACT);
        }
        if (secCallback.canAddStructure()) {
            addButtonCtrl.setShowLink(EPAddElementsController.ADD_STRUCTUREELEMENT);
        }
        vC.put("addButton", addButtonCtrl.getInitialComponent());
    }
    vC.remove(vC.getComponent("commentCtrl"));
    if (secCallback.canCommentAndRate()) {
        removeAsListenerAndDispose(commentsAndRatingCtr);
        boolean anonym = ureq.getUserSession().getRoles().isGuestOnly();
        CommentAndRatingSecurityCallback ratingSecCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, anonym);
        commentsAndRatingCtr = new UserCommentsAndRatingsController(ureq, getWindowControl(), map.getOlatResource(), page.getKey().toString(), ratingSecCallback, true, true, true);
        listenTo(commentsAndRatingCtr);
        vC.put("commentCtrl", commentsAndRatingCtr.getInitialComponent());
    }
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) EPCollectRestrictionResultController(org.olat.portfolio.ui.structel.edit.EPCollectRestrictionResultController) CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) EPMultiArtefactsController(org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) CommentAndRatingDefaultSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback) UserCommentsAndRatingsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsAndRatingsController) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) CollectRestriction(org.olat.portfolio.model.restriction.CollectRestriction)

Example 3 with EPMultiArtefactsController

use of org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController in project OpenOLAT by OpenOLAT.

the class EPStructureElementsController method initForm.

/**
 * @see org.olat.core.gui.components.form.flexible.impl.FormBasicController#initForm(org.olat.core.gui.components.form.flexible.FormItemContainer, org.olat.core.gui.control.Controller, org.olat.core.gui.UserRequest)
 */
protected void initForm(UserRequest ureq) {
    flc.contextPut("structElements", structElements);
    tableCtrls = new ArrayList<Controller>();
    addBtnCtrls = new ArrayList<Controller>();
    int i = 1;
    removeComponents();
    for (PortfolioStructure portStruct : structElements) {
        if (secCallback.isRestrictionsEnabled()) {
            List<CollectRestriction> restrictions = portStruct.getCollectRestrictions();
            if (!restrictions.isEmpty()) {
                boolean check = ePFMgr.checkCollectRestriction(portStruct);
                EPCollectRestrictionResultController resultCtrl = new EPCollectRestrictionResultController(ureq, getWindowControl());
                resultCtrl.setMessage(portStruct.getCollectRestrictions(), check);
                flc.put("checkResults" + i, resultCtrl.getInitialComponent());
                listenTo(resultCtrl);
            }
        }
        // get artefacts for this structure
        List<AbstractArtefact> artefacts = ePFMgr.getArtefacts(portStruct);
        if (artefacts.size() != 0) {
            EPMultiArtefactsController artefactCtrl = EPUIFactory.getConfigDependentArtefactsControllerForStructure(ureq, getWindowControl(), artefacts, portStruct, secCallback);
            flc.put("artefacts" + i, artefactCtrl.getInitialComponent());
            listenTo(artefactCtrl);
            tableCtrls.add(artefactCtrl);
        }
        if (!parentMapClosed && secCallback.canAddArtefact()) {
            // get an addElement-button for each structure
            EPAddElementsController addButton = new EPAddElementsController(ureq, getWindowControl(), portStruct);
            listenTo(addButton);
            addButton.setShowLink(EPAddElementsController.ADD_ARTEFACT);
            flc.put("addButton" + i, addButton.getInitialComponent());
            addBtnCtrls.add(addButton);
        }
        i++;
    }
    if (i != maxStructAmount)
        maxStructAmount = i;
}
Also used : EPCollectRestrictionResultController(org.olat.portfolio.ui.structel.edit.EPCollectRestrictionResultController) EPMultiArtefactsController(org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) CollectRestriction(org.olat.portfolio.model.restriction.CollectRestriction) Controller(org.olat.core.gui.control.Controller) EPMultiArtefactsController(org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController) BasicController(org.olat.core.gui.control.controller.BasicController) EPCollectRestrictionResultController(org.olat.portfolio.ui.structel.edit.EPCollectRestrictionResultController)

Example 4 with EPMultiArtefactsController

use of org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController in project openolat by klemens.

the class EPPageViewController method init.

private void init(UserRequest ureq) {
    vC.contextPut("page", page);
    PortfolioStructureMap parentOfPage = (PortfolioStructureMap) ePFMgr.loadStructureParent(page);
    boolean parentMapClosed = StructureStatusEnum.CLOSED.equals(parentOfPage.getStatus());
    vC.remove(vC.getComponent("checkResults"));
    if (secCallback.isRestrictionsEnabled()) {
        removeAsListenerAndDispose(resultCtrl);
        List<CollectRestriction> restrictions = page.getCollectRestrictions();
        if (!restrictions.isEmpty()) {
            boolean check = ePFMgr.checkCollectRestriction(page);
            resultCtrl = new EPCollectRestrictionResultController(ureq, getWindowControl());
            resultCtrl.setMessage(restrictions, check);
            vC.put("checkResults", resultCtrl.getInitialComponent());
            listenTo(resultCtrl);
        }
    }
    vC.remove(vC.getComponent("artefacts"));
    List<AbstractArtefact> artefacts = ePFMgr.getArtefacts(page);
    if (artefacts.size() != 0) {
        EPMultiArtefactsController artefactCtrl = EPUIFactory.getConfigDependentArtefactsControllerForStructure(ureq, getWindowControl(), artefacts, page, secCallback);
        vC.put("artefacts", artefactCtrl.getInitialComponent());
        listenTo(artefactCtrl);
    }
    vC.remove(vC.getComponent("structElements"));
    List<PortfolioStructure> structElements = ePFMgr.loadStructureChildren(page);
    if (structElements.size() != 0) {
        EPStructureElementsController structElCtrl = new EPStructureElementsController(ureq, getWindowControl(), structElements, secCallback, parentMapClosed);
        vC.put("structElements", structElCtrl.getInitialComponent());
        listenTo(structElCtrl);
    }
    vC.remove(vC.getComponent("addButton"));
    if (!parentMapClosed && (secCallback.canAddArtefact() || secCallback.canAddStructure())) {
        addButtonCtrl = new EPAddElementsController(ureq, getWindowControl(), page);
        listenTo(addButtonCtrl);
        if (secCallback.canAddArtefact()) {
            addButtonCtrl.setShowLink(EPAddElementsController.ADD_ARTEFACT);
        }
        if (secCallback.canAddStructure()) {
            addButtonCtrl.setShowLink(EPAddElementsController.ADD_STRUCTUREELEMENT);
        }
        vC.put("addButton", addButtonCtrl.getInitialComponent());
    }
    vC.remove(vC.getComponent("commentCtrl"));
    if (secCallback.canCommentAndRate()) {
        removeAsListenerAndDispose(commentsAndRatingCtr);
        boolean anonym = ureq.getUserSession().getRoles().isGuestOnly();
        CommentAndRatingSecurityCallback ratingSecCallback = new CommentAndRatingDefaultSecurityCallback(getIdentity(), false, anonym);
        commentsAndRatingCtr = new UserCommentsAndRatingsController(ureq, getWindowControl(), map.getOlatResource(), page.getKey().toString(), ratingSecCallback, true, true, true);
        listenTo(commentsAndRatingCtr);
        vC.put("commentCtrl", commentsAndRatingCtr.getInitialComponent());
    }
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) EPCollectRestrictionResultController(org.olat.portfolio.ui.structel.edit.EPCollectRestrictionResultController) CommentAndRatingSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback) EPMultiArtefactsController(org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController) AbstractArtefact(org.olat.portfolio.model.artefacts.AbstractArtefact) CommentAndRatingDefaultSecurityCallback(org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback) UserCommentsAndRatingsController(org.olat.core.commons.services.commentAndRating.ui.UserCommentsAndRatingsController) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) CollectRestriction(org.olat.portfolio.model.restriction.CollectRestriction)

Aggregations

AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)4 CollectRestriction (org.olat.portfolio.model.restriction.CollectRestriction)4 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)4 EPMultiArtefactsController (org.olat.portfolio.ui.artefacts.view.EPMultiArtefactsController)4 EPCollectRestrictionResultController (org.olat.portfolio.ui.structel.edit.EPCollectRestrictionResultController)4 CommentAndRatingDefaultSecurityCallback (org.olat.core.commons.services.commentAndRating.CommentAndRatingDefaultSecurityCallback)2 CommentAndRatingSecurityCallback (org.olat.core.commons.services.commentAndRating.CommentAndRatingSecurityCallback)2 UserCommentsAndRatingsController (org.olat.core.commons.services.commentAndRating.ui.UserCommentsAndRatingsController)2 Controller (org.olat.core.gui.control.Controller)2 BasicController (org.olat.core.gui.control.controller.BasicController)2 PortfolioStructureMap (org.olat.portfolio.model.structel.PortfolioStructureMap)2