Factor out some common report code

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20772 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Geert Janssens 2011-06-19 21:31:30 +00:00
parent ed732e6a39
commit c0d5d30cb5
2 changed files with 41 additions and 66 deletions

View File

@ -803,74 +803,47 @@
p))
;; TODO: How 'bout factoring the "Edit report options" stuff out of
;; these 3 functions?
(define (gnc:html-make-options-link report-id)
(if report-id
(gnc:html-markup-p
(gnc:html-markup-anchor
(gnc-build-url URL-TYPE-OPTIONS
(string-append "report-id=" (sprintf #f "%a" report-id))
"")
(_ "Edit report options")))))
(define (gnc:html-make-generic-warning
report-title-string report-id
warning-title-string warning-string)
(let ((p (gnc:make-html-text)))
(gnc:html-text-append!
p
(gnc:html-markup-h2 (string-append (_ report-title-string) ":"))
(gnc:html-markup-h2 warning-title-string)
(gnc:html-markup-p warning-string)
(gnc:html-make-options-link report-id))
p))
(define (gnc:html-make-generic-options-warning
report-title-string report-id)
(let ((p (gnc:make-html-text)))
(gnc:html-text-append!
p
(gnc:html-markup-h2 (string-append
(_ report-title-string)
":"))
(gnc:html-markup-h2 "")
(gnc:html-markup-p
(_ "This report requires you to specify certain report options.")))
(if report-id
(gnc:html-text-append!
p
(gnc:html-markup-p
(gnc:html-markup-anchor
(gnc-build-url URL-TYPE-OPTIONS
(string-append "report-id="
(sprintf #f "%a" report-id))
"")
(_ "Edit report options")))))
p))
report-title-string report-id)
(gnc:html-make-generic-warning
report-title-string
report-id
""
(_ "This report requires you to specify certain report options.")))
(define (gnc:html-make-no-account-warning
report-title-string report-id)
(let ((p (gnc:make-html-text)))
(gnc:html-text-append!
p
(gnc:html-markup-h2 (string-append
(_ report-title-string)
":"))
(gnc:html-markup-h2 (_ "No accounts selected"))
(gnc:html-markup-p
(_ "This report requires accounts to be selected.")))
(if report-id
(gnc:html-text-append!
p
(gnc:html-markup-p
(gnc:html-markup-anchor
(gnc-build-url URL-TYPE-OPTIONS
(string-append "report-id="
(sprintf #f "%a" report-id))
"")
(_ "Edit report options")))))
p))
report-title-string report-id)
(gnc:html-make-generic-warning
report-title-string
report-id
(_ "No accounts selected")
(_ "This report requires accounts to be selected.")))
(define (gnc:html-make-empty-data-warning
report-title-string report-id)
(let ((p (gnc:make-html-text)))
(gnc:html-text-append!
p
(gnc:html-markup-h2
(string-append report-title-string ":"))
(gnc:html-markup-h2 (_ "No data"))
(gnc:html-markup-p
(_ "The selected accounts contain no data/transactions (or only zeroes) for the selected time period")))
(if report-id
(gnc:html-text-append!
p
(gnc:html-markup-p
(gnc:html-markup-anchor
(gnc-build-url URL-TYPE-OPTIONS
(string-append "report-id="
(sprintf #f "%a" report-id))
"")
(_ "Edit report options")))))
p))
(define (gnc:html-make-empty-data-warning
report-title-string report-id)
(gnc:html-make-generic-warning
report-title-string
report-id
(_ "No data")
(_ "The selected accounts contain no data/transactions (or only zeroes) for the selected time period")))

View File

@ -92,11 +92,13 @@
(export gnc:html-build-acct-table)
(export gnc:first-html-build-acct-table)
(export gnc:html-make-exchangerates)
(export gnc:html-make-generic-warning)
(export gnc:html-make-no-account-warning)
(export gnc:html-make-generic-budget-warning)
(export gnc:html-make-generic-options-warning)
(export gnc:html-make-generic-simple-warning)
(export gnc:html-make-empty-data-warning)
(export gnc:html-make-options-link)
;; report.scm
(export gnc:menuname-reports)