From 05b746b87ad1ccf9f350a0dd498e79d3f2f8c925 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi 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' %] -

Please note: Mandatory field Identifier is missing.

-[% ELSIF whole.status == 'missing_branch' %] -

Please note: Library is a mandatory field.

-[% ELSIF whole.status == 'invalid_borrower' %] -

Please note: The patron details you entered are invalid.

-[% ELSIF whole.status == 'invalid_branch' %] -

Please note: The library you chose is invalid.

-[% ELSE %] -

Unhandled error

-[% END %] + [% IF whole.status == 'missing_identifier' %] +

Please note: Mandatory field Identifier is missing.

+ [% ELSIF whole.status == 'missing_branch' %] +

Please note: Library is a mandatory field.

+ [% ELSIF whole.status == 'invalid_borrower' %] +

Please note: The patron details you entered are invalid.

+ [% ELSIF whole.status == 'invalid_branch' %] +

Please note: The library you chose is invalid.

+ [% ELSE %] +

Unhandled error

+ [% END %] [% END %] [% IF whole.stage == "form" %] -

Create an ILL request

-
- [% INCLUDE 'csrf-token.inc' %] -
- General details -
    -
  1. - - -
  2. -
-
- [% type = whole.value.other.type %] - [% IF type %] - [% INCLUDE "${cwd}/shared-includes/forms/${type}.inc" %] - [% END %] - [% INCLUDE "${cwd}/shared-includes/custom_fields.inc" %] -
- Patron options -
    -
  1. - - - Required -
  2. -
  3. - - - Required -
  4. -
-
-
- - Cancel -
- - - -
-[% BLOCK backend_jsinclude %] - -[% END %] - -[% ELSIF whole.stage == "borrowers" %] - -

Borrower selection

-
- [% FOREACH prop IN whole.value.other.keys %] - [% IF prop != 'custom_key' && prop != 'custom_value' && prop != 'cardnumber' %] - - [% END %] - [% END %] - [% keys = whole.value.other.custom_key.split('\0') %] - [% values = whole.value.other.custom_value.split('\0') %] - [% i = 0 %] - [% FOREACH key IN keys %] - - - [% i = i + 1 %] - [% END %] -
- Available borrowers for surname [% surname | html %] - [% FOREACH opt IN whole.value %] - [% IF opt.key == "brw" %] -
    -
  1. - - -
  2. -
+

Create an ILL request

+ + [% INCLUDE 'csrf-token.inc' %] +
+ General details +
    +
  1. + + +
  2. +
+
+ [% type = whole.value.other.type %] + [% IF type %] + [% INCLUDE "ill/backends/Standard/shared/forms/${type}.inc" %] + [% END %] + [% INCLUDE "ill/backends/Standard/shared/custom_fields.inc" %] +
+ Patron options +
    +
  1. + + + Required +
  2. +
  3. + + + Required +
  4. +
+
+
+ + Cancel +
+ + + + + [% BLOCK backend_jsinclude %] + [% END %] - [% END %] -
-
- - Cancel -
- - +[% ELSIF whole.stage == "borrowers" %] + +

Borrower selection

+
+ [% FOREACH prop IN whole.value.other.keys %] + [% IF prop != 'custom_key' && prop != 'custom_value' && prop != 'cardnumber' %] + + [% END %] + [% END %] + [% keys = whole.value.other.custom_key.split('\0') %] + [% values = whole.value.other.custom_value.split('\0') %] + [% i = 0 %] + [% FOREACH key IN keys %] + + + [% i = i + 1 %] + [% END %] +
+ Available borrowers for surname [% surname | html %] + [% FOREACH opt IN whole.value %] + [% IF opt.key == "brw" %] +
    +
  1. + + +
  2. +
+ [% END %] + [% END %] +
+
+ + Cancel +
+
[% ELSE %] -

Unknown stage. This should not have happened. - -[% END %] \ No newline at end of file +

Unknown stage. This should not have happened.

+[% 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' %]

Please note: Mandatory field 'type' is missing.

@@ -70,9 +70,9 @@ [% 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" %]
Cancel @@ -84,8 +84,9 @@ [% BLOCK backend_jsinclude %] [% 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 %] -
  • - - [% IF opac %] - - [% ELSE %] - - [% END %] - [% IF required %] -
    Required
    - [% END %] - [% SET required = 0 %] -
  • -[% END %] - -[% BLOCK ill_select_field %] -
  • - - [% IF opac %] - - [% END %] - [% content | $raw %] - - [% IF required %] -
    Required
    - [% END %] - [% SET required = 0 %] -
  • -[% 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 = '
  • ' + - '' + - ' ' + - ' ' + - '
  • '; - $('#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( - '' - ); - $('#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' %]

    Please note: Mandatory field Identifier is missing.

    @@ -74,12 +75,11 @@
    - [% 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" %]
    Patron options
      @@ -107,8 +107,9 @@ [% BLOCK backend_jsinclude %] [% 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 %] +
    1. + + [% IF opac %] + + [% ELSE %] + + [% END %] + [% IF required %] +
      Required
      + [% END %] + [% SET required = 0 %] +
    2. +[% END %] + +[% BLOCK ill_select_field %] +
    3. + + [% IF opac %] + + [% ELSE %] + + [% END %] + + [% IF required %] +
      Required
      + [% END %] + [% SET required = 0 %] +
    4. +[% 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 = + '
    5. ' + + '' + + " " + + ' ' + + '
    6. "; + $("#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( + '' + ); + $("#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' %]
      Please note: Mandatory field Identifier is missing.
      @@ -102,9 +101,9 @@
    [% 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 %]
    Verification @@ -134,8 +133,9 @@ [% END %] [% BLOCK backend_jsinclude %] [% 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 %] -
  • - - [% IF opac %] - - [% ELSE %] - - [% END %] - [% IF required %] -
    Required
    - [% END %] - [% SET required = 0 %] -
  • -[% END %] - -[% BLOCK ill_select_field %] -
  • - - [% IF opac %] - - [% END %] - [% content | $raw %] - - [% IF required %] -
    Required
    - [% END %] - [% SET required = 0 %] -
  • -[% 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 = '
  • ' + - '' + - ' ' + - ' ' + - '
  • '; - $('#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( - '' - ); - $('#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 %] +
  • + + [% IF opac %] + + [% ELSE %] + + [% END %] + [% IF required %] +
    Required
    + [% END %] + [% SET required = 0 %] +
  • +[% END %] + +[% BLOCK ill_select_field %] +
  • + + [% IF opac %] + + [% ELSE %] + + [% END %] + + [% IF required %] +
    Required
    + [% END %] + [% SET required = 0 %] +
  • +[% 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 = + '
  • ' + + '' + + " " + + ' ' + + '
  • "; + $("#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( + '' + ); + $("#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