Bug 19108: Fix Stored XSS in biblio_framework.pl and marctagstructure.pl
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / marctagstructure.tt
1 [% USE AuthorisedValues %]
2 [% INCLUDE 'doc-head-open.inc' %]
3 <title>Koha &rsaquo; Administration &rsaquo;
4 [% IF ( add_form ) %]MARC frameworks &rsaquo; [% action %] [% searchfield %][% END %]
5 [% IF ( delete_confirm ) %]MARC frameworks &rsaquo; Confirm deletion of tag '[% searchfield %]'[% END %]
6 [% IF ( delete_confirmed ) %]MARC frameworks &rsaquo;  Data deleted[% END %]
7 [% IF ( else ) %]MARC frameworks[% END %]</title>
8 [% INCLUDE 'doc-head-close.inc' %]
9 <link rel="stylesheet" type="text/css" href="[% interface %]/[% theme %]/css/datatables.css" />
10 [% INCLUDE 'datatables.inc' %]
11 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.cookie.min.js"></script>
12
13 <script type="text/javascript">
14 //<![CDATA[
15
16 $(document).ready(function() {
17     $("#table_marctagstructure").dataTable($.extend(true, {}, dataTablesDefaults, {
18         "aoColumnDefs": [
19             { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
20         ],
21         "sPaginationType": "four_button"
22     }));
23     $("#select_display").on("change",function(){
24         var checked = $(this).prop("checked") ? 1: 0;
25         $.cookie('marctagstructure_selectdisplay', checked);
26         this.form.submit();
27     });
28 });
29
30 //]]>
31 </script>
32 </head>
33 <body id="admin_marctagstructure" class="admin">
34 [% INCLUDE 'header.inc' %]
35 [% INCLUDE 'prefs-admin-search.inc' %]
36
37 <div id="breadcrumbs">
38          <a href="/cgi-bin/koha/mainpage.pl">Home</a>
39 &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
40 &rsaquo; <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a>
41 [% IF ( add_form ) %]
42 &rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% IF framework %][% framework.frameworktext |html %] ([% framework.frameworkcode %])[% ELSE %]Default MARC framework[% END%]</a>
43 &rsaquo; [% action %] [% searchfield %]
44 [% ELSIF ( else ) %]
45 &rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% IF framework %][% framework.frameworktext |html %] ([% framework.frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a>
46 [% ELSIF ( delete_confirm ) %]
47 &rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% IF framework %][% framework.frameworktext |html %] ([% framework.frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a>
48 &rsaquo; Confirm deletion of tag '[% searchfield %]'
49 [% ELSIF ( delete_confirmed ) %]
50 &rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode %]">[% IF framework %][% framework.frameworktext |html %] ([% framework.frameworkcode %])[% ELSE %]Default MARC framework[% END %]</a>
51 &rsaquo; Data deleted
52 [% END %]
53 </div>
54
55 <div id="doc3" class="yui-t2">
56   <div id="bd">
57     <div id="yui-main">
58       <div class="yui-b">
59
60 [% IF ( else ) %]
61 <div id="toolbar" class="btn-toolbar">
62     <a class="btn btn-default btn-sm" id="addtag" href="/cgi-bin/koha/admin/marctagstructure.pl?op=add_form&amp;frameworkcode=[% framework.frameworkcode %]"><i class="fa fa-plus"></i> New tag</a>
63 </div>[% END %]
64
65 <h1>MARC Framework for [% IF framework %][% framework.frameworktext |html %] ([% framework.frameworkcode %])[% ELSE %]default MARC framework[% END %]</h1>
66
67 [% IF ( add_form ) %]
68
69     <form action="[% script_name %]" name="Aform" method="post" class="validated">
70
71       <fieldset class="rows"><legend>[% IF ( use_heading_flags_p ) %][% IF ( heading_modify_tag_p ) %]Modify tag <input type="hidden" name="modif" value="1" />[% searchfield %][% END %][% IF ( heading_add_tag_p ) %]Add tag[% END %][% ELSE %][% action %][% END %]</legend>  <input type="hidden" name="op" value="add_validate" />
72         <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
73
74         <ol>
75             <li>
76                 [% IF ( heading_modify_tag_p ) %]
77                     <input type="hidden" name="tagfield" value="[% searchfield %]" />
78                     <span class="label">Tag:</span>
79                     [% searchfield %]
80                 [% ELSE %]
81                     <label for="tagfield" class="required">Tag: </label>
82                     <input id="tagfield" type="text" name="tagfield" value="[% searchfield %]" maxlength="3" size="3" required="required" class="required" />
83                     <span class="required">Required</span>
84                 [% END %]
85             </li>
86     <li><label for="liblibrarian">Label for lib: </label><input type="text" id="liblibrarian" name="liblibrarian" value="[% liblibrarian |html %]" size="40" maxlength="100" /></li>
87     <li><label for="libopac">Label for opac: </label><input type="text" id="libopac" name="libopac" value="[% libopac |html %]" size="40" maxlength="100" /></li>
88     <li><label for="repeatable">Repeatable: </label>
89         [% IF ( repeatable ) %]
90             <input type="checkbox" name="repeatable" id="repeatable" value="1" checked="checked" />
91         [% ELSE %]
92             <input type="checkbox" name="repeatable" id="repeatable" value="1" />
93         [% END %]
94     </li>
95     <li><label for="mandatory">Mandatory: </label>
96         [% IF ( mandatory ) %]
97             <input type="checkbox" name="mandatory" id="mandatory" value="1" checked="checked" />
98         [% ELSE %]
99             <input type="checkbox" name="mandatory" id="mandatory" value="1" />
100         [% END %]
101     </li>
102     <li><label for="authorised_value">Authorized value: </label>
103         <select name="authorised_value" id="authorised_value" size="1">
104             <option value=""></option>
105             [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value ) %]
106         </select>
107         (if you select a value here, the indicators will be limited to the authorized value list)</li>
108 </ol></fieldset> 
109     <fieldset class="action">
110         <input type="submit" value="Save changes" />
111         <a class="cancel" href="[% script_name %]?frameworkcode=[% framework.frameworkcode %]">Cancel</a>
112     </fieldset>
113     </form>
114 [% END %]
115
116
117 [% IF ( delete_confirm ) %]
118     <div class="dialog alert">
119         <h3>Confirm deletion of tag <span class="ex">'[% searchfield %]'</span>?</h3>
120         <p>Tag: [% searchfield %]</p>
121         <p>Description: [% liblibrarian %]</p>
122         <form action="[% script_name %]" method="post">
123             <input type="hidden" name="op" value="delete_confirmed" />
124             <input type="hidden" name="searchfield" value="[% searchfield %]" />
125             <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
126             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this tag</button>
127         </form>
128         <form action="[% script_name %]" method="get"><input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
129             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
130         </form>
131     </div>
132 [% END %]
133
134 [% IF ( delete_confirmed ) %]
135
136     <div class="dialog message"><h3>Tag deleted</h3>
137     <form action="[% script_name %]" method="post"><input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
138         <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
139     </form></div>
140 [% END %]
141 [% IF ( framework_create ) %]
142
143     <form action="[% script_name %]" method="post">
144         <input type="hidden" name="op" value="framework_create_confirm" />
145         <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
146         Create framework for [% frameworkcode %] ([% framework.frameworktext |html %]) using
147         <select name="existingframeworkcode">
148             <option value="">Default</option>
149         [% FOREACH existingframeworkloo IN existingframeworkloop %]
150             <option value="[% existingframeworkloo.value %]">[% existingframeworkloo.frameworktext |html %]</option>
151         [% END %]
152         </select>
153         <input type="submit" value="OK" />
154     </form>
155 [% END %]
156
157
158 [% IF ( else ) %]
159 <form name="f" action="[% script_name %]" method="post">
160 <fieldset style="padding:.5em;">
161         <label for="searchfield"><strong>Search for tag:</strong> </label>
162         <input type="text" name="searchfield" id="searchfield" size="4" value="[% searchfield %]" />
163
164 <label for="frameworkcode"><strong>In framework:</strong> </label>
165         <select id="frameworkcode" name="frameworkcode">
166             <option value="">Default</option>
167             [% FOREACH f IN frameworks %]
168             [% IF f.frameworkcode == framework.frameworkcode %]
169                 <option value="[% f.frameworkcode %]" selected="selected">[% f.frameworktext |html %]</option>
170                 [% ELSE %]
171                 <option value="[% f.frameworkcode %]">[% f.frameworktext |html %]</option>
172                 [% END %]
173             [% END %]
174         </select>
175     <input type="submit" value="Search" />
176 <p>        <label for="select_display">Display only used tags/subfields</label>
177         [% IF ( select_display ) %]
178             <input type="checkbox" name="select_display" id="select_display" value="True" checked="checked" />
179         [% ELSE %]
180             <input type="checkbox" name="select_display" id="select_display" value="True" />
181         [% END %]</p>
182 </fieldset>
183 </form>
184
185     <table id="table_marctagstructure">
186     <thead>
187         <tr>
188         <th>Tag</th>
189         <th>Lib</th>
190         <th>Repeatable</th>
191         <th>Mandatory</th>
192         <th>Auth value</th>
193         <th>&nbsp;</th>
194         </tr>
195     </thead>
196     <tbody>
197     [% IF ( select_display ) %]
198         [% FOREACH loo IN loop %]
199         <tr>
200             <td>[% loo.tagfield %]</td>
201             <td>
202                 [% loo.liblibrarian %]
203                 [% FOREACH subfield IN loo.subfields %]
204                     <p>
205                         Tab:[% subfield.tab %] | $[% subfield.tagsubfield %]
206                         [% subfield.liblibrarian %] [% IF ( subfield.kohafield ) %][% subfield.kohafield %][% END %][% IF ( subfield.repeatable ) %], repeatable[% END %][% IF ( subfield.mandatory ) %], Mandatory[% END %][% IF ( subfield.seealso ) %], See [% subfield.seealso %][% END %][% IF ( subfield.authorised_value ) %], [% subfield.authorised_value %][% END %][% IF ( subfield.authtypecode ) %], [% subfield.authtypecode %][% END %][% IF ( subfield.value_builder ) %], [% subfield.value_builder %][% END %]
207                     </p>
208                 [% END %]
209             </td>
210             <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
211             <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
212             <td>[% loo.authorised_value %]</td>
213             <td>
214                 <div class="dropdown">
215                     <a class="btn btn-default btn-xs dropdown-toggle" id="marctagactions[% loo.tagfield %]" role="button" data-toggle="dropdown" href="#">
216                         Actions <b class="caret"></b></a>
217                     <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="marctagactions[% loo.tagfield %]">
218                         <li><a href="[% loo.subfield_link %]"><i class="fa fa-eye"></i> Subfields</a></li>
219                         <li><a href="[% loo.edit %]"><i class="fa fa-pencil"></i> Edit</a></li>
220                         <li><a href="[% loo.delete %]"><i class="fa fa-trash"></i> Delete</a></li>
221                     </ul>
222                 </div>
223             </td>
224         </tr>
225         [% END %]
226     [% ELSE %]
227     [% FOREACH loo IN loop %]
228     <tr>
229         <td>[% loo.tagfield %]</td>
230         <td>[% loo.liblibrarian %]</td>
231         <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
232         <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
233         <td>[% loo.authorised_value %]</td>
234         <td>
235             <div class="dropdown">
236                 <a class="btn btn-default btn-xs dropdown-toggle" id="marctagactions[% loo.tagfield %]" role="button" data-toggle="dropdown" href="#">
237                     Actions <b class="caret"></b></a>
238                 <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="marctagactions[% loo.tagfield %]">
239                     <li><a href="[% loo.subfield_link %]"><i class="fa fa-eye"></i> Subfields</a></li>
240                     <li><a href="[% loo.edit %]"><i class="fa fa-pencil"></i> Edit</a></li>
241                     <li><a href="[% loo.delete %]"><i class="fa fa-trash"></i> Delete</a></li>
242                 </ul>
243             </div>
244         </td>
245     </tr>
246     [% END %]
247     [% END %]
248     </tbody>
249     </table>
250
251
252
253 [% END %]
254
255
256     </div>
257   </div>
258 <div class="yui-b">
259 [% INCLUDE 'admin-menu.inc' %]
260 </div>
261 </div>
262 [% INCLUDE 'intranet-bottom.inc' %]