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

(-)a/cataloguing/value_builder/unimarc_field_182-2.pl (+60 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
4
# This file is part of Koha.
5
#
6
# Koha is free software; you can redistribute it and/or modify it
7
# under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 3 of the License, or
9
# (at your option) any later version.
10
#
11
# Koha is distributed in the hope that it will be useful, but
12
# WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
15
#
16
# You should have received a copy of the GNU General Public License
17
# along with Koha; if not, see <http://www.gnu.org/licenses>.
18
19
use Modern::Perl;
20
21
use Date::Calc;
22
23
use Koha::Util::FrameworkPlugin qw(wrapper);
24
use C4::Auth qw( get_template_and_user );
25
use CGI qw ( -utf8 );
26
use C4::Context;
27
use C4::Output qw( output_html_with_http_headers );
28
29
my $builder= sub {
30
    my $params = shift;
31
    my $id = $params->{id};
32
33
    return qq|
34
<script>
35
36
function Click$id(event) {
37
    var fieldvalue=\$('#'+event.data.id).val();
38
    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_182-2.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
39
    return false; /* prevents scrolling */
40
}
41
</script>|;
42
};
43
44
my $launcher= sub {
45
    my $params = shift;
46
    my $cgi = $params->{cgi};
47
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
48
        template_name => "cataloguing/value_builder/unimarc_field_182-2.tt",
49
        query => $cgi,
50
        type => "intranet",
51
        flagsrequired => {editcatalogue => '*'},
52
    });
53
    $template->param(
54
        index => scalar $cgi->param('index'),
55
        result => scalar $cgi->param('result'),
56
    );
57
    output_html_with_http_headers $cgi, $cookie, $template->output;
58
};
59
60
return { builder => $builder, launcher => $launcher };
(-)a/cataloguing/value_builder/unimarc_field_182a.pl (+71 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2014 Rijksmuseum
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use Date::Calc;
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
25
use C4::Auth qw( get_template_and_user );
26
use CGI qw ( -utf8 );
27
use C4::Context;
28
use C4::Output qw( output_html_with_http_headers );
29
30
my $builder= sub {
31
    my $params = shift;
32
    my $id = $params->{id};
33
34
    return qq|
35
<script>
36
37
function Click$id(event) {
38
    var fieldvalue=\$('#'+event.data.id).val();
39
    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_182a.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
40
    return false; /* prevents scrolling */
41
}
42
</script>|;
43
};
44
45
my $launcher= sub {
46
    my $params = shift;
47
    my $cgi = $params->{cgi};
48
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
49
        template_name => "cataloguing/value_builder/unimarc_field_182a.tt",
50
        query => $cgi,
51
        type => "intranet",
52
        flagsrequired => {editcatalogue => '*'},
53
    });
54
    my $results = scalar $cgi->param('result');
55
56
    $template->param(
57
        index => scalar $cgi->param('index'),
58
        result => $results,
59
    );
60
61
    # Return the result of the position in the string, ex: abcde = 1=a, 2=b, 3=c...
62
    my @x = split(//, $results);
63
    my $i = 1;
64
    for my $fresult (@x) {
65
        $template->param("f$i" => $fresult);
66
        ++$i;
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_182c.pl (+66 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2014 Rijksmuseum
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
use Modern::Perl;
21
22
use Date::Calc;
23
24
use Koha::Util::FrameworkPlugin qw(wrapper);
25
use C4::Auth qw( get_template_and_user );
26
use CGI qw ( -utf8 );
27
use C4::Context;
28
use C4::Output qw( output_html_with_http_headers );
29
30
my $builder= sub {
31
    my $params = shift;
32
    my $id = $params->{id};
33
34
    return qq|
35
<script>
36
37
function Click$id(event) {
38
    var fieldvalue=\$('#'+event.data.id).val();
39
    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_182c.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
40
    return false; /* prevents scrolling */
41
}
42
</script>|;
43
};
44
45
my $launcher= sub {
46
    my $params = shift;
47
    my $cgi = $params->{cgi};
48
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
49
        template_name => "cataloguing/value_builder/unimarc_field_182c.tt",
50
        query => $cgi,
51
        type => "intranet",
52
        flagsrequired => {editcatalogue => '*'},
53
    });
54
    my $results = scalar $cgi->param('result');
55
    my $input_a = substr $results, 0, 3;
56
57
    $template->param(
58
        index => scalar $cgi->param('index'),
59
        result => $results,
60
        f1 => $input_a,
61
    );
62
63
    output_html_with_http_headers $cgi, $cookie, $template->output;
64
};
65
66
return { builder => $builder, launcher => $launcher };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_182-2.tt (+58 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Framework plugin example &rsaquo; Cataloguing &rsaquo; Koha</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
6
<body id="cat_unimarc_field_182-2" class="cat" style="padding:1em;">
7
8
<h3>UNIMARC field 182-2 builder</h3>
9
10
<form name="f_pop" action="">
11
<table>
12
    <tr>
13
        <td><label for="f0">System code :</label></td>
14
        <td>
15
            <select name="f0" id="f0">
16
                [% IF ( f0 == "carr" ) %]
17
                    <option value="RDAcarrier" selected="selected">RDA Carrier</option>
18
                [% ELSE %]
19
                    <option value="RDAcarrier">RDA Carrier</option>
20
                [% END %]
21
22
                [% IF ( f0 == "cont" ) %]
23
                    <option value="RDAcontent" selected="selected">RDA Content</option>
24
                [% ELSE %]
25
                    <option value="RDAcontent">RDA Content</option>
26
                [% END %]
27
28
                [% IF ( f0 == "media" ) %]
29
                    <option value="RDAmedia" selected="selected">RDA Media</option>
30
                [% ELSE %]
31
                    <option value="RDAmedia">RDA Media</option>
32
                [% END %]
33
34
                [% IF ( f0 == "frcarr" ) %]
35
                    <option value="RDAfrCarrier" selected="selected">RDA fr Carrier</option>
36
                [% ELSE %]
37
                    <option value="RDAfrCarrier">RDA fr Carrier</option>
38
                [% END %]
39
            </select>
40
        </td>
41
    </tr>
42
</table>
43
<p><input type="button" value="OK"  onclick="submitMyForm();" /> <a href="#" class="cancel close">Cancel</a> </p>
44
</form>
45
46
<script>
47
48
    function submitMyForm() {
49
        var doc   = opener.document;
50
        var field = doc.getElementById("[% index | html %]");
51
52
        field.value = document.f_pop.f0.value;
53
        window.close();
54
        return false;
55
    }
56
</script>
57
58
[% INCLUDE 'popup-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_182a.tt (+95 lines)
Line 0 Link Here
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Framework plugin example &rsaquo; Cataloguing &rsaquo; Koha</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
6
<body id="cat_unimarc_field_182a" class="cat" style="padding:1em;">
7
8
<h3>UNIMARC field 182a builder</h3>
9
10
<form name="f_pop" action="">
11
<table>
12
    <tr>
13
        <td><label for="f1">Media Type Code </label></td>
14
        <td>
15
            <select name="f1" id="f1">
16
            [% IF ( f1 == "a" ) %]
17
                <option value="a" selected="selected">a - audio</option>
18
            [% ELSE %]
19
                <option value="a">a - audio</option>
20
            [% END %]
21
22
            [% IF ( f1 == "b" ) %]
23
                <option value="b" selected="selected">b - electronic</option>
24
            [% ELSE %]
25
                <option value="b">b - electronic</option>
26
            [% END %]
27
28
            [% IF ( f1 == "c" ) %]
29
                <option value="c" selected="selected">c - microform</option>
30
            [% ELSE %]
31
                <option value="c">c - microform</option>
32
            [% END %]
33
34
            [% IF ( f1 == "d" ) %]
35
                <option value="d" selected="selected">d - microscopic</option>
36
            [% ELSE %]
37
                <option value="d">d - microscopic</option>
38
            [% END %]
39
40
            [% IF ( f1 == "e" ) %]
41
                <option value="e" selected="selected">e - projected</option>
42
            [% ELSE %]
43
                <option value="e">e - projected</option>
44
            [% END %]
45
46
            [% IF ( f1 == "f" ) %]
47
                <option value="f" selected="selected">f - stereographic</option>
48
            [% ELSE %]
49
                <option value="f">f - stereographic</option>
50
            [% END %]
51
52
            [% IF ( f1 == "g" ) %]
53
                <option value="g" selected="selected">g - video</option>
54
            [% ELSE %]
55
                <option value="g">g - video</option>
56
            [% END %]
57
58
            [% IF ( f1 == "m" ) %]
59
                <option value="m" selected="selected">m - multiple media</option>
60
            [% ELSE %]
61
                <option value="m">m - multiple media</option>
62
            [% END %]
63
64
            [% IF ( f1 == "n" ) %]
65
                <option value="n" selected="selected">n - unmediated</option>
66
            [% ELSE %]
67
                <option value="n">n - unmediated</option>
68
            [% END %]
69
70
            [% IF ( f1 == "z" ) %]
71
                <option value="z" selected="selected">z - other media</option>
72
            [% ELSE %]
73
                <option value="z">z - other media</option>
74
            [% END %]
75
            </select>
76
        </td>
77
    </tr>
78
79
</table>
80
<p><input type="button" value="OK"  onclick="submitMyForm();" /> <a href="#" class="cancel close">Cancel</a> </p>
81
</form>
82
83
<script>
84
85
    function submitMyForm() {
86
        var doc   = opener.document;
87
        var field = doc.getElementById("[% index | html %]");
88
89
        field.value = document.f_pop.f1.value;
90
        window.close();
91
        return false;
92
    }
93
</script>
94
95
[% INCLUDE 'popup-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_182c.tt (-1 / +105 lines)
Line 0 Link Here
0
- 
1
[% INCLUDE 'doc-head-open.inc' %]
2
<title>Framework plugin example &rsaquo; Cataloguing &rsaquo; Koha</title>
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
5
6
<body id="cat_unimarc_field_181c" class="cat" style="padding:1em;">
7
8
<h3>UNIMARC field 182c builder</h3>
9
10
<form name="f_pop" action="">
11
<table>
12
    <tr>
13
        <td><label for="f1">Media Type </label></td>
14
        <td>
15
            <select name="f1" id="f1">
16
            [% IF ( f1 == "s" ) %]
17
                <option value="s" selected="selected">s - audio</option>
18
            [% ELSE %]
19
                <option value="s">s - audio</option>
20
            [% END %]
21
22
            [% IF ( f1 == "c" ) %]
23
                <option value="c" selected="selected">c - computer</option>
24
            [% ELSE %]
25
                <option value="c">c - computer</option>
26
            [% END %]
27
28
            [% IF ( f1 == "h" ) %]
29
                <option value="h" selected="selected">h - microform</option>
30
            [% ELSE %]
31
                <option value="h">h - microform</option>
32
            [% END %]
33
34
            [% IF ( f1 == "p" ) %]
35
                <option value="p" selected="selected">p - microscopic</option>
36
            [% ELSE %]
37
                <option value="p">p - microscopic</option>
38
            [% END %]
39
40
            [% IF ( f1 == "g" ) %]
41
                <option value="g" selected="selected">g - projected</option>
42
            [% ELSE %]
43
                <option value="g">g - projected</option>
44
            [% END %]
45
46
            [% IF ( f1 == "e" ) %]
47
                <option value="e" selected="selected">e - stereographic</option>
48
            [% ELSE %]
49
                <option value="e">e - stereographic</option>
50
            [% END %]
51
52
            [% IF ( f1 == "n" ) %]
53
                <option value="n" selected="selected">n - unmediated</option>
54
            [% ELSE %]
55
                <option value="n">n - unmediated</option>
56
            [% END %]
57
58
            [% IF ( f1 == "v" ) %]
59
                <option value="v" selected="selected">v - video</option>
60
            [% ELSE %]
61
                <option value="v">v - video</option>
62
            [% END %]
63
64
            [% IF ( f1 == "x" ) %]
65
                <option value="x" selected="selected">x - other</option>
66
            [% ELSE %]
67
                <option value="x">x - other</option>
68
            [% END %]
69
70
            [% IF ( f1 == "z" ) %]
71
                <option value="z" selected="selected">z - unspecified</option>
72
            [% ELSE %]
73
                <option value="z">z - unspecified</option>
74
            [% END %]
75
            </select>
76
        </td>
77
    </tr>
78
79
</table>
80
<p><input type="button" value="OK"  onclick="submitMyForm();" /> <a href="#" class="cancel close">Cancel</a> </p>
81
</form>
82
83
<script>
84
85
    function submitMyForm() {
86
        var doc   = opener.document;
87
        var field = doc.getElementById("[% index | html %]");
88
        subfield();
89
90
        function subfield() {
91
            const tag = $(field).closest('.tag');
92
            const sub = tag.find('[id*="tag_182_subfield_2_"]');
93
            if ( field !== undefined ) {
94
                sub[0].value = "RDAmedia";
95
            }
96
            return subfield;
97
        }
98
99
        field.value = document.f_pop.f1.value;
100
        window.close();
101
        return false;
102
    }
103
</script>
104
105
[% INCLUDE 'popup-bottom.inc' %]

Return to bug 30506