Bugzilla – Attachment 181217 Details for
Bug 38340
Translatability - Standard form include files are not translatable
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 38340: (follow-up) Refactor and tidy template files
Bug-38340-follow-up-Refactor-and-tidy-template-fil.patch (text/plain), 57.90 KB, created by
Tomás Cohen Arazi (tcohen)
on 2025-04-21 13:03:25 UTC
(
hide
)
Description:
Bug 38340: (follow-up) Refactor and tidy template files
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2025-04-21 13:03:25 UTC
Size:
57.90 KB
patch
obsolete
>From 05b746b87ad1ccf9f350a0dd498e79d3f2f8c925 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Thu, 17 Apr 2025 16:40:26 -0300 >Subject: [PATCH] Bug 38340: (follow-up) Refactor and tidy template files > >--- > .../includes/ill/backends/Standard/create.inc | 410 +++++++++--------- > .../ill/backends/Standard/edititem.inc | 11 +- > .../Standard/inc/form_input_helpers.inc | 52 --- > .../ill/backends/Standard/inc/shared.js | 44 -- > .../ill/backends/Standard/migrate.inc | 9 +- > .../{inc => shared}/custom_fields.inc | 0 > .../Standard/shared/form_input_helpers.inc | 56 +++ > .../{inc => shared}/forms/article.inc | 0 > .../Standard/{inc => shared}/forms/book.inc | 0 > .../{inc => shared}/forms/chapter.inc | 0 > .../{inc => shared}/forms/conference.inc | 0 > .../Standard/{inc => shared}/forms/dvd.inc | 0 > .../{inc => shared}/forms/journal.inc | 0 > .../Standard/{inc => shared}/forms/other.inc | 0 > .../{inc => shared}/forms/resource.inc | 0 > .../Standard/{inc => shared}/forms/thesis.inc | 0 > .../ill/backends/Standard/shared/shared.js | 46 ++ > .../includes/ill/backends/Standard/create.inc | 10 +- > .../Standard/inc/form_input_helpers.inc | 52 --- > .../ill/backends/Standard/inc/shared.js | 44 -- > .../{inc => shared}/custom_fields.inc | 0 > .../Standard/shared/form_input_helpers.inc | 56 +++ > .../{inc => shared}/forms/article.inc | 0 > .../Standard/{inc => shared}/forms/book.inc | 0 > .../{inc => shared}/forms/chapter.inc | 0 > .../{inc => shared}/forms/conference.inc | 0 > .../Standard/{inc => shared}/forms/dvd.inc | 0 > .../{inc => shared}/forms/journal.inc | 0 > .../Standard/{inc => shared}/forms/other.inc | 0 > .../{inc => shared}/forms/resource.inc | 0 > .../Standard/{inc => shared}/forms/thesis.inc | 0 > .../ill/backends/Standard/shared/shared.js | 48 ++ > 32 files changed, 423 insertions(+), 415 deletions(-) > delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/form_input_helpers.inc > delete mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/shared.js > rename koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/{inc => shared}/custom_fields.inc (100%) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/form_input_helpers.inc > rename koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/{inc => shared}/forms/article.inc (100%) > rename koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/{inc => shared}/forms/book.inc (100%) > rename koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/{inc => shared}/forms/chapter.inc (100%) > rename koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/{inc => shared}/forms/conference.inc (100%) > rename koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/{inc => shared}/forms/dvd.inc (100%) > rename koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/{inc => shared}/forms/journal.inc (100%) > rename koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/{inc => shared}/forms/other.inc (100%) > rename koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/{inc => shared}/forms/resource.inc (100%) > rename koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/{inc => shared}/forms/thesis.inc (100%) > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/shared.js > delete mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/form_input_helpers.inc > delete mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/shared.js > rename koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/{inc => shared}/custom_fields.inc (100%) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/form_input_helpers.inc > rename koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/{inc => shared}/forms/article.inc (100%) > rename koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/{inc => shared}/forms/book.inc (100%) > rename koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/{inc => shared}/forms/chapter.inc (100%) > rename koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/{inc => shared}/forms/conference.inc (100%) > rename koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/{inc => shared}/forms/dvd.inc (100%) > rename koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/{inc => shared}/forms/journal.inc (100%) > rename koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/{inc => shared}/forms/other.inc (100%) > rename koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/{inc => shared}/forms/resource.inc (100%) > rename koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/{inc => shared}/forms/thesis.inc (100%) > create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/shared.js > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/create.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/create.inc >index 7f45536d487..01c2d5a7169 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/create.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/create.inc >@@ -1,217 +1,209 @@ > [% USE Koha %] >+[% USE raw %] > [% SET koha_version = Koha.Version %] >-[% cwd = whole.cwd %] >-[% PROCESS "${cwd}/shared-includes/form_input_helpers.inc" %] >+[% PROCESS "ill/backends/Standard/shared/form_input_helpers.inc" %] > [% IF whole.error %] >-[% IF whole.status == 'missing_identifier' %] >-<p><em>Please note:</em> Mandatory field Identifier is missing.</p> >-[% ELSIF whole.status == 'missing_branch' %] >-<p><em>Please note:</em> Library is a mandatory field.</p> >-[% ELSIF whole.status == 'invalid_borrower' %] >-<p><em>Please note:</em> The patron details you entered are invalid.</p> >-[% ELSIF whole.status == 'invalid_branch' %] >-<p><em>Please note:</em> The library you chose is invalid.</p> >-[% ELSE %] >-<p>Unhandled error</p> >-[% END %] >+ [% IF whole.status == 'missing_identifier' %] >+ <p><em>Please note:</em> Mandatory field Identifier is missing.</p> >+ [% ELSIF whole.status == 'missing_branch' %] >+ <p><em>Please note:</em> Library is a mandatory field.</p> >+ [% ELSIF whole.status == 'invalid_borrower' %] >+ <p><em>Please note:</em> The patron details you entered are invalid.</p> >+ [% ELSIF whole.status == 'invalid_branch' %] >+ <p><em>Please note:</em> The library you chose is invalid.</p> >+ [% ELSE %] >+ <p>Unhandled error</p> >+ [% END %] > [% END %] > > [% IF whole.stage == "form" %] >-<h2>Create an ILL request</h2> >-<form id="create_form" method="POST" action=""> >- [% INCLUDE 'csrf-token.inc' %] >- <fieldset class="rows"> >- <legend>General details</legend> >- <ol id="general-standard-fields"> >- <li> >- <label class="required" for="type">Type:</label> >- <select name="type" id="type"> >- <option value=""/> >- [% IF whole.value.other.type.lower == "book" %] >- <option value="book" selected="selected">Book</option> >- [% ELSE %] >- <option value="book">Book</option> >- [% END %] >- [% IF whole.value.other.type.lower == "chapter" %] >- <option value="chapter" selected="selected">Chapter</option> >- [% ELSE %] >- <option value="chapter">Chapter</option> >- [% END %] >- [% IF whole.value.other.type.lower == "journal" %] >- <option value="journal" selected="selected">Journal</option> >- [% ELSE %] >- <option value="journal">Journal</option> >- [% END %] >- [% IF whole.value.other.type.lower == "article" %] >- <option value="article" selected="selected">Journal article</option> >- [% ELSE %] >- <option value="article">Journal article</option> >- [% END %] >- [% IF whole.value.other.type.lower == "thesis" %] >- <option value="thesis" selected="selected">Thesis</option> >- [% ELSE %] >- <option value="thesis">Thesis</option> >- [% END %] >- [% IF whole.value.other.type.lower == "conference" %] >- <option value="conference" selected="selected">Conference</option> >- [% ELSE %] >- <option value="conference">Conference</option> >- [% END %] >- [% IF whole.value.other.type.lower == "dvd" %] >- <option value="dvd" selected="selected">DVD</option> >- [% ELSE %] >- <option value="dvd">DVD</option> >- [% END %] >- [% IF whole.value.other.type.lower == "other" %] >- <option value="other" selected="selected">Other</option> >- [% ELSE %] >- <option value="other">Other</option> >- [% END %] >- [% IF whole.value.other.type.lower == "resource" %] >- <option value="resource" selected="selected">Generic resource</option> >- [% ELSE %] >- <option value="resource">Generic resource</option> >- [% END %] >- </select> >- </li> >- </ol> >- </fieldset> >- [% type = whole.value.other.type %] >- [% IF type %] >- [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %] >- [% END %] >- [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] >- <fieldset class="rows"> >- <legend>Patron options</legend> >- <ol> >- <li> >- <label class="required" for="cardnumber"> >- Card number, username or surname: >- </label> >- <input type="text" name="cardnumber" id="cardnumber" autocomplete="off" type="text" value="[% whole.value.other.cardnumber | html %]" /> >- <span class="required">Required</span> >- </li> >- <li> >- <label class="required" for="branchcode">Destination library:</label> >- <select id="branchcode" name="branchcode"> >- <option value="" /> >- [% FOREACH branch IN branches %] >- [% IF branch.branchcode == whole.value.other.branchcode %] >- <option value="[% branch.branchcode | html %]" selected="selected"> >- [% ELSE %] >- <option value="[% branch.branchcode | html %]"> >- [% END %] >- [% branch.branchname | html %] >- </option> >- [% END %] >- </select> >- <span class="required">Required</span> >- </li> >- </ol> >- </fieldset> >- <fieldset class="action"> >- <input id="ill-submit" class="btn btn-primary" type="submit" value="Create" disabled /> >- <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a> >- </fieldset> >- <input type="hidden" name="method" value="create" /> >- <input type="hidden" name="stage" value="form" /> >- <input type="hidden" name="backend" value="Standard" /> >-</form> >-[% BLOCK backend_jsinclude %] >-<script> >- // <![CDATA[] >- [% INCLUDE "${cwd}/shared-includes/shared.js" %] >- // Require a username and branch selection >- document.addEventListener('DOMContentLoaded', function(){ >- let cardnumber_input = '#create_form #cardnumber'; >- let branchcode_input = '#create_form #branchcode'; >- updateCreateButtonStatus(); >- $(cardnumber_input + ',' + branchcode_input).change(function() { >- updateCreateButtonStatus(); >- }); >- function updateCreateButtonStatus(){ >- var comp = [cardnumber_input,branchcode_input].filter(function(id) { >- return $(id).val().length > 0; >- }); >- $('#ill-submit').attr('disabled', comp.length < 2); >- } >- /* Maintain patron autocomplete compatibility across versions */ >- [% IF koha_version.major <= 22 && koha_version.minor < 11 %] >- $('#create_form #cardnumber').autocomplete({ >- source: "/cgi-bin/koha/circ/ysearch.pl", >- minLength: 3, >- select: function( event, ui ) { >- var field = ui.item.cardnumber; >- $('#create_form #cardnumber').val(field) >- return false; >- } >- }) >- .data( "ui-autocomplete" )._renderItem = function( ul, item ) { >- return $( "<li></li>" ) >- .data( "ui-autocomplete-item", item ) >- .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >- .appendTo( ul ); >- }; >- [% ELSE %] >- patron_autocomplete( >- $('#create_form #cardnumber'), >- { >- 'on-select-callback': function( event, ui ) { >- $("#create_form #cardnumber").val( ui.item.cardnumber ); >- return false; >- } >- } >- ); >- [% END %] >- }); >- // ]]> >-</script> >-[% END %] >- >-[% ELSIF whole.stage == "borrowers" %] >-<!-- We need to clarify the borrower that has been requested. --> >-<h2>Borrower selection</h2> >-<form method="POST" action=""> >- [% FOREACH prop IN whole.value.other.keys %] >- [% IF prop != 'custom_key' && prop != 'custom_value' && prop != 'cardnumber' %] >- <input type="hidden" name="[% prop | html %]" value="[% whole.value.other.$prop | html %]"> >- [% END %] >- [% END %] >- [% keys = whole.value.other.custom_key.split('\0') %] >- [% values = whole.value.other.custom_value.split('\0') %] >- [% i = 0 %] >- [% FOREACH key IN keys %] >- <input type="hidden" name="custom_key" value="[% key | html %]"> >- <input type="hidden" name="custom_value" value="[% values.$i | html %]"> >- [% i = i + 1 %] >- [% END %] >- <fieldset class="rows"> >- <legend>Available borrowers for surname [% surname | html %]</legend> >- [% FOREACH opt IN whole.value %] >- [% IF opt.key == "brw" %] >- <ol> >- <li> >- <label class="required" for="brw">Borrower</label> >- <select name="cardnumber" id="cardnumber"> >- <option value=""></option> >- [% FOREACH brw IN opt.value %] >- <option value="[% brw.cardnumber | html %]"> >- [% brw.firstname | html %] [% brw.surname | html %] ([% brw.cardnumber | html %]) >- </option> >- [% END %] >- </select> >- </li> >- </ol> >+ <h2>Create an ILL request</h2> >+ <form id="create_form" method="POST" action=""> >+ [% INCLUDE 'csrf-token.inc' %] >+ <fieldset class="rows"> >+ <legend>General details</legend> >+ <ol id="general-standard-fields"> >+ <li> >+ <label class="required" for="type">Type:</label> >+ <select name="type" id="type"> >+ <option value="" /> >+ [% IF whole.value.other.type.lower == "book" %] >+ <option value="book" selected="selected">Book</option> >+ [% ELSE %] >+ <option value="book">Book</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "chapter" %] >+ <option value="chapter" selected="selected">Chapter</option> >+ [% ELSE %] >+ <option value="chapter">Chapter</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "journal" %] >+ <option value="journal" selected="selected">Journal</option> >+ [% ELSE %] >+ <option value="journal">Journal</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "article" %] >+ <option value="article" selected="selected">Journal article</option> >+ [% ELSE %] >+ <option value="article">Journal article</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "thesis" %] >+ <option value="thesis" selected="selected">Thesis</option> >+ [% ELSE %] >+ <option value="thesis">Thesis</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "conference" %] >+ <option value="conference" selected="selected">Conference</option> >+ [% ELSE %] >+ <option value="conference">Conference</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "dvd" %] >+ <option value="dvd" selected="selected">DVD</option> >+ [% ELSE %] >+ <option value="dvd">DVD</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "other" %] >+ <option value="other" selected="selected">Other</option> >+ [% ELSE %] >+ <option value="other">Other</option> >+ [% END %] >+ [% IF whole.value.other.type.lower == "resource" %] >+ <option value="resource" selected="selected">Generic resource</option> >+ [% ELSE %] >+ <option value="resource">Generic resource</option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ </fieldset> >+ [% type = whole.value.other.type %] >+ [% IF type %] >+ [% INCLUDE "ill/backends/Standard/shared/forms/${type}.inc" %] >+ [% END %] >+ [% INCLUDE "ill/backends/Standard/shared/custom_fields.inc" %] >+ <fieldset class="rows"> >+ <legend>Patron options</legend> >+ <ol> >+ <li> >+ <label class="required" for="cardnumber"> Card number, username or surname: </label> >+ <input type="text" name="cardnumber" id="cardnumber" autocomplete="off" type="text" value="[% whole.value.other.cardnumber | html %]" /> >+ <span class="required">Required</span> >+ </li> >+ <li> >+ <label class="required" for="branchcode">Destination library:</label> >+ <select id="branchcode" name="branchcode"> >+ <option value="" /> >+ [% FOREACH branch IN branches %] >+ [% IF branch.branchcode == whole.value.other.branchcode %] >+ <option value="[% branch.branchcode | html %]" selected="selected">[% branch.branchname | html %]</option> >+ [% ELSE %] >+ <option value="[% branch.branchcode | html %]">[% branch.branchname | html %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ <span class="required">Required</span> >+ </li> >+ </ol> >+ </fieldset> >+ <fieldset class="action"> >+ <input id="ill-submit" class="btn btn-primary" type="submit" value="Create" disabled /> >+ <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a> >+ </fieldset> >+ <input type="hidden" name="method" value="create" /> >+ <input type="hidden" name="stage" value="form" /> >+ <input type="hidden" name="backend" value="Standard" /> >+ </form> >+ [% BLOCK backend_jsinclude %] >+ <script> >+ // <![CDATA[] >+ var core = [ [% whole.core | $raw %] ]; >+ [% INCLUDE "ill/backends/Standard/shared/shared.js" %] >+ // Require a username and branch selection >+ document.addEventListener('DOMContentLoaded', function(){ >+ let cardnumber_input = '#create_form #cardnumber'; >+ let branchcode_input = '#create_form #branchcode'; >+ updateCreateButtonStatus(); >+ $(cardnumber_input + ',' + branchcode_input).change(function() { >+ updateCreateButtonStatus(); >+ }); >+ function updateCreateButtonStatus(){ >+ var comp = [cardnumber_input,branchcode_input].filter(function(id) { >+ return $(id).val().length > 0; >+ }); >+ $('#ill-submit').attr('disabled', comp.length < 2); >+ } >+ /* Maintain patron autocomplete compatibility across versions */ >+ [% IF koha_version.major <= 22 && koha_version.minor < 11 %] >+ $('#create_form #cardnumber').autocomplete({ >+ source: "/cgi-bin/koha/circ/ysearch.pl", >+ minLength: 3, >+ select: function( event, ui ) { >+ var field = ui.item.cardnumber; >+ $('#create_form #cardnumber').val(field) >+ return false; >+ } >+ }) >+ .data( "ui-autocomplete" )._renderItem = function( ul, item ) { >+ return $( "<li></li>" ) >+ .data( "ui-autocomplete-item", item ) >+ .append( "<a>" + item.surname + ", " + item.firstname + " (" + item.cardnumber + ") <small>" + item.address + " " + item.city + " " + item.zipcode + " " + item.country + "</small></a>" ) >+ .appendTo( ul ); >+ }; >+ [% ELSE %] >+ patron_autocomplete( >+ $('#create_form #cardnumber'), >+ { >+ 'on-select-callback': function( event, ui ) { >+ $("#create_form #cardnumber").val( ui.item.cardnumber ); >+ return false; >+ } >+ } >+ ); >+ [% END %] >+ }); >+ // ]]> >+ </script> > [% END %] >- [% END %] >- </fieldset> >- <fieldset class="action"> >- <input type="submit" value="Select"/> >- <a class="cancel" href=[% parent | url %]>Cancel</a> >- </fieldset> >-</form> >- >+[% ELSIF whole.stage == "borrowers" %] >+ <!-- We need to clarify the borrower that has been requested. --> >+ <h2>Borrower selection</h2> >+ <form method="POST" action=""> >+ [% FOREACH prop IN whole.value.other.keys %] >+ [% IF prop != 'custom_key' && prop != 'custom_value' && prop != 'cardnumber' %] >+ <input type="hidden" name="[% prop | html %]" value="[% whole.value.other.$prop | html %]" /> >+ [% END %] >+ [% END %] >+ [% keys = whole.value.other.custom_key.split('\0') %] >+ [% values = whole.value.other.custom_value.split('\0') %] >+ [% i = 0 %] >+ [% FOREACH key IN keys %] >+ <input type="hidden" name="custom_key" value="[% key | html %]" /> >+ <input type="hidden" name="custom_value" value="[% values.$i | html %]" /> >+ [% i = i + 1 %] >+ [% END %] >+ <fieldset class="rows"> >+ <legend>Available borrowers for surname [% surname | html %]</legend> >+ [% FOREACH opt IN whole.value %] >+ [% IF opt.key == "brw" %] >+ <ol> >+ <li> >+ <label class="required" for="brw">Borrower</label> >+ <select name="cardnumber" id="cardnumber"> >+ <option value=""></option> >+ [% FOREACH brw IN opt.value %] >+ <option value="[% brw.cardnumber | html %]"> [% brw.firstname | html %] [% brw.surname | html %] ([% brw.cardnumber | html %]) </option> >+ [% END %] >+ </select> >+ </li> >+ </ol> >+ [% END %] >+ [% END %] >+ </fieldset> >+ <fieldset class="action"> >+ <input type="submit" value="Select" /> >+ <a class="cancel" href="[% parent | url %]">Cancel</a> >+ </fieldset> >+ </form> > [% ELSE %] >-<p>Unknown stage. This should not have happened. >- >-[% END %] >\ No newline at end of file >+ <p>Unknown stage. This should not have happened. </p> >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/edititem.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/edititem.inc >index f84506fcf62..808e690cb59 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/edititem.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/edititem.inc >@@ -1,5 +1,5 @@ >-[% cwd = whole.cwd %] >-[% PROCESS "${cwd}/shared-includes/form_input_helpers.inc" %] >+[% USE raw %] >+[% PROCESS "ill/backends/Standard/shared/form_input_helpers.inc" %] > [% IF whole.error %] > [% IF whole.status == 'missing_type' %] > <p><em>Please note:</em> Mandatory field 'type' is missing.</p> >@@ -70,9 +70,9 @@ > </fieldset> > [% type = whole.value.other.type %] > [% IF type %] >- [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %] >+ [% INCLUDE "ill/backends/Standard/shared/forms/${type}.inc" %] > [% END %] >- [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] >+ [% INCLUDE "ill/backends/Standard/shared/custom_fields.inc" %] > <fieldset class="action"> > <input id="ill-submit" class="btn btn-primary" type="submit" value="Update" /> > <a class="cancel" href="/cgi-bin/koha/ill/ill-requests.pl">Cancel</a> >@@ -84,8 +84,9 @@ > </form> > [% BLOCK backend_jsinclude %] > <script> >+ var core = [ [% whole.core | $raw %] ]; > // <![CDATA[] >- [% INCLUDE "${cwd}/shared-includes/shared.js" %] >+ [% INCLUDE "ill/backends/Standard/shared/shared.js" %] > // ]]> > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/form_input_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/form_input_helpers.inc >deleted file mode 100644 >index 5ac8be9b868..00000000000 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/form_input_helpers.inc >+++ /dev/null >@@ -1,52 +0,0 @@ >-[% BLOCK ill_text_input_field %] >- <li> >- <label for="[% id | html %]">[% label | html %]:</label> >- [% IF opac %] >- <input class="form-control input-fluid" type="text" name="[% id | html %]" id="[% id | html%]" value="[% value | html %]" /> >- [% ELSE %] >- <input type="text" name="[% id | html %]" id="[% id | html%]" value="[% value | html %]" /> >- [% END %] >- [% IF required %] >- <div class="required_label required">Required</div> >- [% END %] >- [% SET required = 0 %] >- </li> >-[% END %] >- >-[% BLOCK ill_select_field %] >- <li> >- <label for="[% id | html %]">[% label | html %]:</label> >- [% IF opac %] >- <select class="form-select input-fluid" name="[% id | html %]" id="[% id | html %]"> >- [% ELSE %] >- <select name="[% id | html %]" id="[% id | html %]"> >- [% END %] >- [% content | $raw %] >- </select> >- [% IF required %] >- <div class="required_label required">Required</div> >- [% END %] >- [% SET required = 0 %] >- </li> >-[% END %] >- >-[% BLOCK book_text_input_fields %] >- [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %] >- [% PROCESS ill_text_input_field id = 'author' label = t('Author') value = whole.value.other.author %] >- [% PROCESS ill_text_input_field id = 'editor' label = t('Editor') value = whole.value.other.editor %] >- [% PROCESS ill_text_input_field id = 'publisher' label = t('Publisher') value = whole.value.other.publisher %] >- [% PROCESS ill_text_input_field id = 'published_place' label = t('Place of publication') value = whole.value.other.published_place %] >- [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %] >- [% PROCESS ill_text_input_field id = 'part_edition' label = t('Part / Edition') value = whole.value.other.part_edition %] >- [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %] >- [% PROCESS ill_text_input_field id = 'isbn' label = t('ISBN') value = whole.value.other.isbn %] >- [% PROCESS ill_text_input_field id = 'doi' label = t('DOI') value = whole.value.other.doi %] >-[% END %] >- >-[% BLOCK journal_text_input_fields %] >- [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %] >- [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %] >- [% PROCESS ill_text_input_field id = 'issue' label = t('Issue number') value = whole.value.other.issue %] >- [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %] >- [% PROCESS ill_text_input_field id = 'issn' label = t('ISSN') value = whole.value.other.issn %] >-[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/shared.js b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/shared.js >deleted file mode 100644 >index c65fcdab401..00000000000 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/shared.js >+++ /dev/null >@@ -1,44 +0,0 @@ >-var core = [ [% whole.core %] ]; >-var opac = [% opac || 0 %]; >-document.addEventListener('DOMContentLoaded', function() { >- $('#add-new-fields').click(function(e) { >- e.preventDefault(); >- var row = '<li class="form-horizontal">' + >- '<input type="text" class="custom-name ' + >- ( opac ? 'form-control input-fluid custom-field-input' : '') + >- '" name="custom_key" placeholder="'+__('key')+'">' + >- ' ' + >- '<input type="text" id="custom-value" name="custom_value" class="' + >- ( opac ? 'form-control input-fluid custom-field-input' : '') +'" placeholder="'+__('value')+'"> ' + >- '<button type="button" class="btn btn-danger btn-sm ' + >- 'delete-new-field">' + >- '<span class="fa fa-trash-can"></span> ' + >- __('Delete') + >- '</button></li>'; >- $('#standard-fields').append(row); >- }); >- $('#standard-fields').on('click', '.delete-new-field', >- function(event) { >- event.preventDefault(); >- $(event.target).parent().remove(); >- } >- ); >- $('#type').change(function() { >- $('#create_form').prepend( >- '<input type="hidden" name="change_type" value="1" />' >- ); >- $('#create_form').submit(); >- }); >- $('#standard-fields').on('keyup', '.custom-name', function() { >- var val = $(this).val(); >- if (core.indexOf(val.toLowerCase()) > -1) { >- $('#custom-warning').text(__("The name '%s' is not permitted").format(val)).show(); >- $('#ill-submit').attr('disabled', true); >- $('#add-new-fields').attr('disabled', true); >- } else { >- $('#custom-warning').hide(); >- $('#ill-submit').attr('disabled', false); >- $('#add-new-fields').attr('disabled', false); >- } >- }); >-}); >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/migrate.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/migrate.inc >index 75f5cfe0886..180c2d9f1b8 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/migrate.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/migrate.inc >@@ -1,3 +1,4 @@ >+[% USE raw %] > [% IF whole.error %] > [% IF whole.status == 'missing_identifier' %] > <p><em>Please note:</em> Mandatory field Identifier is missing.</p> >@@ -74,12 +75,11 @@ > </li> > </ol> > </fieldset> >- [% cwd = whole.cwd %] > [% type = whole.value.other.type %] > [% IF type %] >- [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %] >+ [% INCLUDE "ill/backends/Standard/shared/forms/${type}.inc" %] > [% END %] >- [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] >+ [% INCLUDE "ill/backends/Standard/shared/custom_fields.inc" %] > <fieldset class="rows"> > <legend>Patron options</legend> > <ol> >@@ -107,8 +107,9 @@ > </form> > [% BLOCK backend_jsinclude %] > <script> >+ var core = [ [% whole.core | $raw %] ]; > // <![CDATA[] >- [% INCLUDE "${cwd}/shared-includes/shared.js" %] >+ [% INCLUDE "ill/backends/Standard/shared/shared.js" %] > // ]]> > </script> > [% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/custom_fields.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/custom_fields.inc >similarity index 100% >rename from koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/custom_fields.inc >rename to koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/custom_fields.inc >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/form_input_helpers.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/form_input_helpers.inc >new file mode 100644 >index 00000000000..79d26fba132 >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/form_input_helpers.inc >@@ -0,0 +1,56 @@ >+[% USE raw %] >+[% BLOCK ill_text_input_field %] >+ <li> >+ <label for="[% id | html %]">[% label | html %]:</label> >+ [% IF opac %] >+ <input class="form-control input-fluid" type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" /> >+ [% ELSE %] >+ <input type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" /> >+ [% END %] >+ [% IF required %] >+ <div class="required_label required">Required</div> >+ [% END %] >+ [% SET required = 0 %] >+ </li> >+[% END %] >+ >+[% BLOCK ill_select_field %] >+ <li> >+ <label for="[% id | html %]">[% label | html %]:</label> >+ [% IF opac %] >+ <select class="form-select input-fluid" name="[% id | html %]" id="[% id | html %]" >+ >[% content | $raw %]</select >+ > >+ [% ELSE %] >+ <select name="[% id | html %]" id="[% id | html %]" >+ >[% content | $raw %]</select >+ > >+ [% END %] >+ >+ [% IF required %] >+ <div class="required_label required">Required</div> >+ [% END %] >+ [% SET required = 0 %] >+ </li> >+[% END %] >+ >+[% BLOCK book_text_input_fields %] >+ [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %] >+ [% PROCESS ill_text_input_field id = 'author' label = t('Author') value = whole.value.other.author %] >+ [% PROCESS ill_text_input_field id = 'editor' label = t('Editor') value = whole.value.other.editor %] >+ [% PROCESS ill_text_input_field id = 'publisher' label = t('Publisher') value = whole.value.other.publisher %] >+ [% PROCESS ill_text_input_field id = 'published_place' label = t('Place of publication') value = whole.value.other.published_place %] >+ [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %] >+ [% PROCESS ill_text_input_field id = 'part_edition' label = t('Part / Edition') value = whole.value.other.part_edition %] >+ [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %] >+ [% PROCESS ill_text_input_field id = 'isbn' label = t('ISBN') value = whole.value.other.isbn %] >+ [% PROCESS ill_text_input_field id = 'doi' label = t('DOI') value = whole.value.other.doi %] >+[% END %] >+ >+[% BLOCK journal_text_input_fields %] >+ [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %] >+ [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %] >+ [% PROCESS ill_text_input_field id = 'issue' label = t('Issue number') value = whole.value.other.issue %] >+ [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %] >+ [% PROCESS ill_text_input_field id = 'issn' label = t('ISSN') value = whole.value.other.issn %] >+[% END %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/article.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/article.inc >similarity index 100% >rename from koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/article.inc >rename to koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/article.inc >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/book.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/book.inc >similarity index 100% >rename from koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/book.inc >rename to koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/book.inc >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/chapter.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/chapter.inc >similarity index 100% >rename from koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/chapter.inc >rename to koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/chapter.inc >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/conference.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/conference.inc >similarity index 100% >rename from koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/conference.inc >rename to koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/conference.inc >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/dvd.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/dvd.inc >similarity index 100% >rename from koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/dvd.inc >rename to koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/dvd.inc >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/journal.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/journal.inc >similarity index 100% >rename from koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/journal.inc >rename to koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/journal.inc >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/other.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/other.inc >similarity index 100% >rename from koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/other.inc >rename to koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/other.inc >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/resource.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/resource.inc >similarity index 100% >rename from koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/resource.inc >rename to koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/resource.inc >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/thesis.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/thesis.inc >similarity index 100% >rename from koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/inc/forms/thesis.inc >rename to koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/forms/thesis.inc >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/shared.js b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/shared.js >new file mode 100644 >index 00000000000..46623bc0f7f >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/ill/backends/Standard/shared/shared.js >@@ -0,0 +1,46 @@ >+document.addEventListener("DOMContentLoaded", function () { >+ $("#add-new-fields").click(function (e) { >+ e.preventDefault(); >+ var row = >+ '<li class="form-horizontal">' + >+ '<input type="text" class="custom-name ' + >+ '" name="custom_key" placeholder="' + >+ __("key") + >+ '">' + >+ " " + >+ '<input type="text" id="custom-value" name="custom_value" class="' + >+ '" placeholder="' + >+ __("value") + >+ '"> ' + >+ '<button type="button" class="btn btn-danger btn-sm ' + >+ 'delete-new-field">' + >+ '<span class="fa fa-trash-can"></span> ' + >+ __("Delete") + >+ "</button></li>"; >+ $("#standard-fields").append(row); >+ }); >+ $("#standard-fields").on("click", ".delete-new-field", function (event) { >+ event.preventDefault(); >+ $(event.target).parent().remove(); >+ }); >+ $("#type").change(function () { >+ $("#create_form").prepend( >+ '<input type="hidden" name="change_type" value="1" />' >+ ); >+ $("#create_form").submit(); >+ }); >+ $("#standard-fields").on("keyup", ".custom-name", function () { >+ var val = $(this).val(); >+ if (core.indexOf(val.toLowerCase()) > -1) { >+ $("#custom-warning") >+ .text(__("The name '%s' is not permitted").format(val)) >+ .show(); >+ $("#ill-submit").attr("disabled", true); >+ $("#add-new-fields").attr("disabled", true); >+ } else { >+ $("#custom-warning").hide(); >+ $("#ill-submit").attr("disabled", false); >+ $("#add-new-fields").attr("disabled", false); >+ } >+ }); >+}); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/create.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/create.inc >index 31c8d5959fb..4ef7691762b 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/create.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/create.inc >@@ -1,7 +1,6 @@ > [% USE Koha %] > [% PROCESS 'i18n.inc' %] >-[% cwd = whole.cwd %] >-[% PROCESS "${cwd}/shared-includes/form_input_helpers.inc" %] >+[% PROCESS "ill/backends/Standard/shared/form_input_helpers.inc" %] > [% IF whole.error %] > [% IF whole.status == 'missing_identifier' %] > <div class="alert alert-warning"> <strong>Please note:</strong> Mandatory field Identifier is missing. </div> >@@ -102,9 +101,9 @@ > </fieldset> > [% type = whole.value.other.type %] > [% IF type %] >- [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %] >+ [% INCLUDE "ill/backends/Standard/shared/forms/${type}.inc" %] > [% END %] >- [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] >+ [% INCLUDE "ill/backends/Standard/shared/custom_fields.inc" %] > [% IF whole.value.other.type && unauthenticated_ill && !logged_in_user %] > <fieldset class="rows" id="illrequest_captcha"> > <legend>Verification</legend> >@@ -134,8 +133,9 @@ > [% END %] > [% BLOCK backend_jsinclude %] > <script> >+ var core = [ [% whole.core | $raw %] ]; > // <![CDATA[] >- [% INCLUDE "${cwd}/shared-includes/shared.js" %] >+ [% INCLUDE "ill/backends/Standard/shared/shared.js" %] > // ]]> > </script> > [% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/form_input_helpers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/form_input_helpers.inc >deleted file mode 100644 >index 5ac8be9b868..00000000000 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/form_input_helpers.inc >+++ /dev/null >@@ -1,52 +0,0 @@ >-[% BLOCK ill_text_input_field %] >- <li> >- <label for="[% id | html %]">[% label | html %]:</label> >- [% IF opac %] >- <input class="form-control input-fluid" type="text" name="[% id | html %]" id="[% id | html%]" value="[% value | html %]" /> >- [% ELSE %] >- <input type="text" name="[% id | html %]" id="[% id | html%]" value="[% value | html %]" /> >- [% END %] >- [% IF required %] >- <div class="required_label required">Required</div> >- [% END %] >- [% SET required = 0 %] >- </li> >-[% END %] >- >-[% BLOCK ill_select_field %] >- <li> >- <label for="[% id | html %]">[% label | html %]:</label> >- [% IF opac %] >- <select class="form-select input-fluid" name="[% id | html %]" id="[% id | html %]"> >- [% ELSE %] >- <select name="[% id | html %]" id="[% id | html %]"> >- [% END %] >- [% content | $raw %] >- </select> >- [% IF required %] >- <div class="required_label required">Required</div> >- [% END %] >- [% SET required = 0 %] >- </li> >-[% END %] >- >-[% BLOCK book_text_input_fields %] >- [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %] >- [% PROCESS ill_text_input_field id = 'author' label = t('Author') value = whole.value.other.author %] >- [% PROCESS ill_text_input_field id = 'editor' label = t('Editor') value = whole.value.other.editor %] >- [% PROCESS ill_text_input_field id = 'publisher' label = t('Publisher') value = whole.value.other.publisher %] >- [% PROCESS ill_text_input_field id = 'published_place' label = t('Place of publication') value = whole.value.other.published_place %] >- [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %] >- [% PROCESS ill_text_input_field id = 'part_edition' label = t('Part / Edition') value = whole.value.other.part_edition %] >- [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %] >- [% PROCESS ill_text_input_field id = 'isbn' label = t('ISBN') value = whole.value.other.isbn %] >- [% PROCESS ill_text_input_field id = 'doi' label = t('DOI') value = whole.value.other.doi %] >-[% END %] >- >-[% BLOCK journal_text_input_fields %] >- [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %] >- [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %] >- [% PROCESS ill_text_input_field id = 'issue' label = t('Issue number') value = whole.value.other.issue %] >- [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %] >- [% PROCESS ill_text_input_field id = 'issn' label = t('ISSN') value = whole.value.other.issn %] >-[% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/shared.js b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/shared.js >deleted file mode 100644 >index c65fcdab401..00000000000 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/shared.js >+++ /dev/null >@@ -1,44 +0,0 @@ >-var core = [ [% whole.core %] ]; >-var opac = [% opac || 0 %]; >-document.addEventListener('DOMContentLoaded', function() { >- $('#add-new-fields').click(function(e) { >- e.preventDefault(); >- var row = '<li class="form-horizontal">' + >- '<input type="text" class="custom-name ' + >- ( opac ? 'form-control input-fluid custom-field-input' : '') + >- '" name="custom_key" placeholder="'+__('key')+'">' + >- ' ' + >- '<input type="text" id="custom-value" name="custom_value" class="' + >- ( opac ? 'form-control input-fluid custom-field-input' : '') +'" placeholder="'+__('value')+'"> ' + >- '<button type="button" class="btn btn-danger btn-sm ' + >- 'delete-new-field">' + >- '<span class="fa fa-trash-can"></span> ' + >- __('Delete') + >- '</button></li>'; >- $('#standard-fields').append(row); >- }); >- $('#standard-fields').on('click', '.delete-new-field', >- function(event) { >- event.preventDefault(); >- $(event.target).parent().remove(); >- } >- ); >- $('#type').change(function() { >- $('#create_form').prepend( >- '<input type="hidden" name="change_type" value="1" />' >- ); >- $('#create_form').submit(); >- }); >- $('#standard-fields').on('keyup', '.custom-name', function() { >- var val = $(this).val(); >- if (core.indexOf(val.toLowerCase()) > -1) { >- $('#custom-warning').text(__("The name '%s' is not permitted").format(val)).show(); >- $('#ill-submit').attr('disabled', true); >- $('#add-new-fields').attr('disabled', true); >- } else { >- $('#custom-warning').hide(); >- $('#ill-submit').attr('disabled', false); >- $('#add-new-fields').attr('disabled', false); >- } >- }); >-}); >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/custom_fields.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/custom_fields.inc >similarity index 100% >rename from koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/custom_fields.inc >rename to koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/custom_fields.inc >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/form_input_helpers.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/form_input_helpers.inc >new file mode 100644 >index 00000000000..79d26fba132 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/form_input_helpers.inc >@@ -0,0 +1,56 @@ >+[% USE raw %] >+[% BLOCK ill_text_input_field %] >+ <li> >+ <label for="[% id | html %]">[% label | html %]:</label> >+ [% IF opac %] >+ <input class="form-control input-fluid" type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" /> >+ [% ELSE %] >+ <input type="text" name="[% id | html %]" id="[% id | html %]" value="[% value | html %]" /> >+ [% END %] >+ [% IF required %] >+ <div class="required_label required">Required</div> >+ [% END %] >+ [% SET required = 0 %] >+ </li> >+[% END %] >+ >+[% BLOCK ill_select_field %] >+ <li> >+ <label for="[% id | html %]">[% label | html %]:</label> >+ [% IF opac %] >+ <select class="form-select input-fluid" name="[% id | html %]" id="[% id | html %]" >+ >[% content | $raw %]</select >+ > >+ [% ELSE %] >+ <select name="[% id | html %]" id="[% id | html %]" >+ >[% content | $raw %]</select >+ > >+ [% END %] >+ >+ [% IF required %] >+ <div class="required_label required">Required</div> >+ [% END %] >+ [% SET required = 0 %] >+ </li> >+[% END %] >+ >+[% BLOCK book_text_input_fields %] >+ [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %] >+ [% PROCESS ill_text_input_field id = 'author' label = t('Author') value = whole.value.other.author %] >+ [% PROCESS ill_text_input_field id = 'editor' label = t('Editor') value = whole.value.other.editor %] >+ [% PROCESS ill_text_input_field id = 'publisher' label = t('Publisher') value = whole.value.other.publisher %] >+ [% PROCESS ill_text_input_field id = 'published_place' label = t('Place of publication') value = whole.value.other.published_place %] >+ [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %] >+ [% PROCESS ill_text_input_field id = 'part_edition' label = t('Part / Edition') value = whole.value.other.part_edition %] >+ [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %] >+ [% PROCESS ill_text_input_field id = 'isbn' label = t('ISBN') value = whole.value.other.isbn %] >+ [% PROCESS ill_text_input_field id = 'doi' label = t('DOI') value = whole.value.other.doi %] >+[% END %] >+ >+[% BLOCK journal_text_input_fields %] >+ [% PROCESS ill_text_input_field id = 'title' label = t('Title') value = whole.value.other.title %] >+ [% PROCESS ill_text_input_field id = 'volume' label = t('Volume') value = whole.value.other.volume %] >+ [% PROCESS ill_text_input_field id = 'issue' label = t('Issue number') value = whole.value.other.issue %] >+ [% PROCESS ill_text_input_field id = 'year' label = t('Year') value = whole.value.other.year %] >+ [% PROCESS ill_text_input_field id = 'issn' label = t('ISSN') value = whole.value.other.issn %] >+[% END %] >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/article.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/article.inc >similarity index 100% >rename from koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/article.inc >rename to koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/article.inc >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/book.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/book.inc >similarity index 100% >rename from koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/book.inc >rename to koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/book.inc >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/chapter.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/chapter.inc >similarity index 100% >rename from koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/chapter.inc >rename to koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/chapter.inc >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/conference.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/conference.inc >similarity index 100% >rename from koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/conference.inc >rename to koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/conference.inc >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/dvd.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/dvd.inc >similarity index 100% >rename from koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/dvd.inc >rename to koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/dvd.inc >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/journal.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/journal.inc >similarity index 100% >rename from koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/journal.inc >rename to koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/journal.inc >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/other.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/other.inc >similarity index 100% >rename from koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/other.inc >rename to koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/other.inc >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/resource.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/resource.inc >similarity index 100% >rename from koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/resource.inc >rename to koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/resource.inc >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/thesis.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/thesis.inc >similarity index 100% >rename from koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/inc/forms/thesis.inc >rename to koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/forms/thesis.inc >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/shared.js b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/shared.js >new file mode 100644 >index 00000000000..493a4146c64 >--- /dev/null >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/ill/backends/Standard/shared/shared.js >@@ -0,0 +1,48 @@ >+document.addEventListener("DOMContentLoaded", function () { >+ $("#add-new-fields").click(function (e) { >+ e.preventDefault(); >+ var row = >+ '<li class="form-horizontal">' + >+ '<input type="text" class="custom-name ' + >+ "form-control input-fluid custom-field-input" + >+ '" name="custom_key" placeholder="' + >+ __("key") + >+ '">' + >+ " " + >+ '<input type="text" id="custom-value" name="custom_value" class="' + >+ "form-control input-fluid custom-field-input" + >+ '" placeholder="' + >+ __("value") + >+ '"> ' + >+ '<button type="button" class="btn btn-danger btn-sm ' + >+ 'delete-new-field">' + >+ '<span class="fa fa-trash-can"></span> ' + >+ __("Delete") + >+ "</button></li>"; >+ $("#standard-fields").append(row); >+ }); >+ $("#standard-fields").on("click", ".delete-new-field", function (event) { >+ event.preventDefault(); >+ $(event.target).parent().remove(); >+ }); >+ $("#type").change(function () { >+ $("#create_form").prepend( >+ '<input type="hidden" name="change_type" value="1" />' >+ ); >+ $("#create_form").submit(); >+ }); >+ $("#standard-fields").on("keyup", ".custom-name", function () { >+ var val = $(this).val(); >+ if (core.indexOf(val.toLowerCase()) > -1) { >+ $("#custom-warning") >+ .text(__("The name '%s' is not permitted").format(val)) >+ .show(); >+ $("#ill-submit").attr("disabled", true); >+ $("#add-new-fields").attr("disabled", true); >+ } else { >+ $("#custom-warning").hide(); >+ $("#ill-submit").attr("disabled", false); >+ $("#add-new-fields").attr("disabled", false); >+ } >+ }); >+}); >-- >2.49.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 38340
:
177749
|
177750
|
178057
|
178058
|
178079
|
178080
|
178414
|
178415
|
178416
|
178418
|
178420
|
178421
|
178422
|
180066
|
180067
|
180068
|
181215
|
181216
|
181217
|
181294
|
181391
|
181392
|
181435
|
181541
|
181542
|
181543
|
181544
|
181549