diff --git a/messages/uniworx/de-de-formal.msg b/messages/uniworx/de-de-formal.msg index f0b4133c7..5a3b9d136 100644 --- a/messages/uniworx/de-de-formal.msg +++ b/messages/uniworx/de-de-formal.msg @@ -2513,7 +2513,12 @@ CourseNewsActionDelete: Löschen CourseNewsActionCreate: Neue Nachricht CourseMaterial: Material CourseMaterialFree: Das Kursmaterial ist ohne Anmeldung frei zugänglich -CourseMaterialNotFree: Eine Anmeldung zum Kurs ist Voraussetzung zum Zugang zu Kursmaterial +CourseMaterialNotFree: Das Kursmaterial ist nur für Mitglieder des Kurses einsehbar, also z.B. für Teilnehmer, Tutoren, Korrektoren und Verwalter. + +CourseSheetsFoundHere: Die Übungsblatter zum Kurs finden Sie hier +CourseSheetsNoneVisible: Aktuell gibt es zu diesem Kurs keine Übungsblätter, oder nur Übungsblätter auf die Sie keinen Zugriff haben (z.B. aufgrund von Fristen bzgl. der Sichtbarkeit). +CourseMaterialsFoundHere: Material zum Kurs finden Sie hier +CourseMaterialsNoneVisible: Aktuell gibt es zu diesem Kurs kein Material, oder nur Material auf das Sie keinen Zugriff haben (z.B. aufgrund von Fristen bzgl. der Sichtbarkeit). CourseNewsVisibleFromEditWarning: Das Datum der Veröffentlichung liegt in der Vergangenheit und sollte nicht mehr verändert werden, da dies die Teilnehmer verwirren könnte. CourseNewsVisibleFromTip: Ohne Datum nie sichtbar für Teilnehmer; leer lassen ist nur sinnvoll für noch unfertige Nachrichten diff --git a/messages/uniworx/en-eu.msg b/messages/uniworx/en-eu.msg index 1a621874c..22c76a2df 100644 --- a/messages/uniworx/en-eu.msg +++ b/messages/uniworx/en-eu.msg @@ -2512,8 +2512,13 @@ CourseNewsActionEdit: Edit CourseNewsActionDelete: Delete CourseNewsActionCreate: Create new item CourseMaterial: Material -CourseMaterialFree: Course material is publicly accessable -CourseMaterialNotFree: Only course participants may access course material +CourseMaterialFree: Course material is publicly accessible +CourseMaterialNotFree: Course material is only accessible to members of the course, e.g. for participants, tutors, correctors or administratiors. + +CourseSheetsFoundHere: Exercise sheets for this course are available here +CourseSheetsNoneVisible: Currently there are no exercise sheets for this course or only exercise sheets to which you don't have access (e.g. because of visibility settings) +CourseMaterialsFoundHere: Material for this course is available here +CourseMaterialsNoneVisible: Currently there is no material for this course or only material to which you don't have access (e.g. because of visibility settings) CourseNewsVisibleFromEditWarning: This item of course news has already been published and should no longer be changed sind this might confuse participants. CourseNewsVisibleFromTip: If left empty this item is never visible. Leave empty for unfinished items diff --git a/src/Handler/Course/Show.hs b/src/Handler/Course/Show.hs index f34d5048f..67fe5e06a 100644 --- a/src/Handler/Course/Show.hs +++ b/src/Handler/Course/Show.hs @@ -28,7 +28,7 @@ getCShowR :: TermId -> SchoolId -> CourseShorthand -> Handler Html getCShowR tid ssh csh = do mbAid <- maybeAuthId now <- liftIO getCurrentTime - (cid,course,courseVisible,schoolName,participants,registration,lecturers,assistants,correctors,tutors,mAllocation,hasApplicationTemplate,mApplication,news,events,submissionGroup,hasAllocationRegistrationOpen,mayReRegister) <- runDB . maybeT notFound $ do + (cid,course,courseVisible,schoolName,participants,registration,lecturers,assistants,correctors,tutors,mAllocation,hasApplicationTemplate,mApplication,news,events,submissionGroup,hasAllocationRegistrationOpen,mayReRegister,(mayViewSheets, mayViewAnySheet), (mayViewMaterials, mayViewAnyMaterial)) <- runDB . maybeT notFound $ do [(E.Entity cid course, E.Value courseVisible, E.Value schoolName, E.Value participants, fmap entityVal -> registration, E.Value hasAllocationRegistrationOpen)] <- lift . E.select . E.from $ \((school `E.InnerJoin` course) `E.LeftOuterJoin` participant) -> do @@ -90,6 +90,7 @@ getCShowR tid ssh csh = do lastEditText <- formatTime SelFormatDateTime $ maybe id max (guardOn visible =<< courseNewsVisibleFrom) courseNewsLastEdit mayEditNews <- hasWriteAccessTo $ CNewsR tid ssh csh cID CNEditR mayDelete <- hasWriteAccessTo $ CNewsR tid ssh csh cID CNDeleteR + return (cID, n, visible, files, lastEditText, mayEditNews, mayDelete) events' <- fmap (sortOn $ courseEventTime . entityVal) . lift $ selectList [ CourseEventCourse ==. cid ] [] @@ -108,7 +109,19 @@ getCShowR tid ssh csh = do mayReRegister <- lift . courseMayReRegister $ Entity cid course - return (cid,course,courseVisible,schoolName,participants,registration,lecturers,assistants,correctors,tutors,mAllocation,hasApplicationTemplate,mApplication,news,events,submissionGroup,hasAllocationRegistrationOpen,mayReRegister) + mayViewSheets <- hasReadAccessTo $ CourseR tid ssh csh SheetListR + sheets <- lift . E.select . E.from $ \sheet -> do + E.where_ $ sheet E.^. SheetCourse E.==. E.val cid + return $ sheet E.^. SheetName + mayViewAnySheet <- anyM sheets $ \(E.Value shn) -> hasReadAccessTo $ CSheetR tid ssh csh shn SShowR + + mayViewMaterials <- hasReadAccessTo $ CourseR tid ssh csh MaterialListR + materials <- lift . E.select . E.from $ \material -> do + E.where_ $ material E.^. MaterialCourse E.==. E.val cid + return $ material E.^. MaterialName + mayViewAnyMaterial <- anyM materials $ \(E.Value mnm) -> hasReadAccessTo $ CMaterialR tid ssh csh mnm MShowR + + return (cid,course,courseVisible,schoolName,participants,registration,lecturers,assistants,correctors,tutors,mAllocation,hasApplicationTemplate,mApplication,news,events,submissionGroup,hasAllocationRegistrationOpen,mayReRegister, (mayViewSheets, mayViewAnySheet), (mayViewMaterials, mayViewAnyMaterial)) let mDereg' = maybe id min (allocationOverrideDeregister =<< mAllocation) <$> courseDeregisterUntil course mDereg <- traverse (formatTime SelFormatDateTime) mDereg' diff --git a/templates/course.hamlet b/templates/course.hamlet index 4492a29e2..c01b249d4 100644 --- a/templates/course.hamlet +++ b/templates/course.hamlet @@ -232,10 +232,27 @@ $# $if NTop (Just 0) < NTop (courseCapacity course)
+ $if mayViewAnySheet
+ _{MsgCourseSheetsFoundHere}: #
+
+ _{MsgMenuSheetList}
+ $else
+ _{MsgCourseSheetsNoneVisible}
+ $if mayViewMaterials
+
+ $if mayViewAnyMaterial
+ _{MsgCourseMaterialsFoundHere}: #
+
+ _{MsgMenuMaterialList}
+ $else
+ _{MsgCourseMaterialsNoneVisible}
+
+ $if courseMaterialFree course
+ _{MsgCourseMaterialFree}
+ $else
+ _{MsgCourseMaterialNotFree}
$if hasExams