Koha/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.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

109 lines
6.6 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

[% USE KohaDates %]
[% USE Koha %]
[% USE AuthorisedValues %]
[% USE Branches %]
[% USE raw %]
[% IF statuscode == "200" %]
[% INCLUDE 'mana/mana-comment-status.inc' %]
<div id="mana_results">
<table id="mana_results_datatable">
<thead>
<tr>
<th>ISSN</th>
<th class="anti-the">Title</th>
<th> Published by </th>
<th>Frequency</th>
<th>Numbering pattern</th>
<th title="Number of libraries using this pattern"># of users</th>
<th class="title-string" title="Last time a library used this pattern">Last import</th>
<th> Comments </th>
[% UNLESS search_only %]
<th class="NoSort">Actions</th>
[% END %]
</tr>
</thead>
<tbody>
[% FOREACH subscription IN subscriptions %]
[% UNLESS subscription.cannotdisplay %]
[% IF subscription.nbofcomment > highWarned %]
<tr id="row[% subscription.id | html %]" class="high-warned-row" title="This resource has been reported more than [% highWarned | html %] times, take care!">
[% ELSIF subscription.nbofcomment > warned %]
<tr id="row[% subscription.id | html %]" class="warned-row" title="This resource has been reported more than [% warned | html %] times, take care!">
[% ELSIF subscription.nbofcomment > lowWarned %]
<tr id="row[% subscription.id | html %]" class="highlighted-row" title="This resource has been reported more than [% lowWarned | html %] times, take care!">
[% ELSE %]
<tr id="row[% subscription.id | html %]">
[% END %]
<input type="hidden" hidden class="rowid" value="[% subscription.id | html %]" />
<td>[% IF ( subscription.issn ) %][% subscription.issn | html %][% END %]</td>
<td>[% subscription.title | html %]</td>
<td>[% IF ( subscription.publishercode ) %][% subscription.publishercode | html %][% END %]</td>
<td>[% IF ( subscription.sfdescription ) %][% subscription.sfdescription | html %][% END %]</td>
<td>[% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod | html %][% END %]</td>
<td>[% IF ( subscription.nbofusers ) %][% subscription.nbofusers | html %][% END %]</td>
<td><span title="[% subscription.lastimport | html %]">[% subscription.lastimport | $KohaDates %]</span></td>
<td>
[% FOREACH comment IN subscription.comments %]
[% comment.message | html %] ([% comment.nb | html %])<br />
[% END %]
</td>
[% UNLESS search_only %]
<td class="actions">
<button class="btn btn-default btn-xs mana-use" data-subscription_id="[% subscription.id | html %]" id="mana-use-[% subscription.id | html %]"><i class="fa fa-download"></i> Import</button>
<div class="dropup">
<button type="button" class="btn btn-default btn-xs dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
Report <span class="caret"></span>
</button>
<ul class="dropdown-menu pull-right mana-actions" id="mana-actions-[% subscription.id | html %]">
[% IF ( subscription.comments.size ) %]
[% FOREACH comment IN subscription.comments %]
<li><a data-commentid="[% comment.id | html %]" data-resourceid="[% subscription.id | html %]" href="#">[% comment.message | html %] ([% comment.nb | html %])</a></li>
[% END %]
<li role="separator" class="divider"></li>
[% END %]
<li><a data-commentid="other" data-resourceid="[% subscription.id | html %]" href="#">New comment</a></li>
</ul>
</div>
</td>
[% END %]
</tr>
[% END %]
[% END %]
</tbody>
</table>
</div>
<div id="new_mana_comment" style="display:none">
<h4 id="mana_submit_comment"> Please enter a new comment (max 35 caracters)</h4>
<form id="mana_comment_form" action="/cgi-bin/koha/serials/subscription-detail.pl" method="get">
<input type="hidden" id="mana-resource" value="subscription" />
<input type="hidden" id="mana-resource-id" value="[% mana_id | html %]" />
<input type="text" maxlength="35" size="35" id="mana-comment" required="required" />
<input type="hidden" id="selected_id" value="" />
<div class="action">
<button id="mana-send-comment">Submit</button>
<a href="#" class="cancel" id="mana-comment-close">Cancel</a>
</div>
</form>
</div>
[% ELSE %]
<h4>Mana search fails with the code: [% statuscode | html %] </h4>
[% END %]
<div id="comment_box" class="modal" tabindex="-1" role="dialog" aria-labelledby="mana_search_result_label" style="display: none;">
<div class="modal-dialog modal-lg" style="width: 30%">
<div class="modal-content" style="">
<div class="modal-header">
<button type="button" id="commentCloseButton" class="closebtn" aria-hidden="true">×</button>
<h3 id="mana_submit_comment"> Please enter a new comment (max 35 characters)</h3>
</div>
<div class="modal-body">
<form>
<input hidden id="selected_id" value="">
<input type="text" id="manamsg"> Comment:
</form>
<button id="CommentButton"> Comment </button>
</div>
</div>
</div>
</div>