Index: lams_admin/conf/language/lams/ApplicationResources.properties =================================================================== diff -u -r1c496f87123d1d2277609837e427b77c18874a79 -r16c695f2188929b7a0020fc76d71f99e31aeecbf --- lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 1c496f87123d1d2277609837e427b77c18874a79) +++ lams_admin/conf/language/lams/ApplicationResources.properties (.../ApplicationResources.properties) (revision 16c695f2188929b7a0020fc76d71f99e31aeecbf) @@ -381,7 +381,6 @@ config.show.all.my.lesson.link = Show "All my lessons" link in User's profile config.display.print.button = Display a print button when the lesson is completed sysadmin.lessonFinishUrl = Lesson finish callback URL -admin.servertimezone.server.timezone.management = Server timezone management admin.servertimezone.title = Server timezone management admin.servertimezone.select.server.timezone = Please, select server timezone admin.servertimezone.raw.offset = Raw offset: {0} Index: lams_admin/src/java/org/lamsfoundation/lams/admin/web/controller/TimezoneManagementController.java =================================================================== diff -u -rf2ad75cef0c507a64877942631fee13efbc6ed50 -r16c695f2188929b7a0020fc76d71f99e31aeecbf --- lams_admin/src/java/org/lamsfoundation/lams/admin/web/controller/TimezoneManagementController.java (.../TimezoneManagementController.java) (revision f2ad75cef0c507a64877942631fee13efbc6ed50) +++ lams_admin/src/java/org/lamsfoundation/lams/admin/web/controller/TimezoneManagementController.java (.../TimezoneManagementController.java) (revision 16c695f2188929b7a0020fc76d71f99e31aeecbf) @@ -23,22 +23,15 @@ package org.lamsfoundation.lams.admin.web.controller; import java.util.ArrayList; -import java.util.List; -import java.util.TimeZone; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.lamsfoundation.lams.admin.web.form.TimezoneForm; import org.lamsfoundation.lams.timezone.Timezone; import org.lamsfoundation.lams.timezone.dto.TimezoneDTO; import org.lamsfoundation.lams.timezone.service.ITimezoneService; -import org.lamsfoundation.lams.util.WebUtil; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RequestParam; /** * Implements time zone manager. @@ -53,72 +46,30 @@ private ITimezoneService timezoneService; /** - * Displays list of all JRE available timezones. + * Shows page where admin can choose server timezone. */ - @RequestMapping("/start") - public String unspecified(@ModelAttribute TimezoneForm timezoneForm, HttpServletRequest request) throws Exception { - List defaultTimezones = timezoneService.getDefaultTimezones(); - + @RequestMapping(path = "/start") + public String serverTimezoneManagement(Model model) throws Exception { ArrayList timezoneDtos = new ArrayList<>(); - for (String availableTimezoneId : TimeZone.getAvailableIDs()) { - boolean isSelected = defaultTimezones.contains(new Timezone(availableTimezoneId)); - TimeZone timeZone = TimeZone.getTimeZone(availableTimezoneId); - TimezoneDTO timezoneDto = TimezoneDTO.createTimezoneDTO(timeZone, isSelected); + + for (Timezone timeZone : timezoneService.getDefaultTimezones()) { + TimezoneDTO timezoneDto = TimezoneDTO.createTimezoneDTO(timeZone); timezoneDtos.add(timezoneDto); } - request.setAttribute("timezoneDtos", timezoneDtos); - request.setAttribute("serverTimezone", timezoneService.getServerTimezone().getTimezoneId()); + model.addAttribute("timezoneDtos", timezoneDtos); + model.addAttribute("serverTimezone", timezoneService.getServerTimezone().getTimezoneId()); return "timezoneManagement"; } /** - * Makes selected timezones default ones. - */ - @RequestMapping(path = "/save", method = RequestMethod.POST) - public String save(@ModelAttribute TimezoneForm timezoneForm, HttpServletRequest request, - HttpServletResponse response) throws Exception { - String[] selectedTimezoneIds = timezoneForm.getSelected(); - - List selectedTimezones = new ArrayList<>(); - for (String selectedTimezoneId : selectedTimezoneIds) { - selectedTimezones.add(new Timezone(selectedTimezoneId)); - } - timezoneService.updateTimezones(selectedTimezones); - - return "redirect:/sysadminstart.do"; - } - - /** - * Shows page where admin can choose server timezone. - */ - @RequestMapping(path = "/serverTimezoneManagement") - public String serverTimezoneManagement(@ModelAttribute TimezoneForm timezoneForm, HttpServletRequest request) - throws Exception { - ArrayList timezoneDtos = new ArrayList<>(); - for (String availableTimezoneId : TimeZone.getAvailableIDs()) { - TimeZone timeZone = TimeZone.getTimeZone(availableTimezoneId); - TimezoneDTO timezoneDto = TimezoneDTO.createTimezoneDTO(timeZone, false); - timezoneDtos.add(timezoneDto); - } - - request.setAttribute("timezoneDtos", timezoneDtos); - request.setAttribute("serverTimezone", timezoneService.getServerTimezone().getTimezoneId()); - - return "timezoneServerManagement"; - } - - /** * Changes server timezone with the one selected by user. */ @RequestMapping(path = "/changeServerTimezone") - public String changeServerTimezone(@ModelAttribute TimezoneForm timezoneForm, HttpServletRequest request) - throws Exception { - String timeZoneId = WebUtil.readStrParam(request, "timeZoneId"); - timezoneService.setServerTimezone(timeZoneId); + public String changeServerTimezone(@RequestParam String serverTimezone) throws Exception { + timezoneService.setServerTimezone(serverTimezone); - return unspecified(timezoneForm, request); + return "forward:start.do?saved=true"; } - -} +} \ No newline at end of file Fisheye: Tag 16c695f2188929b7a0020fc76d71f99e31aeecbf refers to a dead (removed) revision in file `lams_admin/src/java/org/lamsfoundation/lams/admin/web/form/TimezoneForm.java'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_admin/web/timezoneManagement.jsp =================================================================== diff -u -r5f9e583fc8e476f6a5f9e1826332ba3788d7c68c -r16c695f2188929b7a0020fc76d71f99e31aeecbf --- lams_admin/web/timezoneManagement.jsp (.../timezoneManagement.jsp) (revision 5f9e583fc8e476f6a5f9e1826332ba3788d7c68c) +++ lams_admin/web/timezoneManagement.jsp (.../timezoneManagement.jsp) (revision 16c695f2188929b7a0020fc76d71f99e31aeecbf) @@ -12,91 +12,40 @@ - - - - - - + +

+ +

+ +

-

- - - - ${serverTimezone} - - - +
+ - - - - - - - - - - - - - - - - - - - - - - - -
- - -
- - - ${timezoneDto.timeZoneId} - - - - - - - ${timezoneDto.dstOffset} - - - ${timezoneDto.displayName} -
- -
- - - - " /> -

- - - + + + Fisheye: Tag 16c695f2188929b7a0020fc76d71f99e31aeecbf refers to a dead (removed) revision in file `lams_admin/web/timezoneServerManagement.jsp'. Fisheye: No comparison available. Pass `N' to diff? Index: lams_common/src/java/org/lamsfoundation/lams/timezone/dto/TimezoneDTO.java =================================================================== diff -u -r7475d08afc280b5e2e5ddf04e8bf35e3166aaf80 -r16c695f2188929b7a0020fc76d71f99e31aeecbf --- lams_common/src/java/org/lamsfoundation/lams/timezone/dto/TimezoneDTO.java (.../TimezoneDTO.java) (revision 7475d08afc280b5e2e5ddf04e8bf35e3166aaf80) +++ lams_common/src/java/org/lamsfoundation/lams/timezone/dto/TimezoneDTO.java (.../TimezoneDTO.java) (revision 16c695f2188929b7a0020fc76d71f99e31aeecbf) @@ -20,12 +20,13 @@ * **************************************************************** */ - package org.lamsfoundation.lams.timezone.dto; import java.util.Date; import java.util.TimeZone; +import org.lamsfoundation.lams.timezone.Timezone; + /** * DTO object for {@link org.lamsfoundation.lams.timezone.Timezone} * @@ -54,30 +55,25 @@ * timezone human readable name */ private String displayName; - /** - * If this timezone is selected. - */ - private boolean selected; /** * Returns new Timezone object with populated values. - * - * @param timeZone - * @param selected - * @return */ - public static TimezoneDTO createTimezoneDTO(TimeZone timeZone, boolean selected) { + public static TimezoneDTO createTimezoneDTO(TimeZone timeZone) { TimezoneDTO timezoneDTO = new TimezoneDTO(); timezoneDTO.timeZoneId = timeZone.getID(); int timeZoneRawOffset = timeZone.getRawOffset(); timezoneDTO.rawOffset = new Date(Math.abs(timeZoneRawOffset)); timezoneDTO.isRawOffsetNegative = timeZoneRawOffset < 0; timezoneDTO.dstOffset = timeZone.getDSTSavings() / 60000; timezoneDTO.displayName = timeZone.getDisplayName(); - timezoneDTO.selected = selected; return timezoneDTO; } + public static TimezoneDTO createTimezoneDTO(Timezone timeZone) { + return TimezoneDTO.createTimezoneDTO(TimeZone.getTimeZone(timeZone.getTimezoneId())); + } + public String getTimeZoneId() { return timeZoneId; } @@ -94,14 +90,6 @@ this.displayName = displayName; } - public boolean isSelected() { - return selected; - } - - public void setSelected(boolean selected) { - this.selected = selected; - } - public Date getRawOffset() { return rawOffset; }