Bug 25832: Add DataTables to MARC subfield structure admin page for authorities
[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>Koha &rsaquo; Administration &rsaquo; Authority MARC subfield structure</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 </head>
8
9 <body id="admin_auth_subfields_structure" class="admin">
10 [% INCLUDE 'header.inc' %]
11 [% INCLUDE 'prefs-admin-search.inc' %]
12 <div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> &rsaquo;
13   <a href="/cgi-bin/koha/admin/authtypes.pl">Authority types</a> &rsaquo;
14   [% IF ( authtypecode ) %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=[% authtypecode | uri%]">[% authtypecode | html %] framework</a> &rsaquo;
15   [% ELSE %]<a href="/cgi-bin/koha/admin/auth_tag_structure.pl">Default framework</a> &rsaquo;
16   [% END %]
17   [% IF ( else ) %]Authority MARC subfield structure for [% tagfield | html %]
18   [% ELSE %]<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> &rsaquo;
19   [% END %]
20   [% IF ( delete_confirm ) %]Confirm deletion of subfield [% tagsubfield | html %]?[% END %]
21   [% IF ( delete_confirmed ) %]Data deleted[% END %]
22   [% IF ( add_form ) %]
23   [% IF ( use_heading_flags_p ) %]
24   [% IF ( heading_edit_subfields_p ) %]Edit MARC subfields constraints[% END %]
25   [% ELSE %][% action | html %][% END %]
26   [% END %]
27 </div>
28
29 <div class="main container-fluid">
30     <div class="row">
31         <div class="col-sm-10 col-sm-push-2">
32             <main>
33
34 [% IF ( add_form ) %]
35
36     <h1>[% IF ( use_heading_flags_p ) %]
37     [% IF ( heading_edit_subfields_p ) %]Edit MARC subfields constraints for field [% tagfield | html %] authority [% authtypecode | html %][% END %]
38     [% ELSE %][% action | html %][% END %]</h1>
39     <form action="[% script_name | html %]" name="Aform" method="post">
40         <input type="hidden" name="op" value="add_validate" />
41         <input type="hidden" name="tagfield" value="[% tagfield | html %]" />
42         <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
43         <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>
44         <div id="subfieldtabs" class="toptabs numbered">
45             <ul>
46                 [% FOREACH loo IN loop %]
47                     [% IF ( loo.new_subfield ) %]
48                         <li><a href="#sub[% loo.tagsubfield | html_entity %]field" title="[% loo.liblibrarian | html_entity %]">New</a></li>
49                     [% ELSE %]
50                         <li><a href="#sub[% loo.tagsubfield | html_entity %]field" title="[% loo.liblibrarian | html_entity %]">
51                             [% loo.tagsubfield | html %]
52                     </a></li>
53                     [% END %]
54                 [% END %]
55             </ul>
56
57         [% FOREACH loo IN loop %]
58         <div id="sub[% loo.tagsubfield | html %]field">
59             <fieldset class="rows"><ol>
60
61                 [% IF ( loo.new_subfield ) %]
62                     <li>
63                         <label for="tagsubfieldinput[% loo.row | html %]">Subfield code: </label>
64                         <input type="text" name="tagsubfield" value="[% loo.tagsubfield | html %]" size="1" id="tagsubfield" maxlength="1" />
65                     </li>
66                 [% ELSE %]
67                     <li>
68                         <input type="hidden" name="tagsubfield" value="[% loo.tagsubfield | html %]" />
69                     </li>
70                 [% END %]
71                 <li>
72                     <label for="repeatable[% loo.row | html %]">Repeatable: </label>
73                     [% IF loo.repeatable %]
74                         <input type="checkbox" id="repeatable[% loo.row | html %]" name="repeatable[% loo.row | html %]" checked="checked" value="1" />
75                     [% ELSE %]
76                         <input type="checkbox" id="repeatable[% loo.row | html %]" name="repeatable[% loo.row | html %]" value="1" />
77                     [% END %]
78                 </li>
79                 <li>
80                     <label for="mandatory[% loo.row | html %]">Mandatory: </label>
81                     [% IF loo.mandatory %]
82                         <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" checked="checked" value="1" />
83                     [% ELSE %]
84                         <input type="checkbox" id="mandatory[% loo.row | html %]" name="mandatory[% loo.row | html %]" value="1" />
85                     [% END %]
86                 </li>
87                 <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>
88                 <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>
89                 <li><label for="tab[% loo.row | html %]">Managed in tab: </label>
90                     <select name="tab" size="1" id="tab[% loo.row | html %]">
91                         [%- IF ( loo.tab ==  -1 ) -%]
92                         <option value="-1" selected="selected">ignore</option>
93                         [%- ELSE -%]
94                         <option value="-1">ignore</option>
95                         [%- END -%]
96                     [%- FOREACH t IN [ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] -%]
97                         [%- IF ( loo.tab ==  t && t.length>0 ) -%]
98                         <option value="[%- t | html -%]" selected="selected">[%- t | html -%]</option>
99                         [%- ELSIF ( loo.tab ==  t ) -%]
100                         <option value="[%- t | html -%]" selected="selected">&nbsp;</option>
101                         [%- ELSE -%]
102                         <option value="[%- t | html -%]">[%- t | html -%]</option>
103                         [%- END -%]
104                     [%- END -%]
105                     </select>
106                     (ignore means that the subfield does not display in the record editor)
107                 </li>
108                 <li>
109                     <fieldset>
110                         <legend>Display</legend>
111                         <ol>
112                             <li><label for="ohidden[% loo.row | html %]">Select to display or not:</label>
113                                 <select name="ohidden" size="1" id="ohidden[% loo.row | html %]">
114                                     [%- IF ( loo.ohidden ==  0 ) -%]
115                                     <option value= "0" selected="selected">Show all</option>
116                                     <option value="1">Hide all</option>
117                                     [%- ELSE -%]
118                                     [%# All other non-zero values mean: Hide %]
119                                     <option value= "0">Show all</option>
120                                     <option value="1" selected="selected">Hide all</option>
121                                     [%- END -%]
122                                 </select>
123                             </li>
124                         </ol>
125                     </fieldset>
126                 </li>
127                 <li>
128                     <fieldset class="rows">
129                         <legend>Advanced constraints:</legend>
130                         <ol>
131                             <li>
132                                 <label for="isurl[% loo.row | html %]">Is a URL:</label>
133                                 [% IF loo.isurl %]
134                                     <input type="checkbox" id="isurl[% loo.row | html %]" name="isurl[% loo.row | html %]" checked="checked" value="1" />
135                                 [% ELSE %]
136                                     <input type="checkbox" id="isurl[% loo.row | html %]" name="isurl[% loo.row | html %]" value="1" />
137                                 [% END %]
138                                 (if checked, it means that the subfield is a URL and can be clicked)
139                             </li>
140                             <li>
141                                 <label for="defaultvalue[% loo.row | html %]">Default value:</label>
142                                 <input type="text" name="defaultvalue" id="defaultvalue[% loo.row | html %]" value="[% loo.defaultvalue | html %]" />
143                             </li>
144                         </ol>
145                     </fieldset>
146                 </li>
147                 <li>
148                     <fieldset><legend>Help input</legend>    
149                         <ol>
150                             <li>
151                                 <label for="kohafield[% loo.row | html %]">Koha field:</label>
152                                 <select name="kohafield" id="kohafield[% loo.row | html %]" size="1">
153                                 [%- FOREACH value IN loo.kohafields %]
154                                     [% IF ( value == loo.kohafield  && value.length>0 ) -%]
155                                     <option value="[% value | html %]" selected="selected">[% value | html %]</option>
156                                     [%- ELSIF ( value == loo.kohafield ) -%]
157                                     <option value="[% value | html %]" selected="selected">&nbsp;</option>
158                                     [%- ELSIF ( value.length==0 ) -%]
159                                     <option value="[% value | html %]">&nbsp;</option>
160                                     [%- ELSE -%]
161                                     <option value="[% value | html %]">[% value | html %]</option>
162                                     [%- END -%]
163                                 [%- END %]
164                                 </select>
165                             </li>
166                             <li>
167                                 <label for="authorised_value[% loo.row | html %]">Authorized value:</label>
168                                 <select name="authorised_value" id="authorised_value[% loo.row | html %]" size="1">
169                                 [%- FOREACH value IN loo.authorised_values %]
170                                     [% IF ( value == loo.authorised_value && value.length>0 ) -%]
171                                     <option value="[% value | html %]" selected="selected">[% value | html %]</option>
172                                     [%- ELSIF ( value == loo.authorised_value ) -%]
173                                     <option value="[% value | html %]" selected>&nbsp;</option>
174                                     [%- ELSIF ( value.length==0 ) -%]
175                                     <option value="[% value | html %]">&nbsp;</option>
176                                     [%- ELSE -%]
177                                     <option value="[% value | html %]">[% value | html %]</option>
178                                     [%- END -%]
179                                 [%- END %]
180                                 </select>
181                             </li>
182                             <li>
183                                 <label for="frameworkcode[% loo.row | html %]">Thesaurus:</label>
184                                 <select name="frameworkcode" id="frameworkcode[% loo.row | html %]" size="1">
185                                 [%- FOREACH value IN loo.frameworkcodes %]
186                                     [% IF ( value == loo.frameworkcode && value.length>0 ) -%]
187                                     <option value="[% value | html %]" selected="selected">[% value | html %]</option>
188                                     [%- ELSIF ( value == loo.frameworkcode ) -%]
189                                     <option value="[% value | html %]" selected="selected">&nbsp;</option>
190                                     [%- ELSIF ( value.length==0 ) -%]
191                                     <option value="[% value | html %]">&nbsp;</option>
192                                     [%- ELSE -%]
193                                     <option value="[% value | html %]">[% value | html %]</option>
194                                     [%- END -%]
195                                 [%- END %]
196                                 </select>
197                             </li>
198                             <li>
199                                 <label for="value_builder[% loo.row | html %]">Plugin:</label>
200                                 <select name="value_builder" id="value_builder[% loo.row | html %]" size="1">
201                                 [%- FOREACH value IN loo.value_builders %]
202                                     [% IF ( value == loo.value_builder && value.length>0 ) -%]
203                                     <option value="[% value | html %]" selected="selected">[% value | html %]</option>
204                                     [%- ELSIF ( value == loo.value_builder ) -%]
205                                     <option value="[% value | html %]" selected="selected">&nbsp;</option>
206                                     [%- ELSIF ( value.length==0 ) -%]
207                                     <option value="[% value | html %]">&nbsp;</option>
208                                     [%- ELSE -%]
209                                     <option value="[% value | html %]">[% value | html %]</option>
210                                     [%- END -%]
211                                 [%- END %]
212                                 </select>
213                             </li>
214                         </ol>
215                     </fieldset>
216                 </li>
217             </ol></fieldset><br class="clear" />
218         </div>
219         [% END %]
220         </div>
221     </form>
222 [% END %]
223
224 [% IF ( delete_confirm ) %]
225
226     <div class="dialog alert">
227         <h3>Delete subfield <span class="ex">'[% tagsubfield | html %]'?</span></h3>
228         <form action="[% delete_link | html %]" method="post">
229             <input type="hidden" name="op" value="delete_confirmed" />
230             <table>
231                 <tr><th scope="row">Subfield:</th> <td>[% tagsubfield | html %]</td></tr>
232                 <tr><th scope="row">Description:</th> <td>[% liblibrarian | html_entity %]</td></tr>
233             </table>
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="authtypecode" value="[% authtypecode | html %]" />
238             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this subfield</button>
239         </form>
240
241         <form action="[% delete_link | html %]" method="get">
242             <input type="hidden" name="searchfield" value="[% searchfield | html %]" />
243             <input type="hidden" name="tagfield" value="[% tagfield | html %]" />
244             <input type="hidden" name="tagsubfield" value="[% tagsubfield | html %]" />
245             <input type="hidden" name="authtypecode" value="[% authtypecode | html %]" />
246             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
247         </form>
248     </form></div>
249 [% END %]
250
251 [% IF ( delete_confirmed ) %]
252
253    <div class="dialog message"> <h3>Data deleted</h3>
254     <form action="[% script_name | html %]" method="post">
255         <input type="hidden" name="tagfield" value="[% tagfield | html %]" />
256         <input type="submit" class="approve" value="OK" />
257     </form></div>
258 [% END %]
259
260
261 [% IF ( else ) %]
262 <h1>Authority MARC subfield structure admin for [% tagfield | html %] (authority: [% authtypecode | html %])</h1>
263 <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>
264 <p>The column 'Koha field' shows that the subfield is linked with a Koha field.</p>
265
266 <table id="table_authsubfieldstructure">
267     <thead>
268         <tr>
269             <th>Subfield</th>
270             <th>Text</th>
271             <th>Constraints</th>
272             <th class="NoSort">&nbsp;</th>
273         </tr>
274     </thead>
275     <tbody>
276     [% FOREACH loo IN loop %]
277     <tr>
278         <td>
279             <a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | uri %]&authtypecode=[% authtypecode | uri %]#sub[% loo.tagsubfield | uri %]field">[% loo.tagsubfield | html %]</a>
280         </td>
281         <td>
282             [% IF ( loo.subfield_ignored ) %]
283                     <i>[% loo.liblibrarian | html_entity %]</i>
284             [% ELSE %]
285                     [% loo.liblibrarian | html_entity %]
286             [% END %]
287         </td>
288         <td>
289             [% IF ( loo.subfield_ignored ) %]
290                     <i>subfield ignored</i>
291             [% ELSE %]
292                 <strong>Tab:</strong>[% loo.tab | html %],
293                 [% IF ( loo.kohafield ) %] | <strong>Koha field:</strong> [% loo.kohafield | html %], [% END %]
294                 [% IF ( loo.repeatable ) %]Repeatable, [% ELSE %]Not repeatable,
295                 [% END %]
296                         [% IF ( loo.mandatory ) %]Mandatory, [% ELSE %]Not mandatory,
297                 [% END %]
298                         [% IF ( loo.hidden ) %]hidden,
299                 [% END %]
300                         [% IF ( loo.isurl ) %]is a url,
301                 [% END %]
302                         [% IF ( loo.authorised_value ) %] | <strong>Auth value:</strong>[% loo.authorised_value | html %],
303                 [% END %]
304                         [% IF ( loo.frameworkcode ) %] | <strong>Authority:</strong>[% loo.frameworkcode | html %],
305                 [% END %]
306                 [% IF ( loo.value_builder ) %] | <strong>Plugin:</strong>[% loo.value_builder | html %],[% END %]
307             [% END %]
308         </td>
309         <td class="actions">
310             <a href="/cgi-bin/koha/admin/auth_subfields_structure.pl?op=add_form&tagfield=[% tagfield | 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>
311             <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>
312         </td>
313     </tr>
314     [% END %]
315     </tbody>
316 </table>
317
318     <form action="[% script_name | html %]" method="get">
319     <fieldset class="action"><input type="hidden" name="op" value="add_form" />
320     <input type="hidden" name="tagfield" value="[% edit_tagfield | html %]" />
321     <input type="hidden" name="authtypecode" value="[% edit_authtypecode | html %]" />
322     <input type="submit" value="Edit subfields" />
323     <a class="cancel" href="auth_tag_structure.pl?searchfield=[% tagfield | uri %]&amp;authtypecode=[% authtypecode | uri %]">Cancel</a></fieldset>
324     </form>
325
326     [% IF ( previous ) %]
327     <input type="image" src="[% interface | html %]/[% theme | html %]/images/1leftarrow.png" title="previous" alt="previous" />
328     </a>
329     [% END %]
330     [% IF ( next ) %]
331         [% next | html %]
332     <input type="image" src="[% interface | html %]/[% theme | html %]/images/1rightarrow.png" title="next" alt="next" />
333     </a>
334     [% END %]
335
336 [% END %]
337
338             </main>
339         </div> <!-- /.col-sm-10.col-sm-push-2 -->
340
341         <div class="col-sm-2 col-sm-pull-10">
342             <aside>
343                 [% INCLUDE 'admin-menu.inc' %]
344             </aside>
345         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
346      </div> <!-- /.row -->
347
348 [% MACRO jsinclude BLOCK %]
349     [% INCLUDE 'datatables.inc' %]
350     [% Asset.js("js/admin-menu.js") | $raw %]
351     <script>
352         $(document).ready(function() {
353             $('#subfieldtabs').tabs();
354             $("#table_authsubfieldstructure").dataTable($.extend(true, {}, dataTablesDefaults, {
355                 "columnDefs": [
356                     { 'sortable': false, 'targets': [ 'NoSort' ] }
357                 ],
358                 paginate: false
359             }));
360         });
361     </script>
362 [% END %]
363 [% INCLUDE 'intranet-bottom.inc' %]