fradrive/templates/course.hamlet

296 lines
11 KiB
Plaintext

$newline never
$# SPDX-FileCopyrightText: 2022 Felix Hamann <felix.hamann@campus.lmu.de>,Gregor Kleen <gregor.kleen@ifi.lmu.de>,Sarah Vaupel <sarah.vaupel@ifi.lmu.de>,Sarah Vaupel <vaupel.sarah@campus.lmu.de>,Steffen Jost <jost@tcs.ifi.lmu.de>,Winnie Ros <winnie.ros@campus.lmu.de>
$#
$# SPDX-License-Identifier: AGPL-3.0-or-later
<dl .deflist>
$if not (null news) || mayCreateNews
<dt .deflist__dt>
_{MsgCourseNews}
$if not visibleNews
\ #{iconInvisible}
<dd .deflist__dd>
$if not (null news)
<ul .course-news .list--iconless>
$forall (cID, CourseNews{courseNewsTitle, courseNewsSummary, courseNewsContent}, isVisible, files, lastEditText, mayEditNews, mayDelete, archiveUrl) <- news
<li .course-news-item ##{"news-" <> toPathPiece cID}>
$case (courseNewsTitle, courseNewsSummary)
$# $of (Just title, Just summary)
$# <div .div-h3 .course-news-item__title>
$# ^{modal (toWidget title) (Left (SomeRoute (CNewsR tid ssh csh cID CNShowR)))}
$# $if not isVisible
$# \ #{iconInvisible}
$# <p .course-news-item__summary>
$# #{summary}
$of (_, Just summary)
$if not isVisible
<h3 .course-news-item__title>
#{iconInvisible}
<div .div-p .course-news-item__summary>
^{modal (toWidget summary) (Left (SomeRoute (CNewsR tid ssh csh cID CNShowR)))}
$of (Just title, Nothing)
<h3 .course-news-item__title>
#{title}
$if not isVisible
\ #{iconInvisible}
<p .course-news-item__content>
#{courseNewsContent}
$of (Nothing, Nothing)
$if not isVisible
<h3 .course-news-item__title>
#{iconInvisible}
<p .course-news-item__content>
#{courseNewsContent}
$if showNewsFiles files
<ul .course-news-item__files-links .list--inline .list--comma-separated>
$forall ((_, fp), fileUrl) <- filter (not . view (_1 . _1)) files
<li .course-news-item__file-link>
<a href=#{fileUrl}>
#{fp}
$elseif not (null files)
<p .course-news-item__files-link>
<a href=#{archiveUrl}>
#{iconFileZip}
\ _{MsgCourseNewsFiles}
<p .course-news-item__last-edit>
_{MsgCourseNewsLastEdited lastEditText}
$if mayEditNews || mayDelete
<ul .course-news-item__actions .list--inline .list--comma-separated>
$if mayEditNews
<li>
^{modal (i18n MsgCourseNewsActionEdit) (Left (SomeRoute (CNewsR tid ssh csh cID CNEditR)))}
$if mayDelete
<li>
^{modal (i18n MsgCourseNewsActionDelete) (Left (SomeRoute (CNewsR tid ssh csh cID CNDeleteR)))}
$if mayCreateNews
<div .div-p>
^{modal (i18n MsgCourseNewsActionCreate) (Left (SomeRoute (CourseR tid ssh csh CNewsNewR)))}
$maybe descr <- courseDescription course
<dt .deflist__dt>_{MsgCourseDescription}
<dd .deflist__dd>
<div>
#{descr}
<dt .deflist__dt>_{MsgTableCourseSchool}
<dd .deflist__dd>
#{schoolName}
$if length courseQualifications > 0
<dt .deflist__dt>_{MsgCourseQualifications (length courseQualifications)}
<dd .deflist__dd>
<ul .list--inline .list--comma-separated>
$forall Entity{entityVal=Qualification{qualificationName=qName,qualificationShorthand=qShort}} <- courseQualifications
<li>
<a href=@{QualificationR ssh qShort}>
#{qName}
$with numlecs <- length lecturers
$if numlecs /= 0
$if numlecs > 1
<dt .deflist__dt>_{MsgLecturersFor}
$else
<dt .deflist__dt>_{MsgLecturerFor}
<dd .deflist__dd>
<ul .list--inline .list--comma-separated>
$forall lect <- lecturers
<li>^{nameEmailWidget' lect}
$with numassi <- length assistants
$if numassi /= 0
$if numassi > 1
<dt .deflist__dt>_{MsgAssistantsFor}
$else
<dt .deflist__dt>_{MsgAssistantFor}
<dd .deflist__dd>
<ul .list--inline .list--comma-separated>
$forall assi <- assistants
<li>^{nameEmailWidget' assi}
$with numadmins <- length administrators
$if numadmins /= 0
<dt .deflist__dt>_{MsgCourseAdminFor}
<dd .deflist__dd>
<ul .list--inline .list--comma-separated>
$forall admin <- administrators
<li>^{nameEmailWidget' admin}
$with numtutor <- length tutors
$if numtutor /= 0
<dt .deflist__dt>_{MsgTutorsFor numtutor}
<dd .deflist__dd>
<ul .list--inline .list--comma-separated>
$forall tutor <- tutors
<li>^{nameEmailWidget' tutor}
$with numcorrector <- length correctors
$if numcorrector /= 0
<dt .deflist__dt>_{MsgCorrectorsFor numcorrector}
<dd .deflist__dd>
<ul .list--inline .list--comma-separated>
$forall corrector <- correctors
<li>^{nameEmailWidget' corrector}
$maybe link <- courseLinkExternal course
<dt .deflist__dt>_{MsgCourseHomepageExternal}
<dd .deflist__dd>
<a href=#{uriToString id link mempty} target="_blank" rel="noopener" title="_{MsgCourseHomepageExternal}">
#{iconLink}
\ #{uriToString id link mempty}
$# $if NTop (Just 0) < NTop (courseCapacity course)
<dt .deflist__dt>_{MsgCourseParticipantsHeading}
<dd .deflist__dd>
$maybe capacity <- courseCapacity course
_{MsgCourseParticipantsCountOf participants capacity}
$nothing
_{MsgCourseParticipantsCount participants}
$if mayEdit
<dt .deflist__dt>
$if isJust courseVisibleFrom && isNothing courseVisibleTo
_{MsgCourseVisibleFrom}
$else
_{MsgCourseVisibility}
\ #{iconInvisible}
<dd .deflist__dd>
<p>
$maybe visFrom <- courseVisibleFrom
^{formatTimeRangeW SelFormatDateTime visFrom courseVisibleTo}
<br />
$if NTop (Just now) < NTop courseVisibleFrom
_{MsgCourseInvisible}
$maybe regFrom <- courseRegisterFrom course
<dt .deflist__dt>_{MsgCourseRegistrationInterval}
<dd .deflist__dd>
<p>
^{formatTimeRangeW SelFormatDateTime regFrom (courseRegisterTo course)}
$maybe dereg <- mDereg
<p .emph>
_{MsgCourseDeregisterUntil dereg}
$maybe mGroup <- submissionGroup
<dt .deflist__dt>
_{MsgTableSubmissionGroup}
<dd .deflist__dd>
$maybe groupName <- mGroup
#{groupName}
$nothing
<i>
_{MsgTableNoSubmissionGroup}
$if registrationOpen || isJust registration
<dt .deflist__dt>
_{MsgCourseRegistration}
<dd .deflist__dd>
<div .course__registration-status>
$maybe CourseParticipant{courseParticipantRegistration} <- registration
_{MsgRegisteredSince}
\ ^{formatTimeW SelFormatDateTime courseParticipantRegistration}
$nothing
_{MsgNotRegistered}
<div .course__registration>
$if registrationOpen
$# regForm is defined through templates/widgets/registerForm
^{regForm}
<dt .deflist__dt>
_{MsgCourseMaterial}
<dd .deflist__dd>
$if mayViewSheets
<p>
$if mayViewAnySheet
_{MsgCourseSheetsFoundHere}: #
<a href=@{CourseR tid ssh csh SheetListR}>
_{MsgSheetListCourse}
$else
_{MsgCourseSheetsNoneVisible}
$if mayViewMaterials
<p>
$if mayViewAnyMaterial
_{MsgCourseMaterialsFoundHere}: #
<a href=@{CourseR tid ssh csh MaterialListR}>
_{MsgMaterialList}
$else
_{MsgCourseMaterialsNoneVisible}
<p .explanation>
$if courseMaterialFree course
_{MsgCourseMaterialFree}
$else
_{MsgCourseMaterialNotFree}
$if hasExams
<dt .deflist__dt>_{MsgCourseExams}
<dd .deflist__dd>
^{examTable}
$if not (null events) || mayCreateEvents
<dt .deflist__dt>
_{MsgCourseEvents}
$if null events
\ #{iconInvisible}
<dd .deflist__dd>
<div uw-hide-columns="events">
<div .scrolltable .scrolltable--bordered>
<table .table .table--striped .table--hover>
<thead>
<tr .table__row .table__row--head>
<th .table__th uw-hide-column-header="type">
_{MsgCourseEventType}
<th .table__th uw-hide-column-header="time">
_{MsgCourseEventTime}
<th .table__th uw-hide-column-header="room">
_{MsgCourseEventRoom}
<th .table__th uw-hide-column-header="note" :hiddenEventNotes:.course-event-note--hidden>
_{MsgCourseEventNote}
$if mayCreateEvents
<th .table__th uw-hide-column-header="actions">
_{MsgCourseEventActions}
\ #{iconInvisible}
<tbody>
$forall (cID, CourseEvent{courseEventType, courseEventTime, courseEventRoom, courseEventNote}, showRoom) <- events
<tr .table__row ##{"event-" <> toPathPiece cID}>
<td .table__td>
<div .table__td-content>
#{courseEventType}
<td .table__td>
<div .table__td-content>
^{occurrencesWidget courseEventTime}
<td .table__td>
$if showRoom
<div .table__td-content>
$maybe room <- courseEventRoom
^{roomReferenceWidget room}
$nothing
_{MsgCourseEventRoomIsUnset}
$else
<div .table__td-content .explanation>
_{MsgCourseEventRoomIsHidden}
<td .table__td :hiddenEventNotes:.course-event-note--hidden>
<div .table__td-content>
#{courseEventNote}
$if mayCreateEvents
<td .table__td>
<ul .list--inline .list--iconless .list--comma-separated>
<li>
^{modal (i18n MsgCourseEventsActionEdit) (Left (SomeRoute (CEventR tid ssh csh cID CEvEditR)))}
<li>
^{modal (i18n MsgCourseEventsActionDelete) (Left (SomeRoute (CEventR tid ssh csh cID CEvDeleteR)))}
$if mayCreateEvents
<tfoot>
<tr .table__row .table__row--foot>
<td>
<td>
<td>
<td :hiddenEventNotes:.course-event-note--hidden>
<td .table__td>
<div .table__td-content>
^{modal (i18n MsgCourseEventsActionCreate) (Left (SomeRoute (CourseR tid ssh csh CEventsNewR)))}
$if hasTutorials
<dt .deflist__dt>_{MsgCourseTutorials}
<dd .deflist__dd>
^{tutorialTable}