Bug 19823: Move template JavaScript to the footer: MARC21 editor plugins
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / value_builder / marc21_field_008.tt
bloba271c3837e2c1f6e798dc6916c8431cb45fc4bd7
1 [% SET footerjs = 1 %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Cataloging &rsaquo; 008 builder</title>
4 [% INCLUDE 'doc-head-close.inc' %]
5 </head>
7 <body id="cat_marc21_field_008" class="cat" style="padding:1em;" onload="loadXmlValues()">
8 <h3> 008 Fixed-length data elements--Additional material characteristics--General information</h3>
10 <table>
11     <tr id="tr_result">
12     </tr>
13 </table>
14 <h4 id="h4_result">&quot;[% result %]&quot;</h4>
16 <form name="f_pop" id="f_pop" onsubmit="report()" action="">
17 <fieldset class="action" id="fixedlengthbuilderaction"><input type="submit" value="OK" /> <a href="#" class="cancel close">Cancel</a></fieldset>
18 <input type="hidden" name="plugin_name" value="marc21_field_008.pl" />
19 <input type="hidden" id="[% index %]" name="index" value="[% index %]" />
20 <input type="hidden" name="result" id="result" value="[% result %]" />
21 <table id="table_material_types">
22     <tr id="tr_material_types">
23         <td><label for="material_type" title="Select a type of material to specify the variable values">Type of Material</label></td>
24         <td>
25             <select name="material_type" id="material_type" title="Select a type of material to specify the variable values" onchange="changeTypeofMaterial(this.form)">
26                 <option value="">Select a type of material</option>
27             </select>
28         </td>
29     </tr>
31 </table>
32 </form>
34 [% MACRO jsinclude BLOCK %]
35     <script type="text/javascript" src='[% interface %]/[% theme %]/js/xmlControlfield_[% KOHA_VERSION %].js'></script>
36     <script type="text/javascript">
37         var objXmlControlField;
38         var tr_result;
39         var h4_result;
41         function loadXmlValues(){
42             [% IF ( errorXml ) %]
43                 alert("[% errorXml %]");
44             [% ELSE %]
45                 var form = document.f_pop;
46                 h4_result = document.getElementById("h4_result");
47                 tr_result = document.getElementById("tr_result");
48                 objXmlControlField = new xmlControlField('[% tagfield %]', 'f_pop', document.getElementById('material_type'), document.getElementById('table_material_types'), 'h4_result', 'tr_result', '', '[% themelang %]', '[% marcflavour %]');
49                 [%# If material type configuration is found using the leader, use that type when rendering. Otherwise, the default of BKS will be used %]
50                 [% IF ( material_configuration ) %]
51                     objXmlControlField.idMaterial = "[% material_configuration %]";
52                 [% END %]
53                 objXmlControlField.loadXmlValues();
54                 renderResult(tr_result, (form.result.value != "")?form.result.value:returnValueParam("result"));
55             [% END %]
56         } // loadXmlValues
58         function changeTypeofMaterial(form){
59             if (form.material_type.options[form.material_type.selectedIndex].value != "" && confirm(_("Show values for '%s' material type?").format(form.material_type.options[form.material_type.selectedIndex].text))) {
60                 objXmlControlField.setIdMaterial(form.material_type.options[form.material_type.selectedIndex].value);
61                 objXmlControlField.renderTemplate();
62                 renderResult(tr_result, form.result.value, true);
63             }
64         } // changeTypeofMaterial
66         function report() {
67             var doc   = opener.document;
68             var field = doc.getElementById("[% index %]");
69             field.value = document.getElementById("result").value;
70             self.close();
71             return false;
72         }
74     </script>
75 [% END %]
77 [% INCLUDE 'intranet-bottom.inc' popup_window=1 %]