Bug 21526: uri escape TT variables when used in 'a href'
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / marc_subfields_structure.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Koha &rsaquo; Administration &rsaquo;[% IF ( add_form ) %][% IF ( use_heading_flags_p ) %][% IF ( heading_edit_subfields_p ) %] MARC subfield structure &rsaquo; Edit MARC subfields constraints[% END %][% ELSE %] MARC subfield structure &rsaquo; [% action | html %][% END %][% END %]
6 [% IF ( delete_confirm ) %] MARC subfield structure &rsaquo; Confirm deletion of subfield [% tagsubfield | html %][% END %][% IF ( delete_confirmed ) %] MARC subfield structure &rsaquo; Subfield deleted[% END %][% IF ( else ) %]MARC subfield structure[% END %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 </head>
9
10 <body id="admin_marc_subfields_structure" class="admin">
11 [% INCLUDE 'header.inc' %]
12 [% INCLUDE 'prefs-admin-search.inc' %]
13
14 <div id="breadcrumbs">
15   <a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo; <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a> &rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% frameworkcode | html %]&amp;searchfield=[% tagfield | uri %]">[% IF ( frameworkcode ) %][% frameworkcode | html %][% ELSE %]Default[% END %] framework structure</a> &rsaquo;
16   [% IF ( add_form ) %]
17   [% IF ( use_heading_flags_p ) %]
18   [% IF ( heading_edit_subfields_p ) %] <a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=[% tagfield | uri %]&amp;frameworkcode=[% frameworkcode | uri %]">Tag [% tagfield | html %] subfield structure</a> &rsaquo; Edit subfields constraints
19   [% END %]
20   [% ELSE %] <a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=[% tagfield | uri %]&amp;frameworkcode=[% frameworkcode | uri %]">Tag [% tagfield | html %] Subfield structure</a> &rsaquo; [% action | html %]
21   [% END %]
22   [% END %]
23 [% IF ( delete_confirm ) %] <a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=[% tagfield | uri %]&amp;frameworkcode=[% frameworkcode | uri %]">Tag [% tagfield | html %] Subfield structure</a> &rsaquo; Confirm deletion of subfield [% tagsubfield | html %]
24 [% END %]
25 [% IF ( delete_confirmed ) %] <a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=[% tagfield | uri %]&amp;frameworkcode=[% frameworkcode | uri %]">Tag [% tagfield | html %] subfield structure</a> &rsaquo; Subfield deleted
26 [% END %]
27 [% IF ( else ) %]Tag [% tagfield | html %] Subfield structure[% END %]
28 </div>
29
30 <div class="main container-fluid">
31     <div class="row">
32         <div class="col-sm-10 col-sm-push-2">
33             <main>
34
35 [% IF ( add_form ) %]
36     <h1>
37         [% IF ( use_heading_flags_p ) %]
38             [% IF ( heading_edit_subfields_p ) %]Tag [% tagfield | html %] Subfield constraints[% END %]
39         [% ELSE %]
40             [% action | html %]
41         [% END %]
42     </h1>
43     <form action="[% script_name | html %]" name="Aform" method="post">
44     <input type="hidden" name="op" value="add_validate" />
45     <input type="hidden" name="tagfield" value="[% tagfield | html %]" />
46     <input type="hidden" name="frameworkcode" value="[% frameworkcode | html %]" />
47     <div id="subfieldtabs" class="toptabs numbered">
48    <ul>
49         [% FOREACH loo IN loop %]
50             [% IF ( loo.new_subfield ) %]
51                 <li><a href="#sub[% loo.urisubfieldcode | uri %]field" title="[% loo.liblibrarian | html_entity %]">New</a></li>
52             [% ELSE %]
53                 <li><a href="#sub[% loo.urisubfieldcode | uri %]field" title="[% loo.liblibrarian | html_entity %]">
54                     [% loo.subfieldcode | html %]
55                </a></li>
56             [% END %]
57         [% END %]
58     </ul>
59     
60     [% FOREACH loo IN loop %] 
61         <div class="constraints" id="sub[% loo.urisubfieldcode | html %]field">
62
63                <h3><a href="#basic[% loo.urisubfieldcode | uri %]">Basic constraints</a></h3>
64                     <div id="basic[% loo.urisubfieldcode | html %]">
65                     <fieldset class="rows">
66                         <ol>
67                                 [% IF ( subfieldcode == 0 || subfieldcode ) %] 
68                                 <li><span class="label">Subfield code:</span> [% loo.subfieldcode | html %] <input type="hidden" name="tagsubfield" value="[% loo.subfieldcode | html %]" /></li>
69                                 [% ELSE %]
70                                 <li><label for="tagsubfield[% loo.row | html %]">Subfield code:</label> <input type="text" id="tagsubfield[% loo.row | html %]" name="tagsubfield" value="[% loo.subfieldcode | html %]" /></li>
71                                 [% END %]
72                         <li><label for="liblibrarian[% loo.row | html %]">Text for librarian: </label><input id="liblibrarian[% loo.row | html %]" type="text" name="liblibrarian" value="[% loo.liblibrarian | html_entity %]" size="40" maxlength="80" /></li>
73                         <li><label for="libopac[% loo.row | html %]">Text for OPAC: </label><input type="text" id="libopac[% loo.row | html %]" name="libopac" value="[% loo.libopac | html_entity %]" size="40" maxlength="80" /></li>
74                         <li>
75                             <label for="repeatable[% loo.row | html %]">Repeatable: </label>
76                             [% IF loo.repeatable %]
77                                 <input type="checkbox" id="repeatable[% loo.row | html %]" name="repeatable[% loo.row | html %]" checked="checked" value="1" />
78                             [% ELSE %]
79                                 <input type="checkbox" id="repeatable[% loo.row | html %]" name="repeatable[% loo.row | html %]" value="1" />
80                             [% END %]
81                         </li>
82                         <li>
83                             <label for="mandatory[% loo.row | html %]">Mandatory: </label>
84                             [% IF loo.mandatory %]
85                                 <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" checked="checked" value="1" />
86                             [% ELSE %]
87                                 <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" value="1" />
88                             [% END %]
89                         </li>
90                         <li><label for="tab[% loo.row | html %]">Managed in tab: </label>
91                             <select name="tab" tabindex="" size="1" id="tab[% loo.row | html %]">
92                             [%- IF ( loo.tab ==  -1 ) -%]
93                                 <option value="-1" selected="selected">ignore</option>
94                             [%- ELSE -%]
95                                 <option value="-1">ignore</option>
96                             [%- END -%]
97                             [%- FOREACH t IN [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9'] -%]
98                                 [%- IF ( loo.tab ==  t ) -%]
99                                 <option value="[%- t | html -%]" selected="selected">[%- t | html -%]</option>
100                                 [%- ELSE -%]
101                                 <option value="[%- t | html -%]">[%- t | html -%]</option>
102                                 [%- END -%]
103                             [%- END -%]
104                             [%- IF ( loo.tab ==  10 ) -%]
105                                 <option value="10" selected="selected">items (10)</option>
106                             [%- ELSE -%]
107                                 <option value="10">items (10)</option>
108                             [%- END -%]
109                             </select>
110                             (ignore means that the subfield does not display in the record editor)
111                         </li>
112                         </ol>
113                     </fieldset>
114                     </div>
115
116
117             <h3><a href="#advanced[% loo.urisubfieldcode | uri %]">Advanced constraints</a></h3>
118             <div id="advanced[% loo.urisubfieldcode | html %]">
119             <fieldset class="rows">
120                 <ol><li><label for="defaultvalue[% loo.row | html %]">Default value:</label>
121                     <input type="text" name="defaultvalue" id="defaultvalue[% loo.row | html %]" value="[% loo.defaultvalue | html %]" /></li>
122                                 <li><label for="maxlength[% loo.row | html %]">Max length:</label><input type="text" id="maxlength[% loo.row | html %]" name="maxlength" value="[% loo.maxlength | html %]" size="4" /> (see online help)</li>
123                 <li><input type="hidden" id="hidden-[% loo.row | html %]" name="hidden" value="[% loo.hidden | html %]" />
124                     <label for="hidden[% loo.row | html %]" style="float: none;">Visibility: </label>
125                     <input type="checkbox" id="hidden_opac_[% loo.row | html %]" class="inclusive_[% loo.row | html %]" name="hidden_opac_[% loo.row | html %]"/>
126                     <label for="hidden_opac_[% loo.row | html %]" style="float: none;">OPAC</label>
127                     <input type="checkbox" id="hidden_intranet_[% loo.row | html %]" class="inclusive_[% loo.row | html %]" name="hidden_intranet_[% loo.row | html %]"/>
128                     <label for="hidden_intranet_[% loo.row | html %]" style="float: none;">Intranet</label>
129                     <input type="checkbox" id="hidden_editor_[% loo.row | html %]" class="inclusive_[% loo.row | html %]" name="hidden_editor_[% loo.row | html %]"/>
130                     <label for="hidden_editor_[% loo.row | html %]" style="float: none;">Editor</label>
131                     <input type="checkbox" id="hidden_collapsed_[% loo.row | html %]" class="inclusive_[% loo.row | html %]" name="hidden_collapsed_[% loo.row | html %]"/>
132                     <label for="hidden_collapsed_[% loo.row | html %]" style="float: none;">Collapsed</label>
133                     <input type="checkbox" id="hidden_flagged_[% loo.row | html %]" name="flagged_[% loo.row | html %]"/>
134                     <label for="hidden_flagged_[% loo.row | html %]" style="float: none;">Flagged</label>
135                 </li>
136                 <li>
137                     <label for="isurl[% loo.row | html %]">Is a URL:</label>
138                     [% IF loo.isurl %]
139                         <input type="checkbox" id="isurl[% loo.row | html %]" name="isurl[% loo.row | html %]" checked="checked" value="1" />
140                     [% ELSE %]
141                         <input type="checkbox" id="isurl[% loo.row | html %]" name="isurl[% loo.row | html %]" value="1" />
142                     [% END %]
143                     (if checked, it means that the subfield is a URL and can be clicked)
144                 </li>
145                 <li><label for="link[% loo.row | html %]">Link:</label><input type="text" id="link[% loo.row | html %]" name="link" value="[% loo.link | html %]" size="10" maxlength="80" /> (e.g., Title or Local-Number) <span class="error"><em>NOTE: If you change this value you must ask your administrator to run misc/batchRebuildBiblioTables.pl.</em></span></li>
146                 <li>
147                     <label for="kohafield[% loo.row | html %]">Koha link:</label>
148                     <!-- This select should be DISABLED; value is submitted by the following hidden input -->
149                     <select name="kohafield" id="kohafield[% loo.row | html %]" size="1" disabled>
150                     [% FOREACH value IN loo.kohafields %]
151                       [% IF ( value == loo.kohafield ) %]
152                         <option value="[% value | html %]" selected="selected">[% value | html %]</option>
153                       [% ELSE %]
154                         <option value="[% value | html %]">[% value | html %]</option>
155                       [% END %]
156                     [% END %]
157                     </select>
158                     <!-- Do NOT remove this next hidden input! We need it to save kohafield. -->
159                     <input type="hidden" name="kohafield" value="[% loo.kohafield | html %]"/>
160                 </li>
161                         </ol>
162             </fieldset>
163             </div>
164             <h3><a href="#oth[% loo.urisubfieldcode | uri %]">Other options (choose one)</a></h3>
165             <div id="oth[% loo.urisubfieldcode | html %]">
166             <fieldset class="rows">
167                         <ol>
168                             <li>
169                                 <label for="authorised_value[% loo.row | html %]">Authorized value:</label>
170                                 <select name="authorised_value" id="authorised_value[% loo.row | html %]" size="1">
171                                 <option value=""></option>
172                                 [% FOREACH value IN loo.authorised_values %]
173                                     [% IF ( value == loo.authorised_value ) %]
174                                     <option value="[% value | html %]" selected="selected">[% value | html %]</option>
175                                     [% ELSE %]
176                                     <option value="[% value | html %]">[% value | html %]</option>
177                                     [% END %]
178                                 [% END %]
179                                 </select>
180                             </li>
181                             <li>
182                                 <label for="authtypecode[% loo.row | html %]">Thesaurus:</label>
183                                 <select name="authtypecode" id="authtypecode[% loo.row | html %]" size="1">
184                                 [% FOREACH value IN loo.authtypes %]
185                                     [% IF ( value == loo.authtypecode ) %]
186                                     <option value="[% value | html %]" selected="selected">[% value | html %]</option>
187                                     [% ELSE %]
188                                     <option value="[% value | html %]">[% value | html %]</option>
189                                     [% END %]
190                                 [% END %]
191                                 </select>
192                             </li>
193                             <li>
194                                 <label for="value_builder[% loo.row | html %]">Plugin:</label>
195                                 <select name="value_builder" id="value_builder[% loo.row | html %]" size="1">
196                                 [% FOREACH value IN loo.value_builders %]
197                                     [% IF ( value == loo.value_builder ) %]
198                                     <option value="[% value | html %]" selected="selected">[% value | html %]</option>
199                                     [% ELSE %]
200                                     <option value="[% value | html %]">[% value | html %]</option>
201                                     [% END %]
202                                 [% END %]
203                                 </select>
204                             </li>
205                         </ol>
206             </fieldset>
207             </div>
208         </div><!-- /content_sub -->
209         [% END %]
210                 </div><!-- /content -->
211     <fieldset class="action">
212         <input type="submit" value="Save changes" /> <a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=[% tagfield  | uri %]&amp;frameworkcode=[% frameworkcode | uri %]" class="cancel">Cancel</a>
213     </fieldset>
214     </form>
215 [% END %]
216
217 [% IF ( delete_confirm ) %]
218
219     <div class="dialog alert">
220         <h3>Confirm deletion of subfield [% tagsubfield | html %]?</h3>
221         <p>Subfield: [% tagsubfield | html %]</p>
222         <p>Description: [% liblibrarian | html_entity %]</p>
223
224         <form action="[% delete_link | html %]" method="post"><input type="hidden" name="op" value="delete_confirmed" />
225             <input type="hidden" name="searchfield" value="[% searchfield | html %]" />
226             <input type="hidden" name="tagfield" value="[% tagfield | html %]" />
227             <input type="hidden" name="tagsubfield" value="[% tagsubfield | html %]" />
228             <input type="hidden" name="frameworkcode" value="[% frameworkcode | html %]" />
229             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this subfield</button>
230         </form>
231
232
233         <form action="[% script_name | html %]" method="post">
234             <input type="hidden" name="searchfield" value="[% searchfield | html %]" />
235             <input type="hidden" name="tagfield" value="[% tagfield | html %]" />
236             <input type="hidden" name="tagsubfield" value="[% tagsubfield | html %]" />
237             <input type="hidden" name="frameworkcode" value="[% frameworkcode | html %]" />
238             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
239         </form>
240     </div>
241
242 [% END %]
243
244 [% IF ( delete_confirmed ) %]
245
246     <h3>Data deleted</h3>
247     <form action="[% script_name | html %]" method="post">
248         <input type="hidden" name="tagfield" value="[% tagfield | html %]" />
249     <input type="submit" value="OK" />
250     </form>
251 [% END %]
252
253
254 [% IF ( else ) %]
255 <h1>MARC subfield structure admin for [% tagfield | html %] [% IF ( frameworkcode ) %](framework [% frameworkcode | html %])[% ELSE %](default framework)[% END %]</h1>
256 <p>This screen shows the subfields associated with the selected tag. You can edit subfields or add a new one by clicking on edit.</p>
257 <p>The column 'Koha field' shows that the subfield is linked with a Koha field.</p>
258
259 <table>
260 <tr>
261     <th>Subfield</th>
262     <th>Text</th>
263     <th>Constraints</th>
264     <th>Actions</th>
265 </tr>
266 [% FOREACH loo IN loop %]
267 <tr>
268     <td><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&amp;tagfield=[% loo.tagfield | uri %]&amp;frameworkcode=[% frameworkcode | uri %]#sub[% loo.tagsubfield | uri %]field">[% loo.tagsubfield | html %]</a></td>
269     <td>
270         [% IF ( loo.subfield_ignored ) %]
271             <i>[% loo.liblibrarian | html_entity %]</i>
272         [% ELSE %]
273             [% loo.liblibrarian | html_entity %]
274         [% END %]
275     </td>
276     <td>
277         [% IF ( loo.subfield_ignored ) %]
278             <i>subfield ignored</i>
279         [% ELSE %]
280             Tab:[% loo.tab | html %],
281             [% IF ( loo.kohafield ) %] | Koha field: [% loo.kohafield | html %], [% END %]
282             [% IF ( loo.repeatable ) %]Repeatable, [% ELSE %]Not repeatable,[% END %]
283             [% IF ( loo.mandatory ) %]Mandatory, [% ELSE %]Not mandatory,[% END %]
284             [% IF ( loo.seealso ) %] | See Also: [% loo.seealso | html %],[% END %]
285             [% IF ( loo.hidden ) %]hidden,[% END %]
286             [% IF ( loo.isurl ) %]is a URL,[% END %]
287             [% IF ( loo.authorised_value ) %] | Auth value:[% loo.authorised_value | html %],[% END %]
288             [% IF ( loo.authtypecode ) %] | Authority:[% loo.authtypecode | html %],[% END %]
289             [% IF ( loo.value_builder ) %] | Plugin:[% loo.value_builder | html %],[% END %]
290             [% IF ( loo.link ) %] | Link:[% loo.link | html %],[% END %]
291         [% END %]
292     </td>
293     <td class="actions">
294         <a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&amp;tagfield=[% loo.tagfield | uri %]&amp;frameworkcode=[% frameworkcode | uri %]#sub[% loo.tagsubfield | uri %]field" class="btn btn-default btn-xs"><i class="fa fa-pencil"></i> Edit</a>
295         <a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=delete_confirm&amp;tagfield=[% loo.tagfield | uri %]&amp;tagsubfield=[% loo.tagsubfield | uri %]&amp;frameworkcode=[% frameworkcode | uri %]" class="btn btn-default btn-xs"><i class="fa fa-trash"></i> Delete</a>
296     </td>
297 </tr>
298 [% END %]
299 </table>
300
301 <form action="[% script_name | html %]" method="get">
302     <fieldset class="action"><input type="hidden" name="op" value="add_form" />
303     <input type="hidden" name="tagfield" value="[% edit_tagfield | html %]" />
304     <input type="hidden" name="frameworkcode" value="[% edit_frameworkcode | html %]" />
305     <input type="submit" value="Edit subfields" />
306         <a class="cancel" href="marctagstructure.pl?searchfield=[% tagfield | uri %]&amp;frameworkcode=[% frameworkcode | html %]">Cancel</a>
307         </fieldset>
308 </form>
309
310 [% END %]
311
312             </main>
313         </div> <!-- /.col-sm-10.col-sm-push-2 -->
314
315         <div class="col-sm-2 col-sm-pull-10">
316             <aside>
317                 [% INCLUDE 'admin-menu.inc' %]
318             </aside>
319         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
320      </div> <!-- /.row -->
321
322 [% MACRO jsinclude BLOCK %]
323     [% Asset.js("js/admin-menu.js") | $raw %]
324     [% Asset.js("js/marc_subfields_structure.js") | $raw %]
325 [% END %]
326 [% INCLUDE 'intranet-bottom.inc' %]