Bug 13618: Add html filters to all the variables
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / cataloguing / value_builder / marc21_field_008.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Cataloging &rsaquo; 008 builder</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 </head>
8
9 <body id="cat_marc21_field_008" class="cat" style="padding:1em;" onload="loadXmlValues()">
10 <h3> 008 Fixed-length data elements--Additional material characteristics--General information</h3>
11
12 <table>
13     <tr id="tr_result">
14     </tr>
15 </table>
16 <h4 id="h4_result">&quot;[% result | html %]&quot;</h4>
17
18 <form name="f_pop" id="f_pop" onsubmit="report()" action="">
19     <div id="toolbar">
20         <div class="btn-group">
21             <button type="submit" class="btn btn-default btn-sm"><i class="fa fa-save"></i> Save</button>
22         </div>
23         <div class="btn-group">
24             <button type="button" class="btn btn-default btn-sm close_window"><i class="fa fa-remove"></i> Cancel</button>
25         </div>
26     </div>
27
28 <input type="hidden" name="plugin_name" value="marc21_field_008.pl" />
29 <input type="hidden" id="[% index | html %]" name="index" value="[% index | html %]" />
30 <input type="hidden" name="result" id="result" value="[% result | html %]" />
31 <table id="table_material_types">
32     <tr id="tr_material_types">
33         <td><label for="material_type" title="Select a type of material to specify the variable values">Type of Material</label></td>
34         <td>
35             <select name="material_type" id="material_type" title="Select a type of material to specify the variable values" onchange="changeTypeofMaterial(this.form)">
36                 <option value="">Select a type of material</option>
37             </select>
38         </td>
39     </tr>
40
41 </table>
42 </form>
43
44 [% MACRO jsinclude BLOCK %]
45     [% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %]
46     [% Asset.js("js/xmlControlfield.js") | $raw %]
47     <script>
48         $(document).ready(function(){
49             $('#toolbar').fixFloat();
50             $(".close_window").on("click", function(e){
51                 e.preventDefault();
52                 window.close();
53             });
54         });
55         var objXmlControlField;
56         var tr_result;
57         var h4_result;
58
59         function loadXmlValues(){
60             [% IF ( errorXml ) %]
61                 alert("[% errorXml | html %]");
62             [% ELSE %]
63                 var form = document.f_pop;
64                 h4_result = document.getElementById("h4_result");
65                 tr_result = document.getElementById("tr_result");
66                 objXmlControlField = new xmlControlField('[% tagfield | html %]', 'f_pop', document.getElementById('material_type'), document.getElementById('table_material_types'), 'h4_result', 'tr_result', '', '[% themelang | html %]', '[% marcflavour | html %]');
67                 [%# If material type configuration is found using the leader, use that type when rendering. Otherwise, the default of BKS will be used %]
68                 [% IF ( material_configuration ) %]
69                     objXmlControlField.idMaterial = "[% material_configuration | html %]";
70                 [% END %]
71                 objXmlControlField.loadXmlValues();
72                 renderResult(tr_result, (form.result.value != "")?form.result.value:returnValueParam("result"));
73             [% END %]
74         } // loadXmlValues
75
76         function changeTypeofMaterial(form){
77             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))) {
78                 objXmlControlField.setIdMaterial(form.material_type.options[form.material_type.selectedIndex].value);
79                 objXmlControlField.renderTemplate();
80                 renderResult(tr_result, form.result.value, true);
81             }
82         } // changeTypeofMaterial
83
84         function report() {
85             var doc   = opener.document;
86             var field = doc.getElementById("[% index | html %]");
87             field.value = document.getElementById("result").value;
88             self.close();
89             return false;
90         }
91
92     </script>
93 [% END %]
94
95 [% INCLUDE 'intranet-bottom.inc' popup_window=1 %]