feat(exams): display school default in form

This commit is contained in:
Sarah Vaupel 2021-06-09 16:52:50 +02:00 committed by Gregor Kleen
parent 22dfd33aca
commit abd68ac032
3 changed files with 15 additions and 5 deletions

View File

@ -318,7 +318,8 @@ ExamAuthorshipStatementRequired: Eigenständigkeitserklärung für prüfungszuge
ExamAuthorshipStatementRequiredTip: Sollen für alle zu dieser Prüfung zugehörige Übungsblätter die Abgebenden (bei Abgabegruppen jedes Gruppenmitglied) aufgefordert werden, eine Eigenständigkeitserklärung zu akzeptieren?
ExamAuthorshipStatementRequiredDisabledOffTip: Für dieses Institut sind Eigenständigkeitserklärungen für prüfungsrelevante Blätter deaktiviert.
ExamAuthorshipStatementRequiredDisabledOnTip: Für dieses Institut sind Eigenständigkeitserklärungen für prüfungsrelevante Blätter vorgeschrieben.
ExamAuthorshipStatementSchoolDefinition: Institutsweit vorgegebene Eigenständigkeitserklärung
ExamAuthorshipStatementUseCustomDefinition: Benutzerdefinierte Eigenständigkeitserklärung verwenden?
ExamAuthorshipStatementUseCustomDefinitionTip: Soll anstatt der institutsweit vorgegebenen Eigenständigkeitserklärung eine benuzterdefinierte Erklärung für diese Prüfung genutzt werden? (Hinweis: Um konsistente Erklärungen für alle Abgaben der Prüfung zu gewährleisten, dient die institutsweite Erklärung hier nur als Vorlage und wird ab dann getrennt (als Kopie) gespeichert. Ändert sich die institutsweite Erklärung, so muss die Änderung für diese Prüfung manuell übernommen werden, falls erwünscht.)
ExamAuthorshipStatementUseCustomDefinitionDisabledTip: Für dieses Institut ist die institutsweite Vorgabe als Erklärung zu verwenden. Benutzerdefinierte Erklärungen sind nicht gestattet.
ExamAuthorshipStatementCustom: Eigenständigkeitserklärung
ExamAuthorshipStatementCustom: Benutzerdefinierte Eigenständigkeitserklärung

View File

@ -316,7 +316,8 @@ ExamAuthorshipStatementRequired: Require Statement of Authorship for exam-relate
ExamAuthorshipStatementRequiredTip: Should submittors (in case of submission groups each group member) be required to accept a Statement of Authorship for all exercise sheets related to this exam?
ExamAuthorshipStatementRequiredDisabledOffTip: This school permits Statements of Authorship for exam-related sheets.
ExamAuthorshipStatementRequiredDisabledOnTip: This school requires Statements of Authorship for exam-related sheets.
ExamAuthorshipStatementSchoolDefinition: School-wide default Statement of Authorship
ExamAuthorshipStatementUseCustomDefinition: Use custom Statement of Authorship?
ExamAuthorshipStatementUseCustomDefinitionTip: Should a custom Statement of Authorship be used for this exam instead of the school-wide statement? (Hint: To ensure consistent statements for all submissions related to this exam, the school-wide statement will be used as a template here and will then be stored separately (as a copy). If the school-wide statement changes, this change must be applied manually for this exam if desired.)
ExamAuthorshipStatementUseCustomDefinitionTip: Should a custom Statement of Authorship be used for this exam instead of the school-wide default statement? (Hint: To ensure consistent statements for all submissions related to this exam, the school-wide default statement will be used as a template here and will then be stored separately (as a copy). If the school-wide default statement changes, this change must be applied manually for this exam if desired.)
ExamAuthorshipStatementUseCustomDefinitionDisabledTip: This school dictates that the school-wide Statement of Authorship must be used. Custom statements are prohibited.
ExamAuthorshipStatementCustom: Statement of Authorship
ExamAuthorshipStatementCustom: Custom Statement of Authorship

View File

@ -111,7 +111,10 @@ examForm :: ( MonadHandler m
=> Entity Course -> Maybe ExamForm -> (Html -> MForm m (FormResult ExamForm, Widget))
examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
MsgRenderer mr <- getMsgRenderer
School{..} <- liftHandler . runDBRead $ getJust courseSchool
(School{..}, mSchoolAuthorshipStatement) <- liftHandler . runDBRead $ do
school@School{..} <- getJust courseSchool
mSchoolAuthorshipStatement <- maybe (pure Nothing) getEntity schoolSheetExamAuthorshipStatementDefinition
return (school, mSchoolAuthorshipStatement)
flip (renderAForm FormStandard) csrf $ ExamForm
<$> areq ciField (fslpI MsgTableExamName (mr MsgTableExamName) & setTooltip MsgExamNameTip) (efName <$> template)
@ -146,7 +149,12 @@ examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
-- TODO: refactor messages to be used across scopes, then define this form section separately (to be used for exams and sheets)
<* aformSection MsgExamAuthorshipStatementSection
<* optionalActionA
( optionalActionA
( aopt htmlField
( fslI MsgExamAuthorshipStatementSchoolDefinition
& addAttr "disabled" "disabled"
)
((Just . authorshipStatementDefinitionContent . entityVal) <$> mSchoolAuthorshipStatement)
<* optionalActionA
( apreq htmlField
(fslI MsgExamAuthorshipStatementCustom)
(