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

(-)a/cataloguing/value_builder/unimarc_field_183-2.pl (+64 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_183-2.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_183-2.tt",
50
        query => $cgi,
51
        type => "intranet",
52
        flagsrequired => {editcatalogue => '*'},
53
    });
54
    $template->param(
55
        index => scalar $cgi->param('index'),
56
        result => scalar $cgi->param('result'),
57
    );
58
    output_html_with_http_headers $cgi, $cookie, $template->output;
59
};
60
61
# Return the hashref with the builder and launcher to FrameworkPlugin object.
62
# NOTE: If you do not need a popup but only use e.g. Focus, Blur etc. for a
63
# particular plugin, you only need to define and return the builder.
64
return { builder => $builder, launcher => $launcher };
(-)a/cataloguing/value_builder/unimarc_field_183a.pl (+67 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_183a.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_183a.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
    output_html_with_http_headers $cgi, $cookie, $template->output;
62
};
63
64
# Return the hashref with the builder and launcher to FrameworkPlugin object.
65
# NOTE: If you do not need a popup but only use e.g. Focus, Blur etc. for a
66
# particular plugin, you only need to define and return the builder.
67
return { builder => $builder, launcher => $launcher };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_183-2.tt (+60 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_183-2" class="cat" style="padding:1em;">
7
8
<h3>UNIMARC field 183-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
    // The following function just puts back the value of the input #return
48
    // into the caller's field, referenced by index. And closes the popup.
49
    function submitMyForm() {
50
51
        var doc   = opener.document;
52
        var field = doc.getElementById("[% index | html %]");
53
        field.value = document.f_pop.f0.value;
54
55
        window.close();
56
        return false;
57
    }
58
</script>
59
60
[% INCLUDE 'popup-bottom.inc' %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_183a.tt (-1 / +404 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_183a" class="cat" style="padding:1em;">
7
8
<h3>UNIMARC field 183a builder</h3>
9
10
<form name="f_pop" action="">
11
<table>
12
    <tr>
13
        <td>
14
            <select name="f1" id="f1">
15
                <optgroup label="Audio Carriers">
16
                    [% IF ( f1 == "sg" ) %]
17
                        <option value="sg" selected="selected">sg - audio cartridge</option>
18
                    [% ELSE %]
19
                        <option value="sg">sg - audio cartridge</option>
20
                    [% END %]
21
22
                    [% IF ( f1 == "sb" ) %]
23
                        <option value="sb" selected="selected">sb - audio belt</option>
24
                    [% ELSE %]
25
                        <option value="sb">sb - audio belt</option>
26
                    [% END %]
27
28
                    [% IF ( f1 == "se" ) %]
29
                        <option value="se" selected="selected">se - audio cylinder</option>
30
                    [% ELSE %]
31
                        <option value="se">se - audio cylinder</option>
32
                    [% END %]
33
34
                    [% IF ( f1 == "sd" ) %]
35
                        <option value="sd" selected="selected">sd - audio disc</option>
36
                    [% ELSE %]
37
                        <option value="sd">sd - audio disc</option>
38
                    [% END %]
39
40
                    [% IF ( f1 == "si" ) %]
41
                        <option value="si" selected="selected">si - sound track reel</option>
42
                    [% ELSE %]
43
                        <option value="si">si - sound track reel</option>
44
                    [% END %]
45
46
                    [% IF ( f1 == "sq" ) %]
47
                        <option value="sq" selected="selected">sq - audio roll</option>
48
                    [% ELSE %]
49
                        <option value="sq">sq - audio roll</option>
50
                    [% END %]
51
52
                    [% IF ( f1 == "sw" ) %]
53
                        <option value="sw" selected="selected">sw - audio wire reel</option>
54
                    [% ELSE %]
55
                        <option value="sw">sw - audio wire reel</option>
56
                    [% END %]
57
58
                    [% IF ( f1 == "ss" ) %]
59
                        <option value="ss" selected="selected">ss - audiocassette</option>
60
                    [% ELSE %]
61
                        <option value="ss">ss - audiocassette</option>
62
                    [% END %]
63
64
                    [% IF ( f1 == "st" ) %]
65
                        <option value="st" selected="selected">st - audiotape reel</option>
66
                    [% ELSE %]
67
                        <option value="st">st - audiotape reel</option>
68
                    [% END %]
69
70
                    [% IF ( f1 == "sz" ) %]
71
                        <option value="sz" disabled="disabled" selected="selected">sz - other audio carrier</option>
72
                    [% ELSE %]
73
                        <option value="sz" >sz - other audio carrier</option>
74
                    [% END %]
75
                </optgroup>
76
77
                <optgroup label="Computer Carriers">
78
                    [% IF ( f1 == "ck" ) %]
79
                        <option value="ck" selected="selected">ck - computer card</option>
80
                    [% ELSE %]
81
                        <option value="ck">ck - computer card</option>
82
                    [% END %]
83
84
                    [% IF ( f1 == "cb" ) %]
85
                        <option value="cb" selected="selected">cb - computer chip cartridge</option>
86
                    [% ELSE %]
87
                        <option value="cb">cb - computer chip cartridge</option>
88
                    [% END %]
89
90
                    [% IF ( f1 == "cd" ) %]
91
                        <option value="cd" selected="selected">cd - computer disc</option>
92
                    [% ELSE %]
93
                        <option value="cd">cd - computer disc</option>
94
                    [% END %]
95
96
                    [% IF ( f1 == "ce" ) %]
97
                        <option value="ce" selected="selected">ce - computer disc cartridge</option>
98
                    [% ELSE %]
99
                        <option value="ce">ce - computer disc cartridge</option>
100
                    [% END %]
101
102
                    [% IF ( f1 == "ca" ) %]
103
                        <option value="ca" selected="selected">ca - computer tape cartridge</option>
104
                    [% ELSE %]
105
                        <option value="ca">ca - computer tape cartridge</option>
106
                    [% END %]
107
108
                    [% IF ( f1 == "cf" ) %]
109
                        <option value="cf" selected="selected">cf - computer tape cassette</option>
110
                    [% ELSE %]
111
                        <option value="cf">cf - computer tape cassette</option>
112
                    [% END %]
113
114
                    [% IF ( f1 == "ch" ) %]
115
                        <option value="ch" selected="selected">ch - computer tape reel</option>
116
                    [% ELSE %]
117
                        <option value="ch">ch - computer tape reel</option>
118
                    [% END %]
119
120
                    [% IF ( f1 == "cr" ) %]
121
                        <option value="cr" selected="selected">cr - online resource</option>
122
                    [% ELSE %]
123
                        <option value="cr">cr - online resource</option>
124
                    [% END %]
125
126
                    [% IF ( f1 == "cz" ) %]
127
                        <option value="cz" selected="selected">cz - other computer carrier</option>
128
                    [% ELSE %]
129
                        <option value="cz">cz - other computer carrier</option>
130
                    [% END %]
131
                </optgroup>
132
133
                <optgroup label="Microform Carriers">
134
                    [% IF ( f1 == "ha" ) %]
135
                        <option value="ha" selected="selected">ha - aperture card</option>
136
                    [% ELSE %]
137
                        <option value="ha">ha - aperture card</option>
138
                    [% END %]
139
140
                    [% IF ( f1 == "he" ) %]
141
                        <option value="he" selected="selected">he - microfiche</option>
142
                    [% ELSE %]
143
                        <option value="he">he - microfiche</option>
144
                    [% END %]
145
146
                    [% IF ( f1 == "hf" ) %]
147
                        <option value="hf" selected="selected">hf - microfiche cassette</option>
148
                    [% ELSE %]
149
                        <option value="hf">hf - microfiche cassette</option>
150
                    [% END %]
151
152
                    [% IF ( f1 == "hb" ) %]
153
                        <option value="hb" selected="selected">hb - microfilm cartridge</option>
154
                    [% ELSE %]
155
                        <option value="hb">hb - microfilm cartridge</option>
156
                    [% END %]
157
158
                    [% IF ( f1 == "hc" ) %]
159
                        <option value="hc" selected="selected">hc - microfilm cassette</option>
160
                    [% ELSE %]
161
                        <option value="hc">hc - microfilm cassette</option>
162
                    [% END %]
163
164
                    [% IF ( f1 == "hd" ) %]
165
                        <option value="hd" selected="selected">hd - microfilm reel</option>
166
                    [% ELSE %]
167
                        <option value="hd">hd - microfilm reel</option>
168
                    [% END %]
169
170
                    [% IF ( f1 == "hj" ) %]
171
                        <option value="hj" selected="selected">hj - microfilm roll</option>
172
                    [% ELSE %]
173
                        <option value="hj">hj - microfilm roll</option>
174
                    [% END %]
175
176
                    [% IF ( f1 == "hh" ) %]
177
                        <option value="hh" selected="selected">hh - microfilm slip</option>
178
                    [% ELSE %]
179
                        <option value="hh">hh - microfilm slip</option>
180
                    [% END %]
181
182
                    [% IF ( f1 == "hg" ) %]
183
                        <option value="hg" selected="selected">hg - microopaque</option>
184
                    [% ELSE %]
185
                        <option value="hg">hg - microopaque</option>
186
                    [% END %]
187
188
                    [% IF ( f1 == "hz" ) %]
189
                        <option value="hz" selected="selected">hz - other microform carrier</option>
190
                    [% ELSE %]
191
                        <option value="hz">hz - other microform carrier</option>
192
                    [% END %]
193
                </optgroup>
194
195
                <optgroup label="Microscopic Carriers">
196
                    [% IF ( f1 == "pp" ) %]
197
                        <option value="pp" selected="selected">pp - microscope slide</option>
198
                    [% ELSE %]
199
                        <option value="pp">pp - microscope slide</option>
200
                    [% END %]
201
202
                    [% IF ( f1 == "pz" ) %]
203
                        <option value="pz" selected="selected">pz - other microscopic carrier</option>
204
                    [% ELSE %]
205
                        <option value="pz">pz - other microscopic carrier</option>
206
                    [% END %]
207
                </optgroup>
208
209
                <optgroup label="Projected image carriers">
210
                    [% IF ( f1 == "mc" ) %]
211
                        <option value="mc" selected="selected">mc - film cartridge</option>
212
                    [% ELSE %]
213
                        <option value="mc">mc - film cartridge</option>
214
                    [% END %]
215
216
                    [% IF ( f1 == "mf" ) %]
217
                        <option value="mf" selected="selected">mf - film cassette</option>
218
                    [% ELSE %]
219
                        <option value="mf">mf - film cassette</option>
220
                    [% END %]
221
222
                    [% IF ( f1 == "mr" ) %]
223
                        <option value="mr" selected="selected">mr - film reel</option>
224
                    [% ELSE %]
225
                        <option value="mr">mr - film reel</option>
226
                    [% END %]
227
228
                    [% IF ( f1 == "mo" ) %]
229
                        <option value="mo" selected="selected">mo - film roll</option>
230
                    [% ELSE %]
231
                        <option value="mo">mo - film roll</option>
232
                    [% END %]
233
234
                    [% IF ( f1 == "gd" ) %]
235
                        <option value="gd" selected="selected">gd - filmslip</option>
236
                    [% ELSE %]
237
                        <option value="gd">gd - filmslip</option>
238
                    [% END %]
239
240
                    [% IF ( f1 == "gf" ) %]
241
                        <option value="gf" selected="selected">gf - filmstrip</option>
242
                    [% ELSE %]
243
                        <option value="gf">gf - filmstrip</option>
244
                    [% END %]
245
246
                    [% IF ( f1 == "gc" ) %]
247
                        <option value="gc" selected="selected">gc - filmstrip cartridge</option>
248
                    [% ELSE %]
249
                        <option value="gc">gc - filmstrip cartridge</option>
250
                    [% END %]
251
252
                    [% IF ( f1 == "gt" ) %]
253
                        <option value="gt" selected="selected">gt - overhead transparency</option>
254
                    [% ELSE %]
255
                        <option value="gt">gt - overhead transparency</option>
256
                    [% END %]
257
258
                    [% IF ( f1 == "gs" ) %]
259
                        <option value="gs" selected="selected">gs - slide</option>
260
                    [% ELSE %]
261
                        <option value="gs">gs - slide</option>
262
                    [% END %]
263
264
                    [% IF ( f1 == "mz" ) %]
265
                        <option value="mz" selected="selected">mz - other projected image carrier</option>
266
                    [% ELSE %]
267
                        <option value="mz">mz - other projected image carrier</option>
268
                    [% END %]
269
                </optgroup>
270
271
                <optgroup label="Stereographic Carriers">
272
                    [% IF ( f1 == "eh" ) %]
273
                        <option value="eh" selected="selected">eh - stereograph card</option>
274
                    [% ELSE %]
275
                        <option value="eh">eh - stereograph card</option>
276
                    [% END %]
277
278
                    [% IF ( f1 == "es" ) %]
279
                        <option value="es" selected="selected">es - stereograph disc</option>
280
                    [% ELSE %]
281
                        <option value="es">es - stereograph disc</option>
282
                    [% END %]
283
284
                    [% IF ( f1 == "ez" ) %]
285
                        <option value="ez" selected="selected">ez - other stereographic carrier</option>
286
                    [% ELSE %]
287
                        <option value="ez">ez - other stereographic carrier</option>
288
                    [% END %]
289
                </optgroup>
290
291
                <optgroup label="Unmediated carriers">
292
                    [% IF ( f1 == "no" ) %]
293
                        <option value="no" selected="selected">no - card</option>
294
                    [% ELSE %]
295
                        <option value="no">no - card</option>
296
                    [% END %]
297
298
                    [% IF ( f1 == "nn" ) %]
299
                        <option value="nn" selected="selected">nn - flipchart</option>
300
                    [% ELSE %]
301
                        <option value="nn">nn - flipchart</option>
302
                    [% END %]
303
304
                    [% IF ( f1 == "na" ) %]
305
                        <option value="na" selected="selected">na - roll</option>
306
                    [% ELSE %]
307
                        <option value="na">na - roll</option>
308
                    [% END %]
309
310
                    [% IF ( f1 == "nb" ) %]
311
                        <option value="nb" selected="selected">nb - sheet</option>
312
                    [% ELSE %]
313
                        <option value="nb">nb - sheet</option>
314
                    [% END %]
315
316
                    [% IF ( f1 == "nc" ) %]
317
                        <option value="nc" selected="selected">nc - volume</option>
318
                    [% ELSE %]
319
                        <option value="nc">nc - volume</option>
320
                    [% END %]
321
322
                    [% IF ( f1 == "nr" ) %]
323
                        <option value="nr" selected="selected">nr - object</option>
324
                    [% ELSE %]
325
                        <option value="nr">nr - object</option>
326
                    [% END %]
327
328
                    [% IF ( f1 == "nz" ) %]
329
                        <option value="nz" selected="selected">nz - other unmediated carrier</option>
330
                    [% ELSE %]
331
                        <option value="nz">nz - other unmediated carrier</option>
332
                    [% END %]
333
                </optgroup>
334
335
                <optgroup label="Video carriers">
336
                    [% IF ( f1 == "vc" ) %]
337
                        <option value="vc" selected="selected">vc - video cartridge</option>
338
                    [% ELSE %]
339
                        <option value="vc">vc - video cartridge</option>
340
                    [% END %]
341
342
                    [% IF ( f1 == "vf" ) %]
343
                        <option value="vf" selected="selected">vf - videocassette</option>
344
                    [% ELSE %]
345
                        <option value="vf">vf - videocassette</option>
346
                    [% END %]
347
348
                    [% IF ( f1 == "vd" ) %]
349
                        <option value="vd" selected="selected">vd - videodisc</option>
350
                    [% ELSE %]
351
                        <option value="vd">vd - videodisc</option>
352
                    [% END %]
353
354
                    [% IF ( f1 == "vr" ) %]
355
                        <option value="vr" selected="selected">vr - videotape reel</option>
356
                    [% ELSE %]
357
                        <option value="vr">vr - videotape reel</option>
358
                    [% END %]
359
360
                    [% IF ( f1 == "vz" ) %]
361
                        <option value="vz" selected="selected">vz - other video carrier</option>
362
                    [% ELSE %]
363
                        <option value="vz">vz - other video carrier</option>
364
                    [% END %]
365
                </optgroup>
366
367
                <optgroup label="Unspecified carriers">
368
                    [% IF ( f1 == "zu" ) %]
369
                        <option value="zu" selected="selected">zu - unspecified</option>
370
                    [% ELSE %]
371
                        <option value="zu">zu - unspecified</option>
372
                    [% END %]
373
                </optgroup>
374
375
            </select>
376
        </td>
377
    </tr>
378
</table>
379
<p><input type="button" value="OK"  onclick="submitMyForm();" /> <a href="#" class="cancel close">Cancel</a> </p>
380
</form>
381
382
<script>
383
384
   function submitMyForm() {
385
        var doc   = opener.document;
386
        var field = doc.getElementById("[% index | html %]");
387
        subfield();
388
389
        function subfield() {
390
            const tag = $(field).closest('.tag');
391
            const sub = tag.find('[id*="tag_183_subfield_2_"]');
392
            if ( field != 'undefined' ) {
393
                sub[0].value = "RDAcarrier";
394
            }
395
            return subfield;
396
        }
397
398
        field.value = document.f_pop.f1.value;
399
        window.close();
400
        return false;
401
    }
402
</script>
403
404
[% INCLUDE 'popup-bottom.inc' %]

Return to bug 30507