Bug 30504: Value builder for field 181
authorjeremy breuillard <jeremy.breuillard@biblibre.com>
Thu, 3 Mar 2022 09:32:04 +0000 (10:32 +0100)
committerTomas Cohen Arazi <tomascohen@theke.io>
Fri, 19 Aug 2022 11:45:22 +0000 (08:45 -0300)
This patch provides values builders for the subfields $a, $b, $c and $2. Those are unimarc official codes who help to identify the kind of items

Test plan:
1)Go to Home > Cataloging > New record
2)Section 1 - field 181 : it contains subfields $a, $b, $c & $2
3)Inputs are writable but notice that no plugins are suggested
4)Apply patch and repeat 1) to 3)
5)Values builders plugins are available for $a, $b, $c and $2

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
cataloguing/value_builder/unimarc_field_181-2.pl [new file with mode: 0755]
cataloguing/value_builder/unimarc_field_181a.pl [new file with mode: 0755]
cataloguing/value_builder/unimarc_field_181b.pl [new file with mode: 0755]
cataloguing/value_builder/unimarc_field_181c.pl [new file with mode: 0755]
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181-2.tt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181a.tt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181b.tt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181c.tt [new file with mode: 0644]

diff --git a/cataloguing/value_builder/unimarc_field_181-2.pl b/cataloguing/value_builder/unimarc_field_181-2.pl
new file mode 100755 (executable)
index 0000000..f420c05
--- /dev/null
@@ -0,0 +1,65 @@
+#!/usr/bin/perl
+
+# Copyright 2014 Rijksmuseum
+#
+# 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 Date::Calc;
+
+use Koha::Util::FrameworkPlugin qw(wrapper);
+use C4::Auth qw( get_template_and_user );
+use CGI qw ( -utf8 );
+use C4::Context;
+use C4::Output qw( output_html_with_http_headers );
+
+my $builder= sub {
+    my $params = shift;
+    my $id = $params->{id};
+
+    return qq|
+<script>
+
+function Click$id(event) {
+    var fieldvalue=\$('#'+event.data.id).val();
+    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_181-2.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
+    return false; /* prevents scrolling */
+}
+</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_181-2.tt",
+        query => $cgi,
+        type => "intranet",
+        flagsrequired => {editcatalogue => '*'},
+    });
+    $template->param(
+        index => scalar $cgi->param('index'),
+        result => scalar $cgi->param('result'),
+        cgi => $cgi,
+    );
+    output_html_with_http_headers $cgi, $cookie, $template->output;
+};
+
+# Return the hashref with the builder and launcher to FrameworkPlugin object.
+# NOTE: If you do not need a popup but only use e.g. Focus, Blur etc. for a
+# particular plugin, you only need to define and return the builder.
+return { builder => $builder, launcher => $launcher };
diff --git a/cataloguing/value_builder/unimarc_field_181a.pl b/cataloguing/value_builder/unimarc_field_181a.pl
new file mode 100755 (executable)
index 0000000..a29691a
--- /dev/null
@@ -0,0 +1,74 @@
+#!/usr/bin/perl
+
+# Copyright 2014 Rijksmuseum
+#
+# 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 Date::Calc;
+
+use Koha::Util::FrameworkPlugin qw(wrapper);
+use C4::Auth qw( get_template_and_user );
+use CGI qw ( -utf8 );
+use C4::Context;
+use C4::Output qw( output_html_with_http_headers );
+
+my $builder= sub {
+    my $params = shift;
+    my $id = $params->{id};
+
+    return qq|
+<script>
+
+function Click$id(event) {
+    var fieldvalue=\$('#'+event.data.id).val();
+    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_181a.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
+    return false; /* prevents scrolling */
+}
+</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_181a.tt",
+        query => $cgi,
+        type => "intranet",
+        flagsrequired => {editcatalogue => '*'},
+    });
+    my $results = scalar $cgi->param('result');
+
+    $template->param(
+        index => scalar $cgi->param('index'),
+        result => $results,
+    );
+
+    # Return the result of the position in the string, ex: abcde = 1=a, 2=b, 3=c...
+    my @x = split(//, $results);
+    my $i = 1;
+    for my $fresult (@x) {
+        $template->param("f$i" => $fresult);
+        ++$i;
+    }
+    output_html_with_http_headers $cgi, $cookie, $template->output;
+};
+
+# Return the hashref with the builder and launcher to FrameworkPlugin object.
+# NOTE: If you do not need a popup but only use e.g. Focus, Blur etc. for a
+# particular plugin, you only need to define and return the builder.
+return { builder => $builder, launcher => $launcher };
diff --git a/cataloguing/value_builder/unimarc_field_181b.pl b/cataloguing/value_builder/unimarc_field_181b.pl
new file mode 100755 (executable)
index 0000000..d7dd470
--- /dev/null
@@ -0,0 +1,72 @@
+#!/usr/bin/perl
+
+# Copyright 2014 Rijksmuseum
+#
+# 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 Date::Calc;
+
+use Koha::Util::FrameworkPlugin qw(wrapper);
+use C4::Auth qw( get_template_and_user );
+use CGI qw ( -utf8 );
+use C4::Context;
+use C4::Output qw( output_html_with_http_headers );
+use Data::Dumper;
+
+my $builder= sub {
+    my $params = shift;
+    my $id = $params->{id};
+
+    return qq|
+<script>
+
+function Click$id(event) {
+    var fieldvalue=\$('#'+event.data.id).val();
+    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_181b.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
+    return false; /* prevents scrolling */
+}
+</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_181b.tt",
+        query => $cgi,
+        type => "intranet",
+        flagsrequired => {editcatalogue => '*'},
+    });
+    my $results = scalar $cgi->param('result');
+    $template->param(
+        index => scalar $cgi->param('index'),
+        result => $results,
+    );
+
+    # Return the result of the position in the string, ex: abcde = 1=a, 2=b, 3=c...
+    my @x = split(//, $results);
+    my $i = 1;
+    for my $fresult (@x) {
+        $template->param("f$i" => $fresult);
+        ++$i;
+    }
+
+    output_html_with_http_headers $cgi, $cookie, $template->output;
+};
+
+return { builder => $builder, launcher => $launcher };
diff --git a/cataloguing/value_builder/unimarc_field_181c.pl b/cataloguing/value_builder/unimarc_field_181c.pl
new file mode 100755 (executable)
index 0000000..49ac57d
--- /dev/null
@@ -0,0 +1,70 @@
+#!/usr/bin/perl
+
+# Copyright 2014 Rijksmuseum
+#
+# 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 Date::Calc;
+
+use Koha::Util::FrameworkPlugin qw(wrapper);
+use C4::Auth qw( get_template_and_user );
+use CGI qw ( -utf8 );
+use C4::Context;
+use C4::Output qw( output_html_with_http_headers );
+
+
+my $builder= sub {
+    my $params = shift;
+    my $id = $params->{id};
+
+    return qq|
+<script>
+
+function Click$id(event) {
+    var fieldvalue=\$('#'+event.data.id).val();
+    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_181c.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
+    return false; /* prevents scrolling */
+}
+</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_181c.tt",
+        query => $cgi,
+        type => "intranet",
+        flagsrequired => {editcatalogue => '*'},
+    });
+    my $results = scalar $cgi->param('result');
+    my $input_a = substr $results, 0, 3;
+
+    $template->param(
+        index => scalar $cgi->param('index'),
+        result => $results,
+        f1 => $input_a,
+    );
+
+    output_html_with_http_headers $cgi, $cookie, $template->output;
+};
+
+# Return the hashref with the builder and launcher to FrameworkPlugin object.
+# NOTE: If you do not need a popup but only use e.g. Focus, Blur etc. for a
+# particular plugin, you only need to define and return the builder.
+return { builder => $builder, launcher => $launcher };
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181-2.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181-2.tt
new file mode 100644 (file)
index 0000000..2aaf84e
--- /dev/null
@@ -0,0 +1,58 @@
+[% INCLUDE 'doc-head-open.inc' %]
+<title>Framework plugin example &rsaquo; Cataloguing &rsaquo; Koha</title>
+[% INCLUDE 'doc-head-close.inc' %]
+</head>
+
+<body id="cat_unimarc_field_182-2" class="cat" style="padding:1em;">
+
+<h3>UNIMARC field 181-2 builder</h3>
+
+<form name="f_pop" action="">
+<table>
+    <tr>
+        <td><label for="f0">System code :</label></td>
+        <td>
+            <select name="f0" id="f0">
+                [% IF ( f0 == "carr" ) %]
+                    <option value="RDAcarrier" selected="selected">RDA Carrier</option>
+                [% ELSE %]
+                    <option value="RDAcarrier">RDA Carrier</option>
+                [% END %]
+
+                [% IF ( f0 == "cont" ) %]
+                    <option value="RDAcontent" selected="selected">RDA Content</option>
+                [% ELSE %]
+                    <option value="RDAcontent">RDA Content</option>
+                [% END %]
+
+                [% IF ( f0 == "media" ) %]
+                    <option value="RDAmedia" selected="selected">RDA Media</option>
+                [% ELSE %]
+                    <option value="RDAmedia">RDA Media</option>
+                [% END %]
+
+                [% IF ( f0 == "frcarr" ) %]
+                    <option value="RDAfrCarrier" selected="selected">RDA fr Carrier</option>
+                [% ELSE %]
+                    <option value="RDAfrCarrier">RDA fr Carrier</option>
+                [% END %]
+            </select>
+        </td>
+    </tr>
+</table>
+<p><input type="button" value="OK"  onclick="submitMyForm();" /> <a href="#" class="cancel close">Cancel</a> </p>
+</form>
+
+<script>
+
+    function submitMyForm() {
+        var doc   = opener.document;
+        var field = doc.getElementById("[% index | html %]");
+
+        field.value = document.f_pop.f0.value;
+        window.close();
+        return false;
+    }
+</script>
+
+[% INCLUDE 'popup-bottom.inc' %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181a.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181a.tt
new file mode 100644 (file)
index 0000000..8878afa
--- /dev/null
@@ -0,0 +1,143 @@
+[% INCLUDE 'doc-head-open.inc' %]
+<title>Framework plugin example &rsaquo; Cataloguing &rsaquo; Koha</title>
+[% INCLUDE 'doc-head-close.inc' %]
+</head>
+
+<body id="cat_unimarc_field_181a" class="cat" style="padding:1em;">
+
+<h3>UNIMARC field 181a builder</h3>
+
+<form name="f_pop" action="">
+<table>
+    <tr>
+        <td><label for="f1">Content Form </label></td>
+        <td>
+            <select name="f1" id="f1">
+            [% IF ( f1 == "a" ) %]
+                <option value="a" selected="selected">a - dataset</option>
+            [% ELSE %]
+                <option value="a">a - dataset</option>
+            [% END %]
+
+            [% IF ( f1 == "b" ) %]
+                <option value="b" selected="selected">b - image</option>
+            [% ELSE %]
+                <option value="b">b - image</option>
+            [% END %]
+
+            [% IF ( f1 == "c" ) %]
+                <option value="c" selected="selected">c - movement</option>
+            [% ELSE %]
+                <option value="c">c - movement</option>
+            [% END %]
+
+            [% IF ( f1 == "d" ) %]
+                <option value="d" selected="selected">d - music</option>
+            [% ELSE %]
+                <option value="d">d - music</option>
+            [% END %]
+
+            [% IF ( f1 == "e" ) %]
+                <option value="e" selected="selected">e - object</option>
+            [% ELSE %]
+                <option value="e">e - object</option>
+            [% END %]
+
+            [% IF ( f1 == "f" ) %]
+                <option value="f" selected="selected">f - program</option>
+            [% ELSE %]
+                <option value="f">f - program</option>
+            [% END %]
+
+            [% IF ( f1 == "g" ) %]
+                <option value="g" selected="selected">g - sounds</option>
+            [% ELSE %]
+                <option value="g">g - sounds</option>
+            [% END %]
+
+            [% IF ( f1 == "h" ) %]
+                <option value="h" selected="selected">h - spoken word</option>
+            [% ELSE %]
+                <option value="h">h - spoken word</option>
+            [% END %]
+
+            [% IF ( f1 == "i" ) %]
+                <option value="i" selected="selected">i - text</option>
+            [% ELSE %]
+                <option value="i">i - text</option>
+            [% END %]
+
+            [% IF ( f1 == "m" ) %]
+                <option value="m" selected="selected">m - multiple contents forms</option>
+            [% ELSE %]
+                <option value="m">m - multiple contents forms</option>
+            [% END %]
+
+            [% IF ( f1 == "z" ) %]
+                <option value="z" selected="selected">z - other content form</option>
+            [% ELSE %]
+                <option value="z">z - other content form</option>
+            [% END %]
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td><label for="f2">Extent of applicability </label></td>
+        <td>
+            <select name="f2" id="f2">
+            [% IF ( f2 == "0" ) %]
+                <option value="0" selected="selected">0 - none</option>
+            [% ELSE %]
+                <option value="0">0 - none</option>
+            [% END %]
+
+            [% IF ( f2 == "1" ) %]
+                <option value="1" selected="selected">1 - some</option>
+            [% ELSE %]
+                <option value="1">1 - some</option>
+            [% END %]
+
+            [% IF ( f2 == "2" ) %]
+                <option value="2" selected="selected">2 - substantial</option>
+            [% ELSE %]
+                <option value="2">2 - substantial</option>
+            [% END %]
+
+            [% IF ( f2 == "3" ) %]
+                <option value="3" selected="selected">3 - predominate</option>
+            [% ELSE %]
+                <option value="3">3 - predominate</option>
+            [% END %]
+
+            [% IF ( f2 == "4" ) %]
+                <option value="4" selected="selected">4 - full</option>
+            [% ELSE %]
+                <option value="4">4 - full</option>
+            [% END %]
+
+            [% IF ( f2 == "" ) %]
+                <option value=" " selected="selected"># - position not used</option>
+            [% ELSE %]
+                <option value=" "># - position not used</option>
+            [% END %]
+            </select>
+        </td>
+    </tr>
+
+</table>
+<p><input type="button" value="OK"  onclick="submitMyForm();" /> <a href="#" class="cancel close">Cancel</a> </p>
+</form>
+
+<script>
+
+    function submitMyForm() {
+        var doc   = opener.document;
+        var field = doc.getElementById("[% index | html %]");
+        field.value = document.f_pop.f1.value+
+                      document.f_pop.f2.value;
+        window.close();
+        return false;
+    }
+</script>
+
+[% INCLUDE 'popup-bottom.inc' %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181b.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181b.tt
new file mode 100644 (file)
index 0000000..b4c54c1
--- /dev/null
@@ -0,0 +1,257 @@
+[% INCLUDE 'doc-head-open.inc' %]
+<title>Framework plugin example &rsaquo; Cataloguing &rsaquo; Koha</title>
+[% INCLUDE 'doc-head-close.inc' %]
+</head>
+
+<body id="cat_unimarc_field_181b" class="cat" style="padding:1em;">
+
+<h3>UNIMARC field 181b builder</h3>
+
+<form name="f_pop" action="">
+<table>
+    <tr>
+        <td><label for="f1">Specification of Type </label></td>
+        <td>
+            <select name="f1" id="f1">
+            [% IF ( f1 == "a" ) %]
+                <option value="a" selected="selected">a - notated</option>
+            [% ELSE %]
+                <option value="a">a - notated</option>
+            [% END %]
+
+            [% IF ( f1 == "b" ) %]
+                <option value="b" selected="selected">b - performed</option>
+            [% ELSE %]
+                <option value="b">b - performed</option>
+            [% END %]
+
+            [% IF ( f1 == "c" ) %]
+                <option value="c" selected="selected">c - cartographic</option>
+            [% ELSE %]
+                <option value="c">c - cartographic</option>
+            [% END %]
+
+            [% IF ( f1 == "x" ) %]
+                <option value="x" selected="selected">x - not applicable</option>
+            [% ELSE %]
+                <option value="x">x - not applicable</option>
+            [% END %]
+
+            [% IF ( f1 == " " ) %]
+                <option value=" " selected="selected"># - position not used</option>
+            [% ELSE %]
+                <option value=" "># - position not used</option>
+            [% END %]
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td><label for="f2">Specification of Motion </label></td>
+        <td>
+            <select name="f2" id="f2">
+            [% IF ( f2 == "a" ) %]
+                <option value="a" selected="selected">a - moving</option>
+            [% ELSE %]
+                <option value="a">a - moving</option>
+            [% END %]
+
+            [% IF ( f2 == "b" ) %]
+                <option value="b" selected="selected">b - still</option>
+            [% ELSE %]
+                <option value="b">b - still</option>
+            [% END %]
+
+            [% IF ( f2 == "x" ) %]
+                <option value="x" selected="selected">x - not applicable (resource is not an image)</option>
+            [% ELSE %]
+                <option value="x">x - not applicable (resource is not an image)</option>
+            [% END %]
+
+            [% IF ( f2 == " " ) %]
+                <option value=" " selected="selected"># - position not used</option>
+            [% ELSE %]
+                <option value=" "># - position not used</option>
+            [% END %]
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td><label for="f3">Specification of Dimensionality </label></td>
+        <td>
+            <select name="f3" id="f3">
+            [% IF ( f3 == "a" ) %]
+                <option value="a" selected="selected">a - two-dimensional</option>
+            [% ELSE %]
+                <option value="a">a - two-dimensional</option>
+            [% END %]
+
+            [% IF ( f3 == "b" ) %]
+                <option value="b" selected="selected">b - three-dimensional</option>
+            [% ELSE %]
+                <option value="b">b - three-dimensional</option>
+            [% END %]
+
+            [% IF ( f3 == "x" ) %]
+                <option value="x" selected="selected">x - not applicable (resource is not an image)</option>
+            [% ELSE %]
+                <option value="x">x - not applicable (resource is not an image)</option>
+            [% END %]
+
+            [% IF ( f3 == " " ) %]
+                <option value=" " selected="selected"># - position not used</option>
+            [% ELSE %]
+                <option value=" "># - position not used</option>
+            [% END %]
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td><label for="f4">Sensory Specification 1 </label></td>
+        <td>
+
+            <select name="f4" id="f4">
+            [% IF ( f4 == "a" ) %]
+                <option value="a" selected="selected">a - aural</option>
+            [% ELSE %]
+                <option value="a">a - aural</option>
+            [% END %]
+
+            [% IF ( f4 == "b" ) %]
+                <option value="b" selected="selected">b - gustatory</option>
+            [% ELSE %]
+                <option value="b">b - gustatory</option>
+            [% END %]
+
+            [% IF ( f4 == "c" ) %]
+                <option value="c" selected="selected">c - olfactory</option>
+            [% ELSE %]
+                <option value="c">c - olfactory</option>
+            [% END %]
+
+            [% IF ( f4 == "d" ) %]
+                <option value="d" selected="selected">d - tactile</option>
+            [% ELSE %]
+                <option value="d">d - tactile</option>
+            [% END %]
+
+            [% IF ( f4 == "e" ) %]
+                <option value="e" selected="selected">e - visual</option>
+            [% ELSE %]
+                <option value="e">e - visual</option>
+            [% END %]
+
+            [% IF ( f4 == "" ) %]
+                <option value=" " selected="selected"># - position not used</option>
+            [% ELSE %]
+                <option value=" "># - position not used</option>
+            [% END %]
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td><label for="f5">Sensory Specification 2 </label></td>
+        <td>
+            <select name="f5" id="f5">
+            [% IF ( f5 == "a" ) %]
+                <option value="a" selected="selected">a - aural</option>
+            [% ELSE %]
+                <option value="a">a - aural</option>
+            [% END %]
+
+            [% IF ( f5 == "b" ) %]
+                <option value="b" selected="selected">b - gustatory</option>
+            [% ELSE %]
+                <option value="b">b - gustatory</option>
+            [% END %]
+
+            [% IF ( f5 == "c" ) %]
+                <option value="c" selected="selected">c - olfactory</option>
+            [% ELSE %]
+                <option value="c">c - olfactory</option>
+            [% END %]
+
+            [% IF ( f5 == "d" ) %]
+                <option value="d" selected="selected">d - tactile</option>
+            [% ELSE %]
+                <option value="d">d - tactile</option>
+            [% END %]
+
+            [% IF ( f5 == "e" ) %]
+                <option value="e" selected="selected">e - visual</option>
+            [% ELSE %]
+                <option value="e">e - visual</option>
+            [% END %]
+
+            [% IF ( f5 == "" ) %]
+                <option value=" " selected="selected"># - position not used</option>
+            [% ELSE %]
+                <option value=" "># - position not used</option>
+            [% END %]
+            </select>
+        </td>
+    </tr>
+    <tr>
+        <td><label for="f6">Sensory Specification 3 </label></td>
+        <td>
+            <select name="f6" id="f6">
+            [% IF ( f6 == "a" ) %]
+                <option value="a" selected="selected">a - aural</option>
+            [% ELSE %]
+                <option value="a">a - aural</option>
+            [% END %]
+
+            [% IF ( f6 == "b" ) %]
+                <option value="b" selected="selected">b - gustatory</option>
+            [% ELSE %]
+                <option value="b">b - gustatory</option>
+            [% END %]
+
+            [% IF ( f6 == "c" ) %]
+                <option value="c" selected="selected">c - olfactory</option>
+            [% ELSE %]
+                <option value="c">c - olfactory</option>
+            [% END %]
+
+            [% IF ( f6 == "d" ) %]
+                <option value="d" selected="selected">d - tactile</option>
+            [% ELSE %]
+                <option value="d">d - tactile</option>
+            [% END %]
+
+            [% IF ( f6 == "e" ) %]
+                <option value="e" selected="selected">e - visual</option>
+            [% ELSE %]
+                <option value="e">e - visual</option>
+            [% END %]
+
+            [% IF ( f6 == "" ) %]
+                <option value=" " selected="selected"># - position not used</option>
+            [% ELSE %]
+                <option value=" "># - position not used</option>
+            [% END %]
+            </select>
+        </td>
+    </tr>
+
+</table>
+<p><input type="button" value="OK"  onclick="submitMyForm();" /> <a href="#" class="cancel close">Cancel</a> </p>
+</form>
+
+<script>
+    // The following function just puts back the value of the input #return
+    // into the caller's field, referenced by index. And closes the popup.
+    function submitMyForm() {
+        var doc   = opener.document;
+        var field = doc.getElementById("[% index | html %]");
+        field.value = document.f_pop.f1.value+
+                      document.f_pop.f2.value+
+                      document.f_pop.f3.value+
+                      document.f_pop.f4.value+
+                      document.f_pop.f5.value+
+                      document.f_pop.f6.value;
+        window.close();
+        return false;
+    }
+</script>
+
+[% INCLUDE 'popup-bottom.inc' %]
diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181c.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_181c.tt
new file mode 100644 (file)
index 0000000..93df198
--- /dev/null
@@ -0,0 +1,195 @@
+[% INCLUDE 'doc-head-open.inc' %]
+<title>Framework plugin example &rsaquo; Cataloguing &rsaquo; Koha</title>
+[% INCLUDE 'doc-head-close.inc' %]
+</head>
+
+<body id="cat_unimarc_field_181c" class="cat" style="padding:1em;">
+
+<h3>UNIMARC field 181c builder</h3>
+
+<form name="f_pop" action="">
+<table>
+    <tr>
+        <td><label for="f1">Content Type </label></td>
+        <td>
+            <select name="f1" id="f1">
+
+            [% IF ( f1 == "cri" ) %]
+                <option value=" " selected="selected">cri - cartographic image</option>
+            [% ELSE %]
+                <option value=" ">cri - cartographic image</option>
+            [% END %]
+
+            [% IF ( f1 == "crm" ) %]
+                <option value="crm" selected="selected">crm - cartographic moving image</option>
+            [% ELSE %]
+                <option value="a">crm - cartographic moving image</option>
+            [% END %]
+
+            [% IF ( f1 == "crt" ) %]
+                <option value="crt" selected="selected">crt - cartographic tactile image</option>
+            [% ELSE %]
+                <option value="crt">crt - cartographic tactile image</option>
+            [% END %]
+
+            [% IF ( f1 == "crn" ) %]
+                <option value="crn" selected="selected">crn - cartographic tactile three-dimensional form</option>
+            [% ELSE %]
+                <option value="crn">crn - cartographic tactile three-dimensional form</option>
+            [% END %]
+
+            [% IF ( f1 == "cod" ) %]
+                <option value="d" selected="selected">cod - computer dataset</option>
+            [% ELSE %]
+                <option value="cod">cod - computer dataset</option>
+            [% END %]
+
+            [% IF ( f1 == "crd" ) %]
+                <option value="crd" selected="selected">crd - cartographic dataset</option>
+            [% ELSE %]
+                <option value="crd">crd - cartographic dataset</option>
+            [% END %]
+
+            [% IF ( f1 == "crf" ) %]
+                <option value="crf" selected="selected">crf - cartographic three-dimensional form</option>
+            [% ELSE %]
+                <option value="crf">crf - cartographic three-dimensional form</option>
+            [% END %]
+
+            [% IF ( f1 == "tdi" ) %]
+                <option value="tdi" selected="selected">tdi - two-dimensional moving image</option>
+            [% ELSE %]
+                <option value="tdi">tdi - two-dimensional moving image</option>
+            [% END %]
+
+            [% IF ( f1 == "tdm" ) %]
+                <option value="tdm" selected="selected">tdm - three-dimensional moving image</option>
+            [% ELSE %]
+                <option value="tdm">tdm - three-dimensional moving image</option>
+            [% END %]
+
+            [% IF ( f1 == "sti" ) %]
+                <option value="sti" selected="selected">sti - still image</option>
+            [% ELSE %]
+                <option value="sti">sti - still image</option>
+            [% END %]
+
+            [% IF ( f1 == "tci" ) %]
+                <option value="tci" selected="selected">tci - tactile image</option>
+            [% ELSE %]
+                <option value="tci">tci - tactile image</option>
+            [% END %]
+
+            [% IF ( f1 == "prm" ) %]
+                <option value="prm" selected="selected">prm - performed music</option>
+            [% ELSE %]
+                <option value="prm">prm - performed music</option>
+            [% END %]
+
+            [% IF ( f1 == "ntv" ) %]
+                <option value="ntv" selected="selected">ntv - notated movement</option>
+            [% ELSE %]
+                <option value="ntv">ntv - notated movement</option>
+            [% END %]
+
+            [% IF ( f1 == "tcn" ) %]
+                <option value="tcn" selected="selected">tcn - tactile notated movement</option>
+            [% ELSE %]
+                <option value="tcn">tcn - tactile notated movement</option>
+            [% END %]
+
+            [% IF ( f1 == "tdf" ) %]
+                <option value="tdf" selected="selected">tdf - three-dimensional form</option>
+            [% ELSE %]
+                <option value="tdf">tdf - three-dimensional form</option>
+            [% END %]
+
+            [% IF ( f1 == "tcf" ) %]
+                <option value="tcf" selected="selected">tcf - tactile three-dimensional form</option>
+            [% ELSE %]
+                <option value="tcf">tcf - tactile three-dimensional form</option>
+            [% END %]
+
+            [% IF ( f1 == "ntm" ) %]
+                <option value="ntm" selected="selected">ntm - notated music</option>
+            [% ELSE %]
+                <option value="ntm">ntm - notated music</option>
+            [% END %]
+
+            [% IF ( f1 == "tcm" ) %]
+                <option value="tcm" selected="selected">tcm - tactical notated music</option>
+            [% ELSE %]
+                <option value="tcm">tcm - tactical notated music</option>
+            [% END %]
+
+            [% IF ( f1 == "cop" ) %]
+                <option value="cop" selected="selected">cop - computer program</option>
+            [% ELSE %]
+                <option value="cop">cop - computer program</option>
+            [% END %]
+
+            [% IF ( f1 == "snd" ) %]
+                <option value="snd" selected="selected">snd - sounds</option>
+            [% ELSE %]
+                <option value="snd">snd - sounds</option>
+            [% END %]
+
+            [% IF ( f1 == "txt" ) %]
+                <option value="txt" selected="selected">txt - text</option>
+            [% ELSE %]
+                <option value="txt">txt - text</option>
+            [% END %]
+
+            [% IF ( f1 == "tct" ) %]
+                <option value="tct" selected="selected">tct - tactile text</option>
+            [% ELSE %]
+                <option value="tct">tct - tactile text</option>
+            [% END %]
+
+            [% IF ( f1 == "spw" ) %]
+                <option value="spw" selected="selected">spw - spoken word</option>
+            [% ELSE %]
+                <option value="spw">spw - spoken word</option>
+            [% END %]
+
+            [% IF ( f1 == "xxx" ) %]
+                <option value="xxx" selected="selected">xxx - other</option>
+            [% ELSE %]
+                <option value="xxx">xxx - other</option>
+            [% END %]
+
+            [% IF ( f1 == "zzz" ) %]
+                <option value="zzz" selected="selected">zzz - unspecified</option>
+            [% ELSE %]
+                <option value="zzz">zzz - unspecified</option>
+            [% END %]
+            </select>
+        </td>
+    </tr>
+
+</table>
+<p><input type="button" value="OK"  onclick="submitMyForm();" /> <a href="#" class="cancel close">Cancel</a> </p>
+</form>
+
+<script>
+
+    function submitMyForm() {
+        var doc   = opener.document;
+        var field = doc.getElementById("[% index | html %]");
+        subfield();
+
+        function subfield() {
+            const tag = $(field).closest('.tag');
+            const sub = tag.find('[id*="tag_181_subfield_2_"]');
+            if ( field != 'undefined' ) {
+                sub[0].value = "RDAcontent";
+            }
+            return subfield;
+        }
+        field.value = document.f_pop.f1.value;
+        window.close();
+        return false;
+    }
+</script>
+
+[% INCLUDE 'popup-bottom.inc' %]