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