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