feat(exams): first do-nothing stub for exam-wide authorship statements
This commit is contained in:
parent
8bb61401a7
commit
0392297ddb
@ -323,3 +323,6 @@ ExamAuthorshipStatementUseCustomDefinition: Benutzerdefinierte Eigenständigkeit
|
|||||||
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.)
|
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.
|
ExamAuthorshipStatementUseCustomDefinitionDisabledTip: Für dieses Institut ist die institutsweite Vorgabe als Erklärung zu verwenden. Benutzerdefinierte Erklärungen sind nicht gestattet.
|
||||||
ExamAuthorshipStatementCustom: Benutzerdefinierte Eigenständigkeitserklärung
|
ExamAuthorshipStatementCustom: Benutzerdefinierte Eigenständigkeitserklärung
|
||||||
|
|
||||||
|
ExamAuthorshipStatementContent: Eigenständigkeitserklärung
|
||||||
|
ExamAuthorshipStatementAllowOtherFalseTip: Für dieses Institut muss die institutsweit vorgegebene Eigenständigkeitserklärung verwendet werden. Benutzerdefinierte Erklärungen sind nicht gestattet.
|
||||||
@ -321,3 +321,6 @@ ExamAuthorshipStatementUseCustomDefinition: Use custom Statement of Authorship?
|
|||||||
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.)
|
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.
|
ExamAuthorshipStatementUseCustomDefinitionDisabledTip: This school dictates that the school-wide Statement of Authorship must be used. Custom statements are prohibited.
|
||||||
ExamAuthorshipStatementCustom: Custom Statement of Authorship
|
ExamAuthorshipStatementCustom: Custom Statement of Authorship
|
||||||
|
|
||||||
|
ExamAuthorshipStatementContent: Statement of Authorship
|
||||||
|
ExamAuthorshipStatementAllowOtherFalseTip: The settings of this school dictate that the school-wide Statement of Authorship must be used. Custom statements are prohibited.
|
||||||
@ -52,6 +52,7 @@ data ExamForm = ExamForm
|
|||||||
, efStaff :: Maybe Text
|
, efStaff :: Maybe Text
|
||||||
, efCorrectors :: Set (Either UserEmail UserId)
|
, efCorrectors :: Set (Either UserEmail UserId)
|
||||||
, efExamParts :: Set ExamPartForm
|
, efExamParts :: Set ExamPartForm
|
||||||
|
, efAuthorshipStatement :: Maybe StoredMarkup
|
||||||
}
|
}
|
||||||
|
|
||||||
data ExamOccurrenceForm = ExamOccurrenceForm
|
data ExamOccurrenceForm = ExamOccurrenceForm
|
||||||
@ -148,29 +149,16 @@ examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
|
|||||||
<*> examPartsForm (efExamParts <$> template)
|
<*> examPartsForm (efExamParts <$> template)
|
||||||
-- TODO: refactor messages to be used across scopes, then define this form section separately (to be used for exams and sheets)
|
-- TODO: refactor messages to be used across scopes, then define this form section separately (to be used for exams and sheets)
|
||||||
<* aformSection MsgExamAuthorshipStatementSection
|
<* aformSection MsgExamAuthorshipStatementSection
|
||||||
<* optionalActionA
|
<*> optionalActionA
|
||||||
( aopt htmlField
|
( areq htmlField
|
||||||
(fslI MsgExamAuthorshipStatementSchoolDefinition & addAttr "disabled" "disabled")
|
|
||||||
((Just . authorshipStatementDefinitionContent . entityVal) <$> mSchoolAuthorshipStatement)
|
|
||||||
<* optionalActionA
|
|
||||||
( apreq htmlField
|
|
||||||
(fslI MsgExamAuthorshipStatementCustom)
|
|
||||||
(
|
|
||||||
-- TODO: load custom statement from template
|
|
||||||
-- (loading school definition as default is not necessary if it is displayed in form)
|
|
||||||
Nothing
|
|
||||||
)
|
|
||||||
)
|
|
||||||
( if schoolSheetExamAuthorshipStatementAllowOther
|
( if schoolSheetExamAuthorshipStatementAllowOther
|
||||||
then fslI MsgExamAuthorshipStatementUseCustomDefinition
|
then fslI MsgExamAuthorshipStatementContent
|
||||||
& setTooltip MsgExamAuthorshipStatementUseCustomDefinitionTip
|
else fslI MsgExamAuthorshipStatementContent
|
||||||
else fslI MsgExamAuthorshipStatementUseCustomDefinition
|
|
||||||
& addAttr "disabled" "disabled"
|
& addAttr "disabled" "disabled"
|
||||||
& setTooltip MsgExamAuthorshipStatementUseCustomDefinitionDisabledTip
|
& setTooltip MsgExamAuthorshipStatementAllowOtherFalseTip
|
||||||
)
|
)
|
||||||
( bool (Just False)
|
( Nothing -- TODO: take value from template
|
||||||
(Just True) -- TODO: set according to template, if template is empty `Just True`
|
<|> (authorshipStatementDefinitionContent . entityVal <$> mSchoolAuthorshipStatement)
|
||||||
schoolSheetExamAuthorshipStatementAllowOther
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
( case schoolSheetExamAuthorshipStatementMode of
|
( case schoolSheetExamAuthorshipStatementMode of
|
||||||
@ -183,6 +171,44 @@ examForm (Entity _ Course{..}) template csrf = hoist liftHandler $ do
|
|||||||
SchoolAuthorshipStatementModeOptional -> Nothing -- TODO: set value according to template
|
SchoolAuthorshipStatementModeOptional -> Nothing -- TODO: set value according to template
|
||||||
SchoolAuthorshipStatementModeRequired -> Just True
|
SchoolAuthorshipStatementModeRequired -> Just True
|
||||||
)
|
)
|
||||||
|
-- <*> optionalActionA
|
||||||
|
-- ( ( optionalActionA
|
||||||
|
-- ( areq htmlField
|
||||||
|
-- (fslI MsgExamAuthorshipStatementCustom)
|
||||||
|
-- (
|
||||||
|
-- -- TODO: load custom statement from template
|
||||||
|
-- -- (loading school definition as default is not necessary if it is displayed in form)
|
||||||
|
-- mempty
|
||||||
|
-- )
|
||||||
|
-- )
|
||||||
|
-- ( if schoolSheetExamAuthorshipStatementAllowOther
|
||||||
|
-- then fslI MsgExamAuthorshipStatementUseCustomDefinition
|
||||||
|
-- & setTooltip MsgExamAuthorshipStatementUseCustomDefinitionTip
|
||||||
|
-- else fslI MsgExamAuthorshipStatementUseCustomDefinition
|
||||||
|
-- & addAttr "disabled" "disabled"
|
||||||
|
-- & setTooltip MsgExamAuthorshipStatementUseCustomDefinitionDisabledTip
|
||||||
|
-- )
|
||||||
|
-- ( bool (Just False)
|
||||||
|
-- (Just True) -- TODO: set according to template, if template is empty `Just True`
|
||||||
|
-- schoolSheetExamAuthorshipStatementAllowOther
|
||||||
|
-- )
|
||||||
|
-- )
|
||||||
|
-- <*> ( aopt htmlField
|
||||||
|
-- (fslI MsgExamAuthorshipStatementSchoolDefinition & addAttr "disabled" "disabled")
|
||||||
|
-- ((Just . authorshipStatementDefinitionContent . entityVal) <$> mSchoolAuthorshipStatement)
|
||||||
|
-- )
|
||||||
|
-- )
|
||||||
|
-- ( case schoolSheetExamAuthorshipStatementMode of
|
||||||
|
-- SchoolAuthorshipStatementModeNone -> fslI MsgExamAuthorshipStatementRequired & addAttr "disabled" "disabled" & setTooltip MsgExamAuthorshipStatementRequiredDisabledOffTip
|
||||||
|
-- SchoolAuthorshipStatementModeOptional -> fslI MsgExamAuthorshipStatementRequired & setTooltip MsgExamAuthorshipStatementRequiredTip
|
||||||
|
-- SchoolAuthorshipStatementModeRequired -> fslI MsgExamAuthorshipStatementRequired & addAttr "disabled" "disabled" & setTooltip MsgExamAuthorshipStatementRequiredDisabledOnTip
|
||||||
|
-- )
|
||||||
|
-- ( case schoolSheetExamAuthorshipStatementMode of
|
||||||
|
-- SchoolAuthorshipStatementModeNone -> Just False
|
||||||
|
-- SchoolAuthorshipStatementModeOptional -> Nothing -- TODO: set value according to template
|
||||||
|
-- SchoolAuthorshipStatementModeRequired -> Just True
|
||||||
|
-- )
|
||||||
|
-- )
|
||||||
|
|
||||||
officeSchoolsForm :: Maybe (Set SchoolId) -> AForm Handler (Set SchoolId)
|
officeSchoolsForm :: Maybe (Set SchoolId) -> AForm Handler (Set SchoolId)
|
||||||
officeSchoolsForm mPrev = wFormToAForm $ do
|
officeSchoolsForm mPrev = wFormToAForm $ do
|
||||||
@ -403,6 +429,7 @@ examFormTemplate (Entity eId Exam{..}) = do
|
|||||||
, efExamMode = examExamMode
|
, efExamMode = examExamMode
|
||||||
, efOfficeSchools = Set.fromList $ examOfficeSchoolSchool . entityVal <$> extraSchools
|
, efOfficeSchools = Set.fromList $ examOfficeSchoolSchool . entityVal <$> extraSchools
|
||||||
, efStaff = examStaff
|
, efStaff = examStaff
|
||||||
|
, efAuthorshipStatement = Nothing -- TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
examTemplate :: MonadHandler m
|
examTemplate :: MonadHandler m
|
||||||
@ -455,6 +482,7 @@ examTemplate cid = runMaybeT $ do
|
|||||||
, efExamMode = examExamMode oldExam
|
, efExamMode = examExamMode oldExam
|
||||||
, efStaff = examStaff oldExam
|
, efStaff = examStaff oldExam
|
||||||
, efOfficeSchools = Set.fromList $ examOfficeSchoolSchool . entityVal <$> extraSchools
|
, efOfficeSchools = Set.fromList $ examOfficeSchoolSchool . entityVal <$> extraSchools
|
||||||
|
, efAuthorshipStatement = Nothing -- TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -565,5 +593,10 @@ validateExam cId oldExam = do
|
|||||||
|
|
||||||
warnValidation MsgExamModeSchoolDiscouraged . not $ evalExamModeDNF schoolExamDiscouragedModes efExamMode
|
warnValidation MsgExamModeSchoolDiscouraged . not $ evalExamModeDNF schoolExamDiscouragedModes efExamMode
|
||||||
|
|
||||||
|
-- TODO: form validation of examAuthorshipStatement wrt school settings
|
||||||
|
-- - if mode is none, the statement must be `Nothing`
|
||||||
|
-- - if mode is required, the statement must be `Just x`
|
||||||
|
-- - if the school has a definition and disallows other, the statement must match the school definition
|
||||||
|
|
||||||
unless (has (_Just . _entityVal . _examStaff . _Nothing) oldExam) $
|
unless (has (_Just . _entityVal . _examStaff . _Nothing) oldExam) $
|
||||||
guardValidation MsgExamStaffRequired $ isn't _Nothing efStaff
|
guardValidation MsgExamStaffRequired $ isn't _Nothing efStaff
|
||||||
|
|||||||
Reference in New Issue
Block a user