Koha/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc
Owen Leonard 679fdaebb1 Bug 22250: Clean up Mana KB integration with serials and reports
This patch makes many changes to templates and JavaScript related to the
integration of Mana with serials reports:

 - Many incorrect uses of the raw filter with html
 - Corrections to Bootstrap modal markup
 - Untranslatable strings moved out of JavaScript
 - Removed markup and JavaScript related to reports comments, a feature
   which doesn't exist in this version.

  New include file: mana/mana-comment-status.inc

  This file contains hidden-by-default messages which are shown during
  the process of submitting a comment on a subscription.

  New include file: mana/mana-share-report.inc

  This file contains the "Share report" modal markup formerly in
  guided_reports_start.tt

  New JavaScript file: mana.js

  Previously mana.inc, an include file containing only JavaScript which
  didn't include any template processing.

  Changed: mana/mana-report-search-result.inc

  This include file is now a full template so that jQuery's load()
  function can be used to pull its contents into the reports search
  modal.

  Changed: svc/mana/search

  This script was returning json-encoded HTML. Now it returns regular
  HTML.

To test you must have Mana configured and enabled. Apply the patch and
go to Reports -> Saved reports.

 - Choose New report -> New SQL from Mana. A "Mana search" modal should
   appear.
   - Perform a search which will return results, e.g. "circulation."
   - A "Loading" indicator should appear while the results are being
     retrieved. It should disappear when results appear.
   - Results should appear in the DataTable with sorting, paging, and
     search options.
   - In the "Notes" column, notes longer than 200 characters should be
     truncated with a "Show more" link. Clicking it should expand the
     comment and reveal a "Show less" link in its place.
   - Click the "Import" button (previously "Use"). The button icon
     should change to a loading indicator.
   - When the import is complete you should be redirected to a view of
     your new report.

Go to Serials and click the "Search on Mana" link in the sidebar.

 - Perform a search for a serial
 - Results should appear in a DataTable with sorting, paging, and search
   options.
 - Sorting by title should ignore articles "a," "an," and "the."

Create a new subscription or edit an existing subscription which will
match a record in Mana.

 - On the second step of adding/editing the subscription a message
   should appear at the top of the form, "Searching for subscription in
   Mana Knowledge Base," with a loading icon.
 - When searching has completed a "Show Mana results" link should
   appear.
 - Clicking the link should trigger a modal showing search results which
   match your subscription, displayed in a DataTable with sorting,
   paging, and search options.
 - The last column of the table should contain "Import" and "Report"
   buttons.
   - Clicking the "Report" button should trigger a menu. Any existing
     comments will be listed as well as a "New comment" item.
     - Clicking an existing comment should cause the menu to close and a
       "Submitting comment" message to appear. It should be shortly
       replaced with a "Your comment has been submitted" message.
     - Clicking "New comment" should reveal a comment form.
       - It should not be possible to submit an empty comment.
       - Clicking the "cancel" link should redisplay the search results.
       - Submitting a new comment should trigger a "Submitting comment"
         message followed by a "Your comment has been submitted"
         message.
   - In the table of search results, click the "Import" button
     (previously "Use"). The button icon should change to a loading
     indicator.
     - The modal should close and the data from Mana should be loaded
       into the subscription entry form.

View the detail page of a subscription which has saved with Mana data.

  - There should be a "Report mistake" button in the toolbar. Clicking
    it should reveal a menu of comments like the one you saw previously.
     - Clicking an existing comment should cause the menu to close and a
       "Submitting comment" message to appear. It should be shortly
       replaced with a "Your comment has been submitted" message.
     - Clicking "New comment" should reveal a comment form modal.
       - It should not be possible to submit an empty comment.
       - Clicking the "cancel" link should hide the modal.
       - Submitting a new comment should trigger a "Submitting comment"
         message followed by a "Your comment has been submitted"
         message.

Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2019-04-11 11:34:14 +00:00

154 lines
8.9 KiB
HTML

[% INCLUDE 'blocking_errors.inc' %]
<div id="toolbar" class="btn-toolbar">
[% IF ( CAN_user_reports_create_reports ) %]
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New report <span class="caret"></span></button>
<ul class="dropdown-menu">
<li id="newmenuc"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Build%20new">New guided report</a> </li>
<li id="newsql"><a href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create%20report%20from%20SQL">New SQL report</a> </li>
[% IF Koha.Preference('Mana')==1 %]
<li id="new_mana_sql"><a href="#" data-toggle="modal" data-target="#mana_search_result">New SQL from Mana</a> </li>
[% END %]
</ul>
</div>
[% END %]
[% IF ( showsql || execute || editsql || save_successful ) %]
[% IF ( CAN_user_reports_create_reports ) %]
[% UNLESS ( editsql ) # Do not show edit button on edit page %]
<div class="btn-group">
<a id="editreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | html %]&amp;phase=Edit%20SQL">
<i class="fa fa-pencil"></i> Edit
</a>
</div>
[% END %]
<div class="btn-group">
<a class="btn btn-default" title="Duplicate this saved report" href="/cgi-bin/koha/reports/guided_reports.pl?phase=Create report from SQL&amp;sql=[% original_sql || sql |uri %]&amp;reportname=[% reportname |uri %]&amp;notes=[% notes |uri %]">
<i class="fa fa-copy"></i> Duplicate
</a>
</div>
[% END %]
[% IF ( CAN_user_reports_delete_reports ) %]
<div class="btn-group">
<a class="delete btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | html %]&phase=Delete%20Saved">
<i class="fa fa-trash"></i> Delete
</a>
</div>
[% END %]
[% UNLESS ( errors ) # Unless there are errors saving a report %]
<div class="btn-group">
<a id="runreport" class="btn btn-default" href="/cgi-bin/koha/reports/guided_reports.pl?reports=[% id | html %]&amp;phase=Run%20this%20report">
<i class="fa fa-play"></i> Run report
</a>
</div>
<div class="btn-group">
<a class="btn btn-default" href="/cgi-bin/koha/tools/scheduler.pl?id=[% id | html %]">
<i class="fa fa-clock-o"></i> Schedule
</a>
</div>
[% END %]
[% IF ( mana_id && Koha.Preference('Mana') == 1 ) %]
<div class="btn-group">
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"> Report mistake <span class="caret"></span></button>
<ul class="dropdown-menu">
[% FOREACH c IN mana_comments %]
<li class="mana-comment" data-id="[% c.id | $raw %]">
<a href="#">[% c.message | html %] ([% c.nb | html %])</a>
</li>
[% END %]
<li role="separator" class="divider"></li>
<li class="mana-other-comment"><a href="#">Other</a> </li>
</ul>
</div>
<div id="mana-comment-box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h3 id="mana_submit_comment">Enter a new commment (max 35 caracters)</h3>
</div>
<div class="modal-body">
<input hidden id="mana-resource" value="report">
<input hidden id="mana-resource-id" value="[% mana_id | $raw %]">
<div>
<input type="text" maxlength="35" size="35" id="mana-comment">
</div>
<button id="mana-send-comment"> Comment </button>
</div>
</div>
</div>
</div>
[% END %]
[% IF ( execute ) %]
[% BLOCK params %]
[%- FOREACH param IN sql_params %]&amp;sql_params=[% param | uri %][% END %]
[%- FOREACH param_name IN param_names %]&amp;param_name=[% param_name | uri %][% END %]
[%- END %]
<div class="btn-group">
<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" id="format"><i class="fa fa-upload"></i> Download <span class="caret"></span></button>
<ul class="dropdown-menu">
<li><a id="csv" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&amp;format=csv&amp;report_id=[% id | html %]&amp;reportname=[% name |uri %][% PROCESS params %]">[% PROCESS 'delimiter_text.inc' %]</a></li>
<li><a id="tab" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&amp;format=tab&amp;report_id=[% id | html %]&amp;reportname=[% name |uri %][% PROCESS params %]">Tab separated text</a></li>
<li><a id="ods" href="/cgi-bin/koha/reports/guided_reports.pl?reports=1&phase=Export&amp;format=ods&amp;report_id=[% id | html %]&amp;reportname=[% name |uri %][% PROCESS params %]">Open Document Spreadsheet</a></li>
[% IF (results.json) %]
<li><a id="download-chart" href="#">Chart (.svg)</a></li>
[% END %]
</ul>
</div>
<div class="btn-group">
<a class="btn btn-default toggle_sql" id="toggle_sql_hid" href="#"><i class="fa fa-eye"></i> Show SQL code</a>
<a class="btn btn-default 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 toggle_chart_settings" id="toggle_chart_settings_hid" href="#"><i class="fa fa-eye"></i> Show chart settings</a>
<a class="btn btn-default 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 %]
</div>
[% IF Koha.Preference('Mana')==1 %]
<div id="mana_search_result" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label">
<div class="modal-dialog modal-lg">
<form id="mana_search_form">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="closebtn" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h3 id="mana_search_result_label">Mana search</h3>
</div>
<div class="modal-body">
<div id="mana_search_failed" class="dialog alert mana_search_status" style="display:none">
Your search could not be completed. Please try again later.
<div id="mana_search_errortext"></div>
</div>
<div id="mana_use_failed" class="dialog alert mana_search_status" style="display:none">
This report could not be imported. Please try again later.
<div id="mana_use_errortext"></div>
</div>
<fieldset>
<p>
Search reports by keyword:
<input type="text" id="mana_search_field" />
<input type="submit" class="mana_search_button" value="Search" />
<span id="mana-loading" style="display:none"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </span>
</p>
</fieldset>
<div id="mana_result_content">
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
</div>
</div>
</form>
</div>
</div>
[% END %]