1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-23 07:09:43 +02:00

[WIP] PDF viewer section & per section attachments

This commit is contained in:
Harvey Kandola 2019-04-17 17:13:18 +01:00
parent c0ed3c3d04
commit 166aeba09b
428 changed files with 45874 additions and 802 deletions

View file

@ -217,7 +217,6 @@ func (h *Handler) Get(w http.ResponseWriter, r *http.Request) {
response.WriteServerError(w, method, err)
return
}
if len(a) == 0 {
a = []attachment.Attachment{}
}
@ -299,6 +298,9 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
return
}
// File can be associated with a section as well.
sectionID := request.Query(r, "page")
if !permission.CanChangeDocument(ctx, *h.Store, documentID) {
response.WriteForbiddenError(w)
return
@ -336,6 +338,7 @@ func (h *Handler) Add(w http.ResponseWriter, r *http.Request) {
a.FileID = random[0:9]
a.Filename = filename.Filename
a.Data = b.Bytes()
a.SectionID = sectionID
ctx.Transaction, err = h.Runtime.Db.Beginx()
if err != nil {