diff --git a/PageActionPrime.txt b/PageActionPrime.txt new file mode 100644 index 000000000..98c8477e3 --- /dev/null +++ b/PageActionPrime.txt @@ -0,0 +1,31 @@ +Es s + +Course Actions im alten UniWorX: +- Studenten +- Übungsgruppen +- Übungsblätter +- Klausuren +- E-Mails +- Online-Evaluation + +CourseActions in Uni2Work: +-1 Übungsblätter (öfter) +[ Auch aus SheetList übernommen un hier ebenfalls angzeigt: +-1 Aktuelles Blatt (häufig) +-1 Letztes unzugewiesenes (häufig, nur Assistenten) +-1 Abgaben (häufig, nur Assistenten) +-1 Korrekturen (häufig, nur Assistenten) +-1 Neues Blatt (häufig, nur Assistenten) +] +-2 Teilnehmerliste (gelegentlich, nur Assistenten) +-2 Kurs editieren (selten, nur Assistenten) +-2 Kurs klonen (selten, nur Assistenten) +-2 Kurs löschen (sehr selten, nur Assistenten/Admins) + +SheetList: +- Aktuelles Blatt +- Letztes unzugewiesenes +- Abgaben +- Korrekturen +- Neues Blatt + diff --git a/messages/uniworx/de.msg b/messages/uniworx/de.msg index 0f0344878..129f9cc0c 100644 --- a/messages/uniworx/de.msg +++ b/messages/uniworx/de.msg @@ -71,6 +71,7 @@ CourseEditTitle: Kurs editieren/anlegen CourseMembers: Teilnehmer CourseMembersCount num@Int64: #{display num} CourseMembersCountLimited num@Int64 max@Int64: #{display num}/#{display max} +CourseMembersCountOf num@Int64 mbNum@Int64Maybe: #{display num} Anmeldungen #{maybeDisplay " von " mbNum " möglichen"} CourseName: Name CourseDescription: Beschreibung CourseDescriptionTip: Beliebiges HTML-Markup ist gestattet diff --git a/src/Foundation.hs b/src/Foundation.hs index e4de524d2..5d85229e1 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -170,7 +170,13 @@ noneOneMoreDE num noneText singularForm pluralForm | num == 1 = singularForm | otherwise = pluralForm +-- Convenience Type for Messages +type Int64Maybe = Maybe Int64 -- Yesod messages cannot deal with compound type identifiers +-- | Convenience function for i18n messages definitions +maybeDisplay :: DisplayAble m => Text -> Maybe m -> Text -> Text +maybeDisplay _ Nothing _ = mempty +maybeDisplay before (Just x) after = before <> (display x) <> after -- Messages creates type UniWorXMessage and RenderMessage UniWorX instance mkMessage "UniWorX" "messages/uniworx" "de" diff --git a/src/Handler/Course.hs b/src/Handler/Course.hs index e635731b3..0985f7c28 100644 --- a/src/Handler/Course.hs +++ b/src/Handler/Course.hs @@ -289,7 +289,7 @@ getCShowR tid ssh csh = do (regWidget, regEnctype) <- generateFormPost $ identifyForm "registerBtn" $ registerForm (isJust mRegAt) $ courseRegisterSecret course registrationOpen <- (==Authorized) <$> isAuthorized (CourseR tid ssh csh CRegisterR) True siteLayout (toWgt $ courseName course) $ do - setTitle [shamlet| #{toPathPiece tid} - #{csh}|] + setTitleI $ prependCourseTitle tid ssh csh (""::Text) $(widgetFile "course") @@ -698,22 +698,25 @@ makeCourseUserTable whereClause colChoices psValidator = getCUsersR :: TermId -> SchoolId -> CourseShorthand -> Handler Html getCUsersR tid ssh csh = do - Entity cid course <- runDB $ getBy404 $ TermSchoolCourseShort tid ssh csh - let heading = [whamlet|_{MsgMenuCourseMembers} #{courseName course} #{display tid}|] - whereClause = courseIs cid - colChoices = mconcat - [ colUserParticipantLink tid ssh csh - , colUserEmail - , colUserMatriclenr - , sortable (Just "registration") (i18nCell MsgRegisteredHeader) (dateCell . view _userTableRegistration) - , colUserComment tid ssh csh - ] - psValidator = def - tableWidget <- runDB $ makeCourseUserTable whereClause colChoices psValidator - siteLayout heading $ do - setTitle [shamlet| #{toPathPiece tid} - #{csh}|] - -- TODO: creat hamlet wrapper - tableWidget + (course, numParticipants, participantTable) <- runDB $ do + let colChoices = mconcat + [ colUserParticipantLink tid ssh csh + , colUserEmail + , colUserMatriclenr + , sortable (Just "registration") (i18nCell MsgRegisteredHeader) (dateCell . view _userTableRegistration) + , colUserComment tid ssh csh + ] + psValidator = def + Entity cid course <- getBy404 $ TermSchoolCourseShort tid ssh csh + numParticipants <- count [CourseParticipantCourse ==. cid] + participantTable <- makeCourseUserTable (courseIs cid) colChoices psValidator + return (course, numParticipants, participantTable) + let headingLong = [whamlet|_{MsgMenuCourseMembers} #{courseName course} #{display tid}|] + headingShort = prependCourseTitle tid ssh csh MsgCourseMembers + siteLayout headingLong $ do + setTitleI headingShort + + $(widgetFile "course-participants") diff --git a/src/Handler/Utils.hs b/src/Handler/Utils.hs index 67beeabd1..02c25257b 100644 --- a/src/Handler/Utils.hs +++ b/src/Handler/Utils.hs @@ -57,6 +57,23 @@ nameHtml displayName surname [] -> error "Data.Text.splitOn returned empty list in violation of specification." +-- | Prefix a message with a short cours id, +-- eg. for window title bars, etc. +-- This function should help to make this consistent everywhere +prependCourseTitle :: (RenderMessage UniWorX msg) => + TermId -> SchoolId -> CourseShorthand -> msg -> UniWorXMessages +prependCourseTitle tid ssh csh msg = UniWorXMessages + [ SomeMessage $ toPathPiece tid + , SomeMessage dashText + , SomeMessage $ toPathPiece ssh + , SomeMessage dashText + , SomeMessage csh + , SomeMessage msg + ] + where + dashText :: Text + dashText = "-" + warnTermDays :: TermId -> [Maybe UTCTime] -> DB () warnTermDays tid times = do Term{..} <- get404 tid diff --git a/templates/course-participants.hamlet b/templates/course-participants.hamlet new file mode 100644 index 000000000..37f9960b9 --- /dev/null +++ b/templates/course-participants.hamlet @@ -0,0 +1,7 @@ +$# Shows all participants of a course, but no homework statistics +$# Should at some point allow email messaging +$# +$# participantTable : widget table + +^{participantTable} +_{MsgCourseMembersCountOf (fromIntegral numParticipants) (courseCapacity course)}. \ No newline at end of file