Bugzilla – Attachment 69174 Details for
Bug 17282
Ability to create charts for SQL reports
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[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
Bug-17282---Add-information-about-the-new-Javascri.patch (text/plain), 7.83 KB, created by
Alex Arnaud
on 2017-11-16 08:18:31 UTC
(
hide
)
Description:
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
Filename:
MIME Type:
Creator:
Alex Arnaud
Created:
2017-11-16 08:18:31 UTC
Size:
7.83 KB
patch
obsolete
>From 1437b05e7dce2e85542bfcb4b8c999febdad1a1d Mon Sep 17 00:00:00 2001 >From: Alex Arnaud <alex.arnaud@biblibre.com> >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 ceec7a3..55a062f 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 @@ >-<div id="makechart"> >+<div id="makechart" style="display:none;"> > [% supposed_x = header_row.shift.cell %] > > <fieldset> >@@ -28,6 +28,12 @@ > </select> > </li> > >+ <div> >+ <label for="include-all">Include all rows (ignore pagination)</label> >+ <input id="include-all" name="chart-include-all" type="checkbox"> >+ </div> >+ >+ > <label for="exclude-last">Exclude last line (Rollup)</label> > <input id="exclude-last" name="chart-exclude-last" type="checkbox"> > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc >index 05ad112..d3846f6 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc >@@ -62,6 +62,10 @@ > <a class="btn btn-default btn-sm toggle_sql" id="toggle_sql_hid" href="#"><i class="fa fa-eye"></i> Show SQL code</a> > <a class="btn btn-default btn-sm toggle_sql" id="toggle_sql_vis" href="#" style="display:none;"><i class="fa fa-eye-slash"></i> Hide SQL code</a> > </div> >+ <div class="btn-group"> >+ <a class="btn btn-default btn-sm toggle_chart_settings" id="toggle_chart_settings_hid" href="#"><i class="fa fa-eye"></i> Show chart settings</a> >+ <a class="btn btn-default btn-sm toggle_chart_settings" id="toggle_chart_settings_vis" href="#" style="display:none;"><i class="fa fa-eye-slash"></i> Hide chart settings</a> >+ </div> > [% 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 7ce8c89..f3063cc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/about.tt >@@ -912,6 +912,12 @@ > > <h2>Leaflet</h2> > <p>The <a href="http://leafletjs.com">Leaflet</a> JavaScript library by Vladimir Agafonkinis licensed under the <a href="https://github.com/Leaflet/Leaflet/blob/master/LICENSE">BSD License</a>.</p> >+ >+ <h2>D3.js</h2> >+ <p><a href="https://d3js.org/">D3.js v3.5.17</a> is a JavaScript library for manipulating documents based on data. It is under the <a href="https://github.com/d3/d3/blob/master/LICENSE">BSD 3-clause Licence</a></p> >+ >+ <h2>C3.js</h2> >+ <p><a href="http://c3js.org/">C3.js v0.4.11</a> is a D3-based reusable chart library under the <a href="https://opensource.org/licenses/mit-license.php">MIT licence</a></p> > </div> > > <div id="translations"> >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 c2dbc70..9e0dbda 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.</p> > $('#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.</p> > > //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.</p> > <div id="sql_output" style="display:none;"><span class="label">Report SQL:</span><pre>[% sql |html %]</pre></div> > </br> > >+[% INCLUDE 'chart.inc' %] >+ > <form action="/cgi-bin/koha/reports/guided_reports.pl" method="get" id="limitselect"> > <input type="hidden" name="phase" value="Run this report"/> > <input type="hidden" name="reports" value="[% report_id %]"/> >@@ -1069,8 +1084,6 @@ canned reports and writing custom SQL reports.</p> > [% END %] > </table> > >-[% INCLUDE 'chart.inc' %] >- > [% END %] > [% END %] > >diff --git a/reports/guided_reports.pl b/reports/guided_reports.pl >index bfd0a76..f59385b 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 =~ /<</ && !@sql_params) { > # split on ??. Each odd (2,4,6,...) entry should be a parameter to fill >@@ -801,6 +802,7 @@ elsif ($phase eq 'Run this report'){ > $sql =~ s/<<$split[$i*2+1]>>/$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.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 17282
:
55412
|
55442
|
55444
|
55480
|
55582
|
55586
|
55588
|
55604
|
55605
|
55606
|
55607
|
55868
|
55869
|
62529
|
63565
|
63566
|
63567
|
63568
|
63569
|
63570
|
63571
|
67225
|
67226
|
67227
|
67228
|
67229
|
67230
|
67231
|
69174
|
69429
|
69430
|
69493
|
79182
|
79230
|
79308
|
79309
|
79310
|
79311
|
79312
|
79313
|
79337
|
79338
|
79339