r20772 - gnucash/trunk/src/report/report-system - Factor out some common report code
Geert Janssens
gjanssens at code.gnucash.org
Sun Jun 19 17:31:30 EDT 2011
Author: gjanssens
Date: 2011-06-19 17:31:30 -0400 (Sun, 19 Jun 2011)
New Revision: 20772
Trac: http://svn.gnucash.org/trac/changeset/20772
Modified:
gnucash/trunk/src/report/report-system/html-utilities.scm
gnucash/trunk/src/report/report-system/report-system.scm
Log:
Factor out some common report code
Modified: gnucash/trunk/src/report/report-system/html-utilities.scm
===================================================================
--- gnucash/trunk/src/report/report-system/html-utilities.scm 2011-06-19 18:39:28 UTC (rev 20771)
+++ gnucash/trunk/src/report/report-system/html-utilities.scm 2011-06-19 21:31:30 UTC (rev 20772)
@@ -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-options-warning
- report-title-string report-id)
+(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 "")
- (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))
+ (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)
+ (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")))
Modified: gnucash/trunk/src/report/report-system/report-system.scm
===================================================================
--- gnucash/trunk/src/report/report-system/report-system.scm 2011-06-19 18:39:28 UTC (rev 20771)
+++ gnucash/trunk/src/report/report-system/report-system.scm 2011-06-19 21:31:30 UTC (rev 20772)
@@ -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)
More information about the gnucash-changes
mailing list