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();
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project openolat by klemens.
the class UserCalendarWebService method getEvents.
@GET
@Path("events")
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getEvents(@PathParam("identityKey") Long identityKey, @QueryParam("start") @DefaultValue("0") Integer start, @QueryParam("limit") @DefaultValue("25") Integer limit, @QueryParam("onlyFuture") @DefaultValue("false") Boolean onlyFuture, @Context HttpServletRequest httpRequest, @Context Request request) {
UserRequest ureq = getUserRequest(httpRequest);
if (ureq.getIdentity() == null || !ureq.getUserSession().isAuthenticated()) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
} else if (!ureq.getIdentity().getKey().equals(identityKey) && !isAdmin(httpRequest)) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
}
CollectCalendars visitor = new CollectCalendars();
getCalendars(visitor, ureq);
List<KalendarRenderWrapper> wrappers = visitor.getWrappers();
List<EventVO> events = new ArrayList<>();
for (KalendarRenderWrapper wrapper : wrappers) {
Collection<KalendarEvent> kalEvents = wrapper.getKalendar().getEvents();
for (KalendarEvent kalEvent : kalEvents) {
EventVO eventVo = new EventVO(kalEvent);
events.add(eventVo);
}
}
return processEvents(events, onlyFuture, start, limit, httpRequest, request);
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project openolat by klemens.
the class UserCalendarWebService method getCalendars.
@GET
@Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response getCalendars(@PathParam("identityKey") Long identityKey, @Context HttpServletRequest httpRequest) {
UserRequest ureq = getUserRequest(httpRequest);
if (ureq.getIdentity() == null || !ureq.getUserSession().isAuthenticated()) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
} else if (!ureq.getIdentity().getKey().equals(identityKey) && !isAdmin(httpRequest)) {
return Response.serverError().status(Status.UNAUTHORIZED).build();
}
CollectCalendars visitor = new CollectCalendars();
getCalendars(visitor, ureq);
List<KalendarRenderWrapper> wrappers = visitor.getWrappers();
CalendarVO[] voes = new CalendarVO[wrappers.size()];
int count = 0;
for (KalendarRenderWrapper wrapper : wrappers) {
voes[count++] = new CalendarVO(wrapper, hasWriteAccess(wrapper));
}
return Response.ok(voes).build();
}
use of org.olat.commons.calendar.ui.components.KalendarRenderWrapper in project openolat by klemens.
the class UserCalendarWebService method getPersonalCalendar.
private KalendarRenderWrapper getPersonalCalendar(Identity identity) {
// get the personal calendar
CalendarManager calendarManager = CoreSpringFactory.getImpl(CalendarManager.class);
KalendarRenderWrapper calendarWrapper = calendarManager.getPersonalCalendar(identity);
calendarWrapper.setAccess(KalendarRenderWrapper.ACCESS_READ_WRITE);
calendarWrapper.setPrivateEventsVisible(true);
CalendarUserConfiguration config = calendarManager.findCalendarConfigForIdentity(calendarWrapper.getKalendar(), identity);
if (config != null) {
calendarWrapper.setConfiguration(config);
}
return calendarWrapper;
}
Aggregations