use of org.olat.commons.calendar.model.KalendarRecurEvent in project openolat by klemens.
the class CalendarEntryDetailsController method doSave.
private void doSave(UserRequest ureq) {
// ok, save edited entry
kalendarEvent = eventForm.getUpdatedKalendarEvent();
if (isNew) {
boolean doneSuccessfully = true;
// this is a new event, add event to calendar
String calendarID = eventForm.getChoosenKalendarID();
for (Iterator<KalendarRenderWrapper> iter = availableCalendars.iterator(); iter.hasNext(); ) {
KalendarRenderWrapper calendarWrapper = iter.next();
if (!calendarWrapper.getKalendar().getCalendarID().equals(calendarID)) {
continue;
}
Kalendar cal = calendarWrapper.getKalendar();
boolean result = calendarManager.addEventTo(cal, kalendarEvent);
if (result == false) {
// if one failed => done not successfully
doneSuccessfully = false;
}
}
reportSaveStatus(ureq, doneSuccessfully);
} else if (kalendarEvent instanceof KalendarRecurEvent && !StringHelper.containsNonWhitespace(kalendarEvent.getRecurrenceID())) {
updateCtr = new ConfirmUpdateController(ureq, getWindowControl(), (KalendarRecurEvent) kalendarEvent);
listenTo(updateCtr);
String title = translate("cal.edit.update");
cmc = new CloseableModalController(getWindowControl(), translate("close"), updateCtr.getInitialComponent(), true, title);
listenTo(cmc);
cmc.activate();
} else {
// this is an existing event, so we get the previousely assigned calendar from the event
Kalendar cal = kalendarEvent.getCalendar();
boolean doneSuccessfully = calendarManager.updateEventFrom(cal, kalendarEvent);
reportSaveStatus(ureq, doneSuccessfully);
}
}
use of org.olat.commons.calendar.model.KalendarRecurEvent in project openolat by klemens.
the class FullCalendarElement method doResize.
protected void doResize(UserRequest ureq, String eventId, String minuteDelta, String allDayStr) {
Long minute = null;
if (StringHelper.isLong(minuteDelta)) {
minute = Long.parseLong(minuteDelta);
}
Boolean allDay = null;
if ("true".equals(allDayStr)) {
allDay = Boolean.TRUE;
} else if ("false".equals(allDayStr)) {
allDay = Boolean.FALSE;
}
if (component.isOccurenceOfCalendarEvent(eventId)) {
String uid = component.getCalendarEventUid(eventId);
KalendarRenderWrapper cal = component.getCalendarById(uid);
KalendarRecurEvent rEvent = getCurrenceKalendarEvent(cal, eventId);
getRootForm().fireFormEvent(ureq, new CalendarGUIResizeEvent(this, rEvent, cal, minute, allDay));
} else if (component.isReccurenceOfCalendarEvent(eventId)) {
String uid = component.getCalendarEventUid(eventId);
KalendarRenderWrapper cal = component.getCalendarById(uid);
KalendarRecurEvent rEvent = getCurrenceKalendarEvent(cal, eventId);
getRootForm().fireFormEvent(ureq, new CalendarGUIResizeEvent(this, rEvent, cal, minute, allDay));
} else {
KalendarEvent event = component.getCalendarEvent(eventId);
KalendarRenderWrapper calWrapper = component.getCalendarByNormalizedId(eventId);
getRootForm().fireFormEvent(ureq, new CalendarGUIResizeEvent(this, event, calWrapper, minute, allDay));
}
}
use of org.olat.commons.calendar.model.KalendarRecurEvent in project openolat by klemens.
the class FullCalendarElement method getCurrenceKalendarEvent.
private KalendarRecurEvent getCurrenceKalendarEvent(KalendarRenderWrapper cal, String eventId) {
boolean privateEventsVisible = cal.isPrivateEventsVisible();
CalendarManager calendarManager = CoreSpringFactory.getImpl(CalendarManager.class);
Date currentDate = component.getCurrentDate();
Calendar calendar = Calendar.getInstance();
calendar.setTime(currentDate);
calendar.add(Calendar.MONTH, -2);
Date from = calendar.getTime();
calendar.add(Calendar.MONTH, +4);
Date to = calendar.getTime();
List<KalendarEvent> events = calendarManager.getEvents(cal.getKalendar(), from, to, privateEventsVisible);
for (KalendarEvent event : events) {
if (event instanceof KalendarRecurEvent) {
KalendarRecurEvent kEvent = (KalendarRecurEvent) event;
if (eventId.equals(FullCalendarComponent.normalizeId(event))) {
return kEvent;
}
}
}
return null;
}
use of org.olat.commons.calendar.model.KalendarRecurEvent in project OpenOLAT by OpenOLAT.
the class CalendarEntryDetailsController method doSave.
private void doSave(UserRequest ureq) {
// ok, save edited entry
kalendarEvent = eventForm.getUpdatedKalendarEvent();
if (isNew) {
boolean doneSuccessfully = true;
// this is a new event, add event to calendar
String calendarID = eventForm.getChoosenKalendarID();
for (Iterator<KalendarRenderWrapper> iter = availableCalendars.iterator(); iter.hasNext(); ) {
KalendarRenderWrapper calendarWrapper = iter.next();
if (!calendarWrapper.getKalendar().getCalendarID().equals(calendarID)) {
continue;
}
Kalendar cal = calendarWrapper.getKalendar();
boolean result = calendarManager.addEventTo(cal, kalendarEvent);
if (result == false) {
// if one failed => done not successfully
doneSuccessfully = false;
}
}
reportSaveStatus(ureq, doneSuccessfully);
} else if (kalendarEvent instanceof KalendarRecurEvent && !StringHelper.containsNonWhitespace(kalendarEvent.getRecurrenceID())) {
updateCtr = new ConfirmUpdateController(ureq, getWindowControl(), (KalendarRecurEvent) kalendarEvent);
listenTo(updateCtr);
String title = translate("cal.edit.update");
cmc = new CloseableModalController(getWindowControl(), translate("close"), updateCtr.getInitialComponent(), true, title);
listenTo(cmc);
cmc.activate();
} else {
// this is an existing event, so we get the previousely assigned calendar from the event
Kalendar cal = kalendarEvent.getCalendar();
boolean doneSuccessfully = calendarManager.updateEventFrom(cal, kalendarEvent);
reportSaveStatus(ureq, doneSuccessfully);
}
}
use of org.olat.commons.calendar.model.KalendarRecurEvent in project OpenOLAT by OpenOLAT.
the class FullCalendarElement method doMove.
protected void doMove(UserRequest ureq, String eventId, String dayDelta, String minuteDelta, String allDayStr) {
Long day = null;
if (StringHelper.isLong(dayDelta)) {
day = Long.parseLong(dayDelta);
}
Long minute = null;
if (StringHelper.isLong(minuteDelta)) {
minute = Long.parseLong(minuteDelta);
}
Boolean allDay = null;
if ("true".equals(allDayStr)) {
allDay = Boolean.TRUE;
} else if ("false".equals(allDayStr)) {
allDay = Boolean.FALSE;
}
if (component.isOccurenceOfCalendarEvent(eventId)) {
String uid = component.getCalendarEventUid(eventId);
KalendarRenderWrapper cal = component.getCalendarById(uid);
KalendarRecurEvent rEvent = getCurrenceKalendarEvent(cal, eventId);
getRootForm().fireFormEvent(ureq, new CalendarGUIMoveEvent(this, rEvent, cal, day, minute, allDay));
} else if (component.isReccurenceOfCalendarEvent(eventId)) {
String uid = component.getCalendarEventUid(eventId);
KalendarRenderWrapper cal = component.getCalendarById(uid);
KalendarRecurEvent rEvent = getCurrenceKalendarEvent(cal, eventId);
getRootForm().fireFormEvent(ureq, new CalendarGUIMoveEvent(this, rEvent, cal, day, minute, allDay));
} else {
KalendarEvent event = component.getCalendarEvent(eventId);
KalendarRenderWrapper calWrapper = component.getCalendarByNormalizedId(eventId);
getRootForm().fireFormEvent(ureq, new CalendarGUIMoveEvent(this, event, calWrapper, day, minute, allDay));
}
}
Aggregations