Bug 31372: Value builder for field 325
[srvgit] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / value_builder / unimarc_field_325j.tt
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_325j" class="cat" style="padding:1em;">
7
8 <h3>UNIMARC field 325j builder</h3>
9
10 <form name="f_pop" action="" id="form">
11 <table>
12     <tr>
13         <td><label for="f0">Terms of access to the reproduction :</label></td>
14         <td>
15             <select name="f0" id="f0">
16                 [% IF ( f0 == "1" ) %]
17                     <option value="1" selected="selected">1 - free-to-read</option>
18                 [% ELSE %]
19                     <option value="1">1 - free-to-read</option>
20                 [% END %]
21
22                 [% IF ( f0 == "2" ) %]
23                     <option value="2" selected="selected">2 - free-to-read, partly</option>
24                 [% ELSE %]
25                     <option value="2">2 - free-to-read, partly</option>
26                 [% END %]
27
28                 [% IF ( f0 == "3" ) %]
29                     <option value="3" selected="selected">3 - free-to-read, after embargo</option>
30                 [% ELSE %]
31                     <option value="3">3 - free-to-read, after embargo</option>
32                 [% END %]
33
34                 [% IF ( f0 == "4" ) %]
35                     <option value="4" selected="selected">4 - fully</option>
36                 [% ELSE %]
37                     <option value="4">4 - fully</option>
38                 [% END %]
39
40                 [% IF ( f0 == "5" ) %]
41                     <option value="5" selected="selected">5 - free-to-read upon subscription (requires signing up)</option>
42                 [% ELSE %]
43                     <option value="5">5 - free-to-read upon subscription (requires signing up)</option>
44                 [% END %]
45             </select>
46         </td>
47     </tr>
48     <tr>
49         <td><label for="f1">Qualifier type :</label></td>
50         <td>
51             <select name="f1" id="f1">
52                 [% IF ( f1 == "l" ) %]
53                     <option value="l" selected="selected">l - latest</option>
54                 [% ELSE %]
55                     <option value="l" >l - latest</option>
56                 [% END %]
57
58                 [% IF ( f1 == "p" ) %]
59                     <option value="p" selected="selected">p - previous</option>
60                 [% ELSE %]
61                     <option value="p">p - previous</option>
62                 [% END %]
63
64                 [% IF ( f1 == "x" ) %]
65                     <option value="" selected="selected">x - not applicable</option>
66                 [% ELSE %]
67                     <option value="">x - not applicable</option>
68                 [% END %]
69
70                 [% IF ( f1 == "#" ) %]
71                     <option value="#" selected="selected"># - no attempt to code</option>
72                 [% ELSE %]
73                     <option value="#"># - no attempt to code</option>
74                 [% END %]
75             </select>
76         </td>
77     </tr>
78     <tr>
79         <td><label for="f2">Unit under embargo :</label></td>
80         <td>
81             <select name="f2" id="f2">
82                 [% IF ( f2 == "m" ) %]
83                     <option value="m" selected="selected">m - month(s) time</option>
84                 [% ELSE %]
85                     <option value="m">m - month(s) time</option>
86                 [% END %]
87
88                 [% IF ( f2 == "w" ) %]
89                     <option value="w" selected="selected">w - week(s) time</option>
90                 [% ELSE %]
91                     <option value="w">w - week(s) time</option>
92                 [% END %]
93
94                 [% IF ( f2 == "y" ) %]
95                     <option value="y" selected="selected">y - year(s) time</option>
96                 [% ELSE %]
97                     <option value="y">y - year(s) time</option>
98                 [% END %]
99
100                 [% IF ( f2 == "i" ) %]
101                     <option value="i" selected="selected">i - issue(s) part</option>
102                 [% ELSE %]
103                     <option value="i">i - issue(s) part</option>
104                 [% END %]
105
106                 [% IF ( f2 == "x" ) %]
107                     <option value="" selected="selected">x - not applicable</option>
108                 [% ELSE %]
109                     <option value="">x - not applicable</option>
110                 [% END %]
111
112                 [% IF ( f2 == "#" ) %]
113                     <option value="#" selected="selected"># - no attempt to code</option>
114                 [% ELSE %]
115                     <option value="#"># - no attempt to code</option>
116                 [% END %]
117             </select>
118         </td>
119     </tr>
120     <tr>
121         <td><label for="f3">Number of units under embargo :</label></td>
122         <td>
123             <input name="f3" id="f3" inputmode="numeric" pattern="\d{1,2}" value="[% f3 | html %]"></input>
124         </td>
125     </tr>
126 </table>
127 <p><input type="submit" value="OK" /> <a href="#" class="cancel close">Cancel</a> </p>
128 </form>
129
130 <script>
131     $("#form").on('submit', submitMyForm);
132     $("#f0").on('change', function() {
133         document.f_pop.f1.disabled = false;
134         document.f_pop.f2.disabled = false;
135         document.f_pop.f3.disabled = false;
136
137         if ( document.f_pop.f0.value != "3" ) {
138             document.f_pop.f1.value = "x";
139             document.f_pop.f2.value = "x";
140             document.f_pop.f1.disabled = true;
141             document.f_pop.f2.disabled = true;
142             document.f_pop.f3.disabled = true;
143         }
144     });
145     $("#f0").trigger('change');
146
147     function submitMyForm(event) {
148         event.preventDefault();
149         var doc   = opener.document;
150         var field = doc.getElementById("[% index | html %]");
151         if ( document.f_pop.f0.value == "3" ) {
152             var f3v = document.f_pop.f3.value.padStart(2, '0');
153             document.f_pop.f3.value = f3v;
154         }
155
156         field.value = document.f_pop.f0.value+
157                       document.f_pop.f1.value+
158                       document.f_pop.f2.value+
159                       document.f_pop.f3.value;
160         window.close();
161     }
162 </script>
163
164 [% INCLUDE 'popup-bottom.inc' %]