use of org.olat.commons.calendar.ui.events.CalendarGUIFormEvent in project OpenOLAT by OpenOLAT.
the class WeeklyCalendarController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == calendarEl) {
if (event instanceof CalendarGUIEditEvent) {
CalendarGUIEditEvent guiEvent = (CalendarGUIEditEvent) event;
KalendarEvent kalendarEvent = guiEvent.getKalendarEvent();
if (kalendarEvent == null) {
// event already deleted
getWindowControl().setError(translate("cal.error.eventDeleted"));
return;
}
String recurrence = kalendarEvent.getRecurrenceRule();
boolean isImported = false;
KalendarRenderWrapper kalendarRenderWrapper = guiEvent.getKalendarRenderWrapper();
if (kalendarRenderWrapper != null) {
isImported = kalendarRenderWrapper.isImported();
}
if (!isImported && recurrence != null && !recurrence.equals("")) {
List<String> btnLabels = new ArrayList<>(3);
btnLabels.add(translate("cal.edit.dialog.sequence"));
btnLabels.add(translate("cal.edit.dialog.delete.single"));
btnLabels.add(translate("cal.edit.dialog.delete.sequence"));
if (dbcSequence != null) {
dbcSequence.dispose();
}
dbcSequence = DialogBoxUIFactory.createGenericDialog(ureq, getWindowControl(), translate("cal.edit.dialog.title"), translate("cal.edit.dialog.text"), btnLabels);
dbcSequence.addControllerListener(this);
dbcSequence.setUserObject(guiEvent);
dbcSequence.activate();
return;
}
KalendarRenderWrapper kalendarWrapper = guiEvent.getKalendarRenderWrapper();
pushEditEventController(ureq, kalendarEvent, kalendarWrapper);
} else if (event instanceof CalendarGUIAddEvent) {
pushAddEventController((CalendarGUIAddEvent) event, ureq);
} else if (event instanceof CalendarGUISelectEvent) {
CalendarGUISelectEvent selectEvent = (CalendarGUISelectEvent) event;
if (selectEvent.getKalendarEvent() != null) {
doOpenEventCallout(ureq, selectEvent.getKalendarEvent(), selectEvent.getKalendarRenderWrapper(), selectEvent.getTargetDomId());
}
} else if (event instanceof CalendarGUIMoveEvent) {
CalendarGUIMoveEvent moveEvent = (CalendarGUIMoveEvent) event;
doMove(ureq, moveEvent.getKalendarEvent(), moveEvent.getDayDelta(), moveEvent.getMinuteDelta(), moveEvent.getAllDay());
} else if (event instanceof CalendarGUIResizeEvent) {
CalendarGUIResizeEvent resizeEvent = (CalendarGUIResizeEvent) event;
doResize(ureq, resizeEvent.getKalendarEvent(), resizeEvent.getMinuteDelta(), resizeEvent.getAllDay());
} else if (event instanceof CalendarGUIFormEvent) {
String cmd = event.getCommand();
if (CalendarGUIFormEvent.CONFIGURE.equals(cmd)) {
doConfigure(ureq);
} else if (CalendarGUIFormEvent.AGGREGATED_FEED.equals(cmd)) {
CalendarGUIFormEvent guiEvent = (CalendarGUIFormEvent) event;
doOpenAggregatedFeedUrl(ureq, guiEvent.getTargetDomId());
}
} else if (event instanceof CalendarGUIPrintEvent) {
CalendarGUIPrintEvent printEvent = (CalendarGUIPrintEvent) event;
if (printEvent.getFrom() != null && printEvent.getTo() != null) {
doPrint(printEvent.getFrom(), printEvent.getTo());
} else if (printEvent.getTargetDomId() != null) {
doPrintEventCallout(ureq, printEvent.getTargetDomId());
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.commons.calendar.ui.events.CalendarGUIFormEvent in project openolat by klemens.
the class WeeklyCalendarController method formInnerEvent.
@Override
protected void formInnerEvent(UserRequest ureq, FormItem source, FormEvent event) {
if (source == calendarEl) {
if (event instanceof CalendarGUIEditEvent) {
CalendarGUIEditEvent guiEvent = (CalendarGUIEditEvent) event;
KalendarEvent kalendarEvent = guiEvent.getKalendarEvent();
if (kalendarEvent == null) {
// event already deleted
getWindowControl().setError(translate("cal.error.eventDeleted"));
return;
}
String recurrence = kalendarEvent.getRecurrenceRule();
boolean isImported = false;
KalendarRenderWrapper kalendarRenderWrapper = guiEvent.getKalendarRenderWrapper();
if (kalendarRenderWrapper != null) {
isImported = kalendarRenderWrapper.isImported();
}
if (!isImported && recurrence != null && !recurrence.equals("")) {
List<String> btnLabels = new ArrayList<>(3);
btnLabels.add(translate("cal.edit.dialog.sequence"));
btnLabels.add(translate("cal.edit.dialog.delete.single"));
btnLabels.add(translate("cal.edit.dialog.delete.sequence"));
if (dbcSequence != null) {
dbcSequence.dispose();
}
dbcSequence = DialogBoxUIFactory.createGenericDialog(ureq, getWindowControl(), translate("cal.edit.dialog.title"), translate("cal.edit.dialog.text"), btnLabels);
dbcSequence.addControllerListener(this);
dbcSequence.setUserObject(guiEvent);
dbcSequence.activate();
return;
}
KalendarRenderWrapper kalendarWrapper = guiEvent.getKalendarRenderWrapper();
pushEditEventController(ureq, kalendarEvent, kalendarWrapper);
} else if (event instanceof CalendarGUIAddEvent) {
pushAddEventController((CalendarGUIAddEvent) event, ureq);
} else if (event instanceof CalendarGUISelectEvent) {
CalendarGUISelectEvent selectEvent = (CalendarGUISelectEvent) event;
if (selectEvent.getKalendarEvent() != null) {
doOpenEventCallout(ureq, selectEvent.getKalendarEvent(), selectEvent.getKalendarRenderWrapper(), selectEvent.getTargetDomId());
}
} else if (event instanceof CalendarGUIMoveEvent) {
CalendarGUIMoveEvent moveEvent = (CalendarGUIMoveEvent) event;
doMove(ureq, moveEvent.getKalendarEvent(), moveEvent.getDayDelta(), moveEvent.getMinuteDelta(), moveEvent.getAllDay());
} else if (event instanceof CalendarGUIResizeEvent) {
CalendarGUIResizeEvent resizeEvent = (CalendarGUIResizeEvent) event;
doResize(ureq, resizeEvent.getKalendarEvent(), resizeEvent.getMinuteDelta(), resizeEvent.getAllDay());
} else if (event instanceof CalendarGUIFormEvent) {
String cmd = event.getCommand();
if (CalendarGUIFormEvent.CONFIGURE.equals(cmd)) {
doConfigure(ureq);
} else if (CalendarGUIFormEvent.AGGREGATED_FEED.equals(cmd)) {
CalendarGUIFormEvent guiEvent = (CalendarGUIFormEvent) event;
doOpenAggregatedFeedUrl(ureq, guiEvent.getTargetDomId());
}
} else if (event instanceof CalendarGUIPrintEvent) {
CalendarGUIPrintEvent printEvent = (CalendarGUIPrintEvent) event;
if (printEvent.getFrom() != null && printEvent.getTo() != null) {
doPrint(printEvent.getFrom(), printEvent.getTo());
} else if (printEvent.getTargetDomId() != null) {
doPrintEventCallout(ureq, printEvent.getTargetDomId());
}
}
}
super.formInnerEvent(ureq, source, event);
}
use of org.olat.commons.calendar.ui.events.CalendarGUIFormEvent in project openolat by klemens.
the class FullCalendarElement method evalFormRequest.
/**
* @see org.olat.core.gui.components.form.flexible.FormItemImpl#evalFormRequest(org.olat.core.gui.UserRequest)
*/
@Override
public void evalFormRequest(UserRequest ureq) {
String selectedEventId = getRootForm().getRequestParameter("evSelect");
String addEventMarker = getRootForm().getRequestParameter("evAdd");
String movedEventId = getRootForm().getRequestParameter("evMove");
String resizedEventId = getRootForm().getRequestParameter("evResize");
String changeViewName = getRootForm().getRequestParameter("evChangeView");
String print = getRootForm().getRequestParameter("print");
String config = getRootForm().getRequestParameter("config");
String aggregate = getRootForm().getRequestParameter("aggregate");
String dispatchuri = getRootForm().getRequestParameter("dispatchuri");
if ("undefined".equals(dispatchuri)) {
// to nothing
} else if (StringHelper.containsNonWhitespace(print)) {
String targetDomId = "fc_p" + component.getDispatchID();
getRootForm().fireFormEvent(ureq, new CalendarGUIPrintEvent(this, targetDomId));
} else if (StringHelper.containsNonWhitespace(config)) {
String targetDomId = "fc_x" + component.getDispatchID();
getRootForm().fireFormEvent(ureq, new CalendarGUIFormEvent(CalendarGUIFormEvent.CONFIGURE, this, targetDomId));
} else if (StringHelper.containsNonWhitespace(aggregate)) {
String targetDomId = "fc_g" + component.getDispatchID();
getRootForm().fireFormEvent(ureq, new CalendarGUIFormEvent(CalendarGUIFormEvent.AGGREGATED_FEED, this, targetDomId));
} else if (StringHelper.containsNonWhitespace(selectedEventId)) {
String targetDomId = getRootForm().getRequestParameter("evDomId");
doSelect(ureq, selectedEventId, targetDomId);
} else if (StringHelper.containsNonWhitespace(addEventMarker)) {
String start = getRootForm().getRequestParameter("start");
String end = getRootForm().getRequestParameter("end");
String allDay = getRootForm().getRequestParameter("allDay");
doAdd(ureq, start, end, allDay);
} else if (StringHelper.containsNonWhitespace(movedEventId)) {
String dayDelta = getRootForm().getRequestParameter("dayDelta");
String minuteDelta = getRootForm().getRequestParameter("minuteDelta");
String allDay = getRootForm().getRequestParameter("allDay");
doMove(ureq, movedEventId, dayDelta, minuteDelta, allDay);
} else if (StringHelper.containsNonWhitespace(resizedEventId)) {
String minuteDelta = getRootForm().getRequestParameter("minuteDelta");
String allDay = getRootForm().getRequestParameter("allDay");
doResize(ureq, resizedEventId, minuteDelta, allDay);
} else if (StringHelper.containsNonWhitespace(changeViewName)) {
String start = getRootForm().getRequestParameter("start");
doChangeView(changeViewName, start);
}
}
use of org.olat.commons.calendar.ui.events.CalendarGUIFormEvent in project OpenOLAT by OpenOLAT.
the class FullCalendarElement method evalFormRequest.
/**
* @see org.olat.core.gui.components.form.flexible.FormItemImpl#evalFormRequest(org.olat.core.gui.UserRequest)
*/
@Override
public void evalFormRequest(UserRequest ureq) {
String selectedEventId = getRootForm().getRequestParameter("evSelect");
String addEventMarker = getRootForm().getRequestParameter("evAdd");
String movedEventId = getRootForm().getRequestParameter("evMove");
String resizedEventId = getRootForm().getRequestParameter("evResize");
String changeViewName = getRootForm().getRequestParameter("evChangeView");
String print = getRootForm().getRequestParameter("print");
String config = getRootForm().getRequestParameter("config");
String aggregate = getRootForm().getRequestParameter("aggregate");
String dispatchuri = getRootForm().getRequestParameter("dispatchuri");
if ("undefined".equals(dispatchuri)) {
// to nothing
} else if (StringHelper.containsNonWhitespace(print)) {
String targetDomId = "fc_p" + component.getDispatchID();
getRootForm().fireFormEvent(ureq, new CalendarGUIPrintEvent(this, targetDomId));
} else if (StringHelper.containsNonWhitespace(config)) {
String targetDomId = "fc_x" + component.getDispatchID();
getRootForm().fireFormEvent(ureq, new CalendarGUIFormEvent(CalendarGUIFormEvent.CONFIGURE, this, targetDomId));
} else if (StringHelper.containsNonWhitespace(aggregate)) {
String targetDomId = "fc_g" + component.getDispatchID();
getRootForm().fireFormEvent(ureq, new CalendarGUIFormEvent(CalendarGUIFormEvent.AGGREGATED_FEED, this, targetDomId));
} else if (StringHelper.containsNonWhitespace(selectedEventId)) {
String targetDomId = getRootForm().getRequestParameter("evDomId");
doSelect(ureq, selectedEventId, targetDomId);
} else if (StringHelper.containsNonWhitespace(addEventMarker)) {
String start = getRootForm().getRequestParameter("start");
String end = getRootForm().getRequestParameter("end");
String allDay = getRootForm().getRequestParameter("allDay");
doAdd(ureq, start, end, allDay);
} else if (StringHelper.containsNonWhitespace(movedEventId)) {
String dayDelta = getRootForm().getRequestParameter("dayDelta");
String minuteDelta = getRootForm().getRequestParameter("minuteDelta");
String allDay = getRootForm().getRequestParameter("allDay");
doMove(ureq, movedEventId, dayDelta, minuteDelta, allDay);
} else if (StringHelper.containsNonWhitespace(resizedEventId)) {
String minuteDelta = getRootForm().getRequestParameter("minuteDelta");
String allDay = getRootForm().getRequestParameter("allDay");
doResize(ureq, resizedEventId, minuteDelta, allDay);
} else if (StringHelper.containsNonWhitespace(changeViewName)) {
String start = getRootForm().getRequestParameter("start");
doChangeView(changeViewName, start);
}
}
Aggregations