Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== RCS file: /usr/local/cvsroot/lams_admin/conf/language/lams/ApplicationResources.properties,v diff -u -r1.52.2.4.2.5 -r1.52.2.4.2.6 --- lams_admin/conf/language/lams/ApplicationResources.properties 3 Mar 2010 06:29:07 -0000 1.52.2.4.2.5 +++ lams_admin/conf/language/lams/ApplicationResources.properties 30 Mar 2010 23:50:03 -0000 1.52.2.4.2.6 @@ -87,6 +87,20 @@ admin.themes.theme =Theme admin.themes.title =Theme Management admin.themes.type =Type +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: "Australia/Sydney". +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.timezone. = +admin.timezone. = +admin.timezone. = +admin.timezone. = +admin.timezone. = + admin.user.actions =Actions admin.user.add =Add/Remove Users admin.user.address_line_1 =Address Line 1 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.7.8.1 -r1.7.8.2 --- lams_admin/src/java/org/lamsfoundation/lams/admin/service/AdminServiceProxy.java 1 Mar 2010 04:56:25 -0000 1.7.8.1 +++ lams_admin/src/java/org/lamsfoundation/lams/admin/service/AdminServiceProxy.java 30 Mar 2010 23:50:02 -0000 1.7.8.2 @@ -27,6 +27,7 @@ import org.lamsfoundation.lams.integration.service.IIntegrationService; 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.MessageService; @@ -48,6 +49,7 @@ private static IImportService importService; private static LdapService ldapService; private static IThemeService themeService; + private static ITimezoneService timezoneService; public static final IUserManagementService getService(ServletContext servletContext) { if (manageService == null) { @@ -103,4 +105,11 @@ } return themeService; } + + 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/action/SysAdminStartAction.java =================================================================== RCS file: /usr/local/cvsroot/lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/SysAdminStartAction.java,v diff -u -r1.9.10.1 -r1.9.10.2 --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/SysAdminStartAction.java 1 Mar 2010 04:56:25 -0000 1.9.10.1 +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/action/SysAdminStartAction.java 30 Mar 2010 23:50:02 -0000 1.9.10.2 @@ -72,6 +72,7 @@ links.add(new LinkBean("register.do", "sysadmin.register.server")); links.add(new LinkBean("libraryManage.do", "sysadmin.library.management")); links.add(new LinkBean("themeManagement.do", "admin.themes.title")); + links.add(new LinkBean("timezonemanagement.do", "admin.timezone.title")); } else if (request.isUserInRole(Role.AUTHOR_ADMIN)) { LinkBean linkBean = new LinkBean("toolcontentlist.do", "sysadmin.tool.management"); links.add(linkBean); 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? 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.24.2.1 -r1.24.2.1.2.1 --- lams_admin/web/WEB-INF/struts/struts-config.xml 3 Jun 2009 06:36:50 -0000 1.24.2.1 +++ lams_admin/web/WEB-INF/struts/struts-config.xml 30 Mar 2010 23:50:03 -0000 1.24.2.1.2.1 @@ -14,33 +14,37 @@ + + - @@ -88,6 +92,8 @@ + + @@ -157,59 +163,66 @@ + + - + + + + + + + + + + + @@ -352,56 +412,40 @@ /> - - - - - + + + + - - + - - + + - - + - - @@ -806,51 +854,51 @@ /> + + - Index: lams_admin/web/WEB-INF/tiles/tiles-defs.xml =================================================================== RCS file: /usr/local/cvsroot/lams_admin/web/WEB-INF/tiles/Attic/tiles-defs.xml,v diff -u -r1.30.10.1 -r1.30.10.2 --- lams_admin/web/WEB-INF/tiles/tiles-defs.xml 1 Mar 2010 04:56:25 -0000 1.30.10.1 +++ lams_admin/web/WEB-INF/tiles/tiles-defs.xml 30 Mar 2010 23:50:02 -0000 1.30.10.2 @@ -155,4 +155,9 @@ + + + + + \ 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.324.2.7 -r1.324.2.7.2.1 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.8.4.3.2.1 -r1.8.4.3.2.2 --- lams_central/conf/xdoclet/struts-forms.xml 1 Mar 2010 04:55:47 -0000 1.8.4.3.2.1 +++ lams_central/conf/xdoclet/struts-forms.xml 30 Mar 2010 23:50:07 -0000 1.8.4.3.2.2 @@ -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.17.8.3 -r1.17.8.4 --- lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java 1 Mar 2010 04:55:47 -0000 1.17.8.3 +++ lams_central/src/java/org/lamsfoundation/lams/web/ProfileAction.java 30 Mar 2010 23:50:07 -0000 1.17.8.4 @@ -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; @@ -43,6 +45,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; @@ -85,6 +91,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 { @@ -189,8 +197,8 @@ return null; } - public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, - HttpServletResponse response) throws Exception { + public ActionForward edit(ActionMapping mapping, ActionForm form, HttpServletRequest request, + HttpServletResponse response) throws Exception { User requestor = (User) getService().getUserByLogin(request.getRemoteUser()); DynaActionForm userForm = (DynaActionForm) form; @@ -248,10 +256,20 @@ } userForm.set("userFlashTheme", userSelectedFlashTheme); + List availableTimeZones = getTimezoneService().getAllTimezones(); + TreeSet timezoneDtos = new TreeSet(new TimezoneDTOComparator()); + for (Timezone availableTimeZone : availableTimeZones) { + String timezoneId = availableTimeZone.getId(); + TimezoneDTO timezoneDto = new TimezoneDTO(); + timezoneDto.setTimeZoneId(timezoneId); + timezoneDto.setDisplayName(TimeZone.getTimeZone(timezoneId).getDisplayName()); + timezoneDtos.add(timezoneDto); + } + request.setAttribute("timezoneDtos", timezoneDtos); + + return mapping.findForward("edit"); + } - return mapping.findForward("edit"); - } - private IUserManagementService getService() { if (service == null) { WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() @@ -272,12 +290,21 @@ return learnerService; } - private IThemeService getThemeService() { - if (themeService == null) { - WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() - .getServletContext()); - themeService = (IThemeService) ctx.getBean("themeService"); - } - return themeService; + private IThemeService getThemeService() { + if (themeService == null) { + WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(getServlet() + .getServletContext()); + themeService = (IThemeService) ctx.getBean("themeService"); + } + 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.14.4.3.2.3 -r1.14.4.3.2.4 --- lams_central/web/editprofile.jsp 23 Mar 2010 10:42:56 -0000 1.14.4.3.2.3 +++ lams_central/web/editprofile.jsp 30 Mar 2010 23:50:07 -0000 1.14.4.3.2.4 @@ -131,9 +131,9 @@ : - - - + + + ${timezoneDto.displayName} @@ -306,7 +306,7 @@ : - + ${timeZone}" Index: lams_central/web/WEB-INF/struts/struts-config.xml =================================================================== RCS file: /usr/local/cvsroot/lams_central/web/WEB-INF/struts/Attic/struts-config.xml,v diff -u -r1.34.2.1.4.1 -r1.34.2.1.4.2 --- lams_central/web/WEB-INF/struts/struts-config.xml 1 Mar 2010 04:55:46 -0000 1.34.2.1.4.1 +++ lams_central/web/WEB-INF/struts/struts-config.xml 30 Mar 2010 23:50:06 -0000 1.34.2.1.4.2 @@ -14,21 +14,21 @@ + - - + @@ -100,78 +100,45 @@ - - - - - - - - + + - - + + + - - - - - - - - - - + + + @@ -366,6 +301,53 @@ /> + + + + + + + + + + + + - - - - + + + + + - - - - - + + + + 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 @@ -186,6 +189,22 @@ + + + + + + + + true + + + PROPAGATION_REQUIRED + PROPAGATION_REQUIRED + + + + @@ -375,6 +394,11 @@ + + + + + Fisheye: Tag 1.1 refers to a dead (removed) revision in file `lams_common/src/java/org/lamsfoundation/lams/dbupdates/patch02030403.sql'. 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/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/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.36.4.5.2.4 -r1.36.4.5.2.5 --- lams_common/src/java/org/lamsfoundation/lams/usermanagement/User.java 23 Mar 2010 10:42:51 -0000 1.36.4.5.2.4 +++ lams_common/src/java/org/lamsfoundation/lams/usermanagement/User.java 30 Mar 2010 23:50:13 -0000 1.36.4.5.2.5 @@ -110,7 +110,7 @@ private SupportedLocale locale; /** persistent field */ - private Short timeZone; + private String timeZone; /** persistent field */ private Date createDate; @@ -165,21 +165,7 @@ /** persistent field - for Pedagogical Planner */ private Set recentlyModifiedLearningDesigns = new LinkedHashSet(); - - // ------- TIMEZONES (hardcoded, there is no need to put them into database -------------- - public static String[] timezoneList = new String[] { "Etc/GMT+12", "Etc/GMT+11", "Etc/GMT+10", "US/Alaska", - "America/Vancouver", "Etc/GMT+8", "America/Denver", "Etc/GMT+7", "America/Chicago", "Etc/GMT+6", - "America/Mexico_City", "America/Detroit", "Etc/GMT+5", "America/Halifax", "Etc/GMT+4", - "Canada/Newfoundland", "America/Sao_Paulo", "Etc/GMT+3", "Etc/GMT+2", "Atlantic/Azores", - "Atlantic/Cape_Verde", "Europe/London", "Etc/GMT0", "Europe/Brussels", "Etc/GMT-1", "Europe/Athens", - "Etc/GMT-2", "Europe/Moscow", "Etc/GMT-3", "Asia/Tehran", "Asia/Baku", "Etc/GMT-4", "Asia/Kabul", - "Asia/Yekaterinburg", "Etc/GMT-5", "Asia/Calcutta", "Asia/Katmandu", "Asia/Almaty", "Etc/GMT-6", - "Asia/Krasnoyarsk", "Etc/GMT-7", "Asia/Irkutsk", "Etc/GMT-8", "Asia/Yakutsk", "Etc/GMT-9", - "Australia/Adelaide", "Australia/Darwin", "Australia/Sydney", "Asia/Vladivostok", "Etc/GMT-10", - "Asia/Magadan", "Etc/GMT-11", "Pacific/Auckland", "Asia/Kamchatka", "Etc/GMT-12", "Pacific/Tongatapu", - "Pacific/Kiritimati" }; - /** 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, @@ -680,12 +666,12 @@ .getFckLanguageMapping(); } - TimeZone tz = TimeZone.getTimeZone(User.timezoneList[getTimeZone()]); + TimeZone timeZone = TimeZone.getTimeZone(getTimeZone()); 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.getTimeZone("Australia/Sydney"), + timeZone, authenticationMethod.getAuthenticationMethodId(), fckLanguageMapping, enableFlash, lamsCommunityToken, lamsCommunityUsername); } @@ -824,37 +810,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="64" * */ - 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 = 22; - 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.13.4.2 -r1.13.4.2.4.1 --- lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java 11 May 2009 07:22:04 -0000 1.13.4.2 +++ lams_common/src/java/org/lamsfoundation/lams/workspace/dto/FolderContentDTO.java 30 Mar 2010 23:50:13 -0000 1.13.4.2.4.1 @@ -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; @@ -97,7 +97,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()); @@ -111,7 +111,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_common/test/java/org/lamsfoundation/lams/learningdesign/TestScheduleGateActivity.java =================================================================== RCS file: /usr/local/cvsroot/lams_common/test/java/org/lamsfoundation/lams/learningdesign/Attic/TestScheduleGateActivity.java,v diff -u -r1.7 -r1.7.20.1 --- lams_common/test/java/org/lamsfoundation/lams/learningdesign/TestScheduleGateActivity.java 17 Sep 2006 06:14:19 -0000 1.7 +++ lams_common/test/java/org/lamsfoundation/lams/learningdesign/TestScheduleGateActivity.java 30 Mar 2010 23:50:13 -0000 1.7.20.1 @@ -62,7 +62,7 @@ gateByTimeOffset.setGateStartTimeOffset(START_TIME_OFFSET); gateByTimeOffset.setGateEndTimeOffset(END_TIME_OFFSET); - //String tzid[] = TimeZone.getAvailableIDs(); + //String tzid[] = Timezone.getAvailableIDs(); gateByDateTime = new ScheduleGateActivity(); //convert current system time to utc 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.85.4.1.4.2 -r1.85.4.1.4.3 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java 17 Feb 2010 03:23:22 -0000 1.85.4.1.4.2 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/IMonitoringService.java 30 Mar 2010 23:49:56 -0000 1.85.4.1.4.3 @@ -210,11 +210,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.149.2.7.2.2 -r1.149.2.7.2.3 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java 17 Feb 2010 03:23:22 -0000 1.149.2.7.2.2 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/service/MonitoringService.java 30 Mar 2010 23:49:56 -0000 1.149.2.7.2.3 @@ -675,7 +675,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)); @@ -705,10 +705,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); @@ -1446,7 +1447,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.64.2.7.2.1 -r1.64.2.7.2.2 --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 15 Dec 2009 00:53:52 -0000 1.64.2.7.2.1 +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java 30 Mar 2010 23:49:56 -0000 1.64.2.7.2.2 @@ -29,6 +29,7 @@ import java.text.DateFormat; import java.util.ArrayList; import java.util.Date; +import java.util.List; import java.util.TimeZone; import javax.servlet.ServletException; @@ -44,6 +45,8 @@ 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.service.ITimezoneService; import org.lamsfoundation.lams.tool.exception.LamsToolServiceException; import org.lamsfoundation.lams.usermanagement.User; import org.lamsfoundation.lams.usermanagement.dto.UserDTO; @@ -98,6 +101,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 +281,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 +772,15 @@ } 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 + ""; - } + List timezones = getTimezoneService().getAllTimezones(); + for (Timezone timezone : timezones) { + languageOutput += "" + timezone.getId() + "" + + TimeZone.getTimeZone(timezone.getId()).getRawOffset() + ""; + } + + if (orgName != null) { + languageOutput += "" + orgName + ""; + } } languageOutput += ""; @@ -1047,6 +1051,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