(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