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