use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project OpenOLAT by OpenOLAT.
the class CourseCalendarController method needToDifferentiateManagedEvents.
private boolean needToDifferentiateManagedEvents(List<KalendarRenderWrapper> calendars) {
boolean hasManaged = false;
for (KalendarRenderWrapper wrapper : calendars) {
Kalendar cal = wrapper.getKalendar();
hasManaged |= cal.hasManagedEvents();
}
return hasManaged;
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project OpenOLAT by OpenOLAT.
the class UserInfoMainController method doOpenCalendar.
private WeeklyCalendarController doOpenCalendar(UserRequest ureq) {
removeAsListenerAndDispose(calendarController);
KalendarRenderWrapper calendarWrapper = calendarManager.getPersonalCalendar(chosenIdentity);
CalendarUserConfiguration config = calendarManager.findCalendarConfigForIdentity(calendarWrapper.getKalendar(), getIdentity());
if (config != null) {
calendarWrapper.setConfiguration(config);
}
calendarWrapper.setPrivateEventsVisible(chosenIdentity.equals(ureq.getIdentity()));
if (chosenIdentity.equals(ureq.getIdentity())) {
calendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
} else {
calendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_ONLY);
}
List<KalendarRenderWrapper> calendars = new ArrayList<KalendarRenderWrapper>();
calendars.add(calendarWrapper);
OLATResourceable ores = OresHelper.createOLATResourceableType(CMD_CALENDAR);
WindowControl bwControl = addToHistory(ureq, ores, null);
OLATResourceable callerOres = OresHelper.createOLATResourceableInstance(chosenIdentity.getName(), chosenIdentity.getKey());
calendarController = new WeeklyCalendarController(ureq, bwControl, calendars, WeeklyCalendarController.CALLER_PROFILE, callerOres, false);
listenTo(calendarController);
return calendarController;
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project OpenOLAT by OpenOLAT.
the class GroupInfoMainController method getCalendarController.
private WeeklyCalendarController getCalendarController(UserRequest ureq) {
if (calendarController == null) {
OLATResourceable ores = OresHelper.createOLATResourceableInstance("Calendar", 0l);
WindowControl bwControl = BusinessControlFactory.getInstance().createBusinessWindowControl(ores, null, getWindowControl());
List<KalendarRenderWrapper> calendarWrappers = new ArrayList<>(2);
KalendarRenderWrapper groupCalendar = calendarManager.getGroupCalendar(businessGroup);
groupCalendar.setPrivateEventsVisible(false);
calendarWrappers.add(groupCalendar);
calendarController = new WeeklyCalendarController(ureq, bwControl, calendarWrappers, WeeklyCalendarController.CALLER_COLLAB, businessGroup, false);
listenTo(calendarController);
}
layoutController.setCol3(calendarController.getInitialComponent());
addToHistory(ureq, calendarController);
return calendarController;
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project OpenOLAT by OpenOLAT.
the class ICalFileCalendarManagerTest method testImportICal_icalFullDay.
@Test
public void testImportICal_icalFullDay() throws URISyntaxException, IOException {
Identity test = JunitTestHelper.createAndPersistIdentityAsRndUser("ur3-");
URL calendarUrl = ICalFileCalendarManagerTest.class.getResource("Fullday_ical.ics");
File calendarFile = new File(calendarUrl.toURI());
String calendarName = UUID.randomUUID().toString().replace("-", "");
KalendarRenderWrapper importedCalendar = importCalendarManager.importCalendar(test, calendarName, CalendarManager.TYPE_USER, calendarFile);
List<KalendarEvent> events = importedCalendar.getKalendar().getEvents();
Assert.assertEquals(3, events.size());
// 24 hours but on 2 days
KalendarEvent on2days = importedCalendar.getKalendar().getEvent("EFE10508-15B0-4FCE-A258-37BA642B760D", null);
Assert.assertFalse(on2days.isAllDayEvent());
// real all day with the iCal standard
KalendarEvent allDay = importedCalendar.getKalendar().getEvent("14C0ACCD-AC0B-4B10-A448-0BF129492091", null);
Assert.assertTrue(allDay.isAllDayEvent());
// almost a full day bit it miss one minute
KalendarEvent longDay = importedCalendar.getKalendar().getEvent("C562E736-DCFF-4002-9E5B-77D891D4A322", null);
Assert.assertFalse(longDay.isAllDayEvent());
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project OpenOLAT by OpenOLAT.
the class ICalFileCalendarManagerTest method testCalendarRecurringEventMissingEndDate.
/**
* A recurring event with missing end date. This error
* in the calendar cause the whole calendar to crash.
*
* @throws URISyntaxException
* @throws IOException
*/
@Test
public void testCalendarRecurringEventMissingEndDate() throws URISyntaxException, IOException {
Identity test = JunitTestHelper.createAndPersistIdentityAsRndUser("ur1-");
URL calendarUrl = CalendarImportTest.class.getResource("RecurringEventMissingEnd.ics");
File calendarFile = new File(calendarUrl.toURI());
String calendarName = UUID.randomUUID().toString().replace("-", "");
KalendarRenderWrapper importedCalendar = importCalendarManager.importCalendar(test, calendarName, CalendarManager.TYPE_USER, calendarFile);
List<KalendarEvent> events = importedCalendar.getKalendar().getEvents();
Assert.assertEquals(1, events.size());
Calendar cal = Calendar.getInstance();
cal.set(2018, 03, 10, 10, 00);
Date startDate = cal.getTime();
cal.set(2018, 03, 17);
Date endDate = cal.getTime();
List<KalendarEvent> recurringEvents = calendarManager.getEvents(importedCalendar.getKalendar(), startDate, endDate, true);
Assert.assertEquals(0, recurringEvents.size());
}
Aggregations