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

(-)a/cataloguing/value_builder/unimarc_field_283-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_283-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_283-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_283a.pl (+68 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_283a.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_283a.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;
56
57
    $template->param(
58
        index => scalar $cgi->param('index'),
59
        result => $results,
60
        f1 => $input_a,
61
    );
62
    output_html_with_http_headers $cgi, $cookie, $template->output;
63
};
64
65
# Return the hashref with the builder and launcher to FrameworkPlugin object.
66
# NOTE: If you do not need a popup but only use e.g. Focus, Blur etc. for a
67
# particular plugin, you only need to define and return the builder.
68
return { builder => $builder, launcher => $launcher };
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/value_builder/unimarc_field_283-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_283-2" class="cat" style="padding:1em;">
7
8
<h3>UNIMARC field 283-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_283a.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_283a" class="cat" style="padding:1em;">
7
8
<h3>UNIMARC field 283a 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 == "audio cartridge" ) %]
17
                        <option value="audio cartridge" selected="selected">audio cartridge</option>
18
                    [% ELSE %]
19
                        <option value="audio cartridge">audio cartridge</option>
20
                    [% END %]
21
22
                    [% IF ( f1 == "audio belt" ) %]
23
                        <option value="audio belt" selected="selected">audio belt</option>
24
                    [% ELSE %]
25
                        <option value="audio belt">audio belt</option>
26
                    [% END %]
27
28
                    [% IF ( f1 == "audio cylinder" ) %]
29
                        <option value="audio cylinder" selected="selected">audio cylinder</option>
30
                    [% ELSE %]
31
                        <option value="audio cylinder">audio cylinder</option>
32
                    [% END %]
33
34
                    [% IF ( f1 == "audio disc" ) %]
35
                        <option value="audio disc" selected="selected">audio disc</option>
36
                    [% ELSE %]
37
                        <option value="audio disc">audio disc</option>
38
                    [% END %]
39
40
                    [% IF ( f1 == "sound track reel" ) %]
41
                        <option value="sound track reel" selected="selected">sound track reel</option>
42
                    [% ELSE %]
43
                        <option value="sound track reel">sound track reel</option>
44
                    [% END %]
45
46
                    [% IF ( f1 == "audio roll" ) %]
47
                        <option value="audio roll" selected="selected">audio roll</option>
48
                    [% ELSE %]
49
                        <option value="audio roll">audio roll</option>
50
                    [% END %]
51
52
                    [% IF ( f1 == "audio wire reel" ) %]
53
                        <option value="audio wire reel" selected="selected">audio wire reel</option>
54
                    [% ELSE %]
55
                        <option value="audio wire reel">audio wire reel</option>
56
                    [% END %]
57
58
                    [% IF ( f1 == "audiocassette" ) %]
59
                        <option value="audiocassette" selected="selected">audiocassette</option>
60
                    [% ELSE %]
61
                        <option value="audiocassette">audiocassette</option>
62
                    [% END %]
63
64
                    [% IF ( f1 == "audiotape reel" ) %]
65
                        <option value="audiotape reel" selected="selected">audiotape reel</option>
66
                    [% ELSE %]
67
                        <option value="audiotape reel">audiotape reel</option>
68
                    [% END %]
69
70
                    [% IF ( f1 == "other audio carrier" ) %]
71
                        <option value="other audio carrier" disabled="disabled" selected="selected">other audio carrier</option>
72
                    [% ELSE %]
73
                        <option value="other audio carrier" >other audio carrier</option>
74
                    [% END %]
75
                </optgroup>
76
77
                <optgroup label="Computer Carriers">
78
                    [% IF ( f1 == "computer card" ) %]
79
                        <option value="computer card" selected="selected">computer card</option>
80
                    [% ELSE %]
81
                        <option value="computer card">computer card</option>
82
                    [% END %]
83
84
                    [% IF ( f1 == "computer chip cartridge" ) %]
85
                        <option value="computer chip cartridge" selected="selected">computer chip cartridge</option>
86
                    [% ELSE %]
87
                        <option value="computer chip cartridge">computer chip cartridge</option>
88
                    [% END %]
89
90
                    [% IF ( f1 == "computer disc" ) %]
91
                        <option value="computer disc" selected="selected">computer disc</option>
92
                    [% ELSE %]
93
                        <option value="computer disc">computer disc</option>
94
                    [% END %]
95
96
                    [% IF ( f1 == "computer disc cartridge" ) %]
97
                        <option value="computer disc cartridge" selected="selected">computer disc cartridge</option>
98
                    [% ELSE %]
99
                        <option value="computer disc cartridge">computer disc cartridge</option>
100
                    [% END %]
101
102
                    [% IF ( f1 == "computer tape cartridge" ) %]
103
                        <option value="computer tape cartridge" selected="selected">computer tape cartridge</option>
104
                    [% ELSE %]
105
                        <option value="computer tape cartridge">computer tape cartridge</option>
106
                    [% END %]
107
108
                    [% IF ( f1 == "computer tape cassette" ) %]
109
                        <option value="computer tape cassette" selected="selected">computer tape cassette</option>
110
                    [% ELSE %]
111
                        <option value="computer tape cassette">computer tape cassette</option>
112
                    [% END %]
113
114
                    [% IF ( f1 == "computer tape reel" ) %]
115
                        <option value="computer tape reel" selected="selected">computer tape reel</option>
116
                    [% ELSE %]
117
                        <option value="computer tape reel">computer tape reel</option>
118
                    [% END %]
119
120
                    [% IF ( f1 == "online resource" ) %]
121
                        <option value="online resource" selected="selected">online resource</option>
122
                    [% ELSE %]
123
                        <option value="online resource">online resource</option>
124
                    [% END %]
125
126
                    [% IF ( f1 == "other computer carrier" ) %]
127
                        <option value="other computer carrier" selected="selected">other computer carrier</option>
128
                    [% ELSE %]
129
                        <option value="other computer carrier">other computer carrier</option>
130
                    [% END %]
131
                </optgroup>
132
133
                <optgroup label="Microform Carriers">
134
                    [% IF ( f1 == "aperture card" ) %]
135
                        <option value="aperture card" selected="selected">aperture card</option>
136
                    [% ELSE %]
137
                        <option value="aperture card">aperture card</option>
138
                    [% END %]
139
140
                    [% IF ( f1 == "microfiche" ) %]
141
                        <option value="microfiche" selected="selected">microfiche</option>
142
                    [% ELSE %]
143
                        <option value="microfiche">microfiche</option>
144
                    [% END %]
145
146
                    [% IF ( f1 == "microfiche cassette" ) %]
147
                        <option value="microfiche cassette" selected="selected">microfiche cassette</option>
148
                    [% ELSE %]
149
                        <option value="microfiche cassette">microfiche cassette</option>
150
                    [% END %]
151
152
                    [% IF ( f1 == "microfilm cartridge" ) %]
153
                        <option value="microfilm cartridge" selected="selected">microfilm cartridge</option>
154
                    [% ELSE %]
155
                        <option value="microfilm cartridge">microfilm cartridge</option>
156
                    [% END %]
157
158
                    [% IF ( f1 == "microfilm cassette" ) %]
159
                        <option value="microfilm cassette" selected="selected">microfilm cassette</option>
160
                    [% ELSE %]
161
                        <option value="microfilm cassette">microfilm cassette</option>
162
                    [% END %]
163
164
                    [% IF ( f1 == "microfilm reel" ) %]
165
                        <option value="microfilm reel" selected="selected">microfilm reel</option>
166
                    [% ELSE %]
167
                        <option value="microfilm reel">microfilm reel</option>
168
                    [% END %]
169
170
                    [% IF ( f1 == "microfilm roll" ) %]
171
                        <option value="microfilm roll" selected="selected">microfilm roll</option>
172
                    [% ELSE %]
173
                        <option value="microfilm roll">microfilm roll</option>
174
                    [% END %]
175
176
                    [% IF ( f1 == "microfilm slip" ) %]
177
                        <option value="microfilm slip" selected="selected">microfilm slip</option>
178
                    [% ELSE %]
179
                        <option value="microfilm slip">microfilm slip</option>
180
                    [% END %]
181
182
                    [% IF ( f1 == "microopaque" ) %]
183
                        <option value="microopaque" selected="selected">microopaque</option>
184
                    [% ELSE %]
185
                        <option value="microopaque">microopaque</option>
186
                    [% END %]
187
188
                    [% IF ( f1 == "other microform carrier" ) %]
189
                        <option value="other microform carrier" selected="selected">other microform carrier</option>
190
                    [% ELSE %]
191
                        <option value="other microform carrier">other microform carrier</option>
192
                    [% END %]
193
                </optgroup>
194
195
                <optgroup label="Microscopic Carriers">
196
                    [% IF ( f1 == "microscope slide" ) %]
197
                        <option value="microscope slide" selected="selected">microscope slide</option>
198
                    [% ELSE %]
199
                        <option value="microscope slide">microscope slide</option>
200
                    [% END %]
201
202
                    [% IF ( f1 == "other microscopic carrier" ) %]
203
                        <option value="other microscopic carrier" selected="selected">other microscopic carrier</option>
204
                    [% ELSE %]
205
                        <option value="other microscopic carrier">other microscopic carrier</option>
206
                    [% END %]
207
                </optgroup>
208
209
                <optgroup label="Projected image carriers">
210
                    [% IF ( f1 == "film cartridge" ) %]
211
                        <option value="film cartridge" selected="selected">film cartridge</option>
212
                    [% ELSE %]
213
                        <option value="film cartridge">film cartridge</option>
214
                    [% END %]
215
216
                    [% IF ( f1 == "film cassette" ) %]
217
                        <option value="film cassette" selected="selected">film cassette</option>
218
                    [% ELSE %]
219
                        <option value="film cassette">film cassette</option>
220
                    [% END %]
221
222
                    [% IF ( f1 == "film reel" ) %]
223
                        <option value="film reel" selected="selected">film reel</option>
224
                    [% ELSE %]
225
                        <option value="film reel">film reel</option>
226
                    [% END %]
227
228
                    [% IF ( f1 == "film roll" ) %]
229
                        <option value="film roll" selected="selected">film roll</option>
230
                    [% ELSE %]
231
                        <option value="film roll">film roll</option>
232
                    [% END %]
233
234
                    [% IF ( f1 == "filmslip" ) %]
235
                        <option value="filmslip" selected="selected">filmslip</option>
236
                    [% ELSE %]
237
                        <option value="filmslip">filmslip</option>
238
                    [% END %]
239
240
                    [% IF ( f1 == "filmstrip" ) %]
241
                        <option value="filmstrip" selected="selected">filmstrip</option>
242
                    [% ELSE %]
243
                        <option value="filmstrip">filmstrip</option>
244
                    [% END %]
245
246
                    [% IF ( f1 == "filmstrip cartridge" ) %]
247
                        <option value="filmstrip cartridge" selected="selected">filmstrip cartridge</option>
248
                    [% ELSE %]
249
                        <option value="filmstrip cartridge">filmstrip cartridge</option>
250
                    [% END %]
251
252
                    [% IF ( f1 == "overhead transparency" ) %]
253
                        <option value="overhead transparency" selected="selected">overhead transparency</option>
254
                    [% ELSE %]
255
                        <option value="overhead transparency">overhead transparency</option>
256
                    [% END %]
257
258
                    [% IF ( f1 == "slide" ) %]
259
                        <option value="slide" selected="selected">slide</option>
260
                    [% ELSE %]
261
                        <option value="slide">slide</option>
262
                    [% END %]
263
264
                    [% IF ( f1 == "other projected image carrier" ) %]
265
                        <option value="other projected image carrier" selected="selected">other projected image carrier</option>
266
                    [% ELSE %]
267
                        <option value="other projected image carrier">other projected image carrier</option>
268
                    [% END %]
269
                </optgroup>
270
271
                <optgroup label="Stereographic Carriers">
272
                    [% IF ( f1 == "stereograph card" ) %]
273
                        <option value="stereograph card" selected="selected">stereograph card</option>
274
                    [% ELSE %]
275
                        <option value="stereograph card">stereograph card</option>
276
                    [% END %]
277
278
                    [% IF ( f1 == "stereograph disc" ) %]
279
                        <option value="stereograph disc" selected="selected">stereograph disc</option>
280
                    [% ELSE %]
281
                        <option value="stereograph disc">stereograph disc</option>
282
                    [% END %]
283
284
                    [% IF ( f1 == "other stereographic carrier" ) %]
285
                        <option value="other stereographic carrier" selected="selected">other stereographic carrier</option>
286
                    [% ELSE %]
287
                        <option value="other stereographic carrier">other stereographic carrier</option>
288
                    [% END %]
289
                </optgroup>
290
291
                <optgroup label="Unmediated carriers">
292
                    [% IF ( f1 == "card" ) %]
293
                        <option value="card" selected="selected">card</option>
294
                    [% ELSE %]
295
                        <option value="card">card</option>
296
                    [% END %]
297
298
                    [% IF ( f1 == "flipchart" ) %]
299
                        <option value="flipchart" selected="selected">flipchart</option>
300
                    [% ELSE %]
301
                        <option value="flipchart">flipchart</option>
302
                    [% END %]
303
304
                    [% IF ( f1 == "roll" ) %]
305
                        <option value="roll" selected="selected">roll</option>
306
                    [% ELSE %]
307
                        <option value="roll">roll</option>
308
                    [% END %]
309
310
                    [% IF ( f1 == "sheet" ) %]
311
                        <option value="sheet" selected="selected">sheet</option>
312
                    [% ELSE %]
313
                        <option value="sheet">sheet</option>
314
                    [% END %]
315
316
                    [% IF ( f1 == "volume" ) %]
317
                        <option value="volume" selected="selected">volume</option>
318
                    [% ELSE %]
319
                        <option value="volume">volume</option>
320
                    [% END %]
321
322
                    [% IF ( f1 == "object" ) %]
323
                        <option value="object" selected="selected">object</option>
324
                    [% ELSE %]
325
                        <option value="object">object</option>
326
                    [% END %]
327
328
                    [% IF ( f1 == "other unmediated carrier" ) %]
329
                        <option value="other unmediated carrier" selected="selected">other unmediated carrier</option>
330
                    [% ELSE %]
331
                        <option value="other unmediated carrier">other unmediated carrier</option>
332
                    [% END %]
333
                </optgroup>
334
335
                <optgroup label="Video carriers">
336
                    [% IF ( f1 == "video cartridge" ) %]
337
                        <option value="video cartridge" selected="selected">video cartridge</option>
338
                    [% ELSE %]
339
                        <option value="video cartridge">video cartridge</option>
340
                    [% END %]
341
342
                    [% IF ( f1 == "videocassette" ) %]
343
                        <option value="videocassette" selected="selected">videocassette</option>
344
                    [% ELSE %]
345
                        <option value="videocassette">videocassette</option>
346
                    [% END %]
347
348
                    [% IF ( f1 == "videodisc" ) %]
349
                        <option value="videodisc" selected="selected">videodisc</option>
350
                    [% ELSE %]
351
                        <option value="videodisc">videodisc</option>
352
                    [% END %]
353
354
                    [% IF ( f1 == "videotape reel" ) %]
355
                        <option value="videotape reel" selected="selected">videotape reel</option>
356
                    [% ELSE %]
357
                        <option value="videotape reel">videotape reel</option>
358
                    [% END %]
359
360
                    [% IF ( f1 == "other video carrier" ) %]
361
                        <option value="other video carrier" selected="selected">other video carrier</option>
362
                    [% ELSE %]
363
                        <option value="other video carrier">other video carrier</option>
364
                    [% END %]
365
                </optgroup>
366
367
                <optgroup label="Unspecified carriers">
368
                    [% IF ( f1 == "unspecified" ) %]
369
                        <option value="unspecified" selected="selected">unspecified</option>
370
                    [% ELSE %]
371
                        <option value="unspecified">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_283_subfield_2_"]');
392
            if ( field.value == 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 31371