Index: lams_flex/CloudWizard/src/org/lamsfoundation/lams/events/WizardEvent.as =================================================================== diff -u -r41c5f293e1903794bd4f56aafa70824b29ba6de4 -r4071e019e3f49ff24ab7137412dabf98e92aea3a --- lams_flex/CloudWizard/src/org/lamsfoundation/lams/events/WizardEvent.as (.../WizardEvent.as) (revision 41c5f293e1903794bd4f56aafa70824b29ba6de4) +++ lams_flex/CloudWizard/src/org/lamsfoundation/lams/events/WizardEvent.as (.../WizardEvent.as) (revision 4071e019e3f49ff24ab7137412dabf98e92aea3a) @@ -50,7 +50,7 @@ public var startEvent_type:String; public var schedule:String; - public var timeZone:uint; + public var timeZone:String; public var scheduledNumberDaysToLessonFinish:int; Index: lams_flex/CloudWizard/src/org/lamsfoundation/lams/validators/LessonValidator.as =================================================================== diff -u -r288a24d430e10138d07e89241364fc014a1f9352 -r4071e019e3f49ff24ab7137412dabf98e92aea3a --- lams_flex/CloudWizard/src/org/lamsfoundation/lams/validators/LessonValidator.as (.../LessonValidator.as) (revision 288a24d430e10138d07e89241364fc014a1f9352) +++ lams_flex/CloudWizard/src/org/lamsfoundation/lams/validators/LessonValidator.as (.../LessonValidator.as) (revision 4071e019e3f49ff24ab7137412dabf98e92aea3a) @@ -1,91 +1,91 @@ -package org.lamsfoundation.lams.validators -{ - import com.visualempathy.display.controls.datetime.DateTimePicker; - - import mx.collections.ArrayCollection; - import mx.containers.FormItem; - import mx.controls.ComboBox; - import mx.core.Application; - import mx.validators.ValidationResult; - import mx.validators.Validator; - - import org.lamsfoundation.lams.views.Advanced; - import org.lamsfoundation.lams.vos.UserCollection; - - public class LessonValidator extends Validator - { - public var errorMessage:String; - private var results:Array; - - public function LessonValidator() - { - super(); - } - - override protected function doValidation(value:Object):Array { - - // Clear results Array. - results = []; - - if(value is String) { - validateLessonName(value as String); - } else if(value is UserCollection) { - validateUserCollection(value as UserCollection); - } else if(value is FormItem) { - var children:Array = (value as FormItem).getChildren(); - if(children.length > 0) { - validateScheduleDate(children[0] as DateTimePicker, children[1] as ComboBox); - } - } - - // Return if there are errors. - if(results.length > 0) - return results; - - - // Call base class doValidation(). - results = super.doValidation(value); - - return results; - } - - private function validateLessonName(lessonName:String):void { - // Check lesson name field. - if (lessonName == "" || lessonName == null) { - results.push(new ValidationResult(true, - "", "noLessonName", this.errorMessage)); - } - } - - private function validateUserCollection(collection:UserCollection):void { - if(collection.users.length <= 0) - results.push(new ValidationResult(true, "", "noLearners", this.errorMessage)); - } - - private function validateScheduleDate(timePicker:DateTimePicker, timeZonePicker:ComboBox):void { - var now:Date = new Date(); - var tzList:ArrayCollection = (timeZonePicker.dataProvider != null) ? timeZonePicker.dataProvider as ArrayCollection : new ArrayCollection(); - var usersTzIdx:uint = Advanced.getUserTimeZone(Application.application.param("tz") as String, tzList.toArray()); - var usersTzOffset:Number = timeZonePicker.dataProvider[usersTzIdx].data; - - var selectedTzOffset:Number = timeZonePicker.selectedItem.data; - var rawOffset:Number = (usersTzOffset - selectedTzOffset); - - var valTime:Number = now.setTime(now.getTime() - rawOffset); - - if(timePicker.enabled) { - if(timePicker.selectedDate.date > now.date) - return; - else if(timePicker.selectedDate.date == now.date) - if(timePicker.selectedDate.getHours() > now.getHours()) - return; - else if(timePicker.selectedDate.getHours() == now.getHours()) - if(timePicker.selectedDate.getMinutes() >= now.getMinutes()) - return; - - results.push(new ValidationResult(true, "", "incorrectScheduleDate", this.errorMessage)); - } - } - - } +package org.lamsfoundation.lams.validators +{ + import com.visualempathy.display.controls.datetime.DateTimePicker; + + import mx.collections.ArrayCollection; + import mx.containers.FormItem; + import mx.controls.ComboBox; + import mx.core.Application; + import mx.validators.ValidationResult; + import mx.validators.Validator; + + import org.lamsfoundation.lams.views.Advanced; + import org.lamsfoundation.lams.vos.UserCollection; + + public class LessonValidator extends Validator + { + public var errorMessage:String; + private var results:Array; + + public function LessonValidator() + { + super(); + } + + override protected function doValidation(value:Object):Array { + + // Clear results Array. + results = []; + + if(value is String) { + validateLessonName(value as String); + } else if(value is UserCollection) { + validateUserCollection(value as UserCollection); + } else if(value is FormItem) { + var children:Array = (value as FormItem).getChildren(); + if(children.length > 0) { + validateScheduleDate(children[0] as DateTimePicker, children[1] as ComboBox); + } + } + + // Return if there are errors. + if(results.length > 0) + return results; + + + // Call base class doValidation(). + results = super.doValidation(value); + + return results; + } + + private function validateLessonName(lessonName:String):void { + // Check lesson name field. + if (lessonName == "" || lessonName == null) { + results.push(new ValidationResult(true, + "", "noLessonName", this.errorMessage)); + } + } + + private function validateUserCollection(collection:UserCollection):void { + if(collection.users.length <= 0) + results.push(new ValidationResult(true, "", "noLearners", this.errorMessage)); + } + + private function validateScheduleDate(timePicker:DateTimePicker, timeZonePicker:ComboBox):void { + var now:Date = new Date(); + var tzList:ArrayCollection = (timeZonePicker.dataProvider != null) ? timeZonePicker.dataProvider as ArrayCollection : new ArrayCollection(); + var usersTzIdx:uint = Advanced.getUserTimeZoneIndex(Application.application.param("tz") as String, tzList.toArray()); + var usersTzOffset:Number = timeZonePicker.dataProvider[usersTzIdx].data; + + var selectedTzOffset:Number = timeZonePicker.selectedItem.data; + var rawOffset:Number = (usersTzOffset - selectedTzOffset); + + var valTime:Number = now.setTime(now.getTime() - rawOffset); + + if(timePicker.enabled) { + if(timePicker.selectedDate.date > now.date) + return; + else if(timePicker.selectedDate.date == now.date) + if(timePicker.selectedDate.getHours() > now.getHours()) + return; + else if(timePicker.selectedDate.getHours() == now.getHours()) + if(timePicker.selectedDate.getMinutes() >= now.getMinutes()) + return; + + results.push(new ValidationResult(true, "", "incorrectScheduleDate", this.errorMessage)); + } + } + + } } \ No newline at end of file Index: lams_flex/CloudWizard/src/org/lamsfoundation/lams/views/Advanced.mxml =================================================================== diff -u -rb6597b39c4538183110557d7867dff0ab215930e -r4071e019e3f49ff24ab7137412dabf98e92aea3a --- lams_flex/CloudWizard/src/org/lamsfoundation/lams/views/Advanced.mxml (.../Advanced.mxml) (revision b6597b39c4538183110557d7867dff0ab215930e) +++ lams_flex/CloudWizard/src/org/lamsfoundation/lams/views/Advanced.mxml (.../Advanced.mxml) (revision 4071e019e3f49ff24ab7137412dabf98e92aea3a) @@ -7,19 +7,20 @@ 0) return; tzList = new Array(); // populate TimeZone list from User (java) class passed through in the Dictionary data. - for (var i:uint = 0; i <= 30; i++) { - label = dictionary.getLabel(String('timezoneID' + i)); + var timezoneNumber:uint = uint(dictionary.getValue("timezoneNumber")); + for (var i:uint = 0; i < timezoneNumber; i++) { + label = dictionary.getLabel(String('timezoneID' + i)) as String; value = dictionary.getValue(String('timezoneID' + i)) as String; + timeZoneId = label.substring(0, label.indexOf(" - ")); - tzList.push({label: label, data: value }); + tzList.push({label: label, data: value, timeZoneId: timeZoneId }); } - //tzList = [ "GMT-12", "GMT-11", "GMT-10", "GMT-9", "GMT-8", "GMT-7", - // "GMT-6", "GMT-5", "GMT-4", "Canada/Newfoundland", "GMT-3", "GMT-2", "GMT-1", "GMT", "GMT+1", "GMT+2", - // "GMT+3", "Asia/Tehran", "GMT+4", "Asia/Kabul", "GMT+5", "Asia/Calcutta", "Asia/Katmandu", "GMT+6", "GMT+7", - // "GMT+8", "GMT+9", "Australia/Adelaide", "GMT+10", "GMT+11", "GMT+12" ] - - userTimeZone = Advanced.getUserTimeZone(Application.application.param("tz") as String, tzList); + userTimeZoneIndex = Advanced.getUserTimeZoneIndex(Application.application.param("tz") as String, tzList); } ]]> @@ -328,7 +307,7 @@ - + Index: lams_flex/CloudWizard/src/org/lamsfoundation/lams/views/Lesson.mxml =================================================================== diff -u -rb6597b39c4538183110557d7867dff0ab215930e -r4071e019e3f49ff24ab7137412dabf98e92aea3a --- lams_flex/CloudWizard/src/org/lamsfoundation/lams/views/Lesson.mxml (.../Lesson.mxml) (revision b6597b39c4538183110557d7867dff0ab215930e) +++ lams_flex/CloudWizard/src/org/lamsfoundation/lams/views/Lesson.mxml (.../Lesson.mxml) (revision 4071e019e3f49ff24ab7137412dabf98e92aea3a) @@ -189,7 +189,8 @@ wizardEvent.lesson = newLesson; wizardEvent.schedule = (newLesson.enableScheduling) ? advanced.scheduleDateTimeStr : null; - wizardEvent.timeZone = advanced.scheduleDateTZ.selectedIndex + var selectedTimeZoneIndex:uint = advanced.scheduleDateTZ.selectedIndex; + wizardEvent.timeZone = advanced.scheduleDateTZ.dataProvider[selectedTimeZoneIndex].timeZoneId; if(lessonInstances.length > 1) { startLessonInstances(wizardEvent); @@ -210,7 +211,8 @@ wizardEvent.lesson = newLesson; wizardEvent.schedule = event.schedule; - wizardEvent.timeZone = advanced.scheduleDateTZ.selectedIndex + var selectedTimeZoneIndex:uint = advanced.scheduleDateTZ.selectedIndex; + wizardEvent.timeZone = advanced.scheduleDateTZ.dataProvider[selectedTimeZoneIndex].timeZoneId; wizardEvent.last = (lessonInstances.length == count); Index: lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java =================================================================== diff -u -rcb6d628cd53fe3d51e4f67cbaff7390651a048da -r4071e019e3f49ff24ab7137412dabf98e92aea3a --- lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision cb6d628cd53fe3d51e4f67cbaff7390651a048da) +++ lams_monitoring/src/java/org/lamsfoundation/lams/monitoring/web/MonitoringAction.java (.../MonitoringAction.java) (revision 4071e019e3f49ff24ab7137412dabf98e92aea3a) @@ -778,9 +778,13 @@ } if(module.equals("wizard")) { + //sort timezones TreeSet timezones = new TreeSet(new TimezoneComparator()); timezones.addAll(getTimezoneService().getDefaultTimezones()); + + //let Flex know the number of timezones + languageOutput += "" + timezones.size() + ""; int i = 0; for (Timezone timezone : timezones) { Index: lams_monitoring/web/CloudWizard.swf =================================================================== diff -u -r1af4378c901cea902392d4ef17f9d990f25e16f3 -r4071e019e3f49ff24ab7137412dabf98e92aea3a Binary files differ