Search in sources :

Example 91 with PortfolioStructureMap

use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.

the class EPFrontendManager method createAndPersistPortfolioStructuredMap.

/**
 * Create a structured map, based on template.
 *
 * @param identity The author/owner of the map
 * @param title
 * @param description
 * @return The structure element
 */
public PortfolioStructureMap createAndPersistPortfolioStructuredMap(PortfolioStructureMap template, Identity identity, String title, String description, OLATResourceable targetOres, String targetSubPath, String targetBusinessPath) {
    PortfolioStructureMap map = structureManager.createPortfolioStructuredMap(template, identity, title, description, targetOres, targetSubPath, targetBusinessPath);
    structureManager.savePortfolioStructure(map);
    return map;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap)

Example 92 with PortfolioStructureMap

use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.

the class EPFrontendManager method createAndPersistPortfolioDefaultMap.

/**
 * Create a map for a user
 * @param root
 * @param identity
 * @param title
 * @param description
 * @return
 */
public PortfolioStructureMap createAndPersistPortfolioDefaultMap(Identity identity, String title, String description) {
    PortfolioStructureMap map = structureManager.createPortfolioDefaultMap(identity, title, description);
    structureManager.savePortfolioStructure(map);
    return map;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap)

Example 93 with PortfolioStructureMap

use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.

the class EPMapRunController method event.

/**
 * @see org.olat.core.gui.control.DefaultController#event(org.olat.core.gui.UserRequest, org.olat.core.gui.control.Controller, org.olat.core.gui.control.Event)
 */
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
    super.event(ureq, source, event);
    if (source == createMapBox) {
        popDownCreateMapBox();
    } else if (source == createMapCtrl) {
        if (event instanceof EPMapCreatedEvent) {
            PortfolioStructureMap newMap = ((EPMapCreatedEvent) event).getPortfolioStructureMap();
            multiMapCtrl.activateMap(ureq, newMap);
        }
        createMapBox.deactivate();
        popDownCreateMapBox();
        toogleHeader(false);
    } else if (source == searchTemplateCtrl) {
        if (event == ReferencableEntriesSearchController.EVENT_REPOSITORY_ENTRY_SELECTED) {
            RepositoryEntry repoEntry = searchTemplateCtrl.getSelectedEntry();
            PortfolioStructureMap newMap = createMapFromTemplate(repoEntry);
            multiMapCtrl.activateMap(ureq, newMap);
        }
        createMapBox.deactivate();
        popDownCreateMapBox();
    } else if (source == multiMapCtrl) {
        if (event instanceof EPMapEvent) {
            String cmd = event.getCommand();
            if (EPStructureEvent.SELECT.equals(cmd)) {
                toogleHeader(false);
            } else if (EPStructureEvent.CLOSE.equals(cmd)) {
                toogleHeader(true);
            }
        }
    } else if (source == mapCreateCalloutCtrl && event == CloseableCalloutWindowController.CLOSE_WINDOW_EVENT) {
        removeAsListenerAndDispose(mapCreateCalloutCtrl);
        mapCreateCalloutCtrl = null;
    }
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) RepositoryEntry(org.olat.repository.RepositoryEntry) EPMapEvent(org.olat.portfolio.ui.structel.EPMapEvent) EPMapCreatedEvent(org.olat.portfolio.ui.structel.EPMapCreatedEvent)

Example 94 with PortfolioStructureMap

use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.

the class EPMapRunController method createMapFromTemplate.

private PortfolioStructureMap createMapFromTemplate(RepositoryEntry repoEntry) {
    PortfolioStructureMap template = (PortfolioStructureMap) ePFMgr.loadPortfolioStructure(repoEntry.getOlatResource());
    PortfolioStructureMap copy = ePFMgr.createAndPersistPortfolioDefaultMap(getIdentity(), template.getTitle(), template.getDescription());
    ePFMgr.copyStructureRecursively(template, copy, true);
    return copy;
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap)

Example 95 with PortfolioStructureMap

use of org.olat.portfolio.model.structel.PortfolioStructureMap in project openolat by klemens.

the class EPFrontendManagerTest method allMapPolicies.

@Test
public void allMapPolicies() {
    // create a map
    PortfolioStructureMap map = epFrontendManager.createAndPersistPortfolioDefaultMap(ident1, "Policies", "Description");
    PortfolioStructure page1 = epFrontendManager.createAndPersistPortfolioPage(map, "Page policies", "Page description");
    assertNotNull(page1);
    dbInstance.commitAndCloseSession();
    // save a list of policies
    List<EPMapPolicy> policies = new ArrayList<EPMapPolicy>();
    // user policy
    EPMapPolicy userPolicy = new EPMapPolicy();
    userPolicy.setType(Type.user);
    userPolicy.getIdentities().add(ident2);
    userPolicy.getIdentities().add(ident3);
    policies.add(userPolicy);
    // invitation
    Invitation invitation = invitationDao.createAndPersistInvitation();
    invitation.setFirstName("John");
    invitation.setLastName("Doe");
    invitation.setMail("john@doe.ch");
    EPMapPolicy invitationPolicy = new EPMapPolicy();
    invitationPolicy.setType(Type.invitation);
    invitationPolicy.setInvitation(invitation);
    policies.add(invitationPolicy);
    epFrontendManager.updateMapPolicies(map, policies);
    dbInstance.commitAndCloseSession();
    // check visiblity (is owner)
    assertTrue(epFrontendManager.isMapVisible(ident1, map.getOlatResource()));
    // check visibility (is in policy)
    assertTrue(epFrontendManager.isMapVisible(ident2, map.getOlatResource()));
    // check visible (is in policy)
    assertTrue(epFrontendManager.isMapVisible(ident3, map.getOlatResource()));
    // retrieved policies
    List<EPMapPolicy> savedPolicies = epFrontendManager.getMapPolicies(map);
    assertTrue(!savedPolicies.isEmpty());
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) EPMapPolicy(org.olat.portfolio.manager.EPMapPolicy) ArrayList(java.util.ArrayList) Invitation(org.olat.basesecurity.Invitation) Test(org.junit.Test)

Aggregations

PortfolioStructureMap (org.olat.portfolio.model.structel.PortfolioStructureMap)118 Test (org.junit.Test)64 PortfolioStructure (org.olat.portfolio.model.structel.PortfolioStructure)54 Identity (org.olat.core.id.Identity)34 RepositoryEntry (org.olat.repository.RepositoryEntry)30 OLATResource (org.olat.resource.OLATResource)30 ArrayList (java.util.ArrayList)18 AbstractArtefact (org.olat.portfolio.model.artefacts.AbstractArtefact)18 EPStructuredMap (org.olat.portfolio.model.structel.EPStructuredMap)18 EPMapPolicy (org.olat.portfolio.manager.EPMapPolicy)16 Date (java.util.Date)10 Invitation (org.olat.basesecurity.Invitation)8 Binder (org.olat.modules.portfolio.Binder)8 EPTargetResource (org.olat.portfolio.model.structel.EPTargetResource)8 EPSecurityCallback (org.olat.portfolio.EPSecurityCallback)6 EPStructureElement (org.olat.portfolio.model.structel.EPStructureElement)6 CalendarController (org.olat.commons.calendar.ui.CalendarController)4 WeeklyCalendarController (org.olat.commons.calendar.ui.WeeklyCalendarController)4 FolderRunController (org.olat.core.commons.modules.bc.FolderRunController)4 Link (org.olat.core.gui.components.link.Link)4