Bugzilla – Attachment 69621 Details for
Bug 19777
Move template JavaScript to the footer: Serials, part 3
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19777: Move template JavaScript to the footer: Serials, part 3
Bug-19777-Move-template-JavaScript-to-the-footer-S.patch (text/plain), 18.87 KB, created by
Owen Leonard
on 2017-12-07 19:25:12 UTC
(
hide
)
Description:
Bug 19777: Move template JavaScript to the footer: Serials, part 3
Filename:
MIME Type:
Creator:
Owen Leonard
Created:
2017-12-07 19:25:12 UTC
Size:
18.87 KB
patch
obsolete
>From 74aed995e154480e43d93463ebdbdfcd91e1fdc4 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >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 >--- > .../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 @@ >-<script type="text/javascript"> >- //<![CDATA[ >- >- function confirm_close() { >- var is_confirmed = confirm(_("Are you sure you want to close this subscription?")); >- if (is_confirmed) { >- window.location="subscription-detail.pl?subscriptionid=[% subscriptionid %]&op=close"; >- } >- } >- function confirm_reopen() { >- var is_confirmed = confirm(_("Are you sure you want to reopen this subscription?")); >- if (is_confirmed) { >- window.location="subscription-detail.pl?subscriptionid=[% subscriptionid %]&op=reopen"; >- } >- } >- >- $(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; >- }) >- }); >- //]]> >- </script> >- > [% IF subscriptionid and ( CAN_user_serials_edit_subscription || CAN_user_serials_create_subscription || CAN_user_serials_delete_subscription || CAN_user_serials_receive_serials ) %] > <div id="toolbar" class="btn-toolbar"> > [% 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' %] > <title>Koha › Serials › Serial collection information for [% bibliotitle %]</title> > [% INCLUDE 'doc-head-close.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >-<script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> >- >-<script type="text/javascript"> >-//<![CDATA[ >-function generateReceive(subscriptionid) { >- if(nbissues=prompt(_("How many issues do you want to receive ?"))){ >- document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid+'&nbissues='+nbissues; >- } >-} >-function print_slip(subscriptionid,issue){ >- var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue; >- window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes'); >-} >-function addsubscriptionid() >-{ >- var tab=new Array(); >- var serialids = document.edition.serialid; >- for (i=0; i<serialids.length; i++){ >- if (serialids[i].checked == true){ >- var found=false; >- for (var val in tab){ >- if (tab[val] == document.getElementsByName("subs")[i].getAttribute('val')){found = true;} >- } >- if (found == false){ >- tab=tab.concat((document.getElementsByName("subs")[i].getAttribute('val'))); >- } >- } >- } >- var string=""; >- for (var val in tab){ >- string = string + tab[val] + ","; >- } >- string=string.substring(0,string.length -1); >- document.edition.subscriptionid.value=string; >-} >-function popup(subscriptionid) { >- newin=window.open('subscription-renew.pl?mode=popup&subscriptionid='+subscriptionid,'popup','width=500,height=400,toolbar=false,scrollbars=yes'); >-} >- >-function generateNext(subscriptionid) { >- if(confirm(_("Do you really want to generate next serial?"))){ >- document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid; >- } >-} >- >-function CheckAll( node ) { >- $("#"+node).checkCheckboxes(); >- return false; >-} >-function CheckNone( node ) { >- $("#"+node).unCheckCheckboxes(); >- return false; >-} >-$(document).ready(function() { >- $('#subscription_years').tabs(); >- $(".subscription-year-table").dataTable($.extend(true, {}, dataTablesDefaults, { >- "aoColumnDefs": [ >- { "aTargets": [ 0,-1 ], "bSortable": false, "bSearchable": false }, >- { "sType": "title-string", "aTargets" : [ "title-string" ] } >- ], >- "aaSorting": [[0, 'desc']], >- "sDom": 't', >- "bAutoWidth": false, >- "bPaginate": false, >- "bInfo": false, >- "bFilter": false, >- } )); >-}); >- >-//]]> >-</script> > </head> >+ > <body id="ser_serials-collection" class="ser"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'serials-search.inc' %] >@@ -331,4 +261,63 @@ $(document).ready(function() { > [% INCLUDE 'serials-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript"> >+ var subscriptionid = "[% subscriptionid %]"; >+ var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?"); >+ var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?"); >+ var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?"); >+ </script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/serials-toolbar.js"></script> >+ <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script> >+ <script type="text/javascript"> >+ function generateReceive(subscriptionid) { >+ if(nbissues=prompt(_("How many issues do you want to receive ?"))){ >+ document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid+'&nbissues='+nbissues; >+ } >+ } >+ function print_slip(subscriptionid,issue){ >+ var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue; >+ window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes'); >+ } >+ >+ function popup(subscriptionid) { >+ newin=window.open('subscription-renew.pl?mode=popup&subscriptionid='+subscriptionid,'popup','width=500,height=400,toolbar=false,scrollbars=yes'); >+ } >+ >+ function generateNext(subscriptionid) { >+ if(confirm(_("Do you really want to generate next serial?"))){ >+ document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid; >+ } >+ } >+ >+ function CheckAll( node ) { >+ $("#"+node).checkCheckboxes(); >+ return false; >+ } >+ function CheckNone( node ) { >+ $("#"+node).unCheckCheckboxes(); >+ return false; >+ } >+ $(document).ready(function() { >+ $('#subscription_years').tabs(); >+ $(".subscription-year-table").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "aoColumnDefs": [ >+ { "aTargets": [ 0,-1 ], "bSortable": false, "bSearchable": false }, >+ { "sType": "title-string", "aTargets" : [ "title-string" ] } >+ ], >+ "aaSorting": [[0, 'desc']], >+ "sDom": 't', >+ "bAutoWidth": false, >+ "bPaginate": false, >+ "bInfo": false, >+ "bFilter": false, >+ } )); >+ }); >+ >+ </script> >+[% 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' %] > <title>Koha › Serials [% biblionumber %]</title> > [% INCLUDE 'doc-head-close.inc' %] > </head> >@@ -20,4 +21,15 @@ > [% INCLUDE 'serials-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/serials-toolbar.js"></script> >+ <script type="text/javascript"> >+ var subscriptionid = "[% subscriptionid %]"; >+ var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?"); >+ var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?"); >+ var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?"); >+ </script> >+[% 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' %] > <title>Koha › Serials [% biblionumber %]</title> > [% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'calendar.inc' %] > <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" /> >-[% INCLUDE 'datatables.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >- $(document).ready(function() { >- var osrlt = $("#osrlt").dataTable($.extend(true, {}, dataTablesDefaults, { >- "sPaginationType": "four_button", >- "aoColumnDefs": [ >- { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, >- { "sType": "title-string", "aTargets" : [ "title-string" ] }, >- { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] } >- ] >- } ) ); >- >- var csrlt = $("#csrlt").dataTable($.extend(true, {}, dataTablesDefaults, { >- // FIXME sort function of additional_fields! >- "sPaginationType": "four_button", >- "aoColumnDefs": [ >- { 'bSortable': false, 'aTargets': [ 'NoSort' ] }, >- { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] } >- ] >- } ) ); >- >- osrlt.fnAddFilters("dt-filter", 750); >- csrlt.fnAddFilters("dt-filter", 750); >- >- $('#serialstabs').tabs(); >- $("#reopensub").click(function(){ >- return confirm(_("Are you sure you want to reopen this subscription?")); >- }); >- }); >- //]]> >-</script> > <style type="text/css">input.dt-filter { width : 100%; font-size : 85%; }</style> > </head> >+ > <body id="ser_serials-home" class="ser"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'serials-search.inc' %] >@@ -445,4 +414,46 @@ > [% END %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript"> >+ var subscriptionid = "[% subscriptionid %]"; >+ var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?"); >+ var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?"); >+ var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?"); >+ </script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/serials-toolbar.js"></script> >+ <script type="text/javascript"> >+ $(document).ready(function() { >+ var osrlt = $("#osrlt").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "sPaginationType": "four_button", >+ "aoColumnDefs": [ >+ { 'bSortable': false, "bSearchable": false, 'aTargets': [ 'NoSort' ] }, >+ { "sType": "title-string", "aTargets" : [ "title-string" ] }, >+ { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] } >+ ] >+ })); >+ >+ var csrlt = $("#csrlt").dataTable($.extend(true, {}, dataTablesDefaults, { >+ // FIXME sort function of additional_fields! >+ "sPaginationType": "four_button", >+ "aoColumnDefs": [ >+ { 'bSortable': false, 'aTargets': [ 'NoSort' ] }, >+ { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] } >+ ] >+ })); >+ >+ osrlt.fnAddFilters("dt-filter", 750); >+ csrlt.fnAddFilters("dt-filter", 750); >+ >+ $('#serialstabs').tabs(); >+ $("#reopensub").click(function(){ >+ return confirm(_("Are you sure you want to reopen this subscription?")); >+ }); >+ }); >+ </script> >+[% 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' %] > <title>Koha › Serials › Details for subscription #[% subscriptionid %]</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >-// the english words used in display purposes >-var text = new Array(_("Number"),_("Volume"),_("Issue"),_("Month"),_("Week"),_("Starting with:"),_("Rollover at:"),_("Choose Hemisphere:"),_("Northern"),_("Southern", >-"Autumn"),_("Winter"),_("Spring"),_("Summer"),_("Fall"),_("Season"),_("Year")); >- >- >-function confirm_deletion() { >- var is_confirmed = confirm(_("Are you sure you want to delete this 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() { >- $("#subscription_description").tabs(); >- $("#renewsub").click(function(){ >- popup([% subscriptionid %]); >- return false; >- }) >-}); >-//]]> >-</script> > </head> >+ > <body id="ser_subscription-detail" class="ser"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'serials-search.inc' %] >@@ -393,4 +370,27 @@ $(document).ready(function() { > [% INCLUDE 'serials-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript"> >+ var subscriptionid = "[% subscriptionid %]"; >+ var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?"); >+ var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?"); >+ var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?"); >+ </script> >+ <script type="text/javascript" src="[% interface %]/[% theme %]/js/serials-toolbar.js"></script> >+ <script type="text/javascript"> >+ // the english words used in display purposes >+ var text = new Array(_("Number"),_("Volume"),_("Issue"),_("Month"),_("Week"),_("Starting with:"),_("Rollover at:"),_("Choose Hemisphere:"),_("Northern"),_("Southern", >+ "Autumn"),_("Winter"),_("Spring"),_("Summer"),_("Fall"),_("Season"),_("Year")); >+ $(document).ready(function() { >+ $("#subscription_description").tabs(); >+ $("#renewsub").click(function(){ >+ popup([% subscriptionid %]); >+ return false; >+ }) >+ }); >+ </script> >+[% 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..7a803cf >--- /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
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 19777
:
69621
|
69682
|
69791