feat: add timeslot related settings to user and profile form

This commit is contained in:
Sarah Vaupel 2020-10-28 19:41:22 +01:00
parent dc4bbbd97b
commit 6aaa5cc477
8 changed files with 46 additions and 0 deletions

View File

@ -214,6 +214,9 @@ user-defaults:
warning-days: 1209600
show-sex: false
schedule-view: view-week
schedule-week-time-from: 8
schedule-week-time-to: 18
schedule-week-timeslot-length: 2
# During central allocations lecturer-given ratings of applications (as
# ExamGrades) are combined with a central priority.

View File

@ -109,6 +109,16 @@ ScheduleViewWeek: Woche
ProfileScheduleView: Standard-Ansicht
ProfileScheduleViewTip: Betrifft die Terminübersicht auf „Aktuelles“ und „Terminübersicht“. (Weitere Ansichten sind in Arbeit.)
ScheduleWeekTimeFrom: Beginn (Stunde) des ersten in der Wochenansicht dargestellten Zeitslots
ScheduleWeekTimeFromTip: Stunde, zu welcher der erste in der Wochenansicht dargestellte Zeitslot beginnt. Gibt es einen darzustellenden Termin, der in einem Zeitslot vor dem hier angegebenen Zeitslot liegt, so wird der jeweilige Zeitslot als zusätzliche Zeile vor dem hier angegeben Zeitslot angezeigt.
ScheduleWeekTimeFromPlaceholder: Erster Zeitslot
ScheduleWeekTimeTo: Beginn (Stunde) des letzten in der Wochenansicht dargestellten Zeitslots
ScheduleWeekTimeToTip: Stunde, zu welcher der letzte in der Wochenansicht dargestellte Zeitslot beginnt. Gibt es einen darzustellenden Termin, der in einem Zeitslot nach dem hier angegebenen Zeitslot liegt, so wird der jeweilige Zeitslot als zusätzliche Zeile nach dem hier angegebenen Zeitslot angezeigt.
ScheduleWeekTimeToPlaceholder: Letzter Zeitslot
ScheduleWeekTimeslotLength: Länge (in Stunden) der in der Wochenansicht dargestellten Zeitslots
ScheduleWeekTimeslotLengthTip: Die Länge (in Stunden) jedes in der Wochenansicht der Terminübersicht als separate Zeile dargestellten Zeitslots
ScheduleWeekTimeslotLengthPlaceholder: Zeitslotlänge
ScheduleOffsetWeekBackwardWeek: 1 Woche zurück
ScheduleOffsetWeekBackwardDay: 1 Tag zurück
ScheduleOffsetWeekCurrent: Zu aktueller Woche springen

View File

@ -110,6 +110,16 @@ ScheduleViewWeek: Week
ProfileScheduleView: Standard view
ProfileScheduleViewTip: Relevant for the schedule on "News" and "Schedule". (More views are in the works.)
ScheduleWeekTimeFrom: Start (hour) of the first timeslot to display in the weekly schedule
ScheduleWeekTimeFromTip: The hour at which the first timeslot to display in the weekly schedule begins. If there is an occurrence to display which lies in a timeslot before the one given here, the respective timeslot will be displayed above this one as a separate row.
ScheduleWeekTimeFromPlaceholder: First timeslot
ScheduleWeekTimeTo: Start (hour) of the last timeslot to display in the weekly schedule
ScheduleWeekTimeToTip: The hour at which the last timeslot to display in the weekly schedule begins. If there is an occurrence to display which lies in a timeslot after the one given here, the respective timeslot will be displayed below this one as a separate row.
ScheduleWeekTimeToPlaceholder: Last timeslot
ScheduleWeekTimeslotLength: Length (in hours) of timeslots to display in the weekly schedule
ScheduleWeekTimeslotLengthTip: The length (in hours) of each timeslot to display as a separate row in the weekly schedule
ScheduleWeekTimeslotLengthPlaceholder: Timeslot length
ScheduleOffsetWeekBackwardWeek: 1 week back
ScheduleOffsetWeekBackwardDay: 1 day back
ScheduleOffsetWeekCurrent: Jump to current week

View File

@ -37,6 +37,9 @@ User json -- Each Uni2work user has a corresponding row in this table; create
sex Sex Maybe
showSex Bool default=false
scheduleView ScheduleView default='ScheduleViewWeek'
scheduleWeekTimeFrom Int default=8 -- starting hour of the first time slot to display in weekly schedule by default (i.e. regardless of the existence of occurrences in this slot); TODO: increase precision to minutes
scheduleWeekTimeTo Int default=18 -- starting hour of the last time slot to display in weekly schedule by default (i.e. regardless of the existence of occurrences in this slot); TODO: increase precision to minutes; TODO: save last hour/minute to display instead of first (of last time slot)
scheduleWeekTimeslotLength Int default=2 -- length of one timeslot in hours; TODO: increase precision to minutes
UniqueAuthentication ident -- Column 'ident' can be used as a row-key in this table
UniqueEmail email -- Column 'email' can be used as a row-key in this table
deriving Show Eq Ord Generic -- Haskell-specific settings for runtime-value representing a row in memory

View File

@ -258,6 +258,9 @@ upsertCampusUser upsertMode ldapData = do
, userWarningDays = userDefaultWarningDays
, userShowSex = userDefaultShowSex
, userScheduleView = userDefaultScheduleView
, userScheduleWeekTimeFrom = userDefaultScheduleWeekTimeFrom
, userScheduleWeekTimeTo = userDefaultScheduleWeekTimeTo
, userScheduleWeekTimeslotLength = userDefaultScheduleWeekTimeslotLength
, userNotificationSettings = def
, userLanguages = Nothing
, userCsvOptions = def

View File

@ -38,6 +38,9 @@ data SettingsForm = SettingsForm
{ stgDisplayName :: UserDisplayName
, stgDisplayEmail :: UserEmail
, stgScheduleView :: ScheduleView
, stgScheduleWeekTimeFrom :: Int
, stgScheduleWeekTimeTo :: Int
, stgScheduleWeekTimeslotLength :: Int
, stgMaxFavourites :: Int
, stgMaxFavouriteTerms :: Int
, stgTheme :: Theme
@ -105,6 +108,12 @@ makeSettingForm template html = do
<* aformSection MsgSchedule
<*> areq (selectField . return $ mkOptionList (scheduleViewList mr))
(fslI MsgProfileScheduleView & setTooltip MsgProfileScheduleViewTip) { fsId = Just "schedule-view-select" } (stgScheduleView <$> template)
<*> areq (natFieldI MsgScheduleWeekTimeFrom)
(fslpI MsgScheduleWeekTimeFrom (mr MsgScheduleWeekTimeFromPlaceholder) & setTooltip MsgScheduleWeekTimeFromTip) (stgScheduleWeekTimeFrom <$> template)
<*> areq (natFieldI MsgScheduleWeekTimeTo )
(fslpI MsgScheduleWeekTimeTo (mr MsgScheduleWeekTimeToPlaceholder ) & setTooltip MsgScheduleWeekTimeToTip ) (stgScheduleWeekTimeTo <$> template)
<*> areq (natFieldI MsgScheduleWeekTimeslotLength)
(fslpI MsgScheduleWeekTimeslotLength (mr MsgScheduleWeekTimeslotLengthPlaceholder) & setTooltip MsgScheduleWeekTimeslotLengthTip) (stgScheduleWeekTimeslotLength <$> template)
<* aformSection MsgFormCosmetics
<*> areq (natFieldI MsgFavouritesNotNatural)
(fslpI MsgFavourites (mr MsgFavouritesPlaceholder) & setTooltip MsgFavouritesTip) (stgMaxFavourites <$> template)
@ -364,6 +373,9 @@ postProfileR = do
{ stgDisplayName = userDisplayName
, stgDisplayEmail = userDisplayEmail
, stgScheduleView = userScheduleView
, stgScheduleWeekTimeFrom = userScheduleWeekTimeFrom
, stgScheduleWeekTimeTo = userScheduleWeekTimeTo
, stgScheduleWeekTimeslotLength = userScheduleWeekTimeslotLength
, stgMaxFavourites = userMaxFavourites
, stgMaxFavouriteTerms = userMaxFavouriteTerms
, stgTheme = userTheme

View File

@ -77,6 +77,9 @@ postAdminUserAddR = do
, userWarningDays = userDefaultWarningDays
, userShowSex = userDefaultShowSex
, userScheduleView = userDefaultScheduleView
, userScheduleWeekTimeFrom = userDefaultScheduleWeekTimeFrom
, userScheduleWeekTimeTo = userDefaultScheduleWeekTimeTo
, userScheduleWeekTimeslotLength = userDefaultScheduleWeekTimeslotLength
, userNotificationSettings = def
, userLanguages = Nothing
, userCsvOptions = def

View File

@ -214,6 +214,8 @@ data UserDefaultConf = UserDefaultConf
, userDefaultWarningDays :: NominalDiffTime
, userDefaultShowSex :: Bool
, userDefaultScheduleView :: ScheduleView
, userDefaultScheduleWeekTimeFrom, userDefaultScheduleWeekTimeTo :: Int
, userDefaultScheduleWeekTimeslotLength :: Int
} deriving (Show)
data PWHashConf = PWHashConf