use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper 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.ui.components.KalendarRenderWrapper in project openolat by klemens.
the class CalendarPersonalConfigurationController method doToogleAggregated.
private void doToogleAggregated(UserRequest ureq, CalendarPersonalConfigurationRow row) {
KalendarRenderWrapper calendarWrapper = row.getWrapper();
calendarWrapper.setInAggregatedFeed(!calendarWrapper.isInAggregatedFeed());
calendarManager.saveCalendarConfigForIdentity(calendarWrapper, getIdentity());
enableDisableIcons(row.getAggregatedLink(), calendarWrapper.isInAggregatedFeed());
fireEvent(ureq, Event.CHANGED_EVENT);
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project openolat by klemens.
the class CalendarPersonalConfigurationController method doSetColor.
private void doSetColor(UserRequest ureq, CalendarPersonalConfigurationRow row, String cssColor) {
KalendarRenderWrapper calendarWrapper = row.getWrapper();
calendarWrapper.setCssClass(cssColor);
calendarManager.saveCalendarConfigForIdentity(calendarWrapper, getIdentity());
row.getColorLink().setIconLeftCSS("o_cal_config_color ".concat(row.getCssClass()));
fireEvent(ureq, new CalendarGUISettingEvent(calendarWrapper));
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project openolat by klemens.
the class CalendarPersonalConfigurationController method event.
@Override
protected void event(UserRequest ureq, Controller source, Event event) {
if (calloutCtrl == source || cmc == source) {
cleanUp();
} else if (source == confirmRemoveTokenDialog) {
if (DialogBoxUIFactory.isOkEvent(event)) {
doDeleteToken((CalendarPersonalConfigurationRow) confirmRemoveTokenDialog.getUserObject());
showInfo("cal.icalfeed.remove.info");
fireEvent(ureq, Event.CHANGED_EVENT);
}
} else if (source == confirmDeleteCalendarDialog) {
if (DialogBoxUIFactory.isOkEvent(event)) {
doDeleteCalendar(ureq, (CalendarPersonalConfigurationRow) confirmDeleteCalendarDialog.getUserObject());
showInfo("cal.import.remove.info");
fireEvent(ureq, Event.CHANGED_EVENT);
}
} else if (calendarFileUploadCtrl == source) {
KalendarRenderWrapper calendar = calendarFileUploadCtrl.getImportedCalendar();
cmc.deactivate();
cleanUp();
if (event == Event.DONE_EVENT) {
doImportCalendar(calendar);
fireEvent(ureq, new CalendarGUIImportEvent(calendar));
}
} else if (calendarUrlImportCtrl == source) {
KalendarRenderWrapper calendar = calendarUrlImportCtrl.getImportedCalendar();
cmc.deactivate();
cleanUp();
if (event == Event.DONE_EVENT) {
doImportCalendar(calendar);
fireEvent(ureq, new CalendarGUIImportEvent(calendar));
}
} else if (calendarToolsCtrl == source) {
CalendarPersonalConfigurationRow row = calendarToolsCtrl.getRow();
calloutCtrl.deactivate();
cleanUp();
if (CalendarGUIEvent.IMPORT_BY_FILE.equals(event.getCommand())) {
doOpenInjectCalendarFile(ureq, row);
} else if (CalendarGUIEvent.IMPORT_SYNCHRONIZED_URL.equals(event.getCommand())) {
doOpenSynchronizedCalendarUrl(ureq, row);
} else if (CalendarGUIEvent.DELETE_TOKEN.equals(event.getCommand())) {
doConfirmDeleteToken(ureq, row);
} else if (CalendarGUIEvent.DELETE_CALENDAR.equals(event.getCommand())) {
doConfirmDeleteCalendar(ureq, row);
}
} else if (injectCalendarFileCtrl == source || synchronizedCalendarUrlCtrl == source) {
cmc.deactivate();
cleanUp();
} else if (colorChooserCtrl == source) {
if (event == Event.DONE_EVENT) {
doSetColor(ureq, colorChooserCtrl.getRow(), colorChooserCtrl.getChoosenColor());
}
calloutCtrl.deactivate();
cleanUp();
}
super.event(ureq, source, event);
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project openolat by klemens.
the class CalendarPersonalConfigurationController method doShowFeedURL.
private void doShowFeedURL(UserRequest ureq, FormLink link, CalendarPersonalConfigurationRow row) {
removeAsListenerAndDispose(feedUrlCtrl);
removeAsListenerAndDispose(calloutCtrl);
KalendarRenderWrapper calendarWrapper = row.getWrapper();
if (!StringHelper.containsNonWhitespace(row.getToken())) {
calendarWrapper.setToken(RandomStringUtils.randomAlphanumeric(6));
calendarManager.saveCalendarConfigForIdentity(calendarWrapper, getIdentity());
}
String calFeedLink = row.getFeedUrl(getIdentity());
feedUrlCtrl = new CalendarURLController(ureq, getWindowControl(), calFeedLink);
listenTo(feedUrlCtrl);
calloutCtrl = new CloseableCalloutWindowController(ureq, getWindowControl(), feedUrlCtrl.getInitialComponent(), link.getFormDispatchId(), "", true, "");
listenTo(calloutCtrl);
calloutCtrl.activate();
}
Aggregations