From 5ebfa9151ecd811736546a88ba2369f865b1f9bc Mon Sep 17 00:00:00 2001 From: Alex Arnaud Date: Tue, 14 Nov 2017 13:29:33 +0000 Subject: [PATCH] Bug 17282 - Add information about the new Javascript libraries in the about page - fix a QA warning - Move chart settings on top and make them hidden by default - Add options to get all results --- koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc | 8 +++++++- .../prog/en/includes/reports-toolbar.inc | 4 ++++ koha-tmpl/intranet-tmpl/prog/en/modules/about.tt | 6 ++++++ .../prog/en/modules/reports/guided_reports_start.tt | 21 +++++++++++++++++---- reports/guided_reports.pl | 7 +++++++ 5 files changed, 41 insertions(+), 5 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc index ceec7a31c5..55a062f8b4 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/chart.inc @@ -1,4 +1,4 @@ -
+ + [% END %] [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt index 6ab111fda0..23f5aece62 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt @@ -914,6 +914,12 @@

Leaflet

The Leaflet JavaScript library by Vladimir Agafonkinis licensed under the BSD License.

+ +

D3.js

+

D3.js v3.5.17 is a JavaScript library for manipulating documents based on data. It is under the BSD 3-clause Licence

+ +

C3.js

+

C3.js v0.4.11 is a D3-based reusable chart library under the MIT licence

diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt index c2dbc70cad..9e0dbda464 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/reports/guided_reports_start.tt @@ -206,6 +206,12 @@ $("#delColumn").on("click",function(){ $("#toggle_sql_vis").toggle(); }); + $(".toggle_chart_settings").click(function(){ + $("#makechart").toggle(); + $("#toggle_chart_settings_hid").toggle(); + $("#toggle_chart_settings_vis").toggle(); + }); + $("#table_reports").delegate(".confirmdelete", 'click', function(){ $(this).parents('tr').attr("class","warn"); if(confirm(_("Are you sure you want to delete this saved report?"))){ @@ -963,7 +969,7 @@ canned reports and writing custom SQL reports.

$('#draw-chart').click(function() { var btn_text = $("#draw-chart").html(); - $("#draw-chart").html(_('Loading...')); + $("#draw-chart").html(_("Loading...")); var x_elements = $('select[name="x"]').val(); var y_elements = []; @@ -973,7 +979,14 @@ canned reports and writing custom SQL reports.

//var headers = [% header_row.json %]; headers = [% header_row.json %]; - var results = [% results.json %] + + var results; + if ($('input[name="chart-include-all"]').prop('checked')) { + results = [% allresults.json %] + } + else { + results = [% results.json %] + } if ($('input[name="chart-exclude-last"]').prop('checked')) { results.splice(-1, 1); @@ -1037,6 +1050,8 @@ canned reports and writing custom SQL reports.


+[% INCLUDE 'chart.inc' %] +
@@ -1069,8 +1084,6 @@ canned reports and writing custom SQL reports.

[% END %] -[% INCLUDE 'chart.inc' %] - [% END %] [% END %] diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl index bfd0a7646b..f59385ba5b 100755 --- a/reports/guided_reports.pl +++ b/reports/guided_reports.pl @@ -676,6 +676,7 @@ elsif ($phase eq 'Run this report'){ $notes = $report->{notes}; my @rows = (); + my @allrows = (); # if we have at least 1 parameter, and it's not filled, then don't execute but ask for parameters if ($sql =~ /<>/$quoted/; } my ( $sth, $errors ) = execute_query( $sql, $offset, $limit, undef, $report_id ); + my ($sth2, $errors2) = execute_query($sql); my $total = nb_rows($sql) || 0; unless ($sth) { die "execute_query failed to return sth for report $report_id: $sql"; @@ -811,6 +813,10 @@ elsif ($phase eq 'Run this report'){ my @cells = map { +{ cell => $_ } } @$row; push @rows, { cells => \@cells }; } + while (my $row = $sth2->fetchrow_arrayref()) { + my @cells = map { +{ cell => $_ } } @$row; + push @allrows, { cells => \@cells }; + } } my $totpages = int($total/$limit) + (($total % $limit) > 0 ? 1 : 0); @@ -820,6 +826,7 @@ elsif ($phase eq 'Run this report'){ } $template->param( 'results' => \@rows, + 'allresults' => \@allrows, 'sql' => $sql, original_sql => $original_sql, 'id' => $report_id, -- 2.11.0