From c0d5d30cb515f08099057185b6d237d07aeeed92 Mon Sep 17 00:00:00 2001 From: Geert Janssens Date: Sun, 19 Jun 2011 21:31:30 +0000 Subject: [PATCH] Factor out some common report code git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20772 57a11ea4-9604-0410-9ed3-97b8803252fd --- src/report/report-system/html-utilities.scm | 105 ++++++++------------ src/report/report-system/report-system.scm | 2 + 2 files changed, 41 insertions(+), 66 deletions(-) diff --git a/src/report/report-system/html-utilities.scm b/src/report/report-system/html-utilities.scm index b8a9f0242a..5d8333d16b 100644 --- a/src/report/report-system/html-utilities.scm +++ b/src/report/report-system/html-utilities.scm @@ -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"))) diff --git a/src/report/report-system/report-system.scm b/src/report/report-system/report-system.scm index ca11ae2b50..f8863ee4b0 100644 --- a/src/report/report-system/report-system.scm +++ b/src/report/report-system/report-system.scm @@ -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)