@@ -0,0 +1,2032 @@
+package edu.yale.its.tp.portlets.calendar.mvc.controller;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map;%0Aimport java.util.TimeZone;%0A%0Aimport javax.portlet.ActionRequest;%0Aimport javax.portlet.ActionResponse;%0Aimport javax.portlet.PortletPreferences;%0Aimport javax.portlet.PortletRequest;%0Aimport javax.portlet.PortletSession;%0A%0Aimport org.apache.commons.logging.Log;%0Aimport org.apache.commons.logging.LogFactory;%0Aimport org.springframework.validation.BindException;%0Aimport org.springframework.validation.Errors;%0Aimport org.springframework.web.portlet.mvc.SimpleFormController;%0A%0Aimport edu.yale.its.tp.portlets.calendar.mvc.CalendarPreferencesCommand;%0A%0Apublic class EditCalendarPreferencesController extends SimpleFormController %7B%0A%0A%09private static Log log = LogFactory.getLog(AdminCalendarController.class);%0A%0A%09@Override%0A%09protected void onSubmitAction(ActionRequest request,%0A%09%09%09ActionResponse response, Object command, BindException errors)%0A%09%09%09throws Exception %7B%0A%09%09%0A%09%09CalendarPreferencesCommand form = (CalendarPreferencesCommand) command;%0A%0A%09%09PortletPreferences prefs = request.getPreferences();%0A%09%09prefs.setValue(%22timezone%22, form.getTimezone());%0A%09%09prefs.store();%0A%0A%09%09PortletSession session = request.getPortletSession();%0A%09%09session.setAttribute(%22timezone%22, form.getTimezone(), PortletSession.APPLICATION_SCOPE);%0A%0A%09%09// send the user back to the main edit page%0A%09%09response.setRenderParameter(%22action%22, %22editSubscriptions%22);%0A%09%09%0A%0A%09%7D%0A%0A%09@Override%0A%09protected Map referenceData(PortletRequest request, Object command,%0A%09%09%09Errors errors) throws Exception %7B%0A%09%09%0A%09%09Map data = super.referenceData(request, command, errors);%0A%09%09if (data == null) %7B%0A%09%09%09data = new HashMap();%0A%09%09%7D%0A%0A%09%09data.put(%22timezones%22, TimeZone.getAvailableIDs());%0A%09%09return data;%0A%09%7D%0A%0A%09@Override%0A%09protected Object formBackingObject(PortletRequest request) throws Exception %7B%0A%09%09CalendarPreferencesCommand form = new CalendarPreferencesCommand();%0A%09%09PortletPreferences prefs = request.getPreferences();%0A%09%09form.setTimezone(prefs.getValue(%22timezone%22, %22America/Los_Angeles%22));%0A%09%09return form;%0A%09%7D%0A%0A%7D%0A

NOJIRA Adding user-configurable timezone support.