From 59af472f0726b7ffdc89c66dab685fd3e686c9f7 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Mon, 8 Aug 2016 14:15:09 -0400 Subject: [PATCH] Report Templates! Signed-off-by: Mike Rylander --- Open-ILS/examples/fm_IDL.xml | 36 +- Open-ILS/src/perlmods/lib/OpenILS/WWW/IDL2js.pm | 5 + Open-ILS/src/templates/staff/css/reporter.css | 0 Open-ILS/src/templates/staff/reporter/index.tt2 | 21 + .../staff/reporter/share/report_strings.tt2 | 180 +++++++ .../templates/staff/reporter/t_edit_template.tt2 | 233 ++++++++ Open-ILS/src/templates/staff/reporter/t_legacy.tt2 | 1 + .../src/templates/staff/share/t_confirm_dialog.tt2 | 2 +- .../src/templates/staff/share/t_select_dialog.tt2 | 23 + Open-ILS/web/js/ui/default/staff/bower.json | 2 +- .../ui/default/staff/reporter/services/template.js | 440 +++++++++++++++ .../js/ui/default/staff/reporter/template/app.js | 600 +++++++++++++++++++++ Open-ILS/web/js/ui/default/staff/services/idl.js | 82 ++- Open-ILS/web/js/ui/default/staff/services/ui.js | 81 ++- Open-ILS/xsl/fm_IDL2js.xsl | 2 +- 15 files changed, 1680 insertions(+), 28 deletions(-) create mode 100644 Open-ILS/src/templates/staff/css/reporter.css create mode 100644 Open-ILS/src/templates/staff/reporter/index.tt2 create mode 100644 Open-ILS/src/templates/staff/reporter/share/report_strings.tt2 create mode 100644 Open-ILS/src/templates/staff/reporter/t_edit_template.tt2 create mode 100644 Open-ILS/src/templates/staff/reporter/t_legacy.tt2 create mode 100644 Open-ILS/src/templates/staff/share/t_select_dialog.tt2 create mode 100644 Open-ILS/web/js/ui/default/staff/reporter/services/template.js create mode 100644 Open-ILS/web/js/ui/default/staff/reporter/template/app.js diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 2420c0b0c5..b21f7b3dbc 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -9063,7 +9063,7 @@ SELECT usr, - + @@ -9079,6 +9079,14 @@ SELECT usr, + + + + + + + + @@ -10562,20 +10570,20 @@ SELECT usr, -- -- If we expect to use pcrud to query against specific bibs, we probably want to do this. However, if we're using this to populate a report, we -- -- may not. -- SELECT - -- bre.id AS "bib_id", - -- COALESCE( z.copy_count, 0 ) AS "copy_count", - -- COALESCE( z.hold_count, 0 ) AS "hold_count", - -- COALESCE( z.copy_hold_ratio, 0 ) AS "hold_copy_ratio" + -- bre.id AS bib_id, + -- COALESCE( z.copy_count, 0 ) AS copy_count, + -- COALESCE( z.hold_count, 0 ) AS hold_count, + -- COALESCE( z.copy_hold_ratio, 0 ) AS hold_copy_ratio -- FROM ( SELECT - y.bre AS "id", - COALESCE( x.copy_count, 0 ) AS "copy_count", - y.hold_count AS "hold_count", - (y.hold_count::REAL / (CASE WHEN x.copy_count = 0 OR x.copy_count IS NULL THEN 0.1 ELSE x.copy_count::REAL END)) AS "hold_copy_ratio" + y.bre AS id, + COALESCE( x.copy_count, 0 ) AS copy_count, + y.hold_count AS hold_count, + (y.hold_count::REAL / (CASE WHEN x.copy_count = 0 OR x.copy_count IS NULL THEN 0.1 ELSE x.copy_count::REAL END)) AS hold_copy_ratio FROM ( SELECT - (SELECT bib_record FROM reporter.hold_request_record r WHERE r.id = h.id LIMIT 1) AS "bre", - COUNT(*) AS "hold_count" + (SELECT bib_record FROM reporter.hold_request_record r WHERE r.id = h.id LIMIT 1) AS bre, + COUNT(*) AS hold_count FROM action.hold_request h WHERE cancel_time IS NULL @@ -10587,8 +10595,8 @@ SELECT usr, (SELECT id FROM biblio.record_entry WHERE id = (SELECT record FROM asset.call_number WHERE id = call_number and deleted is false) - ) AS "bre", - COUNT(*) AS "copy_count" + ) AS bre, + COUNT(*) AS copy_count FROM asset.copy JOIN asset.copy_location loc ON (copy.location = loc.id AND loc.holdable) WHERE copy.holdable @@ -11527,7 +11535,7 @@ SELECT usr, - SELECT ahcm.target_copy AS "id",count(*) AS "count" + SELECT ahcm.target_copy AS id,count(*) AS count FROM action.hold_request ahr, action.hold_copy_map ahcm diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/IDL2js.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/IDL2js.pm index 497b0dbc16..a7486e4f2a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/IDL2js.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/IDL2js.pm @@ -125,6 +125,11 @@ sub load_IDL { return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR; } + $xml =~ s///sg; # filter out XML comments ... + $xml =~ s/(?:^|\s+)--.*$//mg; # and SQL comments ... + $xml =~ s/^\s+/ /mg; # and extra leading spaces ... + $xml =~ s/\R*//g; # and newlines + my $output; try { my $idl_doc = XML::LibXML->load_xml(string => $xml); diff --git a/Open-ILS/src/templates/staff/css/reporter.css b/Open-ILS/src/templates/staff/css/reporter.css new file mode 100644 index 0000000000..e69de29bb2 diff --git a/Open-ILS/src/templates/staff/reporter/index.tt2 b/Open-ILS/src/templates/staff/reporter/index.tt2 new file mode 100644 index 0000000000..ee6e2fcb95 --- /dev/null +++ b/Open-ILS/src/templates/staff/reporter/index.tt2 @@ -0,0 +1,21 @@ +[% + WRAPPER "staff/base.tt2"; + ctx.page_title = l("Reporter"); + ctx.page_app = "egReporter"; +%] + +[% BLOCK APP_JS %] + + + + + + +[% INCLUDE 'staff/reporter/share/report_strings.tt2' %] + + +[% END %] + +
+ +[% END %] diff --git a/Open-ILS/src/templates/staff/reporter/share/report_strings.tt2 b/Open-ILS/src/templates/staff/reporter/share/report_strings.tt2 new file mode 100644 index 0000000000..a6d50cb16f --- /dev/null +++ b/Open-ILS/src/templates/staff/reporter/share/report_strings.tt2 @@ -0,0 +1,180 @@ + + diff --git a/Open-ILS/src/templates/staff/reporter/t_edit_template.tt2 b/Open-ILS/src/templates/staff/reporter/t_edit_template.tt2 new file mode 100644 index 0000000000..cd8b74af83 --- /dev/null +++ b/Open-ILS/src/templates/staff/reporter/t_edit_template.tt2 @@ -0,0 +1,233 @@ + + +
+
+ [% l('Template Name') %] +
+
+
+
+
+ [% l('Documentation URL') %] +
+
+
+
+
+ +
+
+ [% l('Template Description') %] +
+
+