Bug 27796: (QA follow-up) Missing filters
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / marctagstructure.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% USE AuthorisedValues %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Administration &rsaquo;
7 [% IF ( add_form ) %]MARC frameworks &rsaquo; [% IF heading_add_tag_p %]Add tag[% ELSE %]Modify tag[% END %] [% searchfield | html %][% END %]
8 [% IF ( delete_confirm ) %]MARC frameworks &rsaquo; Confirm deletion of tag '[% searchfield | html %]'[% END %]
9 [% IF ( delete_confirmed ) %]MARC frameworks &rsaquo;  Data deleted[% END %]
10 [% IF ( else ) %]MARC frameworks[% END %]</title>
11 [% INCLUDE 'doc-head-close.inc' %]
12 </head>
13
14 <body id="admin_marctagstructure" class="admin">
15 [% INCLUDE 'header.inc' %]
16 [% INCLUDE 'prefs-admin-search.inc' %]
17
18 <nav id="breadcrumbs" aria-label="Breadcrumb" class="breadcrumb">
19     <ol>
20         <li>
21             <a href="/cgi-bin/koha/mainpage.pl">Home</a>
22         </li>
23         <li>
24             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
25         </li>
26         <li>
27             <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a>
28         </li>
29
30         [% IF ( add_form ) %]
31             <li>
32                 <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode | uri %]">
33                     [% IF framework %]
34                         [% framework.frameworktext | html %] ([% framework.frameworkcode | html %])
35                     [% ELSE %]
36                         Default MARC framework
37                     [% END%]
38                 </a>
39             </li>
40             <li>
41                 <a href="#" aria-current="page">
42                     [% IF heading_add_tag_p %]
43                         Add tag
44                     [% ELSE %]
45                         Modify tag
46                     [% END %] [% searchfield | html %]
47                 </a>
48             </li>
49
50         [% ELSIF ( else ) %]
51             <li>
52                 <a href="#" aria-current="page">
53                     [% IF framework %]
54                         [% framework.frameworktext | html %] ([% framework.frameworkcode | html %])
55                     [% ELSE %]
56                         Default MARC framework
57                     [% END %]
58                 </a>
59             </li>
60
61         [% ELSIF ( delete_confirm ) %]
62             <li>
63                 <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode | uri %]">
64                     [% IF framework %]
65                         [% framework.frameworktext | html %] ([% framework.frameworkcode | html %])
66                     [% ELSE %]
67                         Default MARC framework
68                     [% END %]
69                 </a>
70             </li>
71             <li>
72                 <a href="#" aria-current="page">
73                     Confirm deletion of tag '[% searchfield | html %]'
74                 </a>
75             </li>
76
77         [% ELSIF ( delete_confirmed ) %]
78             <li>
79                 <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode | uri %]">
80                     [% IF framework %]
81                         [% framework.frameworktext | html %] ([% framework.frameworkcode | html %])
82                     [% ELSE %]
83                         Default MARC framework
84                     [% END %]
85                 </a>
86             </li>
87             <li>
88                 <a href="#" aria-current="page">
89                     Data deleted
90                 </a>
91             </li>
92         [% END %]
93     </ol>
94 </nav>
95
96 <div class="main container-fluid">
97     <div class="row">
98         <div class="col-sm-10 col-sm-push-2">
99             <main>
100
101 [% IF ( else ) %]
102 <div id="toolbar" class="btn-toolbar">
103     <a class="btn btn-default" id="addtag" href="/cgi-bin/koha/admin/marctagstructure.pl?op=add_form&amp;frameworkcode=[% framework.frameworkcode | uri %]"><i class="fa fa-plus"></i> New tag</a>
104 </div>[% END %]
105
106 <h1>MARC Framework for [% IF framework %][% framework.frameworktext | html %] ([% framework.frameworkcode | html %])[% ELSE %]default MARC framework[% END %]</h1>
107
108 [% IF ( add_form ) %]
109
110     <form action="[% script_name | html %]" name="Aform" method="post" class="validated">
111
112       <fieldset class="rows">
113             <legend>
114                 [% IF heading_add_tag_p %]
115                     Add tag
116                 [% ELSE %]
117                     Modify tag <input type="hidden" name="modif" value="1" />[% searchfield | html %]
118                 [% END %]
119             </legend>
120             <input type="hidden" name="op" value="add_validate" />
121             <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode | html %]" />
122         <ol>
123             <li>
124                 [% IF ( heading_modify_tag_p ) %]
125                     <input type="hidden" name="tagfield" value="[% searchfield | html %]" />
126                     <span class="label">Tag:</span>
127                     [% searchfield | html %]
128                 [% ELSE %]
129                     <label for="tagfield" class="required">Tag: </label>
130                     <input id="tagfield" type="text" name="tagfield" value="[% searchfield | html %]" maxlength="3" size="3" required="required" class="required" />
131                     <span class="required">Required</span>
132                 [% END %]
133             </li>
134     <li><label for="liblibrarian">Label for lib: </label><input type="text" id="liblibrarian" name="liblibrarian" value="[% liblibrarian | html %]" size="40" maxlength="100" /></li>
135     <li><label for="libopac">Label for opac: </label><input type="text" id="libopac" name="libopac" value="[% libopac | html %]" size="40" maxlength="100" /></li>
136     <li><label for="repeatable">Repeatable: </label>
137         [% IF ( repeatable ) %]
138             <input type="checkbox" name="repeatable" id="repeatable" value="1" checked="checked" />
139         [% ELSE %]
140             <input type="checkbox" name="repeatable" id="repeatable" value="1" />
141         [% END %]
142     </li>
143     <li><label for="mandatory">Mandatory: </label>
144         [% IF ( mandatory ) %]
145             <input type="checkbox" name="mandatory" id="mandatory" value="1" checked="checked" />
146         [% ELSE %]
147             <input type="checkbox" name="mandatory" id="mandatory" value="1" />
148         [% END %]
149     </li>
150     <li><label for="important">Important: </label>
151         [% IF ( important ) %]
152             <input type="checkbox" name="important" id="important" value="1" checked="checked" />
153         [% ELSE %]
154             <input type="checkbox" name="important" id="important" value="1" />
155         [% END %]
156     </li>
157     <li><label for="ind1_defaultvalue">First indicator default value: </label>
158         <input id="ind1_defaultvalue" type="text" name="ind1_defaultvalue" value="[% ind1_defaultvalue | html %]" maxlength="1" size="1" />
159     </li>
160     <li><label for="ind2_defaultvalue">Second indicator default value: </label>
161         <input id="ind2_defaultvalue" type="text" name="ind2_defaultvalue" value="[% ind2_defaultvalue | html %]" maxlength="1" size="1" />
162     </li>
163     <li><label for="authorised_value">Authorized value: </label>
164         <select name="authorised_value" id="authorised_value">
165             <option value=""></option>
166             [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value ) %]
167         </select>
168         (if you select a value here, the indicators will be limited to the authorized value list)</li>
169 </ol></fieldset> 
170     <fieldset class="action">
171         <input type="submit" value="Save changes" />
172         <a class="cancel" href="[% script_name | url %]?frameworkcode=[% framework.frameworkcode | uri %]">Cancel</a>
173     </fieldset>
174     </form>
175 [% END %]
176
177
178 [% IF ( delete_confirm ) %]
179     <div class="dialog alert">
180         <h3>Confirm deletion of tag <span class="ex">'[% searchfield | html %]'</span>?</h3>
181         <p>Tag: [% searchfield | html %]</p>
182         <p>Description: [% liblibrarian | html %]</p>
183         <form action="[% script_name | html %]" method="post">
184             <input type="hidden" name="op" value="delete_confirmed" />
185             <input type="hidden" name="searchfield" value="[% searchfield | html %]" />
186             <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode | html %]" />
187             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this tag</button>
188         </form>
189         <form action="[% script_name | html %]" method="get"><input type="hidden" name="frameworkcode" value="[% framework.frameworkcode | html %]" />
190             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
191         </form>
192     </div>
193 [% END %]
194
195 [% IF ( delete_confirmed ) %]
196
197     <div class="dialog message"><h3>Tag deleted</h3>
198     <form action="[% script_name | html %]" method="post"><input type="hidden" name="frameworkcode" value="[% framework.frameworkcode | html %]" />
199         <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
200     </form></div>
201 [% END %]
202 [% IF ( framework_create ) %]
203
204     <form action="[% script_name | html %]" method="post">
205         <input type="hidden" name="op" value="framework_create_confirm" />
206         <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode | html %]" />
207         Create framework for [% framework.frameworkcode | html %] ([% framework.frameworktext | html %]) using
208         <select name="existingframeworkcode">
209             <option value="">Default</option>
210         [% FOREACH existingframeworkloo IN existingframeworkloop %]
211             <option value="[% existingframeworkloo.value | html %]">[% existingframeworkloo.frameworktext | html %]</option>
212         [% END %]
213         </select>
214         <input type="submit" value="OK" />
215     </form>
216 [% END %]
217
218
219 [% IF ( else ) %]
220 <form name="f" action="[% script_name | html %]" method="post">
221 <fieldset style="padding:.5em;">
222         <label for="tag_search"><strong>Search for tag:</strong> </label>
223         <input type="text" name="searchfield" id="tag_search" size="4" value="[% searchfield | html %]" />
224
225 <label for="frameworkcode"><strong>In framework:</strong> </label>
226         <select id="frameworkcode" name="frameworkcode">
227             <option value="">Default</option>
228             [% FOREACH f IN frameworks %]
229             [% IF f.frameworkcode == framework.frameworkcode %]
230                 <option value="[% f.frameworkcode | html %]" selected="selected">[% f.frameworktext | html %]</option>
231                 [% ELSE %]
232                 <option value="[% f.frameworkcode | html %]">[% f.frameworktext | html %]</option>
233                 [% END %]
234             [% END %]
235         </select>
236     <input type="submit" value="Search" />
237 <p>        <label for="select_display">Display only used tags/subfields</label>
238         [% IF ( select_display ) %]
239             <input type="checkbox" name="select_display" id="select_display" value="True" checked="checked" />
240         [% ELSE %]
241             <input type="checkbox" name="select_display" id="select_display" value="True" />
242         [% END %]</p>
243 </fieldset>
244 </form>
245
246     <table id="table_marctagstructure">
247     <thead>
248         <tr>
249         <th>Tag</th>
250         <th>Lib</th>
251         <th>Repeatable</th>
252         <th>Mandatory</th>
253         <th>Important</th>
254         <th>Auth value</th>
255         <th>Indicator 1</th>
256         <th>Indicator 2</th>
257         <th>&nbsp;</th>
258         </tr>
259     </thead>
260     <tbody>
261     [% FOREACH loo IN loop %]
262         <tr>
263             <td>[% loo.tagfield | html %]</td>
264             <td>
265                 [% loo.liblibrarian | html %]
266             [% IF ( select_display ) %]
267                 [% FOREACH subfield IN loo.subfields %]
268                     <p>
269                         Tab:[% subfield.tab | html %] | $[% subfield.tagsubfield | html %]
270                         [% subfield.liblibrarian | html %] [% IF ( subfield.kohafield ) %][% subfield.kohafield | html %][% END %][% IF ( subfield.repeatable ) %], repeatable[% END %][% IF ( subfield.mandatory ) %], Mandatory[% END %][% IF ( subfield.seealso ) %], See [% subfield.seealso | html %][% END %][% IF ( subfield.authorised_value ) %], [% subfield.authorised_value | html %][% END %][% IF ( subfield.authtypecode ) %], [% subfield.authtypecode | html %][% END %][% IF ( subfield.value_builder ) %], [% subfield.value_builder | html %][% END %]
271                     </p>
272                 [% END %]
273             [% END %]
274             </td>
275             <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
276             <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
277             <td>[% IF ( loo.important ) %]Yes[% ELSE %]No[% END %]</td>
278             <td>[% loo.authorised_value | html %]</td>
279             <td>[% loo.ind1_defaultvalue | html %]</td>
280             <td>[% loo.ind2_defaultvalue | html %]</td>
281             <td>
282                 <div class="btn-group dropup">
283                     <a class="btn btn-default btn-xs dropdown-toggle" id="marctagactions[% loo.tagfield | html %]" role="button" data-toggle="dropdown" href="#">
284                         Actions <b class="caret"></b></a>
285                     <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="marctagactions[% loo.tagfield | html %]">
286                         <li><a href="?op=add_form&amp;searchfield=[% loo.tagfield | uri %]&amp;frameworkcode=[% framework.frameworkcode | uri %]"><i class="fa fa-pencil"></i> Edit tag</a></li>
287                         <li><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?tagfield=[% loo.tagfield | uri %]&amp;frameworkcode=[% framework.frameworkcode | uri %]"><i class="fa fa-eye"></i> View subfields</a></li>
288                         <li><a href="/cgi-bin/koha/admin/marc_subfields_structure.pl?op=add_form&amp;tagfield=[% loo.tagfield | uri %]&amp;frameworkcode=[% framework.frameworkcode | uri %]"><i class="fa fa-pencil"></i> Edit subfields</a></li>
289                         <li><a href="?op=delete_confirm&amp;searchfield=[% loo.tagfield | uri %]&amp;frameworkcode=[% framework.frameworkcode | uri %]"><i class="fa fa-trash"></i> Delete</a></li>
290                     </ul>
291                 </div>
292             </td>
293         </tr>
294     [% END %]
295     </tbody>
296     </table>
297 [% END %]
298
299             </main>
300         </div> <!-- /.col-sm-10.col-sm-push-2 -->
301
302         <div class="col-sm-2 col-sm-pull-10">
303             <aside>
304                 [% INCLUDE 'admin-menu.inc' %]
305             </aside>
306         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
307      </div> <!-- /.row -->
308
309 [% MACRO jsinclude BLOCK %]
310     [% INCLUDE 'datatables.inc' %]
311     [% Asset.js("js/admin-menu.js") | $raw %]
312     <script>
313         $(document).ready(function() {
314             $("#table_marctagstructure").dataTable($.extend(true, {}, dataTablesDefaults, {
315                 "aoColumnDefs": [
316                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
317                 ],
318                 "sPaginationType": "full"
319             }));
320             $("#select_display").on("change",function(){
321                 var checked = $(this).prop("checked") ? 1: 0;
322                 Cookies.set("marctagstructure_selectdisplay", checked);
323                 this.form.submit();
324             });
325         });
326     </script>
327 [% END %]
328 [% INCLUDE 'intranet-bottom.inc' %]