Search in sources :

Example 81 with PortfolioStructureMap

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

the class PortfolioResultDetailsController method formInnerEvent.

@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
    if (source instanceof FormLink) {
        FormLink link = (FormLink) source;
        String cmd = link.getCmd();
        if (cmd != null && cmd.startsWith("map.deadline.change")) {
            if (deadlineCalloutCtr == null) {
                EPStructuredMap map = (EPStructuredMap) link.getUserObject();
                popupDeadlineBox(ureq, map);
            } else {
                // close on second click
                closeDeadlineBox();
            }
        } else if (link.getName().startsWith("open.map")) {
            PortfolioStructureMap map = (PortfolioStructureMap) link.getUserObject();
            doOpenMap(ureq, map);
        } else if (link.getName().startsWith("open.binder")) {
            Binder map = (Binder) link.getUserObject();
            doOpenMap(ureq, map);
        }
    }
    super.formInnerEvent(ureq, source, event);
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) Binder(org.olat.modules.portfolio.Binder) EPStructuredMap(org.olat.portfolio.model.structel.EPStructuredMap) FormLink(org.olat.core.gui.components.form.flexible.elements.FormLink)

Example 82 with PortfolioStructureMap

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

the class PortfolioResultDetailsController method initMapsForm.

protected void initMapsForm(FormItemContainer formLayout) {
    Formatter formatter = Formatter.getInstance(getLocale());
    int count = 0;
    for (PortfolioStructureMap map : maps) {
        MapElements mapElements = new MapElements();
        if (map instanceof EPStructuredMap) {
            EPStructuredMap structuredMap = (EPStructuredMap) map;
            if (maps.size() > 1 || !structuredMap.getStructuredMapSource().equals(templateMap)) {
                String templateTitle = structuredMap.getStructuredMapSource().getTitle();
                uifactory.addStaticTextElement("map.template." + count, "map.template", templateTitle, formLayout);
            }
            String copyDate = "";
            if (structuredMap.getCopyDate() != null) {
                copyDate = formatter.formatDateAndTime(structuredMap.getCopyDate());
            }
            uifactory.addStaticTextElement("map.copyDate." + count, "map.copyDate", copyDate, formLayout);
            String returnDate = "";
            if (structuredMap.getReturnDate() != null) {
                returnDate = formatter.formatDateAndTime(structuredMap.getReturnDate());
            }
            uifactory.addStaticTextElement("map.returnDate." + count, "map.returnDate", returnDate, formLayout);
            String deadLine = "";
            if (structuredMap.getDeadLine() != null) {
                deadLine = formatter.formatDateAndTime(structuredMap.getDeadLine());
            }
            mapElements.deadlineEl = uifactory.addStaticTextElement("map.deadline." + count, "map.deadline", deadLine, formLayout);
        }
        FormLayoutContainer buttonsCont = FormLayoutContainer.createButtonLayout("buttons." + count, getTranslator());
        buttonsCont.setRootForm(mainForm);
        formLayout.add(buttonsCont);
        if (map instanceof EPStructuredMap) {
            mapElements.changeDeadlineLink = uifactory.addFormLink("map.deadline.change." + count, "map.deadline.change", null, buttonsCont, Link.BUTTON);
            mapElements.changeDeadlineLink.setUserObject(map);
        }
        mapElements.openMapLink = uifactory.addFormLink("open.map." + count, "open.map", null, buttonsCont, Link.BUTTON);
        mapElements.openMapLink.setUserObject(map);
        count++;
        if (count != maps.size()) {
            uifactory.addSpacerElement("spacer-" + count, formLayout, false);
        }
        mapToElements.put(map, mapElements);
    }
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) EPStructuredMap(org.olat.portfolio.model.structel.EPStructuredMap) Formatter(org.olat.core.util.Formatter) FormLayoutContainer(org.olat.core.gui.components.form.flexible.impl.FormLayoutContainer)

Example 83 with PortfolioStructureMap

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

the class EPStructureManagerTest method testLoadPortfolioStructuredMaps.

@Test
public void testLoadPortfolioStructuredMaps() {
    Identity user = JunitTestHelper.createAndPersistIdentityAsRndUser("EP-tmp-");
    // a template
    PortfolioStructureMap template = epStructureManager.createPortfolioMapTemplate(user, "paged-parent-structure-el", "parent-structure-element");
    epStructureManager.savePortfolioStructure(template);
    dbInstance.commitAndCloseSession();
    // clone the template
    PortfolioStructureMap map = epFrontendManager.createAndPersistPortfolioStructuredMap(template, user, "cloned-map", "cloned-map-from-template", null, null, null);
    ((EPStructuredMap) map).setReturnDate(new Date());
    EPTargetResource targetResource = ((EPStructuredMap) map).getTargetResource();
    targetResource.setResourceableTypeName("CourseModule");
    targetResource.setResourceableId(234l);
    targetResource.setSubPath(UUID.randomUUID().toString());
    targetResource.setBusinessPath("[RepositoryEntry:23647600][CourseNode:934600]");
    epStructureManager.savePortfolioStructure(map);
    dbInstance.commitAndCloseSession();
    // load the cloned map another map
    List<PortfolioStructureMap> myCloneAlt = epStructureManager.loadPortfolioStructuredMaps(user, targetResource.getOLATResourceable(), targetResource.getSubPath(), targetResource.getBusinessPath());
    Assert.assertNotNull(myCloneAlt);
    Assert.assertEquals(1, myCloneAlt.size());
    Assert.assertEquals(map, myCloneAlt.get(0));
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) EPStructuredMap(org.olat.portfolio.model.structel.EPStructuredMap) EPTargetResource(org.olat.portfolio.model.structel.EPTargetResource) Identity(org.olat.core.id.Identity) Date(java.util.Date) Test(org.junit.Test)

Example 84 with PortfolioStructureMap

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

the class EPStructureManagerTest method loadPortfolioStructure_resourceable.

@Test
public void loadPortfolioStructure_resourceable() {
    Identity user = JunitTestHelper.createAndPersistIdentityAsRndUser("EP-res-tmp-");
    // a template
    PortfolioStructureMap template = epStructureManager.createPortfolioMapTemplate(user, "resourced-el", "resource-element");
    epStructureManager.savePortfolioStructure(template);
    dbInstance.commitAndCloseSession();
    OLATResource resource = template.getOlatResource();
    PortfolioStructure structure = epStructureManager.loadPortfolioStructure(resource);
    Assert.assertNotNull(structure);
    Assert.assertEquals(template, structure);
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) PortfolioStructure(org.olat.portfolio.model.structel.PortfolioStructure) OLATResource(org.olat.resource.OLATResource) Identity(org.olat.core.id.Identity) Test(org.junit.Test)

Example 85 with PortfolioStructureMap

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

the class EPStructureManagerTest method testLoadPortfolioStructuredMap.

@Test
public void testLoadPortfolioStructuredMap() {
    Identity user = JunitTestHelper.createAndPersistIdentityAsRndUser("EP-tmp-");
    // create a template
    PortfolioStructureMap template = epStructureManager.createPortfolioMapTemplate(user, "paged-parent-structure-el", "parent-structure-element");
    epStructureManager.savePortfolioStructure(template);
    dbInstance.commitAndCloseSession();
    // clone the template
    PortfolioStructureMap map = epFrontendManager.createAndPersistPortfolioStructuredMap(template, user, "cloned-map", "cloned-map-from-template", null, null, null);
    ((EPStructuredMap) map).setReturnDate(new Date());
    EPTargetResource targetResource = ((EPStructuredMap) map).getTargetResource();
    targetResource.setResourceableTypeName("CourseModule");
    targetResource.setResourceableId(234l);
    targetResource.setSubPath(UUID.randomUUID().toString());
    targetResource.setBusinessPath("[RepositoryEntry:23647599][CourseNode:934599]");
    epStructureManager.savePortfolioStructure(map);
    dbInstance.commitAndCloseSession();
    // load the cloned map another map
    PortfolioStructureMap myClonedMap = epStructureManager.loadPortfolioStructuredMap(user, template, targetResource.getOLATResourceable(), targetResource.getSubPath(), targetResource.getBusinessPath());
    Assert.assertNotNull(myClonedMap);
}
Also used : PortfolioStructureMap(org.olat.portfolio.model.structel.PortfolioStructureMap) EPStructuredMap(org.olat.portfolio.model.structel.EPStructuredMap) EPTargetResource(org.olat.portfolio.model.structel.EPTargetResource) Identity(org.olat.core.id.Identity) Date(java.util.Date) 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