}
public void event(UserRequest ureq, Component source, Event event) {
if (event == ComponentUtil.VALIDATE_EVENT && dirty) {
dirty = false;
fireEvent(ureq, new KalendarModifiedEvent());
} else if (event == ComponentUtil.VALIDATE_EVENT && weeklyCalendar.isDirty() && modifiedCalenderDirty ) {
KalendarRenderWrapper kalendarRenderWrapper = weeklyCalendar.getKalendarRenderWrapper(modifiedCalendarId);
kalendarRenderWrapper.reloadKalendar();
}else if (source == vcMain) {
if (event.getCommand().equals(CMD_PREVIOUS_WEEK)) {
weeklyCalendar.previousWeek();
} else if (event.getCommand().equals(CMD_NEXT_WEEK)) {
weeklyCalendar.nextWeek();
}
} else if (source == thisWeekLink){
Calendar cal = CalendarUtils.createCalendarInstance(ureq.getLocale());
weeklyCalendar.setFocus(cal.get(Calendar.YEAR), cal.get(Calendar.WEEK_OF_YEAR));
} else if (source == searchLink) {
if (searchController != null) searchController.dispose();
ArrayList allCalendarWrappers = new ArrayList(calendarWrappers);
allCalendarWrappers.addAll(importedCalendarWrappers);
searchController = new SearchAllCalendarsController(ureq, getWindowControl(), translator, allCalendarWrappers);
searchController.addControllerListener(this);
if (cmc != null) cmc.dispose();
cmc = new CloseableModalController(getWindowControl(), translator.translate("close"), searchController.getInitialComponent());
cmc.activate();
} else if (source == subscribeButton || source == unsubscribeButton) {
if (subscriptionController != null) subscriptionController.dispose();
if(calendarSubscription.isSubscribed() == (source == unsubscribeButton)) {
subscriptionController = calendarSubscription.triggerSubscribeAction();
}
if (subscriptionController != null) {
// activate subscription controller
subscriptionController.addControllerListener(this);
mainPanel.setContent(subscriptionController.getInitialComponent());
} else {
vcMain.contextPut("isSubscribed", new Boolean(calendarSubscription.isSubscribed()));
CoordinatorManager.getCoordinator().getEventBus().fireEventToListenersOf(new KalendarModifiedEvent(), OresHelper.lookupType(CalendarManager.class));
}
} else if (source == weeklyCalendar) {
if (event instanceof KalendarGUIEditEvent) {
KalendarGUIEditEvent guiEvent = (KalendarGUIEditEvent) event;
KalendarEvent kalendarEvent = guiEvent.getKalendarEvent();