Bug 21526: (follow-up) Use the 'url' filter when needed
[koha-equinox.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; [% action | html %] [% 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 [% Asset.css("css/datatables.css") | $raw %]
13 </head>
14
15 <body id="admin_marctagstructure" class="admin">
16 [% INCLUDE 'header.inc' %]
17 [% INCLUDE 'prefs-admin-search.inc' %]
18
19 <div id="breadcrumbs">
20          <a href="/cgi-bin/koha/mainpage.pl">Home</a>
21 &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
22 &rsaquo; <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a>
23 [% IF ( add_form ) %]
24 &rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode | uri %]">[% IF framework %][% framework.frameworktext | html %] ([% framework.frameworkcode | html %])[% ELSE %]Default MARC framework[% END%]</a>
25 &rsaquo; [% action | html %] [% searchfield | html %]
26 [% ELSIF ( else ) %]
27 &rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode | uri %]">[% IF framework %][% framework.frameworktext | html %] ([% framework.frameworkcode | html %])[% ELSE %]Default MARC framework[% END %]</a>
28 [% ELSIF ( delete_confirm ) %]
29 &rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode | uri %]">[% IF framework %][% framework.frameworktext | html %] ([% framework.frameworkcode | html %])[% ELSE %]Default MARC framework[% END %]</a>
30 &rsaquo; Confirm deletion of tag '[% searchfield | html %]'
31 [% ELSIF ( delete_confirmed ) %]
32 &rsaquo; <a href="/cgi-bin/koha/admin/marctagstructure.pl?frameworkcode=[% framework.frameworkcode | uri %]">[% IF framework %][% framework.frameworktext | html %] ([% framework.frameworkcode | html %])[% ELSE %]Default MARC framework[% END %]</a>
33 &rsaquo; Data deleted
34 [% END %]
35 </div>
36
37 <div class="main container-fluid">
38     <div class="row">
39         <div class="col-sm-10 col-sm-push-2">
40             <main>
41
42 [% IF ( else ) %]
43 <div id="toolbar" class="btn-toolbar">
44     <a class="btn btn-default btn-sm" 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>
45 </div>[% END %]
46
47 <h1>MARC Framework for [% IF framework %][% framework.frameworktext | html %] ([% framework.frameworkcode | html %])[% ELSE %]default MARC framework[% END %]</h1>
48
49 [% IF ( add_form ) %]
50
51     <form action="[% script_name | html %]" name="Aform" method="post" class="validated">
52
53       <fieldset class="rows"><legend>[% IF ( use_heading_flags_p ) %][% IF ( heading_modify_tag_p ) %]Modify tag <input type="hidden" name="modif" value="1" />[% searchfield | html %][% END %][% IF ( heading_add_tag_p ) %]Add tag[% END %][% ELSE %][% action | html %][% END %]</legend>  <input type="hidden" name="op" value="add_validate" />
54         <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode | html %]" />
55
56         <ol>
57             <li>
58                 [% IF ( heading_modify_tag_p ) %]
59                     <input type="hidden" name="tagfield" value="[% searchfield | html %]" />
60                     <span class="label">Tag:</span>
61                     [% searchfield | html %]
62                 [% ELSE %]
63                     <label for="tagfield" class="required">Tag: </label>
64                     <input id="tagfield" type="text" name="tagfield" value="[% searchfield | html %]" maxlength="3" size="3" required="required" class="required" />
65                     <span class="required">Required</span>
66                 [% END %]
67             </li>
68     <li><label for="liblibrarian">Label for lib: </label><input type="text" id="liblibrarian" name="liblibrarian" value="[% liblibrarian | html %]" size="40" maxlength="100" /></li>
69     <li><label for="libopac">Label for opac: </label><input type="text" id="libopac" name="libopac" value="[% libopac | html %]" size="40" maxlength="100" /></li>
70     <li><label for="repeatable">Repeatable: </label>
71         [% IF ( repeatable ) %]
72             <input type="checkbox" name="repeatable" id="repeatable" value="1" checked="checked" />
73         [% ELSE %]
74             <input type="checkbox" name="repeatable" id="repeatable" value="1" />
75         [% END %]
76     </li>
77     <li><label for="mandatory">Mandatory: </label>
78         [% IF ( mandatory ) %]
79             <input type="checkbox" name="mandatory" id="mandatory" value="1" checked="checked" />
80         [% ELSE %]
81             <input type="checkbox" name="mandatory" id="mandatory" value="1" />
82         [% END %]
83     </li>
84     <li><label for="ind1_defaultvalue">First indicator default value: </label>
85         <input id="ind1_defaultvalue" type="text" name="ind1_defaultvalue" value="[% ind1_defaultvalue | html %]" maxlength="1" size="1" />
86     </li>
87     <li><label for="ind2_defaultvalue">Second indicator default value: </label>
88         <input id="ind2_defaultvalue" type="text" name="ind2_defaultvalue" value="[% ind2_defaultvalue | html %]" maxlength="1" size="1" />
89     </li>
90     <li><label for="authorised_value">Authorized value: </label>
91         <select name="authorised_value" id="authorised_value" size="1">
92             <option value=""></option>
93             [% PROCESS options_for_authorised_value_categories authorised_value_categories => AuthorisedValues.GetCategories( selected => authorised_value ) %]
94         </select>
95         (if you select a value here, the indicators will be limited to the authorized value list)</li>
96 </ol></fieldset> 
97     <fieldset class="action">
98         <input type="submit" value="Save changes" />
99         <a class="cancel" href="[% script_name | url %]?frameworkcode=[% framework.frameworkcode | uri %]">Cancel</a>
100     </fieldset>
101     </form>
102 [% END %]
103
104
105 [% IF ( delete_confirm ) %]
106     <div class="dialog alert">
107         <h3>Confirm deletion of tag <span class="ex">'[% searchfield | html %]'</span>?</h3>
108         <p>Tag: [% searchfield | html %]</p>
109         <p>Description: [% liblibrarian | html %]</p>
110         <form action="[% script_name | html %]" method="post">
111             <input type="hidden" name="op" value="delete_confirmed" />
112             <input type="hidden" name="searchfield" value="[% searchfield | html %]" />
113             <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode | html %]" />
114             <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this tag</button>
115         </form>
116         <form action="[% script_name | html %]" method="get"><input type="hidden" name="frameworkcode" value="[% framework.frameworkcode | html %]" />
117             <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
118         </form>
119     </div>
120 [% END %]
121
122 [% IF ( delete_confirmed ) %]
123
124     <div class="dialog message"><h3>Tag deleted</h3>
125     <form action="[% script_name | html %]" method="post"><input type="hidden" name="frameworkcode" value="[% framework.frameworkcode | html %]" />
126         <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> OK</button>
127     </form></div>
128 [% END %]
129 [% IF ( framework_create ) %]
130
131     <form action="[% script_name | html %]" method="post">
132         <input type="hidden" name="op" value="framework_create_confirm" />
133         <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode | html %]" />
134         Create framework for [% framework.frameworkcode | html %] ([% framework.frameworktext | html %]) using
135         <select name="existingframeworkcode">
136             <option value="">Default</option>
137         [% FOREACH existingframeworkloo IN existingframeworkloop %]
138             <option value="[% existingframeworkloo.value | html %]">[% existingframeworkloo.frameworktext | html %]</option>
139         [% END %]
140         </select>
141         <input type="submit" value="OK" />
142     </form>
143 [% END %]
144
145
146 [% IF ( else ) %]
147 <form name="f" action="[% script_name | html %]" method="post">
148 <fieldset style="padding:.5em;">
149         <label for="searchfield"><strong>Search for tag:</strong> </label>
150         <input type="text" name="searchfield" id="searchfield" size="4" value="[% searchfield | html %]" />
151
152 <label for="frameworkcode"><strong>In framework:</strong> </label>
153         <select id="frameworkcode" name="frameworkcode">
154             <option value="">Default</option>
155             [% FOREACH f IN frameworks %]
156             [% IF f.frameworkcode == framework.frameworkcode %]
157                 <option value="[% f.frameworkcode | html %]" selected="selected">[% f.frameworktext | html %]</option>
158                 [% ELSE %]
159                 <option value="[% f.frameworkcode | html %]">[% f.frameworktext | html %]</option>
160                 [% END %]
161             [% END %]
162         </select>
163     <input type="submit" value="Search" />
164 <p>        <label for="select_display">Display only used tags/subfields</label>
165         [% IF ( select_display ) %]
166             <input type="checkbox" name="select_display" id="select_display" value="True" checked="checked" />
167         [% ELSE %]
168             <input type="checkbox" name="select_display" id="select_display" value="True" />
169         [% END %]</p>
170 </fieldset>
171 </form>
172
173     <table id="table_marctagstructure">
174     <thead>
175         <tr>
176         <th>Tag</th>
177         <th>Lib</th>
178         <th>Repeatable</th>
179         <th>Mandatory</th>
180         <th>Auth value</th>
181         <th>Indicator 1</th>
182         <th>Indicator 2</th>
183         <th>&nbsp;</th>
184         </tr>
185     </thead>
186     <tbody>
187     [% FOREACH loo IN loop %]
188         <tr>
189             <td>[% loo.tagfield | html %]</td>
190             <td>
191                 [% loo.liblibrarian | html %]
192             [% IF ( select_display ) %]
193                 [% FOREACH subfield IN loo.subfields %]
194                     <p>
195                         Tab:[% subfield.tab | html %] | $[% subfield.tagsubfield | html %]
196                         [% 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 %]
197                     </p>
198                 [% END %]
199             [% END %]
200             </td>
201             <td>[% IF ( loo.repeatable ) %]Yes[% ELSE %]No[% END %]</td>
202             <td>[% IF ( loo.mandatory ) %]Yes[% ELSE %]No[% END %]</td>
203             <td>[% loo.authorised_value | html %]</td>
204             <td>[% loo.ind1_defaultvalue | html %]</td>
205             <td>[% loo.ind2_defaultvalue | html %]</td>
206             <td>
207                 <div class="dropdown">
208                     <a class="btn btn-default btn-xs dropdown-toggle" id="marctagactions[% loo.tagfield | html %]" role="button" data-toggle="dropdown" href="#">
209                         Actions <b class="caret"></b></a>
210                     <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="marctagactions[% loo.tagfield | html %]">
211                         <li><a href="marc_subfields_structure.pl?op=add_form&amp;tagfield=[% loo.tagfield | uri %]&amp;frameworkcode=[% framework.frameworkcode | uri %]"><i class="fa fa-eye"></i> Subfields</a></li>
212                         <li><a href="?op=add_form&amp;searchfield=[% loo.tagfield | uri %]&amp;frameworkcode=[% framework.frameworkcode | uri %]"><i class="fa fa-pencil"></i> Edit</a></li>
213                         <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>
214                     </ul>
215                 </div>
216             </td>
217         </tr>
218     [% END %]
219     </tbody>
220     </table>
221 [% END %]
222
223             </main>
224         </div> <!-- /.col-sm-10.col-sm-push-2 -->
225
226         <div class="col-sm-2 col-sm-pull-10">
227             <aside>
228                 [% INCLUDE 'admin-menu.inc' %]
229             </aside>
230         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
231      </div> <!-- /.row -->
232
233 [% MACRO jsinclude BLOCK %]
234     [% INCLUDE 'datatables.inc' %]
235     [% Asset.js("js/admin-menu.js") | $raw %]
236     [% Asset.js("lib/jquery/plugins/jquery.cookie.min.js") | $raw %]
237     <script>
238         $(document).ready(function() {
239             $("#table_marctagstructure").dataTable($.extend(true, {}, dataTablesDefaults, {
240                 "aoColumnDefs": [
241                     { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
242                 ],
243                 "sPaginationType": "four_button"
244             }));
245             $("#select_display").on("change",function(){
246                 var checked = $(this).prop("checked") ? 1: 0;
247                 $.cookie('marctagstructure_selectdisplay', checked);
248                 this.form.submit();
249             });
250         });
251     </script>
252 [% END %]
253 [% INCLUDE 'intranet-bottom.inc' %]