Пример #1
0
func (t *thumb) Get(ctxt *websrv.Context) {
	png, err := db.Thumb(t.Doc, t.Page, t.DPI)
	if err != nil {
		panic(err)
	}
	ctxt.Write(png)
}
Пример #2
0
func sendJson(ctxt *websrv.Context, obj interface{}) {
	data, err := json.Marshal(obj)
	if err != nil {
		panic(err)
	}
	ctxt.Header().Set("Content-Type", "application/json")
	ctxt.Write(data)
}
Пример #3
0
func (req *editRequest) Post(ctxt *websrv.Context) {
	doc := req.Doc

	fmt.Println(ctxt.Request.Form)

	doc.Time = req.Time.Parsed
	if doc.Time.IsZero() {
		doc.Time = doc.Created
	}

	doc.Due = req.Due.Parsed
	doc.Tags = req.Tags
	doc.Desc = req.Desc
	doc.Text = req.Text
	doc.Location = req.Location

	if err := db.Write(doc); err != nil {
		panic(err)
	}

	ctxt.Redirect("/scan/doc/" + strconv.FormatInt(req.Doc.ID, 10))
}
Пример #4
0
func (s *showPDF) Get(ctxt *websrv.Context) {
	ctxt.ServeFile(filepath.Join(*dir, s.Doc.File))
}