diff --git a/messages/uniworx/de-de-formal.msg b/messages/uniworx/de-de-formal.msg index 0c3e2f4b9..8118b4559 100644 --- a/messages/uniworx/de-de-formal.msg +++ b/messages/uniworx/de-de-formal.msg @@ -119,6 +119,12 @@ ScheduleWeekTimeslotLength: Länge (in Stunden) der in der Wochenansicht dargest ScheduleWeekTimeslotLengthTip: Die Länge (in Stunden) jedes in der Wochenansicht der Terminübersicht als separate Zeile dargestellten Zeitslots ScheduleWeekTimeslotLengthPlaceholder: Zeitslotlänge +ScheduleWeekTimeFromMustBeAValidTime n@Int: Erster Zeitslot der Wochenansicht muss zwischen 0 und #{n} liegen +ScheduleWeekTimeToMustBeAValidTime: Letzter Zeitslot der Wochenansicht muss zwischen 0 und 24 liegen +ScheduleWeekTimeToMustBeAfterTimeFrom: Letzter Zeitslot muss nach erstem Zeitslot der Wochenansicht liegen +ScheduleWeekTimeslotLengthMustBeGreaterZero: Zeitslotlänge muss größer als null sein +ScheduleWeekTimeFromToMustMatchTimeslotLength: Beginn des ersten und letzten Zeitslots der Wochenansicht muss mit der Zeitslotlänge übereinstimmen + ScheduleOffsetWeekBackwardWeek: 1 Woche zurück ScheduleOffsetWeekBackwardDay: 1 Tag zurück ScheduleOffsetWeekCurrent: Zu aktueller Woche springen diff --git a/messages/uniworx/en-eu.msg b/messages/uniworx/en-eu.msg index a8bccee61..3dbcc74c5 100644 --- a/messages/uniworx/en-eu.msg +++ b/messages/uniworx/en-eu.msg @@ -120,6 +120,12 @@ ScheduleWeekTimeslotLength: Length (in hours) of timeslots to display in the wee ScheduleWeekTimeslotLengthTip: The length (in hours) of each timeslot to display as a separate row in the weekly schedule ScheduleWeekTimeslotLengthPlaceholder: Timeslot length +ScheduleWeekTimeFromMustBeAValidTime n@Int: First timeslot to display in the weekly schedule must be between 0 and #{n} +ScheduleWeekTimeToMustBeAValidTime: Last timeslot to display in the weekly schedule must be between 0 and 24 +ScheduleWeekTimeToMustBeAfterTimeFrom: Last timeslot must be after first timeslot to display in the weekly schedule +ScheduleWeekTimeslotLengthMustBeGreaterZero: Timeslot length must be greater than zero +ScheduleWeekTimeFromToMustMatchTimeslotLength: Start of the first and last timeslots to display in the weekly schedule must match with the given timeslot length + ScheduleOffsetWeekBackwardWeek: 1 week back ScheduleOffsetWeekBackwardDay: 1 day back ScheduleOffsetWeekCurrent: Jump to current week diff --git a/src/Handler/Profile.hs b/src/Handler/Profile.hs index 46a98df0e..a5392f910 100644 --- a/src/Handler/Profile.hs +++ b/src/Handler/Profile.hs @@ -137,7 +137,7 @@ makeSettingForm template html = do <*> schoolsForm (stgSchools <$> template) <*> notificationForm (stgNotificationSettings <$> template) <*> allocationNotificationForm (stgAllocationNotificationSettings <$> template) - return (result, widget) -- no validation required here + return (result, widget) where scheduleViewList mr = [ Option (mr t) t (toPathPiece t) | t <- universeF ] themeList = [ Option (toMessage t) t (toPathPiece t) | t <- universeF ] @@ -338,6 +338,22 @@ validateSettings User{..} = do guardValidation MsgUserDisplayNameInvalid $ validDisplayName userTitle userFirstName userSurname userDisplayName' + userScheduleWeekTimeFrom' <- use _stgScheduleWeekTimeFrom + userScheduleWeekTimeTo' <- use _stgScheduleWeekTimeTo + userScheduleWeekTimeslotLength' <- use _stgScheduleWeekTimeslotLength + + let maxFrom = 25 - userScheduleWeekTimeslotLength' + guardValidation (MsgScheduleWeekTimeFromMustBeAValidTime maxFrom) + $ 0 < userScheduleWeekTimeFrom' && userScheduleWeekTimeFrom' < maxFrom + guardValidation MsgScheduleWeekTimeToMustBeAValidTime + $ 0 < userScheduleWeekTimeTo' && userScheduleWeekTimeTo' < 25 + guardValidation MsgScheduleWeekTimeToMustBeAfterTimeFrom + $ userScheduleWeekTimeTo' > userScheduleWeekTimeFrom' + guardValidation MsgScheduleWeekTimeslotLengthMustBeGreaterZero + $ userScheduleWeekTimeslotLength' > 0 + guardValidation MsgScheduleWeekTimeFromToMustMatchTimeslotLength + $ userScheduleWeekTimeTo' `elem` [userScheduleWeekTimeFrom', userScheduleWeekTimeFrom'+userScheduleWeekTimeslotLength' .. 24-userScheduleWeekTimeslotLength'] + data ButtonResetTokens = BtnResetTokens deriving (Enum, Eq, Ord, Bounded, Read, Show, Generic, Typeable)