Bug 30952: Staff interface redesign (header)
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / auth_subfields_structure.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% SET footerjs = 1 %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>Authority MARC subfield structure &rsaquo; Administration &rsaquo; Koha</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 </head>
8
9 <body id="admin_auth_subfields_structure" class="admin">
10 [% WRAPPER 'header.inc' %]
11     [% INCLUDE 'prefs-admin-search.inc' %]
12 [% END %]
13
14 [% WRAPPER 'sub-header.inc' %]
15 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
16     <ol>
17         <li>
18             <a href="/cgi-bin/koha/mainpage.pl"><i class="fa fa-home"></i></a>
19         </li>
20         <li>
21             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
22         </li>
23         <li>
24             <a href="/cgi-bin/koha/admin/authtypes.pl">Authority types</a>
25         </li>
26
27         [% IF ( authtypecode ) %]
28             <li>
29                 <a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode | uri%]">[% authtypecode | html %] framework</a>
30             </li>
31         [% ELSE %]
32             <li>
33                 <a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default framework</a>
34             </li>
35         [% END %]
36
37         [% IF ( else ) %]
38             <li>
39                 <a href="#" aria-current="page">
40                     Authority MARC subfield structure for [% tagfield | html %]
41                 </a>
42             </li>
43         [% ELSE %]
44             <li>
45                 <a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?tagfield=[% tagfield | uri %]&amp;tagsubfield=[% tagsubfield | uri %]&amp;authtypecode=[% authtypecode |uri %]">Authority MARC subfield structure for [% tagfield | html %]</a>
46             </li>
47         [% END %]
48
49         [% IF ( delete_confirm ) %]
50             <li>
51                 <a href="#" aria-current="page">
52                     Confirm deletion of subfield [% tagsubfield | html %]?
53                 </a>
54             </li>
55         [% END %]
56
57         [% IF ( add_form ) %]
58             [% IF ( use_heading_flags_p ) %]
59                 [% IF ( heading_edit_subfields_p ) %]
60                     <li>
61                         <a href="#" aria-current="page">
62                             Edit MARC subfields constraints
63                         </a>
64                     </li>
65                 [% END %]
66             [% ELSE %]
67                 <li>
68                     <a href="#" aria-current="page">
69                         [% action | html %]
70                     </a>
71                 </li>
72             [% END %]
73         [% END %]
74     </ol>
75 </nav>
76 [% END %]
77
78 <div class="main container-fluid">
79     <div class="row">
80         <div class="col-sm-10 col-sm-push-2">
81             <main>
82
83 [% IF ( add_form ) %]
84
85     <h1>[% IF ( use_heading_flags_p ) %]
86     [% IF ( heading_edit_subfields_p ) %]Edit MARC subfields constraints for field [% tagfield | html %] authority [% authtypecode | html %][% END %]
87     [% ELSE %][% action | html %][% END %]</h1>
88     <form action="[% script_name | html %]" name="Aform" method="post">
89         <input type="hidden" name="op" value="add_validate" />
90         <input type="hidden" name="tagfield" value="[% tagfield | html %]" />
91         <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
92         <fieldset class="action"><input type="submit" class="submit" value="Save changes" /> <a class="cancel" href="/cgi-bin/koha/admin/auth_subfields_structure.pl?tagfield=[% tagfield | uri %]&amp;authtypecode=[% authtypecode | uri %]">Cancel</a></fieldset>
93
94         [% BLOCK outputsubfield %][% FILTER collapse %]
95             [% SWITCH ( subfieldanchor ) %]
96                 [%   CASE "@" %]
97                 AT
98                 [%   CASE "%" %]
99                 %
100                 [%   CASE  %]
101                 [% subfieldanchor | html %]
102             [% END %]
103         [% END %][% END %]
104
105         <div id="subfieldtabs" class="toptabs numbered">
106             <ul class="nav nav-tabs" role="tablist">
107                 [% FOREACH loo IN loop %]
108                     <li role="presentation" id="tab_subfield_[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]">
109                         [% IF ( loo.new_subfield ) %]
110                             <a href="#sub[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]field"  aria-controls="sub[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]field" role="tab" data-toggle="tab" title="[% loo.liblibrarian | html %]">New</a>
111                         [% ELSE %]
112                             <a href="#sub[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]field"  aria-controls="sub[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]field" role="tab" data-toggle="tab" title="[% loo.liblibrarian | html %]">[% loo.tagsubfield | html %]</a>
113                         [% END %]
114                     </li>
115                 [% END %]
116             </ul>
117             <div class="tab-content">
118                 [% FOREACH loo IN loop %]
119                     <div role="tabpanel" class="tab-pane" id="sub[%- PROCESS outputsubfield subfieldanchor = loo.tagsubfield -%]field">
120                         <fieldset class="rows"><ol>
121
122                             [% IF ( loo.new_subfield ) %]
123                                 <li>
124                                     <label for="tagsubfieldinput[% loo.row | html %]">Subfield code: </label>
125                                     <input type="text" name="tagsubfield" value="[% loo.tagsubfield | html %]" size="1" id="tagsubfield" maxlength="1" />
126                                 </li>
127                             [% ELSE %]
128                                 <li>
129                                     <input type="hidden" name="tagsubfield" value="[% loo.tagsubfield | html %]" />
130                                 </li>
131                             [% END %]
132                             <li>
133                                 <label for="repeatable[% loo.row | html %]">Repeatable: </label>
134                                 [% IF loo.repeatable %]
135                                     <input type="checkbox" id="repeatable[% loo.row | html %]" name="repeatable[% loo.row | html %]" checked="checked" value="1" />
136                                 [% ELSE %]
137                                     <input type="checkbox" id="repeatable[% loo.row | html %]" name="repeatable[% loo.row | html %]" value="1" />
138                                 [% END %]
139                             </li>
140                             <li>
141                                 <label for="mandatory[% loo.row | html %]">Mandatory: </label>
142                                 [% IF loo.mandatory %]
143                                     <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" checked="checked" value="1" />
144                                 [% ELSE %]
145                                     <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" value="1" />
146                                 [% END %]
147                             </li>
148                             <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>
149                             <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>
150                             <li><label for="tab[% loo.row | html %]">Managed in tab: </label>
151                                 <select name="tab" id="tab[% loo.row | html %]">
152                                     [%- IF ( loo.tab ==  -1 ) -%]
153                                     <option value="-1" selected="selected">ignore</option>
154                                     [%- ELSE -%]
155                                     <option value="-1">ignore</option>
156                                     [%- END -%]
157                                 [%- FOREACH t IN [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] -%]
158                                     [%- IF ( loo.tab ==  t && t.length>0 ) -%]
159                                     <option value="[%- t | html -%]" selected="selected">[%- t | html -%]</option>
160                                     [%- ELSIF ( loo.tab ==  t ) -%]
161                                     <option value="[%- t | html -%]" selected="selected">&nbsp;</option>
162                                     [%- ELSE -%]
163                                     <option value="[%- t | html -%]">[%- t | html -%]</option>
164                                     [%- END -%]
165                                 [%- END -%]
166                                 </select>
167                                 <div class="hint">Ignore means that the subfield does not display in the record editor</div>
168                             </li>
169                             <li>
170                                 <fieldset>
171                                     <legend>Display</legend>
172                                     <ol>
173                                         <li><label for="ohidden[% loo.row | html %]">Select to display or not:</label>
174                                             <select name="ohidden" id="ohidden[% loo.row | html %]">
175                                                 [%- IF ( loo.hidden ==  0 ) -%]
176                                                 <option value= "0" selected="selected">Show all</option>
177                                                 <option value="1">Hide all</option>
178                                                 [%- ELSE -%]
179                                                 [%# All other non-zero values mean: Hide %]
180                                                 <option value= "0">Show all</option>
181                                                 <option value="1" selected="selected">Hide all</option>
182                                                 [%- END -%]
183                                             </select>
184                                         </li>
185                                     </ol>
186                                 </fieldset>
187                             </li>
188                             <li>
189                                 <fieldset class="rows">
190                                     <legend>Advanced constraints:</legend>
191                                     <ol>
192                                         <li>
193                                             <label for="isurl[% loo.row | html %]">Is a URL:</label>
194                                             [% IF loo.isurl %]
195                                                 <input type="checkbox" id="isurl[% loo.row | html %]" name="isurl[% loo.row | html %]" checked="checked" value="1" />
196                                             [% ELSE %]
197                                                 <input type="checkbox" id="isurl[% loo.row | html %]" name="isurl[% loo.row | html %]" value="1" />
198                                             [% END %]
199                                             <span class="hint">If checked, it means that the subfield is a URL and can be clicked.</span>
200                                         </li>
201                                         <li>
202                                             <label for="defaultvalue[% loo.row | html %]">Default value:</label>
203                                             <input type="text" name="defaultvalue" id="defaultvalue[% loo.row | html %]" value="[% loo.defaultvalue | html %]" />
204                                         </li>
205                                     </ol>
206                                 </fieldset>
207                             </li>
208                             <li>
209                                 <fieldset><legend>Help input</legend>
210                                     <ol>
211                                         <li>
212                                             <label for="kohafield[% loo.row | html %]">Koha field:</label>
213                                             <select name="kohafield" id="kohafield[% loo.row | html %]">
214                                             [%- FOREACH value IN loo.kohafields %]
215                                                 [% IF ( value == loo.kohafield  && value.length>0 ) -%]
216                                                 <option value="[% value | html %]" selected="selected">[% value | html %]</option>
217                                                 [%- ELSIF ( value == loo.kohafield ) -%]
218                                                 <option value="[% value | html %]" selected="selected">&nbsp;</option>
219                                                 [%- ELSIF ( value.length==0 ) -%]
220                                                 <option value="[% value | html %]">&nbsp;</option>
221                                                 [%- ELSE -%]
222                                                 <option value="[% value | html %]">[% value | html %]</option>
223                                                 [%- END -%]
224                                             [%- END %]
225                                             </select>
226                                         </li>
227                                         <li>
228                                             <label for="authorised_value[% loo.row | html %]">Authorized value:</label>
229                                             <select name="authorised_value" id="authorised_value[% loo.row | html %]">
230                                             [%- FOREACH value IN loo.authorised_values %]
231                                                 [% IF ( value == loo.authorised_value && value.length>0 ) -%]
232                                                 <option value="[% value | html %]" selected="selected">[% value | html %]</option>
233                                                 [%- ELSIF ( value == loo.authorised_value ) -%]
234                                                 <option value="[% value | html %]" selected>&nbsp;</option>
235                                                 [%- ELSIF ( value.length==0 ) -%]
236                                                 <option value="[% value | html %]">&nbsp;</option>
237                                                 [%- ELSE -%]
238                                                 <option value="[% value | html %]">[% value | html %]</option>
239                                                 [%- END -%]
240                                             [%- END %]
241                                             </select>
242                                         </li>
243                                         <li>
244                                             <label for="frameworkcode[% loo.row | html %]">Thesaurus:</label>
245                                             <select name="frameworkcode" id="frameworkcode[% loo.row | html %]">
246                                             [%- FOREACH value IN loo.frameworkcodes %]
247                                                 [% IF ( value == loo.frameworkcode && value.length>0 ) -%]
248                                                 <option value="[% value | html %]" selected="selected">[% value | html %]</option>
249                                                 [%- ELSIF ( value == loo.frameworkcode ) -%]
250                                                 <option value="[% value | html %]" selected="selected">&nbsp;</option>
251                                                 [%- ELSIF ( value.length==0 ) -%]
252                                                 <option value="[% value | html %]">&nbsp;</option>
253                                                 [%- ELSE -%]
254                                                 <option value="[% value | html %]">[% value | html %]</option>
255                                                 [%- END -%]
256                                             [%- END %]
257                                             </select>
258                                         </li>
259                                         <li>
260                                             <label for="value_builder[% loo.row | html %]">Plugin:</label>
261                                             <select name="value_builder" id="value_builder[% loo.row | html %]">
262                                             [%- FOREACH value IN loo.value_builders %]
263                                                 [% IF ( value == loo.value_builder && value.length>0 ) -%]
264                                                 <option value="[% value | html %]" selected="selected">[% value | html %]</option>
265                                                 [%- ELSIF ( value == loo.value_builder ) -%]
266                                                 <option value="[% value | html %]" selected="selected">&nbsp;</option>
267                                                 [%- ELSIF ( value.length==0 ) -%]
268                                                 <option value="[% value | html %]">&nbsp;</option>
269                                                 [%- ELSE -%]
270                                                 <option value="[% value | html %]">[% value | html %]</option>
271                                                 [%- END -%]
272                                             [%- END %]
273                                             </select>
274                                         </li>
275                                     </ol>
276                                 </fieldset>
277                             </li>
278                         </ol></fieldset><br class="clear" />
279                     </div>
280                 [% END %]
281             </div> <!-- /.tab-content -->
282         </div>
283     </form>
284 [% END %]
285
286 [% IF ( delete_confirm ) %]
287
288     <div class="dialog alert">
289         <h1>Delete subfield <span class="ex">'[% ass.tagsubfield | html %]'?</span></h1>
290         <form action="[% delete_link | html %]" method="post">
291             <input type="hidden" name="op" value="delete_confirmed" />
292             <table>
293                 <tr><th scope="row">Subfield:</th> <td>[% ass.tagsubfield | html %]</td></tr>
294                 <tr><th scope="row">Description:</th> <td>[% ass.liblibrarian | html_entity %]</td></tr>
295             </table>
296             <input type="hidden" name="tagfield" value="[% ass.tagfield | html %]" />
297             <input type="hidden" name="tagsubfield" value="[% ass.tagsubfield | html %]" />
298             <input type="hidden" name="authtypecode" value="[% ass.authtypecode | html %]" />
299             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this subfield</button>
300         </form>
301
302         <form action="[% delete_link | html %]" method="get">
303             <input type="hidden" name="tagfield" value="[% ass.tagfield | html %]" />
304             <input type="hidden" name="tagsubfield" value="[% ass.tagsubfield | html %]" />
305             <input type="hidden" name="authtypecode" value="[% ass.authtypecode | html %]" />
306             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
307         </form>
308     </form></div>
309 [% END %]
310
311 [% IF ( else ) %]
312 <h1>Authority MARC subfield structure admin for [% tagfield | html %] (authority: [% authtypecode | html %])</h1>
313 <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>
314 <p>The column 'Koha field' shows that the subfield is linked with a Koha field.</p>
315
316 <table id="table_authsubfieldstructure">
317     <thead>
318         <tr>
319             <th>Subfield</th>
320             <th>Text</th>
321             <th>Constraints</th>
322             <th class="NoSort">&nbsp;</th>
323         </tr>
324     </thead>
325     <tbody>
326     [% FOREACH loo IN loop %]
327     <tr>
328         <td>
329             <a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&authtypecode=[% authtypecode | uri %]#sub[% subfieldanchor | uri %]field">[% loo.tagsubfield | html %]</a>
330         </td>
331         <td>
332             [% IF loo.tab == -1 %]
333                     <em>[% loo.liblibrarian | html_entity %]</em>
334             [% ELSE %]
335                     [% loo.liblibrarian | html_entity %]
336             [% END %]
337         </td>
338         <td>
339             [% IF loo.subfield_ignored == -1 %]
340                     <em>subfield ignored</em>
341             [% ELSE %]
342                 <strong>Tab:</strong>[% loo.tab | html %],
343                 [% IF ( loo.kohafield ) %] | <strong>Koha field:</strong> [% loo.kohafield | html %], [% END %]
344                 [% IF ( loo.repeatable ) %]<span>Repeatable</span>, [% ELSE %]<span>Not repeatable</span>,
345                 [% END %]
346                         [% IF ( loo.mandatory ) %]<span>Mandatory</span>, [% ELSE %]<span>Not mandatory</span>,
347                 [% END %]
348                         [% IF ( loo.hidden ) %]<span>hidden</span>,
349                 [% END %]
350                         [% IF ( loo.isurl ) %]<span>is a URL</span>,
351                 [% END %]
352                         [% IF ( loo.authorised_value ) %] | <strong>Auth value:</strong>[% loo.authorised_value | html %],
353                 [% END %]
354                         [% IF ( loo.frameworkcode ) %] | <strong>Authority:</strong>[% loo.frameworkcode | html %],
355                 [% END %]
356                 [% IF ( loo.value_builder ) %] | <strong>Plugin:</strong>[% loo.value_builder | html %],[% END %]
357             [% END %]
358         </td>
359         <td class="actions">
360             <a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&tagsubfield=[% loo.tagsubfield | uri %]&authtypecode=[% authtypecode | uri %]#sub[% loo.tagsubfield | uri %]field" class="btn btn-default btn-xs"><i class="fa fa-pencil" aria-hidden="true"></i> Edit</a>
361             <a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=delete_confirm&amp;tagfield=[% loo.tagfield | uri %]&amp;tagsubfield=[% loo.tagsubfield | uri %]&amp;authtypecode=[% authtypecode | uri %]" class="btn btn-default btn-xs"><i class="fa fa-trash" aria-hidden="true"></i> Delete</a>
362         </td>
363     </tr>
364     [% END %]
365     </tbody>
366 </table>
367
368     <form action="[% script_name | html %]" method="get">
369     <fieldset class="action"><input type="hidden" name="op" value="add_form" />
370     <input type="hidden" name="tagfield" value="[% edit_tagfield | html %]" />
371     <input type="hidden" name="authtypecode" value="[% edit_authtypecode | html %]" />
372     <input type="submit" value="Edit subfields" />
373     <a class="cancel" href="auth_tag_structure.pl?searchfield=[% tagfield | uri %]&amp;authtypecode=[% authtypecode | uri %]">Cancel</a></fieldset>
374     </form>
375
376 [% END %]
377
378             </main>
379         </div> <!-- /.col-sm-10.col-sm-push-2 -->
380
381         <div class="col-sm-2 col-sm-pull-10">
382             <aside>
383                 [% INCLUDE 'admin-menu.inc' %]
384             </aside>
385         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
386      </div> <!-- /.row -->
387
388 [% MACRO jsinclude BLOCK %]
389     [% INCLUDE 'datatables.inc' %]
390     [% Asset.js("js/admin-menu.js") | $raw %]
391     <script>
392         $(document).ready(function() {
393             $("#table_authsubfieldstructure").dataTable($.extend(true, {}, dataTablesDefaults, {
394                 "columnDefs": [
395                     { 'sortable': false, 'targets': [ 'NoSort' ] }
396                 ],
397                 aaSorting: [],
398                 paginate: false
399             }));
400
401             [% IF ( tagsubfield && tagsubfield == "@") %]
402                 $("#subfieldtabs a[href='#subATfield']").tab("show");
403             [% ELSIF ( tagsubfield && tagsubfield != "@") %]
404                 $("#subfieldtabs a[href='#sub[% tagsubfield | html %]field']").tab("show");
405             [% ELSE  %]
406                 $("#subfieldtabs a:first").tab("show");
407             [% END %]
408
409             var current_index;
410             $("#subfieldtabs > ul").sortable({
411                 axis: "x",
412                 start: function (e, ui) {
413                     current_index = $(ui.item[0]).index();
414                 },
415                 stop: function (e, ui) {
416                     var new_index = $(ui.item[0]).index();
417                     if (current_index < new_index) new_index++;
418                     var subfield_code = $(ui.item[0]).attr('id').replace( /^tab_subfield_/, '');
419                     var content = $('#sub' + subfield_code + 'field');
420                     var panels = $("#subfieldtabs .tab-pane");
421                     if ( new_index < $(panels).size() ){
422                         $(content).insertBefore( panels[new_index]);
423                     } else {
424                         $(content).insertAfter( panels[new_index-1]);
425                     }
426                 }
427             });
428
429         });
430     </script>
431 [% END %]
432 [% INCLUDE 'intranet-bottom.inc' %]