Bugzilla – Attachment 134445 Details for
Bug 30604
Add value builders for UNIMARC 146 ($a, $h and $i)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30604: Add value builders for UNIMARC 146 ($a, $h and $i)
Bug-30604-Add-value-builders-for-UNIMARC-146-a-h-a.patch (text/plain), 19.53 KB, created by
David Nind
on 2022-05-01 21:24:10 UTC
(
hide
)
Description:
Bug 30604: Add value builders for UNIMARC 146 ($a, $h and $i)
Filename:
MIME Type:
Creator:
David Nind
Created:
2022-05-01 21:24:10 UTC
Size:
19.53 KB
patch
obsolete
>From 8e7c8f62b0b0f9f101f8a6298e5b379019e7afdd Mon Sep 17 00:00:00 2001 >From: Julian Maurice <julian.maurice@biblibre.com> >Date: Tue, 18 Jan 2022 14:36:34 +0100 >Subject: [PATCH] Bug 30604: Add value builders for UNIMARC 146 ($a, $h and $i) > >Test plan: >1. Configure the default MARC framework to use those value builders: > - unimarc_field_146a for 146$a > - unimarc_field_146h for 146$h > - unimarc_field_146i for 146$i >2. Verify that they all work correctly according to >https://www.ifla.org/files/assets/uca/unimarc_updates/BIBLIOGRAPHIC/u-b_146.pdf > >Signed-off-by: David Nind <david@davidnind.com> >--- > .../value_builder/unimarc_field_146a.pl | 71 +++++++++++++++ > .../value_builder/unimarc_field_146h.pl | 89 +++++++++++++++++++ > .../value_builder/unimarc_field_146i.pl | 89 +++++++++++++++++++ > .../value_builder/unimarc_field_146a.tt | 47 ++++++++++ > .../value_builder/unimarc_field_146h.tt | 58 ++++++++++++ > .../value_builder/unimarc_field_146i.tt | 58 ++++++++++++ > 6 files changed, 412 insertions(+) > create mode 100755 cataloguing/value_builder/unimarc_field_146a.pl > create mode 100755 cataloguing/value_builder/unimarc_field_146h.pl > create mode 100755 cataloguing/value_builder/unimarc_field_146i.pl > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146a.tt > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146h.tt > create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146i.tt > >diff --git a/cataloguing/value_builder/unimarc_field_146a.pl b/cataloguing/value_builder/unimarc_field_146a.pl >new file mode 100755 >index 0000000000..51f0861325 >--- /dev/null >+++ b/cataloguing/value_builder/unimarc_field_146a.pl >@@ -0,0 +1,71 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use C4::Auth qw( get_template_and_user ); >+use C4::Output qw( output_html_with_http_headers ); >+ >+use Koha::I18N; >+ >+my $builder = sub { >+ my $params = shift; >+ my $id = $params->{id}; >+ >+ return qq| >+<script> >+function Click$id(event) { >+ event.preventDefault(); >+ const value = document.getElementById(event.data.id).value; >+ const url = new URL('/cgi-bin/koha/cataloguing/plugin_launcher.pl', location); >+ url.searchParams.set('plugin_name', 'unimarc_field_146a.pl'); >+ url.searchParams.set('id', event.data.id); >+ url.searchParams.set('value', value); >+ window.open(url.toString(), 'tag_editor', 'width=700,height=700,toolbar=false,scrollbars=yes'); >+} >+</script>|; >+}; >+ >+my $launcher = sub { >+ my $params = shift; >+ my $cgi = $params->{cgi}; >+ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ >+ template_name => "cataloguing/value_builder/unimarc_field_146a.tt", >+ query => $cgi, >+ type => 'intranet', >+ flagsrequired => { editcatalogue => '*' }, >+ }); >+ >+ my @options = ( >+ { value => 'a', label => __('vocal a cappella music') }, >+ { value => 'b', label => __('instrumental music') }, >+ { value => 'c', label => __('vocal and instrumental music') }, >+ { value => 'd', label => __('electroacoustic music') }, >+ { value => 'e', label => __('mixed media music (electroacoustic and other media)') }, >+ { value => 'u', label => __('undefined, variable (e.g. Renaissance vocal or instrumental music)') }, >+ { value => 'z', label => __('other (e.g. ordinary objects or natural sounds)') }, >+ ); >+ >+ $template->param( >+ id => scalar $cgi->param('id'), >+ value => scalar $cgi->param('value'), >+ options => \@options, >+ ); >+ output_html_with_http_headers $cgi, $cookie, $template->output; >+}; >+ >+return { builder => $builder, launcher => $launcher }; >diff --git a/cataloguing/value_builder/unimarc_field_146h.pl b/cataloguing/value_builder/unimarc_field_146h.pl >new file mode 100755 >index 0000000000..84ad417b1a >--- /dev/null >+++ b/cataloguing/value_builder/unimarc_field_146h.pl >@@ -0,0 +1,89 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use C4::Auth qw( get_template_and_user ); >+use C4::Output qw( output_html_with_http_headers ); >+ >+use Koha::I18N; >+ >+my $builder = sub { >+ my $params = shift; >+ my $id = $params->{id}; >+ >+ return qq| >+<script> >+function Click$id(event) { >+ event.preventDefault(); >+ const value = document.getElementById(event.data.id).value; >+ const url = new URL('/cgi-bin/koha/cataloguing/plugin_launcher.pl', location); >+ url.searchParams.set('plugin_name', 'unimarc_field_146h.pl'); >+ url.searchParams.set('id', event.data.id); >+ url.searchParams.set('value', value); >+ window.open(url.toString(), 'tag_editor', 'width=700,height=700,toolbar=false,scrollbars=yes'); >+} >+</script>|; >+}; >+ >+my $launcher = sub { >+ my $params = shift; >+ my $cgi = $params->{cgi}; >+ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ >+ template_name => "cataloguing/value_builder/unimarc_field_146h.tt", >+ query => $cgi, >+ type => 'intranet', >+ flagsrequired => { editcatalogue => '*' }, >+ }); >+ >+ my @options = ( >+ { value => 'a', label => __('performers total') }, >+ { value => 'b', label => __('brass instruments') }, >+ { value => 'c', label => __('choirs') }, >+ { value => 'd', label => __('wind instruments') }, >+ { value => 'e', label => __('electro-acoustic instruments') }, >+ { value => 'i', label => __('instruments total') }, >+ { value => 'j', label => __('solo instruments') }, >+ { value => 'k', label => __('keyboard instruments') }, >+ { value => 'l', label => __('solo voices') }, >+ { value => 'm', label => __('miscellaneous, other instruments') }, >+ { value => 'o', label => __('orchestras') }, >+ { value => 'p', label => __('percussion instruments') }, >+ { value => 'q', label => __('conductors') }, >+ { value => 's', label => __('bowed string instruments') }, >+ { value => 't', label => __('plucked string instruments') }, >+ { value => 'v', label => __('voices total') }, >+ { value => 'w', label => __('woodwind instruments') }, >+ { value => 'x', label => __('choral voices') }, >+ { value => 'y', label => __('ensemble instruments') }, >+ { value => 'z', label => __('devices, other performers') }, >+ ); >+ >+ my $value = $cgi->param('value'); >+ my $number = substr($value, 0, 3); >+ my $category = substr($value, 3, 1); >+ >+ $template->param( >+ id => scalar $cgi->param('id'), >+ number => $number, >+ category => $category, >+ options => \@options, >+ ); >+ output_html_with_http_headers $cgi, $cookie, $template->output; >+}; >+ >+return { builder => $builder, launcher => $launcher }; >diff --git a/cataloguing/value_builder/unimarc_field_146i.pl b/cataloguing/value_builder/unimarc_field_146i.pl >new file mode 100755 >index 0000000000..609218db4e >--- /dev/null >+++ b/cataloguing/value_builder/unimarc_field_146i.pl >@@ -0,0 +1,89 @@ >+#!/usr/bin/perl >+ >+# This file is part of Koha. >+# >+# Koha is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by >+# the Free Software Foundation; either version 3 of the License, or >+# (at your option) any later version. >+# >+# Koha is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >+# GNU General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License >+# along with Koha; if not, see <http://www.gnu.org/licenses>. >+ >+use Modern::Perl; >+ >+use C4::Auth qw( get_template_and_user ); >+use C4::Output qw( output_html_with_http_headers ); >+ >+use Koha::I18N; >+ >+my $builder = sub { >+ my $params = shift; >+ my $id = $params->{id}; >+ >+ return qq| >+<script> >+function Click$id(event) { >+ event.preventDefault(); >+ const value = document.getElementById(event.data.id).value; >+ const url = new URL('/cgi-bin/koha/cataloguing/plugin_launcher.pl', location); >+ url.searchParams.set('plugin_name', 'unimarc_field_146i.pl'); >+ url.searchParams.set('id', event.data.id); >+ url.searchParams.set('value', value); >+ window.open(url.toString(), 'tag_editor', 'width=700,height=700,toolbar=false,scrollbars=yes'); >+} >+</script>|; >+}; >+ >+my $launcher = sub { >+ my $params = shift; >+ my $cgi = $params->{cgi}; >+ my ( $template, $loggedinuser, $cookie ) = get_template_and_user({ >+ template_name => "cataloguing/value_builder/unimarc_field_146i.tt", >+ query => $cgi, >+ type => 'intranet', >+ flagsrequired => { editcatalogue => '*' }, >+ }); >+ >+ my @options = ( >+ { value => 'a', label => __('performers total') }, >+ { value => 'b', label => __('brass instruments') }, >+ { value => 'c', label => __('choirs') }, >+ { value => 'd', label => __('wind instruments') }, >+ { value => 'e', label => __('electro-acoustic instruments') }, >+ { value => 'i', label => __('instruments total') }, >+ { value => 'j', label => __('solo instruments') }, >+ { value => 'k', label => __('keyboard instruments') }, >+ { value => 'l', label => __('solo voices') }, >+ { value => 'm', label => __('miscellaneous, other instruments') }, >+ { value => 'o', label => __('orchestras') }, >+ { value => 'p', label => __('percussion instruments') }, >+ { value => 'q', label => __('conductors') }, >+ { value => 's', label => __('bowed string instruments') }, >+ { value => 't', label => __('plucked string instruments') }, >+ { value => 'v', label => __('voices total') }, >+ { value => 'w', label => __('woodwind instruments') }, >+ { value => 'x', label => __('choral voices') }, >+ { value => 'y', label => __('ensemble instruments') }, >+ { value => 'z', label => __('devices, other performers') }, >+ ); >+ >+ my $value = $cgi->param('value'); >+ my $number = substr($value, 0, 3); >+ my $category = substr($value, 3, 1); >+ >+ $template->param( >+ id => scalar $cgi->param('id'), >+ number => $number, >+ category => $category, >+ options => \@options, >+ ); >+ output_html_with_http_headers $cgi, $cookie, $template->output; >+}; >+ >+return { builder => $builder, launcher => $launcher }; >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146a.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146a.tt >new file mode 100644 >index 0000000000..4e0b5d021c >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146a.tt >@@ -0,0 +1,47 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Framework plugin unimarc_field_146a › Cataloguing › Koha</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+ >+<body id="unimarc_field_146a" class="cat"> >+ <div class="container-fluid"> >+ <h1>Framework plugin for UNIMARC 146$a</h1> >+ >+ <form class="form-horizontal" id="form"> >+ <input type="hidden" id="id" name="id" value="[% id | html %]"> >+ >+ <div class="form-group"> >+ <label for="type" class="col-sm-2 control-label">Type of Performance Medium</label> >+ <div class="col-sm-10"> >+ <select class="form-control" id="type"> >+ [% FOREACH option IN options %] >+ [% IF option.value == value %] >+ <option value="[% option.value | html %]" selected>[% option.label | html %]</option> >+ [% ELSE %] >+ <option value="[% option.value | html %]">[% option.label | html %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </div> >+ </div> >+ >+ <div class="form-group"> >+ <div class="col-sm-offset-2 col-sm-10"> >+ <button type="submit">OK</button> >+ <a href="#" class="cancel close">Cancel</a> >+ </div> >+ </div> >+ </form> >+ </div> >+ >+ <script> >+ document.getElementById('form').addEventListener('submit', function (ev) { >+ ev.preventDefault(); >+ const id = document.getElementById('id').value; >+ const type = document.getElementById('type').value; >+ opener.document.getElementById(id).value = type; >+ window.close(); >+ }); >+ </script> >+ >+[% INCLUDE 'popup-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146h.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146h.tt >new file mode 100644 >index 0000000000..a8c736ddda >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146h.tt >@@ -0,0 +1,58 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Framework plugin unimarc_field_146h › Cataloguing › Koha</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+ >+<body id="unimarc_field_146h" class="cat"> >+ <div class="container-fluid"> >+ <h1>Framework plugin for UNIMARC 146$h</h1> >+ >+ <form class="form-horizontal" id="form"> >+ <input type="hidden" id="id" name="id" value="[% id | html %]"> >+ >+ <div class="form-group"> >+ <label for="number" class="col-sm-2 control-label">Number of parts</label> >+ <div class="col-sm-10"> >+ <input type="text" inputmode="numeric" pattern="[0-9]{1,3}" id="number" name="number" title="a number between 0 and 999 (inclusive)" value="[% number | html %]"> >+ <p class="help-block"> >+ A number between 0 and 999 (inclusive) >+ </p> >+ </div> >+ </div> >+ <div class="form-group"> >+ <label for="category" class="col-sm-2 control-label">Category</label> >+ <div class="col-sm-10"> >+ <select class="form-control" id="category"> >+ [% FOREACH option IN options %] >+ [% IF option.value == category %] >+ <option value="[% option.value | html %]" selected>[% option.label | html %]</option> >+ [% ELSE %] >+ <option value="[% option.value | html %]">[% option.label | html %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </div> >+ </div> >+ >+ <div class="form-group"> >+ <div class="col-sm-offset-2 col-sm-10"> >+ <button type="submit">OK</button> >+ <a href="#" class="cancel close">Cancel</a> >+ </div> >+ </div> >+ </form> >+ </div> >+ >+ <script> >+ document.getElementById('form').addEventListener('submit', function (ev) { >+ ev.preventDefault(); >+ const id = document.getElementById('id').value; >+ const number = document.getElementById('number').value; >+ const category = document.getElementById('category').value; >+ const value = number.toString().padStart(3, '0') + category; >+ opener.document.getElementById(id).value = value; >+ window.close(); >+ }); >+ </script> >+ >+[% INCLUDE 'popup-bottom.inc' %] >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146i.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146i.tt >new file mode 100644 >index 0000000000..189219b0bd >--- /dev/null >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146i.tt >@@ -0,0 +1,58 @@ >+[% INCLUDE 'doc-head-open.inc' %] >+<title>Framework plugin unimarc_field_146i › Cataloguing › Koha</title> >+[% INCLUDE 'doc-head-close.inc' %] >+</head> >+ >+<body id="unimarc_field_146i" class="cat"> >+ <div class="container-fluid"> >+ <h1>Framework plugin for UNIMARC 146$i</h1> >+ >+ <form class="form-horizontal" id="form"> >+ <input type="hidden" id="id" name="id" value="[% id | html %]"> >+ >+ <div class="form-group"> >+ <label for="number" class="col-sm-2 control-label">Number of players</label> >+ <div class="col-sm-10"> >+ <input type="text" inputmode="numeric" pattern="[0-9]{1,3}" id="number" name="number" title="a number between 0 and 999 (inclusive)" value="[% number | html %]"> >+ <p class="help-block"> >+ A number between 0 and 999 (inclusive) >+ </p> >+ </div> >+ </div> >+ <div class="form-group"> >+ <label for="category" class="col-sm-2 control-label">Category</label> >+ <div class="col-sm-10"> >+ <select class="form-control" id="category"> >+ [% FOREACH option IN options %] >+ [% IF option.value == category %] >+ <option value="[% option.value | html %]" selected>[% option.label | html %]</option> >+ [% ELSE %] >+ <option value="[% option.value | html %]">[% option.label | html %]</option> >+ [% END %] >+ [% END %] >+ </select> >+ </div> >+ </div> >+ >+ <div class="form-group"> >+ <div class="col-sm-offset-2 col-sm-10"> >+ <button type="submit">OK</button> >+ <a href="#" class="cancel close">Cancel</a> >+ </div> >+ </div> >+ </form> >+ </div> >+ >+ <script> >+ document.getElementById('form').addEventListener('submit', function (ev) { >+ ev.preventDefault(); >+ const id = document.getElementById('id').value; >+ const number = document.getElementById('number').value; >+ const category = document.getElementById('category').value; >+ const value = number.toString().padStart(3, '0') + category; >+ opener.document.getElementById(id).value = value; >+ window.close(); >+ }); >+ </script> >+ >+[% INCLUDE 'popup-bottom.inc' %] >-- >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 30604
:
133727
|
134445
|
134718