admin: allow import of remote hint and partials remote parts

This commit is contained in:
nemunaire 2017-01-19 14:20:34 +01:00
parent b8b1f14806
commit d4177f6228
2 changed files with 42 additions and 15 deletions

View file

@ -124,6 +124,7 @@ type uploadedHint struct {
Title string
Content string
Cost int64
URI string
Path string
}
@ -135,8 +136,8 @@ func createExerciceHint(exercice fic.Exercice, body []byte) (interface{}, error)
if len(uh.Content) != 0 {
return exercice.AddHint(uh.Title, uh.Content, uh.Cost)
} else if len(uh.Path) != 0 {
return importFile(uploadedFile{Path: uh.Path},
} else if len(uh.Path) != 0 || len(uh.URI) != 0 {
return importFile(uploadedFile{Path: uh.Path, URI: uh.URI},
func(filePath string, origin string, digest []byte) (interface{}, error) {
return exercice.AddHint(uh.Title, "$FILES" + strings.TrimPrefix(filePath, fic.FilesDir), uh.Cost)
})