Bugzilla – Attachment 69604 Details for
Bug 19758
Move template JavaScript to the footer: Serials, part 1
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19758: Move template JavaScript to the footer: Serials, part 1
Bug-19758-Move-template-JavaScript-to-the-footer-S.patch (text/plain), 20.24 KB, created by
Claire Gravely
on 2017-12-07 13:02:07 UTC
(
hide
)
Description:
Bug 19758: Move template JavaScript to the footer: Serials, part 1
Filename:
MIME Type:
Creator:
Claire Gravely
Created:
2017-12-07 13:02:07 UTC
Size:
20.24 KB
patch
obsolete
>From 2e47951d289a2f9f355d47c0ceb829293b251289 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Wed, 6 Dec 2017 15:52:37 +0000 >Subject: [PATCH] Bug 19758: Move template JavaScript to the footer: Serials, > part 1 > >This patch modifies some staff client serials templates so >that JavaScript is included in the footer instead of the header. > >To test, apply the patch and test the JavaScript-driven features of the >modified templates: All button controls, DataTables functionality, tabs, >etc. > >- Serials -> New subscription > - Search for a vendor > - "Choose" link and "Cancel" button should work correctly > - Search for record > - "Choose" link and "Cancel" button should word correctly >- Serials -> Add subscription fields > - Datatable, delete confirmation > - Edit > - Form validation (submit both authorised value and MARC field) >- Serials -> Check expiration > - Date picker in search form > - Search > - Renew button triggers popup >- Serials -> Claims -> Search results > - Date picker, datatable, form validation > - Select all/none; Download claims > >Signed-off-by: Claire Gravely <claire.gravely@bsz-bw.de> >--- > .../prog/en/modules/serials/acqui-search-result.tt | 38 ++-- > .../prog/en/modules/serials/acqui-search.tt | 11 +- > .../prog/en/modules/serials/add_fields.tt | 67 +++--- > .../prog/en/modules/serials/checkexpiration.tt | 36 +-- > .../prog/en/modules/serials/claims.tt | 242 ++++++++++----------- > .../prog/en/modules/serials/result.tt | 37 ++-- > 6 files changed, 217 insertions(+), 214 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search-result.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search-result.tt >index ccd6cfa..3ee8266 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search-result.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search-result.tt >@@ -1,24 +1,9 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials › Select vendor</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >- >-function GetIt(aqbooksellerid,name) >-{ >- opener.document.f.aqbooksellerid.value = aqbooksellerid; >- opener.document.f.aqbooksellername.value = name; >- window.close(); >-} >-$(document).ready(function(){ >- $(".select_vendor").on("click",function(e){ >- e.preventDefault(); >- var vendorname = $(this).data("vendorname"); >- var vendorid = $(this).data("vendorid"); >- GetIt( vendorid, vendorname ); >- }); >-}); >-</script> > </head> >+ > <body id="ser_acqui-search-result" class="ser"> > > <div id="doc" class="yui-t7"> >@@ -55,4 +40,23 @@ $(document).ready(function(){ > > </div> > >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript"> >+ function GetIt(aqbooksellerid,name){ >+ opener.document.f.aqbooksellerid.value = aqbooksellerid; >+ opener.document.f.aqbooksellername.value = name; >+ window.close(); >+ } >+ >+ $(document).ready(function(){ >+ $(".select_vendor").on("click",function(e){ >+ e.preventDefault(); >+ var vendorname = $(this).data("vendorname"); >+ var vendorid = $(this).data("vendorid"); >+ GetIt( vendorid, vendorname ); >+ }); >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search.tt >index b3f113f..db09180 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/acqui-search.tt >@@ -1,17 +1,8 @@ > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials › Search for vendor</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >-function GetIt(aqbooksellerid,name) >-{ >- opener.document.f.aqbooksellerid.value = aqbooksellerid; >- opener.document.f.aqbooksellername.value = name; >- window.close(); >-} >-//]]> >-</script> > </head> >+ > <body id="ser_acqui-search" class="ser"> > > <div id="doc" class="yui-t7"> >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/add_fields.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/add_fields.tt >index c74bf15..e356bbe 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/add_fields.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/add_fields.tt >@@ -1,4 +1,5 @@ > [% USE AuthorisedValues %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials › Manage new fields for subscriptions > [% IF op == "list" %] › List of fields >@@ -10,38 +11,6 @@ > </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"> >-//<![CDATA[ >- $(document).ready(function(){ >- >- $("#fieldst").dataTable($.extend(true, {}, dataTablesDefaults, { >- 'bAutoWidth': false, >- 'sDom': 't<"bottom pager"ilpf>', >- 'sPaginationType': 'four_button', >- 'aLengthMenu': [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]], >- 'iDisplayLength': 20, >- 'aaSorting': [[ 0, "asc" ]], >- "aoColumnDefs": [ >- { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >- ] >- })); >- >- $(".confirmdelete").click(function(){ >- return confirm(_("Are you sure you want to delete this field?")); >- }); >- >- $("#add_field").on('submit', function(){ >- if ( $("#marcfield").val().length > 0 >- && $("select[name='authorised_value_category']" ).val().length > 0 ) { >- alert("You cannot select an authorised value category and a marcfield"); >- return false; >- } >- return true; >- }); >- }); >-//]]> >-</script> > </head> > > <body id="ser_add_fields" class="ser"> >@@ -172,4 +141,38 @@ > [% INCLUDE 'serials-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE "datatables.inc" %] >+ <script type="text/javascript"> >+ $(document).ready(function(){ >+ >+ $("#fieldst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ 'bAutoWidth': false, >+ 'sDom': 't<"bottom pager"ilpf>', >+ 'sPaginationType': 'four_button', >+ 'aLengthMenu': [[10, 20, 50, 100, -1], [10, 20, 50, 100, "All"]], >+ 'iDisplayLength': 20, >+ 'aaSorting': [[ 0, "asc" ]], >+ "aoColumnDefs": [ >+ { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, >+ ] >+ })); >+ >+ $(".confirmdelete").click(function(){ >+ return confirm(_("Are you sure you want to delete this field?")); >+ }); >+ >+ $("#add_field").on('submit', function(){ >+ if ( $("#marcfield").val().length > 0 >+ && $("select[name='authorised_value_category']" ).val().length > 0 ) { >+ alert("You cannot select an authorised value category and a marcfield"); >+ return false; >+ } >+ return true; >+ }); >+ }); >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >index 8a59bbe..3ceb99c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/checkexpiration.tt >@@ -1,26 +1,11 @@ > [% USE Branches %] > [% USE KohaDates %] >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials › Check expiration</title> > [% INCLUDE 'doc-head-close.inc' %] >-[% INCLUDE 'calendar.inc' %] >-<script type="text/javascript" language="JavaScript"> >-// <![CDATA[ >- $(document).ready(function(){ >- $(".renew_subscription").on("click",function(e){ >- e.preventDefault(); >- var subscriptionid = $(this).data("subscriptionid"); >- popup( subscriptionid ); >- }); >- }); >- function popup(subscriptionid) { >- newin=window.open("subscription-renew.pl?mode=popup&subscriptionid="+subscriptionid,'popup','width=590,height=440,toolbar=false,scrollbars=yes,resize=yes'); >- } >- >- // ]]> >-</script> >-<!-- End of additions --> > </head> >+ > <body id="ser_checkexpiration" class="ser"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'serials-search.inc' %] >@@ -128,4 +113,21 @@ > [% INCLUDE 'serials-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'calendar.inc' %] >+ <script type="text/javascript" language="JavaScript"> >+ $(document).ready(function(){ >+ $(".renew_subscription").on("click",function(e){ >+ e.preventDefault(); >+ var subscriptionid = $(this).data("subscriptionid"); >+ popup( subscriptionid ); >+ }); >+ }); >+ function popup(subscriptionid) { >+ newin=window.open("subscription-renew.pl?mode=popup&subscriptionid="+subscriptionid,'popup','width=590,height=440,toolbar=false,scrollbars=yes,resize=yes'); >+ } >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >index a140ebb..eb001f4 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/claims.tt >@@ -1,130 +1,12 @@ >+[% USE AuthorisedValues %] > [% USE Branches %] >- >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] >-[% USE AuthorisedValues %] > <title>Koha › Serials › Claims</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[ >- var sTable; >- $(document).ready(function() { >- sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, { >- "sDom": 't', >- "aoColumnDefs": [ >- { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, >- { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }, >- { 'sType': "title-string", 'aTargets' : [ 'title-string'] } >- ], >- "bPaginate": false >- })); >- sTable.fnAddFilters("filter", "200"); >- $('#supplierid').change(function() { >- $('#claims').submit(); >- }); >- >- // Checkboxes : Select All / None >- $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>"); >- >- $("#CheckAll").click(function() { >- $("#claimst tr:visible :checkbox").prop('checked', $("#CheckAll").is(':checked')); >- }); >- >- // Generates a dynamic link for exporting the selections data as CSV >- $("#ExportSelected").click(function() { >- // We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error. >- var selected = $("input[name=serialid]:checked"); >- >- if (selected.length == 0) { >- alert(_("Please select at least one item to export.")); >- return false; >- } >- >- // Building the url from currently checked boxes >- var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&op=claims'; >- for (var i = 0; i < selected.length; i++) { >- url += '&serialid=' + selected[i].value; >- } >- url += '&csv_profile=' + $("#csv_profile_for_export option:selected").val(); >- // And redirecting to the CSV page >- location.href = url; >- return false; >- }); >- $("#filterByDate").on("click",function(e){ >- e.preventDefault(); >- filterByDate(); >- }); >- $("#clearfilter").on("click",function(e){ >- e.preventDefault(); >- $("#from,#to").val(""); >- $("table#claimst tbody tr").show(); >- }); >- $("#claims_form").on("submit",function(){ >- return checkForm(); >- }); >- $("#filter_claims_form").on("submit",function(){ >- return false; >- }); >- }); >- >- // Checks if the form can be sent (at least one checkbox must be checked) >- function checkForm() { >- if ($("input:checked").length == 0) { >- alert(_("Please select at least one issue.")); >- return false; >- } >- } >- >- // Filter by date >- function filterByDate() { >- var beginDate = Date_from_syspref($("#from").val()).getTime(); >- var endDate = Date_from_syspref($("#to").val()).getTime(); >- >- // Checks if the beginning date is valid >- if (!parseInt(beginDate)) { >- alert(_("The beginning date is missing or invalid.")); >- return false; >- } >- >- // Checks if the ending date is valid >- if (!parseInt(endDate)) { >- alert(_("The ending date is missing or invalid.")); >- return false; >- } >- >- // Checks if beginning date is before ending date >- if (beginDate > endDate) { >- // If not, we swap them >- var tmpDate = endDate; >- endDate = beginDate; >- beginDate = tmpDate; >- } >- >- // We hide everything >- $("table#claimst tbody tr").hide(); >- >- // For each date in the table >- $(".planneddate").each(function() { >- >- // We make a JS Date Object, according to the locale >- var pdate = Date_from_syspref($(this).text()).getTime(); >- >- // And checks if the date is between the beginning and ending dates >- if (pdate > beginDate && >- pdate < endDate) { >- // If so, we can show the row >- $(this).parent().show(); >- } >- >- }); >- } >- >- >-//]]> >-</script> > </head> >+ > <body id="ser_claims" class="ser"> > [% INCLUDE 'header.inc' %] > [% INCLUDE 'serials-search.inc' %] >@@ -321,4 +203,122 @@ > [% INCLUDE 'serials-menu.inc' %] > </div> > </div> >+ >+[% MACRO jsinclude BLOCK %] >+ [% INCLUDE 'calendar.inc' %] >+ [% INCLUDE 'datatables.inc' %] >+ <script type="text/javascript"> >+ var sTable; >+ $(document).ready(function() { >+ sTable = $("#claimst").dataTable($.extend(true, {}, dataTablesDefaults, { >+ "sDom": 't', >+ "aoColumnDefs": [ >+ { "aTargets": [ 0 ], "bSortable": false, "bSearchable": false }, >+ { 'sType': "anti-the", 'aTargets' : [ 'anti-the'] }, >+ { 'sType': "title-string", 'aTargets' : [ 'title-string'] } >+ ], >+ "bPaginate": false >+ })); >+ sTable.fnAddFilters("filter", "200"); >+ $('#supplierid').change(function() { >+ $('#claims').submit(); >+ }); >+ >+ // Checkboxes : Select All / None >+ $("span.checkall").html("<input type=\"checkbox\" name=\"CheckAll\"> "+_("Check All")+"</input>"); >+ >+ $("#CheckAll").click(function() { >+ $("#claimst tr:visible :checkbox").prop('checked', $("#CheckAll").is(':checked')); >+ }); >+ >+ // Generates a dynamic link for exporting the selections data as CSV >+ $("#ExportSelected").click(function() { >+ // We need to use "input[name=serialid]:checked" instead of "input:checked". Otherwise, the "check all" box will pass the value of "on" as a serialid, which produces a SQL error. >+ var selected = $("input[name=serialid]:checked"); >+ >+ if (selected.length == 0) { >+ alert(_("Please select at least one item to export.")); >+ return false; >+ } >+ >+ // Building the url from currently checked boxes >+ var url = '/cgi-bin/koha/serials/lateissues-export.pl?supplierid=&op=claims'; >+ for (var i = 0; i < selected.length; i++) { >+ url += '&serialid=' + selected[i].value; >+ } >+ url += '&csv_profile=' + $("#csv_profile_for_export option:selected").val(); >+ // And redirecting to the CSV page >+ location.href = url; >+ return false; >+ }); >+ $("#filterByDate").on("click",function(e){ >+ e.preventDefault(); >+ filterByDate(); >+ }); >+ $("#clearfilter").on("click",function(e){ >+ e.preventDefault(); >+ $("#from,#to").val(""); >+ $("table#claimst tbody tr").show(); >+ }); >+ $("#claims_form").on("submit",function(){ >+ return checkForm(); >+ }); >+ $("#filter_claims_form").on("submit",function(){ >+ return false; >+ }); >+ }); >+ >+ // Checks if the form can be sent (at least one checkbox must be checked) >+ function checkForm() { >+ if ($("input:checked").length == 0) { >+ alert(_("Please select at least one issue.")); >+ return false; >+ } >+ } >+ >+ // Filter by date >+ function filterByDate() { >+ var beginDate = Date_from_syspref($("#from").val()).getTime(); >+ var endDate = Date_from_syspref($("#to").val()).getTime(); >+ >+ // Checks if the beginning date is valid >+ if (!parseInt(beginDate)) { >+ alert(_("The beginning date is missing or invalid.")); >+ return false; >+ } >+ >+ // Checks if the ending date is valid >+ if (!parseInt(endDate)) { >+ alert(_("The ending date is missing or invalid.")); >+ return false; >+ } >+ >+ // Checks if beginning date is before ending date >+ if (beginDate > endDate) { >+ // If not, we swap them >+ var tmpDate = endDate; >+ endDate = beginDate; >+ beginDate = tmpDate; >+ } >+ >+ // We hide everything >+ $("table#claimst tbody tr").hide(); >+ >+ // For each date in the table >+ $(".planneddate").each(function() { >+ >+ // We make a JS Date Object, according to the locale >+ var pdate = Date_from_syspref($(this).text()).getTime(); >+ >+ // And checks if the date is between the beginning and ending dates >+ if (pdate > beginDate && >+ pdate < endDate) { >+ // If so, we can show the row >+ $(this).parent().show(); >+ } >+ }); >+ } >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/result.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/result.tt >index 2c5a14f..1c0c97a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/result.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/serials/result.tt >@@ -1,24 +1,9 @@ >+[% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > <title>Koha › Serials › Search results</title> > [% INCLUDE 'doc-head-close.inc' %] >-<script type="text/javascript"> >-//<![CDATA[ >- $(document).ready(function(){ >- $(".select_title").on("click",function(e){ >- e.preventDefault(); >- var biblionumber = $(this).data("biblionumber"); >- GetIt( biblionumber, $(this) ); >- }); >- }); >- function GetIt(bibno,title) { >- title = title.parents('tr').find('.title').text(); >- opener.document.f.biblionumber.value = bibno; >- opener.document.f.title.value = title; >- window.close(); >- } >-//]]> >-</script> > </head> >+ > <body id="ser_result" class="ser"> > > <div id="doc" class="yui-t7"> >@@ -79,4 +64,22 @@ > > </div> > >+[% MACRO jsinclude BLOCK %] >+ <script type="text/javascript"> >+ $(document).ready(function(){ >+ $(".select_title").on("click",function(e){ >+ e.preventDefault(); >+ var biblionumber = $(this).data("biblionumber"); >+ GetIt( biblionumber, $(this) ); >+ }); >+ }); >+ function GetIt(bibno,title) { >+ title = title.parents('tr').find('.title').text(); >+ opener.document.f.biblionumber.value = bibno; >+ opener.document.f.title.value = title; >+ window.close(); >+ } >+ </script> >+[% END %] >+ > [% INCLUDE 'intranet-bottom.inc' %] >-- >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 19758
:
69570
|
69604
|
69788