use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.
the class BinderDAOTest method createNewBinder.
@Test
public void createNewBinder() {
String title = "My portfolio";
String summary = "My live";
BinderImpl binder = binderDao.createAndPersist(title, summary, null, null);
dbInstance.commitAndCloseSession();
Assert.assertNotNull(binder);
Assert.assertNotNull(binder.getKey());
Assert.assertNotNull(binder.getCreationDate());
Assert.assertNotNull(binder.getLastModified());
Assert.assertNotNull(binder.getBaseGroup());
Assert.assertEquals(title, binder.getTitle());
Assert.assertEquals(summary, binder.getSummary());
Binder reloadedBinder = binderDao.loadByKey(binder.getKey());
Assert.assertNotNull(reloadedBinder);
Assert.assertNotNull(reloadedBinder.getKey());
Assert.assertEquals(binder.getKey(), reloadedBinder.getKey());
Assert.assertEquals(binder, reloadedBinder);
Assert.assertNotNull(reloadedBinder.getCreationDate());
Assert.assertNotNull(reloadedBinder.getLastModified());
Assert.assertEquals(title, reloadedBinder.getTitle());
Assert.assertEquals(summary, reloadedBinder.getSummary());
}
use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.
the class BinderDAOTest method getOwnedBinders.
@Test
public void getOwnedBinders() {
Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("binder-owner");
Binder binder = portfolioService.createNewBinder("My own binder", "", "", owner);
dbInstance.commit();
Binder deletedBinder = portfolioService.createNewBinder("My own deleted binder", "", "", owner);
deletedBinder.setBinderStatus(BinderStatus.deleted);
deletedBinder = portfolioService.updateBinder(deletedBinder);
dbInstance.commitAndCloseSession();
List<Binder> ownedBinders = binderDao.getOwnedBinders(owner);
Assert.assertNotNull(ownedBinders);
Assert.assertEquals(1, ownedBinders.size());
Assert.assertTrue(ownedBinders.contains(binder));
Assert.assertFalse(ownedBinders.contains(deletedBinder));
}
use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.
the class AssignmentDAOTest method loadAssignments_section.
@Test
public void loadAssignments_section() {
Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("assign-4");
Binder binder = portfolioService.createNewBinder("Assignment binder 4", "Difficult!", null, owner);
dbInstance.commit();
portfolioService.appendNewSection("Section", "Assignment section", null, null, binder);
dbInstance.commit();
// create assignment
List<Section> sections = portfolioService.getSections(binder);
Section section = sections.get(0);
Assignment assignment = assignmentDao.createAssignment("Load assignment", "Load by section", "The another content", null, AssignmentType.essay, AssignmentStatus.template, section, false, false, false, null);
dbInstance.commitAndCloseSession();
// load the assignment
List<Assignment> assignments = assignmentDao.loadAssignments(section, null);
Assert.assertNotNull(assignments);
Assert.assertEquals(1, assignments.size());
Assert.assertEquals(assignment, assignments.get(0));
}
use of org.olat.modules.portfolio.Binder in project OpenOLAT by OpenOLAT.
the class AssignmentDAOTest method loadAssignments_section_search.
@Test
public void loadAssignments_section_search() {
Identity owner = JunitTestHelper.createAndPersistIdentityAsRndUser("assign-5");
Binder binder = portfolioService.createNewBinder("Assignment binder 5", "Difficult!", null, owner);
dbInstance.commit();
portfolioService.appendNewSection("Section", "Assignment section", null, null, binder);
dbInstance.commit();
// create assignment
List<Section> sections = portfolioService.getSections(binder);
Section section = sections.get(0);
Assignment assignment = assignmentDao.createAssignment("Load assignment", "Load by binder", "The little blabla to search", null, AssignmentType.essay, AssignmentStatus.template, section, false, false, false, null);
dbInstance.commitAndCloseSession();
// search the assignment
List<Assignment> assignments = assignmentDao.loadAssignments(section, "blabla");
Assert.assertNotNull(assignments);
Assert.assertEquals(1, assignments.size());
Assert.assertEquals(assignment, assignments.get(0));
// dummy search
List<Assignment> emptyAssignments = assignmentDao.loadAssignments(section, "wezruiwezi");
Assert.assertNotNull(emptyAssignments);
Assert.assertEquals(0, emptyAssignments.size());
}
use of org.olat.modules.portfolio.Binder 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);
}
Aggregations