View | Details | Raw Unified | Return to bug 30604
Collapse All | Expand All

(-)a/cataloguing/value_builder/unimarc_field_146a.pl (+71 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use C4::Auth qw( get_template_and_user );
21
use C4::Output qw( output_html_with_http_headers );
22
23
use Koha::I18N;
24
25
my $builder = sub {
26
    my $params = shift;
27
    my $id = $params->{id};
28
29
    return qq|
30
<script>
31
function Click$id(event) {
32
    event.preventDefault();
33
    const value = document.getElementById(event.data.id).value;
34
    const url = new URL('/cgi-bin/koha/cataloguing/plugin_launcher.pl', location);
35
    url.searchParams.set('plugin_name', 'unimarc_field_146a.pl');
36
    url.searchParams.set('id', event.data.id);
37
    url.searchParams.set('value', value);
38
    window.open(url.toString(), 'tag_editor', 'width=700,height=700,toolbar=false,scrollbars=yes');
39
}
40
</script>|;
41
};
42
43
my $launcher = sub {
44
    my $params = shift;
45
    my $cgi = $params->{cgi};
46
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
47
        template_name => "cataloguing/value_builder/unimarc_field_146a.tt",
48
        query => $cgi,
49
        type => 'intranet',
50
        flagsrequired => { editcatalogue => '*' },
51
    });
52
53
    my @options = (
54
        { value => 'a', label => __('vocal a cappella music') },
55
        { value => 'b', label => __('instrumental music') },
56
        { value => 'c', label => __('vocal and instrumental music') },
57
        { value => 'd', label => __('electroacoustic music') },
58
        { value => 'e', label => __('mixed media music (electroacoustic and other media)') },
59
        { value => 'u', label => __('undefined, variable (e.g. Renaissance vocal or instrumental music)') },
60
        { value => 'z', label => __('other (e.g. ordinary objects or natural sounds)') },
61
    );
62
63
    $template->param(
64
        id => scalar $cgi->param('id'),
65
        value => scalar $cgi->param('value'),
66
        options => \@options,
67
    );
68
    output_html_with_http_headers $cgi, $cookie, $template->output;
69
};
70
71
return { builder => $builder, launcher => $launcher };
(-)a/cataloguing/value_builder/unimarc_field_146h.pl (+89 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use C4::Auth qw( get_template_and_user );
21
use C4::Output qw( output_html_with_http_headers );
22
23
use Koha::I18N;
24
25
my $builder = sub {
26
    my $params = shift;
27
    my $id = $params->{id};
28
29
    return qq|
30
<script>
31
function Click$id(event) {
32
    event.preventDefault();
33
    const value = document.getElementById(event.data.id).value;
34
    const url = new URL('/cgi-bin/koha/cataloguing/plugin_launcher.pl', location);
35
    url.searchParams.set('plugin_name', 'unimarc_field_146h.pl');
36
    url.searchParams.set('id', event.data.id);
37
    url.searchParams.set('value', value);
38
    window.open(url.toString(), 'tag_editor', 'width=700,height=700,toolbar=false,scrollbars=yes');
39
}
40
</script>|;
41
};
42
43
my $launcher = sub {
44
    my $params = shift;
45
    my $cgi = $params->{cgi};
46
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
47
        template_name => "cataloguing/value_builder/unimarc_field_146h.tt",
48
        query => $cgi,
49
        type => 'intranet',
50
        flagsrequired => { editcatalogue => '*' },
51
    });
52
53
    my @options = (
54
        { value => 'a', label => __('performers total') },
55
        { value => 'b', label => __('brass instruments') },
56
        { value => 'c', label => __('choirs') },
57
        { value => 'd', label => __('wind instruments') },
58
        { value => 'e', label => __('electro-acoustic instruments') },
59
        { value => 'i', label => __('instruments total') },
60
        { value => 'j', label => __('solo instruments') },
61
        { value => 'k', label => __('keyboard instruments') },
62
        { value => 'l', label => __('solo voices') },
63
        { value => 'm', label => __('miscellaneous, other instruments') },
64
        { value => 'o', label => __('orchestras') },
65
        { value => 'p', label => __('percussion instruments') },
66
        { value => 'q', label => __('conductors') },
67
        { value => 's', label => __('bowed string instruments') },
68
        { value => 't', label => __('plucked string instruments') },
69
        { value => 'v', label => __('voices total') },
70
        { value => 'w', label => __('woodwind instruments') },
71
        { value => 'x', label => __('choral voices') },
72
        { value => 'y', label => __('ensemble instruments') },
73
        { value => 'z', label => __('devices, other performers') },
74
    );
75
76
    my $value = $cgi->param('value');
77
    my $number = substr($value, 0, 3);
78
    my $category = substr($value, 3, 1);
79
80
    $template->param(
81
        id => scalar $cgi->param('id'),
82
        number => $number,
83
        category => $category,
84
        options => \@options,
85
    );
86
    output_html_with_http_headers $cgi, $cookie, $template->output;
87
};
88
89
return { builder => $builder, launcher => $launcher };
(-)a/cataloguing/value_builder/unimarc_field_146i.pl (+89 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# This file is part of Koha.
4
#
5
# Koha is free software; you can redistribute it and/or modify it
6
# under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
9
#
10
# Koha is distributed in the hope that it will be useful, but
11
# WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
14
#
15
# You should have received a copy of the GNU General Public License
16
# along with Koha; if not, see <http://www.gnu.org/licenses>.
17
18
use Modern::Perl;
19
20
use C4::Auth qw( get_template_and_user );
21
use C4::Output qw( output_html_with_http_headers );
22
23
use Koha::I18N;
24
25
my $builder = sub {
26
    my $params = shift;
27
    my $id = $params->{id};
28
29
    return qq|
30
<script>
31
function Click$id(event) {
32
    event.preventDefault();
33
    const value = document.getElementById(event.data.id).value;
34
    const url = new URL('/cgi-bin/koha/cataloguing/plugin_launcher.pl', location);
35
    url.searchParams.set('plugin_name', 'unimarc_field_146i.pl');
36
    url.searchParams.set('id', event.data.id);
37
    url.searchParams.set('value', value);
38
    window.open(url.toString(), 'tag_editor', 'width=700,height=700,toolbar=false,scrollbars=yes');
39
}
40
</script>|;
41
};
42
43
my $launcher = sub {
44
    my $params = shift;
45
    my $cgi = $params->{cgi};
46
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
47
        template_name => "cataloguing/value_builder/unimarc_field_146i.tt",
48
        query => $cgi,
49
        type => 'intranet',
50
        flagsrequired => { editcatalogue => '*' },
51
    });
52
53
    my @options = (
54
        { value => 'a', label => __('performers total') },
55
        { value => 'b', label => __('brass instruments') },
56
        { value => 'c', label => __('choirs') },
57
        { value => 'd', label => __('wind instruments') },
58
        { value => 'e', label => __('electro-acoustic instruments') },
59
        { value => 'i', label => __('instruments total') },
60
        { value => 'j', label => __('solo instruments') },
61
        { value => 'k', label => __('keyboard instruments') },
62
        { value => 'l', label => __('solo voices') },
63
        { value => 'm', label => __('miscellaneous, other instruments') },
64
        { value => 'o', label => __('orchestras') },
65
        { value => 'p', label => __('percussion instruments') },
66
        { value => 'q', label => __('conductors') },
67
        { value => 's', label => __('bowed string instruments') },
68
        { value => 't', label => __('plucked string instruments') },
69
        { value => 'v', label => __('voices total') },
70
        { value => 'w', label => __('woodwind instruments') },
71
        { value => 'x', label => __('choral voices') },
72
        { value => 'y', label => __('ensemble instruments') },
73
        { value => 'z', label => __('devices, other performers') },
74
    );
75
76
    my $value = $cgi->param('value');
77
    my $number = substr($value, 0, 3);
78
    my $category = substr($value, 3, 1);
79
80
    $template->param(
81
        id => scalar $cgi->param('id'),
82
        number => $number,
83
        category => $category,
84
        options => \@options,
85
    );
86
    output_html_with_http_headers $cgi, $cookie, $template->output;
87
};
88
89
return { builder => $builder, launcher => $launcher };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146a.tt (+47 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Framework plugin unimarc_field_146a &rsaquo; Cataloguing &rsaquo; Koha</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
6
<body id="unimarc_field_146a" class="cat">
7
    <div class="container-fluid">
8
        <h1>Framework plugin for UNIMARC 146$a</h1>
9
10
        <form class="form-horizontal" id="form">
11
            <input type="hidden" id="id" name="id" value="[% id | html %]">
12
13
            <div class="form-group">
14
                <label for="type" class="col-sm-2 control-label">Type of Performance Medium</label>
15
                <div class="col-sm-10">
16
                    <select class="form-control" id="type">
17
                        [% FOREACH option IN options %]
18
                            [% IF option.value == value %]
19
                                <option value="[% option.value | html %]" selected>[% option.label | html %]</option>
20
                            [% ELSE %]
21
                                <option value="[% option.value | html %]">[% option.label | html %]</option>
22
                            [% END %]
23
                        [% END %]
24
                    </select>
25
                </div>
26
            </div>
27
28
            <div class="form-group">
29
                <div class="col-sm-offset-2 col-sm-10">
30
                    <button type="submit">OK</button>
31
                    <a href="#" class="cancel close">Cancel</a>
32
                </div>
33
            </div>
34
        </form>
35
    </div>
36
37
    <script>
38
        document.getElementById('form').addEventListener('submit', function (ev) {
39
            ev.preventDefault();
40
            const id = document.getElementById('id').value;
41
            const type = document.getElementById('type').value;
42
            opener.document.getElementById(id).value = type;
43
            window.close();
44
        });
45
    </script>
46
47
[% INCLUDE 'popup-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146h.tt (+58 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Framework plugin unimarc_field_146h &rsaquo; Cataloguing &rsaquo; Koha</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
6
<body id="unimarc_field_146h" class="cat">
7
    <div class="container-fluid">
8
        <h1>Framework plugin for UNIMARC 146$h</h1>
9
10
        <form class="form-horizontal" id="form">
11
            <input type="hidden" id="id" name="id" value="[% id | html %]">
12
13
            <div class="form-group">
14
                <label for="number" class="col-sm-2 control-label">Number of parts</label>
15
                <div class="col-sm-10">
16
                    <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 %]">
17
                    <p class="help-block">
18
                        A number between 0 and 999 (inclusive)
19
                    </p>
20
                </div>
21
            </div>
22
            <div class="form-group">
23
                <label for="category" class="col-sm-2 control-label">Category</label>
24
                <div class="col-sm-10">
25
                    <select class="form-control" id="category">
26
                        [% FOREACH option IN options %]
27
                            [% IF option.value == category %]
28
                                <option value="[% option.value | html %]" selected>[% option.label | html %]</option>
29
                            [% ELSE %]
30
                                <option value="[% option.value | html %]">[% option.label | html %]</option>
31
                            [% END %]
32
                        [% END %]
33
                    </select>
34
                </div>
35
            </div>
36
37
            <div class="form-group">
38
                <div class="col-sm-offset-2 col-sm-10">
39
                    <button type="submit">OK</button>
40
                    <a href="#" class="cancel close">Cancel</a>
41
                </div>
42
            </div>
43
        </form>
44
    </div>
45
46
    <script>
47
        document.getElementById('form').addEventListener('submit', function (ev) {
48
            ev.preventDefault();
49
            const id = document.getElementById('id').value;
50
            const number = document.getElementById('number').value;
51
            const category = document.getElementById('category').value;
52
            const value = number.toString().padStart(3, '0') + category;
53
            opener.document.getElementById(id).value = value;
54
            window.close();
55
        });
56
    </script>
57
58
[% INCLUDE 'popup-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_146i.tt (-1 / +58 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Framework plugin unimarc_field_146i &rsaquo; Cataloguing &rsaquo; Koha</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
6
<body id="unimarc_field_146i" class="cat">
7
    <div class="container-fluid">
8
        <h1>Framework plugin for UNIMARC 146$i</h1>
9
10
        <form class="form-horizontal" id="form">
11
            <input type="hidden" id="id" name="id" value="[% id | html %]">
12
13
            <div class="form-group">
14
                <label for="number" class="col-sm-2 control-label">Number of players</label>
15
                <div class="col-sm-10">
16
                    <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 %]">
17
                    <p class="help-block">
18
                        A number between 0 and 999 (inclusive)
19
                    </p>
20
                </div>
21
            </div>
22
            <div class="form-group">
23
                <label for="category" class="col-sm-2 control-label">Category</label>
24
                <div class="col-sm-10">
25
                    <select class="form-control" id="category">
26
                        [% FOREACH option IN options %]
27
                            [% IF option.value == category %]
28
                                <option value="[% option.value | html %]" selected>[% option.label | html %]</option>
29
                            [% ELSE %]
30
                                <option value="[% option.value | html %]">[% option.label | html %]</option>
31
                            [% END %]
32
                        [% END %]
33
                    </select>
34
                </div>
35
            </div>
36
37
            <div class="form-group">
38
                <div class="col-sm-offset-2 col-sm-10">
39
                    <button type="submit">OK</button>
40
                    <a href="#" class="cancel close">Cancel</a>
41
                </div>
42
            </div>
43
        </form>
44
    </div>
45
46
    <script>
47
        document.getElementById('form').addEventListener('submit', function (ev) {
48
            ev.preventDefault();
49
            const id = document.getElementById('id').value;
50
            const number = document.getElementById('number').value;
51
            const category = document.getElementById('category').value;
52
            const value = number.toString().padStart(3, '0') + category;
53
            opener.document.getElementById(id).value = value;
54
            window.close();
55
        });
56
    </script>
57
58
[% INCLUDE 'popup-bottom.inc' %]

Return to bug 30604