Bugzilla – Attachment 103381 Details for
Bug 16962
Remove the use of "onclick" from serial collection template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16962: Remove the use of "onclick" from serial collection template
Bug-16962-Remove-the-use-of-onclick-from-serial-co.patch (text/plain), 7.73 KB, created by
Josef Moravec
on 2020-04-21 14:47:11 UTC
(
hide
)
Description:
Bug 16962: Remove the use of "onclick" from serial collection template
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2020-04-21 14:47:11 UTC
Size:
7.73 KB
patch
obsolete
>From 20581bda570acf0ad18a73d4daf6dcde479ef651 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 17 Mar 2020 18:44:23 +0000 >Subject: [PATCH] Bug 16962: Remove the use of "onclick" from serial collection > template > >This patch removes the use of event attributes like "onclick" from the >serial collection template. Events are now defined in JavaScript. > >To test, apply the patch and go to Serials > >- Locate or create a subscription for which an item record is NOT > created when receiving. > - On the serial collection page for this subscription, test that the > "Multi receiving" button works correctly. > - For any subscription, test that the "Generate next" button works > correctly. > - In each tab, test that the "select all" and "clear all" links work > correctly and affect only that tab. > - On a subscription which has expired, test that the "Renew" button > works correctly. > >Signed-off-by: David Nind <david@davidnind.com> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > .../prog/en/modules/serials/serials-collection.tt | 65 +++++++++++++--------- > 1 file changed, 38 insertions(+), 27 deletions(-) > >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 192565e88f..a67be01377 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 >@@ -102,12 +102,8 @@ > <a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid | html %]&op=new"><i class="fa fa-plus"></i> Create routing list</a> > [% END %] > [% END %] >- [% IF ( subscription.abouttoexpire ) %]<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscription.subscriptionid | html %]" onclick="popup([% subscription.subscriptionid | html %]); return false;"><i class="fa fa-refresh"></i> Renew</a> >- [% ELSE %] >- [% IF ( subscription.subscriptionexpired ) %]<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscription.subscriptionid | html %]" onclick="popup([% subscription.subscriptionid | html %]); return false;"><i class="fa fa-refresh"></i> Renew</a> >- [% ELSE %] >- >- [% END %] >+ [% IF ( subscription.abouttoexpire || subscription.subscriptionexpired) %] >+ <a class="btn btn-default btn-xs subscription_renew" data-subscriptionid="[% subscription.subscriptionid | html %]" href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscription.subscriptionid | html %]"><i class="fa fa-refresh"></i> Renew</a> > [% END %] > [% ELSE %] > >@@ -145,7 +141,9 @@ > <p> > <div class="btn-group"><input type="submit" value="Edit serials" class="btn btn-default btn-sm" /></div> > [% UNLESS subscription.closed %] >- <div class="btn-group"><input type="button" value="Generate next" onclick="javascription:generateNext([% subscriptionidlist | html %])" class="btn btn-default btn-sm" /></div> >+ <div class="btn-group"> >+ <input type="button" value="Generate next" data-subscriptionid="[% subscriptionidlist | html %]" class="btn btn-default btn-sm generatenext" /> >+ </div> > [% IF ( subscriptions.size == 1 and !serialsadditems ) %] > <div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div> > [% END %] >@@ -154,10 +152,10 @@ > </p> > [% END %] > <span class="checkall"> >- <a class="CheckAll" href="#" onclick="CheckAll('subscription-year-[% year.year | html %]'); return false;">Select all</a> >+ <a class="CheckAll" href="#" data-year="[% year.year | html %]">Select all</a> > </span> | > <span class="clearall"> >- <a class="CheckNone" href="#" onclick="CheckNone('subscription-year-[% year.year | html %]'); return false;">Clear all</a> >+ <a class="CheckNone" href="#" data-year="[% year.year | html %]">Clear all</a> > </span> > <table class="subscription-year-table"> > <thead> >@@ -278,7 +276,7 @@ > </td> > [% IF ( routing ) %] > <td class="actions"> >- <a href="" onclick="print_slip([% serial.subscriptionid | html %], '[% serial.serialseq.replace("'", "\\'") | html %] ([% serial.publisheddate | $KohaDates %])'); return false" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print list</a> >+ <a href="/cgi-bin/koha/serials/routing-preview.pl?ok=1&subscriptionid=[% serial.subscriptionid | uri %]&issue=[% serial.serialseq.replace("'", "\\'") | uri %]%20([% serial.publisheddate | $KohaDates %])" class="btn btn-default btn-xs print_list"><i class="fa fa-print"></i> Print list</a> > </td> > [% END %] > </tr> >@@ -329,29 +327,12 @@ > } > } > >- 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, { >@@ -367,6 +348,36 @@ > "bFilter": false, > } )); > >+ $(".CheckAll").on("click", function(e){ >+ e.preventDefault(); >+ var years = $(this).data("year"); >+ $("#subscription-year-" + years ).checkCheckboxes(); >+ }); >+ >+ $(".CheckNone").on("click", function(e){ >+ e.preventDefault(); >+ var years = $(this).data("year"); >+ $("#subscription-year-" + years ).unCheckCheckboxes(); >+ }); >+ >+ $(".generatenext").on("click", function(e){ >+ e.preventDefault(); >+ var subscriptionid = $(this).data("subscriptionid"); >+ generateNext( subscriptionid ); >+ }); >+ >+ $(".subscription_renew").on("click", function(e){ >+ e.preventDefault(); >+ var subscriptionid = $(this).data("subscriptionid"); >+ popup( subscriptionid ); >+ }); >+ >+ $(".print_list").on("click", function(e){ >+ e.preventDefault(); >+ var url = $(this).attr("href"); >+ window.open( url,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes'); >+ }); >+ > $('#multi_receiving').on('show', function () { > $(this).find(".modal-body").html($(".serials_multi_receiving")[0].outerHTML); > }); >-- >2.11.0
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 16962
:
53647
|
53856
|
53884
|
59181
|
67814
|
100923
|
102647
|
103328
| 103381