From 928d8246fa62dcfcb9118eef56490079ce6cc4f6 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 31 Jan 2019 14:29:45 +0000 Subject: [PATCH] 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. --- koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc | 44 ---- .../prog/en/includes/mana/mana-comment-status.inc | 10 + .../en/includes/mana/mana-report-search-result.inc | 190 ++++++++++------ .../prog/en/includes/mana/mana-share-report.inc | 95 ++++++++ .../mana/mana-subscription-search-result.inc | 156 +++++++------ .../prog/en/includes/reports-toolbar.inc | 133 +++-------- .../prog/en/includes/serials-toolbar.inc | 102 +++++---- .../en/modules/mana/mana-report-search-result.tt | 2 +- .../mana/mana-subscription-search-result.tt | 2 +- .../en/modules/reports/guided_reports_start.tt | 217 ++++++++---------- .../prog/en/modules/serials/serials-search.tt | 1 - .../prog/en/modules/serials/subscription-add.tt | 42 +++- .../prog/en/modules/serials/subscription-detail.tt | 12 +- koha-tmpl/intranet-tmpl/prog/js/mana.js | 83 +++++++ .../intranet-tmpl/prog/js/subscription-add.js | 249 ++++++++++++--------- svc/mana/search | 5 +- 16 files changed, 748 insertions(+), 595 deletions(-) delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-comment-status.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-share-report.inc create mode 100644 koha-tmpl/intranet-tmpl/prog/js/mana.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc deleted file mode 100644 index 2dd7e86..0000000 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana.inc +++ /dev/null @@ -1,44 +0,0 @@ - diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-comment-status.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-comment-status.inc new file mode 100644 index 0000000..edd7300 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-comment-status.inc @@ -0,0 +1,10 @@ + + + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc index 6257472..36cbd1f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-report-search-result.inc @@ -1,82 +1,128 @@ +[% USE Asset %] [% USE KohaDates %] [% USE Koha %] [% USE AuthorisedValues %] [% USE Branches %] [% USE raw %] - -[% INCLUDE 'mana.inc' %] + +[% INCLUDE 'header.inc' %] +[% INCLUDE 'circ-search.inc' %] -[% IF statuscode == "200" AND reports %] - - - - - - - - - - [% UNLESS search_only %] - - [% END %] - - - - [% FOREACH report IN reports %] - [% UNLESS report.cannotdisplay %] - [% IF report.nbofcomment > highWarned %] - - [% ELSIF report.nbofcomment > warned %] - - [% ELSIF report.nbofcomment > lowWarned %] - - [% END %] - - - - [% END %] - - - - + + +
+
+
+
+

Mana Knowledge Base report search results

+ +
+ [% IF statuscode == "200" AND reports %] + +
Report NameNotesType# of usersLast import Comments Actions
[% IF ( report.report_name ) %][% report.report_name | html %][% END %]
- [% IF report.notes.length > 200 %] - [% report.notes.substr(0,200) | html %]Show More
[% report.type | html %] [% IF ( report.nbofusers ) %][% report.nbofusers | $raw %][% END %][% report.lastimport | $KohaDates %][% FOREACH comment IN report.comments %][% comment.message | html %] ([% comment.nb | $raw %])
[% END %]
+ + + + + + + + + [% UNLESS search_only %] + + [% END %] + + + + [% FOREACH report IN reports %] + [% UNLESS report.cannotdisplay %] + [% IF report.nbofcomment > highWarned %] + + [% ELSIF report.nbofcomment > warned %] + + [% ELSIF report.nbofcomment > lowWarned %] + + [% ELSE %] + + [% END %] + + + + + + - [% UNLESS search_only %] - + [% UNLESS search_only %] + + [% END %] + + [% END %] + [% END %] + +
Report nameNotesType# of usersLast import Comments Actions
+ + [% IF ( report.report_name ) %] + [% report.report_name | html %] + [% END %] + + [% IF report.notes.length > 200 %] +
+ [% report.notes.substr(0,200) | html %]... Show more +
+
+ [% report.notes | html %] + Show less +
+ [% ELSE %] + [% report.notes | html %] + [% END %] +
[% report.type | html %] + [% IF ( report.nbofusers ) %] + [% report.nbofusers | html %] + [% END %] + + + [% report.lastimport | $KohaDates %] + + + [% FOREACH comment IN report.comments %] + [% comment.message | html %] ([% comment.nb | html %])
+ [% END %] +
- - + +
+ [% ELSE %] +

+ [% IF ( msg ) %] + [% msg | html %] (Statuscode: [% statuscode | html %]) + [% ELSE %] + No results found + [% END %] +

[% END %] - - [% END %] - [% END %] - - -[% ELSE %] -

[% msg | html %] statuscode: [% statuscode | $raw %]

-[% END %] + + + + + +
+ +
+ + +[% INCLUDE 'intranet-bottom.inc' %] \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-share-report.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-share-report.inc new file mode 100644 index 0000000..a181062 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-share-report.inc @@ -0,0 +1,95 @@ + \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc index bf7327f..f6f37f6 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/mana/mana-subscription-search-result.inc @@ -3,91 +3,89 @@ [% USE AuthorisedValues %] [% USE Branches %] [% USE raw %] -[% INCLUDE 'mana.inc' %] - [% IF statuscode == "200" %] - - - - - - - - - - - - [% UNLESS search_only %] - - [% END %] - - - - [% FOREACH subscription IN subscriptions %] - [% UNLESS subscription.cannotdisplay %] - [% IF subscription.nbofcomment > highWarned %] - - [% ELSIF subscription.nbofcomment > warned %] - - [% ELSIF subscription.nbofcomment > lowWarned %] - + [% INCLUDE 'mana/mana-comment-status.inc' %] +
+
ISSNTitle Published by FrequencyNumbering pattern# of usersLast import Comments Actions
+ + + + + + + + + + + [% UNLESS search_only %] + [% END %] - - - - - - - - - - - [% UNLESS search_only %] + + + + [% FOREACH subscription IN subscriptions %] + [% UNLESS subscription.cannotdisplay %] + [% IF subscription.nbofcomment > highWarned %] + + [% ELSIF subscription.nbofcomment > warned %] + + [% ELSIF subscription.nbofcomment > lowWarned %] + + [% ELSE %] + + [% END %] + + + + + + + + - [% END %] - + [% UNLESS search_only %] + + [% END %] + + [% END %] [% END %] - [% END %] - -
ISSNTitle Published by FrequencyNumbering pattern# of usersLast import Comments Actions[% IF ( subscription.issn ) %][% subscription.issn | html %][% END %][% subscription.title | html %][% IF ( subscription.publishercode ) %][% subscription.publishercode | html %][% END %][% IF ( subscription.sfdescription ) %][% subscription.sfdescription | html %][% END %][% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod | html %][% END %][% IF ( subscription.nbofusers ) %][% subscription.nbofusers | $raw %][% END %][% subscription.lastimport | $KohaDates %][% FOREACH comment IN subscription.comments %][% comment.message | html %] ([% comment.nb | $raw %])
[% END %]
[% IF ( subscription.issn ) %][% subscription.issn | html %][% END %][% subscription.title | html %][% IF ( subscription.publishercode ) %][% subscription.publishercode | html %][% END %][% IF ( subscription.sfdescription ) %][% subscription.sfdescription | html %][% END %][% IF ( subscription.numberingmethod ) %][% subscription.numberingmethod | html %][% END %][% IF ( subscription.nbofusers ) %][% subscription.nbofusers | html %][% END %][% subscription.lastimport | $KohaDates %] - - - + [% FOREACH comment IN subscription.comments %] + [% comment.message | html %] ([% comment.nb | html %])
+ [% END %]
+ +
+ + +
+
+ + + + [% ELSE %]

Mana search fails with the code: [% statuscode | html %]

[% END %] - - 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 d9aa003..ab3047d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/reports-toolbar.inc @@ -7,7 +7,7 @@
  • New guided report
  • New SQL report
  • [% IF Koha.Preference('Mana')==1 %] -
  • New SQL from Mana
  • +
  • New SQL from Mana
  • [% END %] @@ -64,12 +64,12 @@ -