Bugzilla – Attachment 156988 Details for
Bug 35032
Remove the use of "onclick" from Koha to MARC mapping template
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35032: Remove the use of "onclick" from Koha to MARC mapping template
Bug-35032-Remove-the-use-of-onclick-from-Koha-to-M.patch (text/plain), 4.10 KB, created by
Nick Clemens (kidclamp)
on 2023-10-12 17:38:59 UTC
(
hide
)
Description:
Bug 35032: Remove the use of "onclick" from Koha to MARC mapping template
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2023-10-12 17:38:59 UTC
Size:
4.10 KB
patch
obsolete
>From 19ba76da70ac8280eb09e2c33140bc11365a13b8 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Fri, 21 Jul 2023 16:41:48 +0000 >Subject: [PATCH] Bug 35032: Remove the use of "onclick" from Koha to MARC > mapping template > >This patch eliminates two instances of "onclick" from the Koha to MARC >mapping template, moving these event handlers into JS in the footer. > >To test, apply the patch and go to Administration -> Koha to MARC >mapping. > >- Click "Add" next to a Koha field. > - You should get a JS popup asking for entry of a MARC tag. Confirm > that this process completes correctly. >- Test a "Remove" link too. It should work to remove mapping from a Koha > field. >- Test the "Cancel" choice in both the "Add" and "Remove" cases to > confirm that the operation is cancelled. > >Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org> >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > .../prog/en/modules/admin/koha2marclinks.tt | 34 ++++++++++++++----- > 1 file changed, 25 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt >index 70976c367f..9f4173498a 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/koha2marclinks.tt >@@ -33,7 +33,7 @@ > <main> > > <h1>Koha to MARC mapping</h1> >-<br/> >+ > <div class="dialog message">If you make any change to the mappings, you must ask your administrator to run misc/batchRebuildBiblioTables.pl.</div> > <form action="/cgi-bin/koha/admin/koha2marclinks.pl" method="post" id="koha2marc"> > >@@ -59,8 +59,10 @@ > <td>[% loo.liblibrarian | html %]</td> > <td class="actions"> > [% IF !loo.readonly %] >- <a onclick="AddFld('[% loo.kohafield | html %]');" class="btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</a> >- [% IF loo.tagfield %] <a onclick="RemFld('[% loo.tagfield | html %]','[% loo.tagsubfield | html %]');" class="btn btn-default btn-xs"><i class="fa fa-times"></i> Remove</a> [% END %] >+ <a href="#" data-kohafield="[% loo.kohafield | html %]" class="addfld btn btn-default btn-xs"><i class="fa fa-plus"></i> Add</a> >+ [% IF loo.tagfield %] >+ <a href="#" data-tagfield="[% loo.tagfield | html %]" data-tagsubfield="[% loo.tagsubfield | html %]" class="remfld btn btn-default btn-xs"><i class="fa fa-trash-can"></i> Remove</a> >+ [% END %] > [% END %] > </td> > </td> >@@ -90,12 +92,14 @@ > <script> > function AddFld(kohafield) { > var fieldstr = prompt( _("Adding a mapping for: %s.").format(kohafield) + "\n" + _("Please enter field tag and subfield code, separated by a comma. (For control fields: add '@' as subfield code.)") + "\n" + _("The change will be applied immediately.") ); >- var temp = fieldstr.split(','); >- if( temp.length == 2 ) { >- $('#add_field').val( kohafield+','+fieldstr ); >- $('#koha2marc').submit(); >- } else { >- alert( _("Invalid input. Enter something like: 245,a") ); >+ if( fieldstr ){ >+ var temp = fieldstr.split(','); >+ if( temp.length == 2 ) { >+ $('#add_field').val( kohafield+','+fieldstr ); >+ $('#koha2marc').submit(); >+ } else { >+ alert( _("Invalid input. Enter something like: 245,a") ); >+ } > } > } > >@@ -113,6 +117,18 @@ > "paging": false > } )); > >+ $(".addfld").on("click", function(e){ >+ e.preventDefault(); >+ const kohafield = $(this).data("kohafield"); >+ AddFld( kohafield ); >+ }); >+ >+ $(".remfld").on("click", function(e){ >+ e.preventDefault(); >+ const tagfield = $(this).data("tagfield"); >+ const tagsubfield = $(this).data("tagsubfield"); >+ RemFld( tagfield, tagsubfield ); >+ }); > }); > </script> > [% END %] >-- >2.30.2
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 35032
:
156851
|
156877
| 156988