Bug 20731: Move template JavaScript to the footer: Call number browser MARC plugin
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / value_builder / marc21_field_006.tt
1 [% USE Asset %]
2 [% SET footerjs = 1 %]
3 [% INCLUDE 'doc-head-open.inc' %]
4 <title>Koha &rsaquo; Cataloging &rsaquo; 006 builder</title>
5 [% INCLUDE 'doc-head-close.inc' %]
6 </head>
7
8 <body id="cat_marc21_field_006" class="cat" style="padding:1em;" onload="loadXmlValues()">
9 <h3>006 Fixed-length data elements--Additional material characteristics--General information</h3>
10
11 <table>
12     <tr id="tr_result">
13     </tr>
14 </table>
15 <h4 id="h4_result">&quot;[% result %]&quot;</h4>
16
17 <form name="f_pop" id="f_pop" onsubmit="report()" action="">
18 <input type="hidden" name="plugin_name" value="marc21_field_006.pl" />
19 <input type="hidden" id="[% index %]" name="index" value="[% index %]" />
20 <input type="hidden" id="result" name="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>
30 </table>
31 <fieldset class="action"><input type="submit" value="OK" /> <a href="#" class="cancel close">Cancel</a></fieldset>
32 </form>
33
34 [% MACRO jsinclude BLOCK %]
35     [% Asset.js("js/xmlControlfield.js") %]
36     <script type="text/javascript">
37         var objXmlControlField;
38         var tr_result;
39         var h4_result;
40
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_configuration ) %]
50             objXmlControlField.idMaterial = "[% material_configuration %]";
51             [% END %]
52             objXmlControlField.loadXmlValues();
53             renderResult(tr_result, (form.result.value != "")?form.result.value:returnValueParam("result"));
54             [% END %]
55         } // loadXmlValues
56
57         function changeTypeofMaterial(form){
58             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))) {
59                 objXmlControlField.setIdMaterial(form.material_type.options[form.material_type.selectedIndex].value);
60                 objXmlControlField.renderTemplate();
61                 renderResult(tr_result, form.result.value, true);
62             }
63         } // changeTypeofMaterial
64
65         function report() {
66             var doc   = opener.document;
67             var field = doc.getElementById("[% index %]");
68             field.value = document.getElementById("result").value;
69             self.close();
70             return false;
71         }
72     </script>
73 [% END %]
74
75 [% INCLUDE 'intranet-bottom.inc' popup_window=1 %]