Example #1
0
func (h *MailHandler) Handle(request shared.IPathRequest) (shared.IResponse, error) {
	reportName := ""
	var id uint64
	recipientRaw := ""
	notes := ""

	err := request.ScanPath(&reportName, &id, &recipientRaw, &notes)
	if err != nil {
		return nil, err
	}
	if notes == "-" {
		notes = ""
	}

	report, err := h.Reporter.GetReportHTMLWriter(reportName, id, request.Session())
	if err != nil {
		return nil, err
	}

	err = h.Mailer.SendMailFromResponse(report, recipientRaw, notes)

	if err != nil {
		return nil, err
	}

	return shared.QuickStringResponse("Email sent to " + recipientRaw), nil
}
Example #2
0
func (r *Reporter) HandleReportRequest(request shared.IPathRequest) (shared.IResponse, error) {

	var name string
	var pk uint64
	//var fname string
	err := request.ScanPath(&name, &pk) //, &fname)
	if err != nil {
		return nil, err
	}
	return r.GetReportHTMLWriter(name, pk, request.Session())
}
Example #3
0
func (h *PDFHandler) Handle(request shared.IPathRequest) (shared.IResponse, error) {
	reportName := ""
	var id uint64
	var fname string
	err := request.ScanPath(&reportName, &id, &fname)
	if err != nil {
		return nil, err
	}

	report, err := h.Reporter.GetReportHTMLWriter(reportName, id, request.Session())
	if err != nil {
		return nil, err
	}

	pdfResponse := h.PDFer.ResponseAsPDF(report)
	return pdfResponse, nil
}