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> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
parent
541929ea29
commit
a36145eb8d
|
|
@ -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 };
|
||||
|
|
@ -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 };
|
||||
|
|
@ -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 };
|
||||
|
|
@ -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' %]
|
||||
|
|
@ -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' %]
|
||||
|
|
@ -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' %]
|
||||
Loading…
Reference in New Issue