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

(-)a/cataloguing/value_builder/unimarc_field_182a.pl (-74 lines)
Lines 1-74 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 the hashref with the builder and launcher to FrameworkPlugin object.
72
# NOTE: If you do not need a popup but only use e.g. Focus, Blur etc. for a
73
# particular plugin, you only need to define and return the builder.
74
return { builder => $builder, launcher => $launcher };
(-)a/cataloguing/value_builder/unimarc_field_182c.pl (-74 lines)
Lines 1-74 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
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 the hashref with the builder and launcher to FrameworkPlugin object.
72
# NOTE: If you do not need a popup but only use e.g. Focus, Blur etc. for a
73
# particular plugin, you only need to define and return the builder.
74
return { builder => $builder, launcher => $launcher };
(-)a/cataloguing/value_builder/unimarc_field_182-2.pl (-2 / +2 lines)
Lines 36-42 my $builder= sub { Link Here
36
36
37
function Click$id(event) {
37
function Click$id(event) {
38
    var fieldvalue=\$('#'+event.data.id).val();
38
    var fieldvalue=\$('#'+event.data.id).val();
39
    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
    window.open(\"../cataloguing/plugin_launcher.pl?plugin_name=unimarc_field_183-2.pl&index=\"+event.data.id+\"&result=\"+fieldvalue,\"tag_editor\",'width=700,height=700,toolbar=false,scrollbars=yes');
40
    return false; /* prevents scrolling */
40
    return false; /* prevents scrolling */
41
}
41
}
42
</script>|;
42
</script>|;
Lines 46-52 my $launcher= sub { Link Here
46
    my $params = shift;
46
    my $params = shift;
47
    my $cgi = $params->{cgi};
47
    my $cgi = $params->{cgi};
48
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
48
    my ( $template, $loggedinuser, $cookie ) = get_template_and_user({
49
        template_name => "cataloguing/value_builder/unimarc_field_182-2.tt",
49
        template_name => "cataloguing/value_builder/unimarc_field_183-2.tt",
50
        query => $cgi,
50
        query => $cgi,
51
        type => "intranet",
51
        type => "intranet",
52
        flagsrequired => {editcatalogue => '*'},
52
        flagsrequired => {editcatalogue => '*'},
(-)a/cataloguing/value_builder/unimarc_field_183a.pl (-2 lines)
Lines 26-33 use C4::Auth qw( get_template_and_user ); Link Here
26
use CGI qw ( -utf8 );
26
use CGI qw ( -utf8 );
27
use C4::Context;
27
use C4::Context;
28
use C4::Output qw( output_html_with_http_headers );
28
use C4::Output qw( output_html_with_http_headers );
29
use Data::Dumper;
30
31
29
32
my $builder= sub {
30
my $builder= sub {
33
    my $params = shift;
31
    my $params = shift;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_182-2.tt (-58 lines)
Lines 1-58 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)
Lines 1-95 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 (-105 lines)
Lines 1-105 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_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' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_183-2.tt (-2 / +1 lines)
Lines 3-9 Link Here
3
[% INCLUDE 'doc-head-close.inc' %]
3
[% INCLUDE 'doc-head-close.inc' %]
4
</head>
4
</head>
5
5
6
<body id="cat_unimarc_field_181-2" class="cat" style="padding:1em;">
6
<body id="cat_unimarc_field_183-2" class="cat" style="padding:1em;">
7
7
8
<h3>UNIMARC field 183-2 builder</h3>
8
<h3>UNIMARC field 183-2 builder</h3>
9
9
10
- 

Return to bug 30507