Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_admin/conf/language/lams/ApplicationResources.properties,v diff -u -r1.71 -r1.72 --- lams_admin/conf/language/lams/ApplicationResources.properties 25 May 2010 20:38:58 -0000 1.71 +++ lams_admin/conf/language/lams/ApplicationResources.properties 1 Oct 2010 20:30:49 -0000 1.72 @@ -444,6 +444,21 @@ message.check.to.add.monitor =Check the box of each monitor to add as staff to each of the new lessons. label.return.to.group =Return to group config.show.all.my.lesson.link =Show All My Lesson link +admin.timezone.title =Timezone Management +admin.timezone.available.timezones =Available timezones +admin.timezone.select.timezones.you.want.users.choose =Select the timezones you want the users for choose from. The server timezone is: +admin.timezone.select =Select +admin.timezone.time.zone.id =Time zone ID +admin.timezone.raw.offset =Raw offset (Hours : Minutes) +admin.timezone.dst.offset =DST offset (Minutes) +admin.timezone.display.name =Display name +admin.servertimezone.title =Server Timezone Management +admin.servertimezone.server.timezone.management =Server Timezone Management +admin.servertimezone.select.server.timezone =Please, select server timezone +admin.servertimezone.raw.offset =Raw offset: {0} +admin.servertimezone.dst.offset =DST offset: {0} +admin.servertimezone.name =Name: {0} +admin.servertimezone.select =Select #======= End labels: Exported 437 labels for en AU ===== Index: lams_admin/conf/xdoclet/struts-forms.xml =================================================================== RCS file: /usr/local/cvsroot/lams_admin/conf/xdoclet/struts-forms.xml,v diff -u -r1.35 -r1.36 --- lams_admin/conf/xdoclet/struts-forms.xml 20 Aug 2009 06:40:01 -0000 1.35 +++ lams_admin/conf/xdoclet/struts-forms.xml 1 Oct 2010 20:30:49 -0000 1.36 @@ -89,6 +89,12 @@ + + + + + + Index: lams_admin/src/java/org/lamsfoundation/lams/admin/service/AdminServiceProxy.java =================================================================== RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/service/AdminServiceProxy.java,v diff -u -r1.12 -r1.13 --- lams_admin/src/java/org/lamsfoundation/lams/admin/service/AdminServiceProxy.java 6 Mar 2010 22:39:02 -0000 1.12 +++ lams_admin/src/java/org/lamsfoundation/lams/admin/service/AdminServiceProxy.java 1 Oct 2010 20:30:49 -0000 1.13 @@ -31,6 +31,7 @@ import org.lamsfoundation.lams.monitoring.service.IMonitoringService; import org.lamsfoundation.lams.statistics.service.IStatisticsService; import org.lamsfoundation.lams.themes.service.IThemeService; +import org.lamsfoundation.lams.timezone.service.ITimezoneService; import org.lamsfoundation.lams.usermanagement.service.IUserManagementService; import org.lamsfoundation.lams.usermanagement.service.LdapService; import org.lamsfoundation.lams.util.Configuration; @@ -58,6 +59,7 @@ private static ILessonService lessonService; private static IMonitoringService monitoringService; private static IEventNotificationService eventNotificationService; + private static ITimezoneService timezoneService; public static final IUserManagementService getService(ServletContext servletContext) { if (manageService == null) { @@ -148,4 +150,11 @@ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(servletContext); return wac.getBean(serviceName); } + + public static final ITimezoneService getTimezoneService(ServletContext servletContext) { + if (timezoneService == null) { + timezoneService = (ITimezoneService)getDomainService(servletContext, "timezoneService"); + } + return timezoneService; + } } Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserAction.java,v diff -u -r1.50 -r1.51 --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserAction.java 20 Aug 2009 23:57:47 -0000 1.50 +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/UserAction.java 1 Oct 2010 20:30:49 -0000 1.51 @@ -27,6 +27,8 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import java.util.TimeZone; +import java.util.TreeSet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -42,6 +44,10 @@ import org.lamsfoundation.lams.admin.web.dto.UserOrgRoleDTO; import org.lamsfoundation.lams.themes.Theme; import org.lamsfoundation.lams.themes.service.IThemeService; +import org.lamsfoundation.lams.timezone.Timezone; +import org.lamsfoundation.lams.timezone.dto.TimezoneDTO; +import org.lamsfoundation.lams.timezone.service.ITimezoneService; +import org.lamsfoundation.lams.timezone.util.TimezoneDTOComparator; import org.lamsfoundation.lams.usermanagement.AuthenticationMethod; import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.OrganisationState; Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/SysAdminStartAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/SysAdminStartAction.java,v diff -u -r1.12 -r1.13 --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/SysAdminStartAction.java 18 Feb 2010 05:42:19 -0000 1.12 +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/SysAdminStartAction.java 1 Oct 2010 20:30:49 -0000 1.13 @@ -74,6 +74,7 @@ links.add(new LinkBean("libraryManage.do", "sysadmin.library.management")); links.add(new LinkBean("statistics.do", "admin.statistics.title")); links.add(new LinkBean("themeManagement.do", "admin.themes.title")); + links.add(new LinkBean("timezonemanagement.do", "admin.timezone.title")); OpenIDConfig openIDEnabled = (OpenIDConfig)service.findById(OpenIDConfig.class, OpenIDConfig.KEY_ENABLED); if (openIDEnabled != null && Boolean.parseBoolean(openIDEnabled.getConfigValue()) == Boolean.TRUE) { Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/TimezoneManagementAction.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_admin/web/timezoneManagement.jsp'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_admin/web/timezoneServerManagement.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_admin/web/WEB-INF/struts/struts-config.xml =================================================================== RCS file: /usr/local/cvsroot/lams_admin/web/WEB-INF/struts/Attic/struts-config.xml,v diff -u -r1.30 -r1.31 --- lams_admin/web/WEB-INF/struts/struts-config.xml 6 Mar 2010 22:39:02 -0000 1.30 +++ lams_admin/web/WEB-INF/struts/struts-config.xml 1 Oct 2010 20:30:49 -0000 1.31 @@ -145,6 +145,11 @@ + + + + + @@ -450,6 +455,32 @@ /> + + + + + + + + + + + + + + + \ No newline at end of file Index: lams_build/lib/lams/lams.jar =================================================================== RCS file: /usr/local/cvsroot/lams_build/lib/lams/lams.jar,v diff -u -r1.332 -r1.333 Binary files differ Index: lams_central/conf/xdoclet/struts-forms.xml =================================================================== RCS file: /usr/local/cvsroot/lams_central/conf/xdoclet/struts-forms.xml,v diff -u -r1.14 -r1.15 --- lams_central/conf/xdoclet/struts-forms.xml 20 Aug 2009 04:38:20 -0000 1.14 +++ lams_central/conf/xdoclet/struts-forms.xml 1 Oct 2010 20:34:12 -0000 1.15 @@ -32,7 +32,7 @@ - + Index: lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java,v diff -u -r1.22 -r1.23 --- lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java 6 Nov 2009 06:50:14 -0000 1.22 +++ lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java 1 Oct 2010 20:34:12 -0000 1.23 @@ -26,6 +26,8 @@ import java.util.Collections; import java.util.HashMap; import java.util.List; +import java.util.TimeZone; +import java.util.TreeSet; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; @@ -45,6 +47,10 @@ import org.lamsfoundation.lams.lesson.dto.LessonDTO; import org.lamsfoundation.lams.themes.Theme; import org.lamsfoundation.lams.themes.service.IThemeService; +import org.lamsfoundation.lams.timezone.Timezone; +import org.lamsfoundation.lams.timezone.dto.TimezoneDTO; +import org.lamsfoundation.lams.timezone.service.ITimezoneService; +import org.lamsfoundation.lams.timezone.util.TimezoneDTOComparator; import org.lamsfoundation.lams.usermanagement.Organisation; import org.lamsfoundation.lams.usermanagement.OrganisationType; import org.lamsfoundation.lams.usermanagement.SupportedLocale; @@ -88,6 +94,8 @@ private static ICoreLearnerService learnerService; private static IThemeService themeService; + + private static ITimezoneService timezoneService; public ActionForward view(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { @@ -261,6 +269,17 @@ } userForm.set("userFlashTheme", userSelectedFlashTheme); + List availableTimeZones = getTimezoneService().getDefaultTimezones(); + TreeSet timezoneDtos = new TreeSet(new TimezoneDTOComparator()); + for (Timezone availableTimeZone : availableTimeZones) { + String timezoneId = availableTimeZone.getTimezoneId(); + TimezoneDTO timezoneDto = new TimezoneDTO(); + timezoneDto.setTimeZoneId(timezoneId); + timezoneDto.setDisplayName(TimeZone.getTimeZone(timezoneId).getDisplayName()); + timezoneDtos.add(timezoneDto); + } + request.setAttribute("timezoneDtos", timezoneDtos); + return mapping.findForward("edit"); } @@ -292,4 +311,13 @@ } return themeService; } + + private ITimezoneService getTimezoneService() { + if (timezoneService == null) { + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + timezoneService = (ITimezoneService) ctx.getBean("timezoneService"); + } + return timezoneService; + } } Index: lams_central/web/editprofile.jsp =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/editprofile.jsp,v diff -u -r1.20 -r1.21 --- lams_central/web/editprofile.jsp 6 Nov 2009 06:48:31 -0000 1.20 +++ lams_central/web/editprofile.jsp 1 Oct 2010 20:34:12 -0000 1.21 @@ -132,9 +132,9 @@ : - - - + + + ${timezoneDto.timeZoneId} - ${timezoneDto.displayName} @@ -320,7 +320,7 @@ : - + ${timeZone}" Index: lams_common/build.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/build.xml,v diff -u -r1.70 -r1.71 --- lams_common/build.xml 2 Jul 2009 13:06:10 -0000 1.70 +++ lams_common/build.xml 1 Oct 2010 20:36:29 -0000 1.71 @@ -455,6 +455,7 @@ + Index: lams_common/conf/hibernate/mappings/hibernate.cfg.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/conf/hibernate/mappings/hibernate.cfg.xml,v diff -u -r1.2 -r1.3 --- lams_common/conf/hibernate/mappings/hibernate.cfg.xml 20 Aug 2009 04:40:13 -0000 1.2 +++ lams_common/conf/hibernate/mappings/hibernate.cfg.xml 1 Oct 2010 20:36:29 -0000 1.3 @@ -41,6 +41,7 @@ + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/timezone/Timezone.hbm.xml'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/User.hbm.xml =================================================================== RCS file: /usr/local/cvsroot/lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/User.hbm.xml,v diff -u -r1.33 -r1.34 --- lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/User.hbm.xml 18 Feb 2010 05:41:36 -0000 1.33 +++ lams_common/conf/hibernate/mappings/org/lamsfoundation/lams/usermanagement/User.hbm.xml 1 Oct 2010 20:36:29 -0000 1.34 @@ -474,17 +474,18 @@ - - name="timeZone" - type="java.lang.Short" - column="timezone" + @hibernate.property + column="timezone" + length="64" - + classpath:org/lamsfoundation/lams/themes/Theme.hbm.xml + classpath:org/lamsfoundation/lams/timezone/Timezone.hbm.xml + classpath:org/lamsfoundation/lams/notebook/model/NotebookEntry.hbm.xml classpath:org/lamsfoundation/lams/presence/model/PresenceChatMessage.hbm.xml @@ -352,6 +354,22 @@ + + + + + + + + true + + + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + + + + @@ -542,6 +560,11 @@ + + + + + Index: lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040006.sql =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040006.sql,v diff -u -r1.2 -r1.3 --- lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040006.sql 25 May 2010 20:44:36 -0000 1.2 +++ lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02040006.sql 1 Oct 2010 20:36:29 -0000 1.3 @@ -9,5 +9,81 @@ insert into lams_configuration (config_key, config_value, description_key, header_name, format, required) values ('ShowAllMyLessonLink','true', 'config.show.all.my.lesson.link', 'config.header.features', 'BOOLEAN', 1); +-- LDEV-2544 Default Timezones +CREATE TABLE lams_timezone ( + id BIGINT(20) NOT NULL AUTO_INCREMENT + , timezone_id VARCHAR(255) NOT NULL + , server_timezone TINYINT DEFAULT 0 + , PRIMARY KEY (id) +)TYPE=InnoDB; + +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT+12'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT+11'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT+10'); +INSERT INTO lams_timezone (timezone_id) VALUES ('US/Alaska'); +INSERT INTO lams_timezone (timezone_id) VALUES ('America/Vancouver'); +INSERT INTO lams_timezone (timezone_id) VALUES ('America/Denver'); +INSERT INTO lams_timezone (timezone_id) VALUES ('America/Chicago'); +INSERT INTO lams_timezone (timezone_id) VALUES ('America/Detroit'); +INSERT INTO lams_timezone (timezone_id) VALUES ('America/Halifax'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Canada/Newfoundland'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT+3'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT+2'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT+1'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Europe/London'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Europe/Brussels'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Europe/Athens'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Europe/Moscow'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Asia/Tehran'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT-4'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Asia/Kabul'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT-5'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Asia/Calcutta'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Asia/Katmandu'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT-6'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT-7'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Australia/West'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT-9'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Australia/Adelaide'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Australia/Sydney'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Etc/GMT-11'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Pacific/Auckland'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Pacific/Tongatapu'); +INSERT INTO lams_timezone (timezone_id) VALUES ('Pacific/Kiritimati'); + +ALTER TABLE lams_user MODIFY COLUMN timezone VARCHAR(255); + +UPDATE lams_user SET timezone='Etc/GMT+12' WHERE timezone='0'; +UPDATE lams_user SET timezone='Etc/GMT+11' WHERE timezone='1'; +UPDATE lams_user SET timezone='Etc/GMT+10' WHERE timezone='2'; +UPDATE lams_user SET timezone='US/Alaska' WHERE timezone='3'; +UPDATE lams_user SET timezone='America/Vancouver' WHERE timezone='4'; +UPDATE lams_user SET timezone='America/Denver' WHERE timezone='5'; +UPDATE lams_user SET timezone='America/Chicago' WHERE timezone='6'; +UPDATE lams_user SET timezone='America/Detroit' WHERE timezone='7'; +UPDATE lams_user SET timezone='America/Halifax' WHERE timezone='8'; +UPDATE lams_user SET timezone='Canada/Newfoundland' WHERE timezone='9'; +UPDATE lams_user SET timezone='Etc/GMT+3' WHERE timezone='10'; +UPDATE lams_user SET timezone='Etc/GMT+2' WHERE timezone='11'; +UPDATE lams_user SET timezone='Etc/GMT+1' WHERE timezone='12'; +UPDATE lams_user SET timezone='Europe/London' WHERE timezone='13'; +UPDATE lams_user SET timezone='Europe/Brussels' WHERE timezone='14'; +UPDATE lams_user SET timezone='Europe/Athens' WHERE timezone='15'; +UPDATE lams_user SET timezone='Europe/Moscow' WHERE timezone='16'; +UPDATE lams_user SET timezone='Asia/Tehran' WHERE timezone='17'; +UPDATE lams_user SET timezone='Etc/GMT-4' WHERE timezone='18'; +UPDATE lams_user SET timezone='Asia/Kabul' WHERE timezone='19'; +UPDATE lams_user SET timezone='Etc/GMT-5' WHERE timezone='20'; +UPDATE lams_user SET timezone='Asia/Calcutta' WHERE timezone='21'; +UPDATE lams_user SET timezone='Asia/Katmandu' WHERE timezone='22'; +UPDATE lams_user SET timezone='Etc/GMT-6' WHERE timezone='23'; +UPDATE lams_user SET timezone='Etc/GMT-7' WHERE timezone='24'; +UPDATE lams_user SET timezone='Australia/West' WHERE timezone='25'; +UPDATE lams_user SET timezone='Etc/GMT-9' WHERE timezone='26'; +UPDATE lams_user SET timezone='Australia/Adelaide' WHERE timezone='27'; +UPDATE lams_user SET timezone='Australia/Sydney' WHERE timezone='28'; +UPDATE lams_user SET timezone='Etc/GMT-11' WHERE timezone='29'; +UPDATE lams_user SET timezone='Pacific/Auckland' WHERE timezone='30'; + COMMIT; SET AUTOCOMMIT = 1; \ No newline at end of file Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/timezone/Timezone.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/timezone/dao/ITimezoneDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/timezone/dao/hibernate/TimezoneDAO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/timezone/dto/TimezoneDTO.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/timezone/service/ITimezoneService.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/timezone/service/TimezoneService.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/timezone/util/TimezoneComparator.java'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/timezone/util/TimezoneDTOComparator.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_common/src/java/org/lamsfoundation/lams/usermanagement/User.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/usermanagement/User.java,v diff -u -r1.46 -r1.47 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/User.java 18 Feb 2010 05:41:36 -0000 1.46 +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/User.java 1 Oct 2010 20:36:29 -0000 1.47 @@ -110,7 +110,7 @@ private SupportedLocale locale; /** persistent field */ - private Short timeZone; + private String timeZone; /** persistent field */ private Date createDate; @@ -180,14 +180,6 @@ /** persistent field */ private String openidURL; - - // ------- TIMEZONES (hardcoded, there is no need to put them into database -------------- - - public static String[] timezoneList = new String[] { "GMT-12", "GMT-11", "GMT-10", "GMT-9", "GMT-8", "GMT-7", - "GMT-6", "GMT-5", "GMT-4", "GMT-3:30", "GMT-3", "GMT-2", "GMT-1", "GMT", "GMT+1", "GMT+2", "GMT+3", - "GMT+3:30", "GMT+4", "GMT+4:30", "GMT+5", "GMT+5:30", "GMT+5:45", "GMT+6", "GMT+7", "GMT+8", "GMT+9", - "GMT+9:30", "GMT+10", "GMT+11", "GMT+12" }; - /** full constructor */ public User(String login, String password, String title, String firstName, String lastName, String addressLine1, String addressLine2, String addressLine3, String city, String state, String postcode, String country, @@ -688,15 +680,15 @@ .getFckLanguageMapping(); } - TimeZone tz = TimeZone.getTimeZone(User.timezoneList[getTimeZone()]); + TimeZone timeZone = TimeZone.getTimeZone(getTimeZone()); Set tutorialPages = pagesWithDisabledTutorials == null || pagesWithDisabledTutorials.isEmpty() ? null : pagesWithDisabledTutorials; return new UserDTO(userId, firstName, lastName, login, languageIsoCode, countryIsoCode, direction, email, new CSSThemeBriefDTO(flashTheme), new CSSThemeBriefDTO(htmlTheme), // TimeZone.getTimeZone("Australia/Sydney"), - tz, authenticationMethod.getAuthenticationMethodId(), fckLanguageMapping, enableFlash, + timeZone, authenticationMethod.getAuthenticationMethodId(), fckLanguageMapping, enableFlash, lamsCommunityToken, lamsCommunityUsername, (tutorialsDisabled == null ? false : true), // assume tutorials enabled if not set tutorialPages, @@ -839,38 +831,19 @@ } /** - * Returns user's time zone. If NULL, returns server default time zone. If server default time zone is not in the - * list of supported time zones, returns GMT. + * Returns user's time zone. If NULL, returns server default time zone. * - * @hibernate.property column="timezone" + * @hibernate.property column="timezone" length="255" * */ - public Short getTimeZone() { + public String getTimeZone() { if (timeZone == null) { - TimeZone defaultTimeZone = TimeZone.getDefault(); - int defaultRawOffset = defaultTimeZone.getRawOffset(); - // initial index of GMT time zone, but later it is verified - short fallbackTimeZone = 13; - for (short timeZoneIndex = 0; timeZoneIndex < User.timezoneList.length; timeZoneIndex++) { - TimeZone candidateTimeZone = TimeZone.getTimeZone(User.timezoneList[timeZoneIndex]); - if (defaultRawOffset == candidateTimeZone.getRawOffset()) { - // we found a time zone from the list which has the same offset as the server's one - timeZone = timeZoneIndex; - break; - } else if (candidateTimeZone.getRawOffset() == 0) { - // we found GMT time zone; it will be used if server default time zone is not in the list - fallbackTimeZone = timeZoneIndex; - } - } - if (timeZone == null) { - timeZone = fallbackTimeZone; - } + timeZone = TimeZone.getDefault().getID(); } return timeZone; } - public void setTimeZone(Short timeZone) { - + public void setTimeZone(String timeZone) { this.timeZone = timeZone; } Index: lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java,v diff -u -r1.15 -r1.16 --- lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java 3 May 2010 10:11:02 -0000 1.15 +++ lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java 1 Oct 2010 20:36:29 -0000 1.16 @@ -83,7 +83,7 @@ this.description = design.getDescription(); this.creationDateTime = design.getCreateDateTime(); this.lastModifiedDateTime = design.getLastModifiedDateTime(); - this.formattedLastModifiedDateTime = formatLastModifiedDateTime(TimeZone.getTimeZone(User.timezoneList[user.getTimeZone()])); + this.formattedLastModifiedDateTime = formatLastModifiedDateTime(TimeZone.getTimeZone(user.getTimeZone())); this.resourceType = DESIGN; this.resourceID = design.getLearningDesignId(); this.permissionCode = permissionCode; @@ -98,7 +98,7 @@ this.description = "Folder"; this.creationDateTime = workspaceFolder.getCreationDate(); this.lastModifiedDateTime = workspaceFolder.getLastModifiedDate(); - this.formattedLastModifiedDateTime = formatLastModifiedDateTime(TimeZone.getTimeZone(User.timezoneList[user.getTimeZone()])); + this.formattedLastModifiedDateTime = formatLastModifiedDateTime(TimeZone.getTimeZone(user.getTimeZone())); this.resourceType = FOLDER; this.resourceTypeID = new Long(workspaceFolder.getWorkspaceFolderType().intValue()); this.resourceID = new Long(workspaceFolder.getWorkspaceFolderId().intValue()); @@ -112,7 +112,7 @@ this.description = workspaceFolderContent.getDescription(); this.creationDateTime = workspaceFolderContent.getCreateDate(); this.lastModifiedDateTime = workspaceFolderContent.getLastModified(); - this.formattedLastModifiedDateTime = formatLastModifiedDateTime(TimeZone.getTimeZone(User.timezoneList[user.getTimeZone()])); + this.formattedLastModifiedDateTime = formatLastModifiedDateTime(TimeZone.getTimeZone(user.getTimeZone())); this.resourceID = workspaceFolderContent.getFolderContentID(); this.permissionCode = permissionCode; if(workspaceFolderContent.getContentTypeID().equals(WorkspaceFolderContent.CONTENT_TYPE_FILE)) Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java,v diff -u -r1.88 -r1.89 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java 17 Feb 2010 04:23:30 -0000 1.88 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java 1 Oct 2010 20:38:05 -0000 1.89 @@ -209,11 +209,11 @@ * the lesson start date and time. * @param userId * checks that the user is a staff member for this lesson - * @param timeZoneIdx - * the index of the TimeZone to use for the start date + * @param timeZoneId + * Timezone id to use for the start date * @see org.lamsfoundation.lams.monitoring.service#startLesson(long) */ - public void startLessonOnSchedule(long lessonId, Date startDate, Integer userId, Integer timeZoneIdx) throws UserAccessDeniedException; + public void startLessonOnSchedule(long lessonId, Date startDate, Integer userId, String timeZoneId) throws UserAccessDeniedException; /** * Finish a lesson on schedule datetime. Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java,v diff -u -r1.153 -r1.154 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java 17 Feb 2010 04:23:30 -0000 1.153 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java 1 Oct 2010 20:38:05 -0000 1.154 @@ -678,7 +678,7 @@ * @see org.lamsfoundation.lams.monitoring.service.IMonitoringService#startLessonOnSchedule(long * , Date, User) */ - public void startLessonOnSchedule(long lessonId, Date startDate, Integer userId, Integer timeZoneIdx) { + public void startLessonOnSchedule(long lessonId, Date startDate, Integer userId, String timeZoneId) { // we get the lesson just created Lesson requestedLesson = lessonDAO.getLesson(new Long(lessonId)); @@ -708,10 +708,11 @@ TimeZone tz = TimeZone.getDefault(); TimeZone selectedTz; - if(timeZoneIdx != null) - selectedTz = TimeZone.getTimeZone(User.timezoneList[timeZoneIdx]); - else - selectedTz = TimeZone.getTimeZone(User.timezoneList[user.getTimeZone()]); + if (timeZoneId != null) { + selectedTz = TimeZone.getTimeZone(timeZoneId); + } else { + selectedTz = TimeZone.getTimeZone(user.getTimeZone()); + } Date tzStartLessonDate = DateUtil.convertFromTimeZoneToDefault(selectedTz, startDate); @@ -1449,7 +1450,7 @@ LessonDetailsDTO dto = lessonService.getLessonDetails(lessonID); Locale userLocale = new Locale(user.getLocale().getLanguageIsoCode(), user.getLocale().getCountryIsoCode()); - TimeZone tz = TimeZone.getTimeZone(User.timezoneList[user.getTimeZone()]); + TimeZone tz = TimeZone.getTimeZone(user.getTimeZone()); DateFormat indfm = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss", userLocale); Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java,v diff -u -r1.66 -r1.67 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 1 Jul 2009 02:47:00 -0000 1.66 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 1 Oct 2010 20:38:05 -0000 1.67 @@ -30,6 +30,7 @@ import java.util.ArrayList; import java.util.Date; import java.util.TimeZone; +import java.util.TreeSet; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; @@ -44,6 +45,11 @@ import org.lamsfoundation.lams.monitoring.MonitoringConstants; import org.lamsfoundation.lams.monitoring.service.IMonitoringService; import org.lamsfoundation.lams.monitoring.service.MonitoringServiceProxy; +import org.lamsfoundation.lams.timezone.Timezone; +import org.lamsfoundation.lams.timezone.dto.TimezoneDTO; +import org.lamsfoundation.lams.timezone.service.ITimezoneService; +import org.lamsfoundation.lams.timezone.util.TimezoneComparator; +import org.lamsfoundation.lams.timezone.util.TimezoneDTOComparator; import org.lamsfoundation.lams.tool.exception.LamsToolServiceException; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -98,6 +104,8 @@ public static final String NUM_DELETED = "numDeleted"; private static IAuditService auditService; + + private static ITimezoneService timezoneService; private Integer getUserId() { HttpSession ss = SessionManager.getSession(); @@ -276,9 +284,9 @@ String dateStr = WebUtil.readStrParam(request, MonitoringConstants.PARAM_LESSON_START_DATE); Date startDate = DateUtil.convertFromLAMSFlashFormat(dateStr); - Integer timeZoneIdx = WebUtil.readIntParam(request, MonitoringConstants.PARAM_SCHEDULE_TIME_ZONE_IDX, true); + String timeZoneId = WebUtil.readStrParam(request, MonitoringConstants.PARAM_SCHEDULE_TIME_ZONE_IDX, true); - monitoringService.startLessonOnSchedule(lessonId,startDate,getUserId(),timeZoneIdx); + monitoringService.startLessonOnSchedule(lessonId,startDate,getUserId(),timeZoneId); flashMessage = new FlashMessage("startOnScheduleLesson",Boolean.TRUE); }catch (Exception e) { flashMessage = handleException(e, "startOnScheduleLesson", monitoringService); @@ -767,16 +775,22 @@ } if(module.equals("wizard")) { - String ids[] = User.timezoneList; - int idx = 0; - for(String id: ids) { - languageOutput += "" + id + "" + TimeZone.getTimeZone(id).getRawOffset() + ""; - idx++; - } - - if(orgName != null) { - languageOutput += "" + orgName + ""; - } + //sort timezones + TreeSet timezones = new TreeSet(new TimezoneComparator()); + timezones.addAll(getTimezoneService().getDefaultTimezones()); + + int i = 0; + for (Timezone timezone : timezones) { + TimeZone timeZone = TimeZone.getTimeZone(timezone.getTimezoneId()); + languageOutput += "" + + "" + timezone.getTimezoneId() + " - " + timeZone.getDisplayName() + "" + + "" + TimeZone.getTimeZone(timezone.getTimezoneId()).getRawOffset() + "" + + ""; + } + + if (orgName != null) { + languageOutput += "" + orgName + ""; + } } languageOutput += ""; @@ -1047,6 +1061,20 @@ } return auditService; } + + /** + * Get TimezoneService bean. + * + * @return + */ + private ITimezoneService getTimezoneService() { + if (timezoneService == null) { + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + timezoneService = (ITimezoneService) ctx.getBean("timezoneService"); + } + return timezoneService; + } /** * Set whether or not the export portfolio button is available in learner. Expects parameters lessonID