From e847522d447305f8af696d71361860b907ff0ca4 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Thu, 7 Dec 2017 19:00:12 +0000 Subject: [PATCH] Bug 19777: Move template JavaScript to the footer: Serials, part 3 This patch modifies even more staff client serials templates so that JavaScript is included in the footer instead of the header. This patch adds a new JavaScript include, serials-toolbar.js, which is required on pages which include serials-toolbar.inc. To test, apply the patch and test the JavaScript-driven features of the modified templates: All button controls, DataTables functionality, tabs, etc. - Serials - Search for a subscription - Tabs, datatables, date pickers - Open a subscription for viewing - Tabs, toolbar buttons for delete, renew, and close. - Serial collection (in the sidebar menu) - Select all / clear all - Datatable - Print slip - Generate next Signed-off-by: Claire Gravely --- .../prog/en/includes/serials-toolbar.inc | 37 ------ .../prog/en/modules/serials/serials-collection.tt | 133 ++++++++++----------- .../prog/en/modules/serials/serials-home.tt | 14 ++- .../prog/en/modules/serials/serials-search.tt | 81 +++++++------ .../prog/en/modules/serials/subscription-detail.tt | 50 ++++---- koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js | 43 +++++++ 6 files changed, 188 insertions(+), 170 deletions(-) create mode 100644 koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc index ecc9e55..19b264d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/serials-toolbar.inc @@ -1,40 +1,3 @@ - - [% IF subscriptionid and ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription || CAN_user_serials_receive_serials ) %]
[% IF CAN_user_serials_create_subscription %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt index 628276e..2b14039 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-collection.tt @@ -1,83 +1,13 @@ [% USE AuthorisedValues %] [% USE Branches %] [% USE KohaDates %] +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Serials › Serial collection information for [% bibliotitle %] [% INCLUDE 'doc-head-close.inc' %] -[% INCLUDE 'datatables.inc' %] - - - + [% INCLUDE 'header.inc' %] [% INCLUDE 'serials-search.inc' %] @@ -331,4 +261,63 @@ $(document).ready(function() { [% INCLUDE 'serials-menu.inc' %]
+ +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'datatables.inc' %] + + + + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt index eaafc94..049f386 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-home.tt @@ -1,5 +1,6 @@ -[% INCLUDE 'doc-head-open.inc' %] [% USE KohaDates %] +[% SET footerjs = 1 %] +[% INCLUDE 'doc-head-open.inc' %] Koha › Serials [% biblionumber %] [% INCLUDE 'doc-head-close.inc' %] @@ -20,4 +21,15 @@ [% INCLUDE 'serials-menu.inc' %] + +[% MACRO jsinclude BLOCK %] + + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt index 1728fb0..a7896f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt @@ -1,45 +1,14 @@ +[% USE AuthorisedValues %] [% USE Branches %] -[% INCLUDE 'doc-head-open.inc' %] [% USE KohaDates %] -[% USE AuthorisedValues %] +[% SET footerjs = 1 %] +[% INCLUDE 'doc-head-open.inc' %] Koha › Serials [% biblionumber %] [% INCLUDE 'doc-head-close.inc' %] -[% INCLUDE 'calendar.inc' %] -[% INCLUDE 'datatables.inc' %] - + [% INCLUDE 'header.inc' %] [% INCLUDE 'serials-search.inc' %] @@ -445,4 +414,46 @@ [% END %] + +[% MACRO jsinclude BLOCK %] + [% INCLUDE 'calendar.inc' %] + [% INCLUDE 'datatables.inc' %] + + + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt index 670a9c0..c9d0330 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/subscription-detail.tt @@ -1,35 +1,12 @@ [% USE Koha %] [% USE Branches %] [% USE AuthorisedValues %] +[% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] Koha › Serials › Details for subscription #[% subscriptionid %] [% INCLUDE 'doc-head-close.inc' %] - + [% INCLUDE 'header.inc' %] [% INCLUDE 'serials-search.inc' %] @@ -393,4 +370,27 @@ $(document).ready(function() { [% INCLUDE 'serials-menu.inc' %] + +[% MACRO jsinclude BLOCK %] + + + +[% END %] + [% INCLUDE 'intranet-bottom.inc' %] diff --git a/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js b/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js new file mode 100644 index 0000000..8ef2db9 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/js/serials-toolbar.js @@ -0,0 +1,43 @@ +/* global MSG_CLOSE_SUBSCRIPTION MSG_REOPEN_SUBSCRIPTION CONFIRM_DELETE_SUBSCRIPTION subscriptionid */ + +function confirm_close() { + var is_confirmed = confirm( MSG_CLOSE_SUBSCRIPTION ); + if (is_confirmed) { + window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=close"; + } +} +function confirm_reopen() { + var is_confirmed = confirm( MSG_REOPEN_SUBSCRIPTION ); + if (is_confirmed) { + window.location="subscription-detail.pl?subscriptionid=" + subscriptionid + "&op=reopen"; + } +} + +function confirm_deletion() { + var is_confirmed = confirm( CONFIRM_DELETE_SUBSCRIPTION ); + if (is_confirmed) { + window.location="subscription-detail.pl?subscriptionid=[% subscriptionid %]&op=del"; + } +} +function popup(subscriptionid) { + newin=window.open("subscription-renew.pl?mode=popup&subscriptionid="+subscriptionid,'popup','width=590,height=440,toolbar=false,scrollbars=yes'); +} + + $(document).ready(function() { + $("#deletesub").click(function(){ + confirm_deletion(); + return false; + }); + $("#reopen").click(function(){ + confirm_reopen(); + return false; + }); + $("#close").click(function(){ + confirm_close(); + return false; + }); + $("#renew").click(function(){ + popup( subscriptionid ); + return false; + }); + }); -- 2.1.4