diff --git a/messages/de.msg b/messages/de.msg index c3bfe568f..fb15e4fea 100644 --- a/messages/de.msg +++ b/messages/de.msg @@ -23,3 +23,4 @@ UnauthorizedSchoolLecturer: Sie sind nicht als Veranstalter für dieses Institut UnauthorizedLecturer: Sie sind nicht als Veranstalter für diese Veranstaltung eingetragen. UnauthorizedCorrector: Sie sind nicht als Korrektor für diese Veranstaltung eingetragen. UnauthorizedParticipant: Sie sind nicht als Teilnehmer für diese Veranstaltung registriert. +OnlyUploadOneFile: Bitte nur eine Datei hochladen. \ No newline at end of file diff --git a/src/Handler/Utils/Form.hs b/src/Handler/Utils/Form.hs index bbd547277..d9877e918 100644 --- a/src/Handler/Utils/Form.hs +++ b/src/Handler/Utils/Form.hs @@ -245,6 +245,20 @@ schoolEntField = selectField schools where schools = optionsPersist [] [Asc SchoolName] schoolName +zipFileField :: Bool -- ^ Unpack zips? + -> Field Handler (Source Handler File) +zipFileField doUnpack = Field{..} + where + fieldEnctype = Multipart + fieldParse _ files + | [f] <- files = return . Right . Just $ bool (yieldM . acceptFile) sourceFiles doUnpack f + | null files = return $ Right Nothing + | otherwise = return . Left $ SomeMessage MsgOnlyUploadOneFile + fieldView fieldId fieldName attrs _ req = do + [whamlet| + + |] + multiFileField :: Handler (Set FileId) -> Field Handler (Source Handler (Either FileId File)) multiFileField permittedFiles' = Field{..} where