Bug 35378: 'This authority type is used {count} times' missing dot
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / authtypes.tt
1 [% USE raw %]
2 [% USE Asset %]
3 [% PROCESS 'i18n.inc' %]
4 [% SET footerjs = 1 %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>[% FILTER collapse %]
7     [% IF op == 'add_form' %]
8         [% IF authority_type.authtypecode.defined %]
9             [% IF authority_type.authtypecode %]
10                 [% tx("Modify authority type '{authority_type_code}'", { authority_type_code= authority_type.authtypecode }) | html %]
11             [% ELSE %]
12                 [% t("Modify default authority type") | html %]
13             [% END %]
14         [% ELSE %]
15             [% t("New authority type") | html %]
16         [% END %] &rsaquo;
17     [% ELSIF op == 'delete_confirm' %]
18         [% IF authorities_using_it %]
19             [% t("Authority type cannot be deleted") | html %]
20         [% ELSE %]
21             [% tx("Confirm deletion of authority type '{authority_type_code}'", { authority_type_code= authority_type.authtypecode } ) | html %]
22         [% END %] &rsaquo;
23     [% END %]
24     [% t("Authority types") | html %] &rsaquo;
25     [% t("Administration") | html %] &rsaquo;
26     [% t("Koha") | html %]
27 [% END %]</title>
28 [% INCLUDE 'doc-head-close.inc' %]
29 </head>
30
31 <body id="admin_authtypes" class="admin">
32 [% WRAPPER 'header.inc' %]
33     [% INCLUDE 'prefs-admin-search.inc' %]
34 [% END %]
35
36 [% WRAPPER 'sub-header.inc' %]
37     [% WRAPPER breadcrumbs %]
38         [% WRAPPER breadcrumb_item %]
39             <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
40         [% END %]
41
42         [% IF op == 'add_form' || op == 'delete_confirm' %]
43             [% WRAPPER breadcrumb_item %]
44                 <a href="/cgi-bin/koha/admin/authtypes.pl">Authority types</a>
45             [% END %]
46         [% ELSE %]
47             [% WRAPPER breadcrumb_item bc_active= 1 %]
48                 <span>Authority types</span>
49             [% END %]
50         [% END %]
51
52         [% IF op == 'add_form' %]
53             [% WRAPPER breadcrumb_item bc_active= 1 %]
54                 [% IF authority_type.authtypecode.defined %]
55                     [% IF authority_type.authtypecode %]
56                         [% tx("Modify authority type '{authority_type_code}'", { authority_type_code= authority_type.authtypecode }) | html %]
57                     [% ELSE %]
58                         [% t("Modify default authority type") | html %]
59                     [% END %]
60                 [% ELSE %]
61                     <span>New authority type</span>
62                 [% END %]
63             [% END %]
64
65         [% ELSIF op == 'delete_confirm' %]
66             [% WRAPPER breadcrumb_item bc_active= 1 %]
67                 [% IF authorities_using_it %]
68                     [% t("Authority type cannot be deleted") | html %]
69                 [% ELSE %]
70                     [% tx("Confirm deletion of authority type '{authority_type_code}'", { authority_type_code= authority_type.authtypecode } ) | html %]
71                 [% END %]
72             [% END %]
73
74         [% END %]
75     [% END #/ WRAPPER breadcrumbs %]
76 [% END #/ WRAPPER sub-header.inc %]
77
78 <div class="main container-fluid">
79     <div class="row">
80         <div class="col-sm-10 col-sm-push-2">
81             <main>
82
83 [% FOR m IN messages %]
84     <div class="dialog [% m.type | html %]">
85         [% SWITCH m.code %]
86         [% CASE 'error_on_update' %]
87             <span>An error occurred when updating this authority type. Perhaps it already exists.</span>
88         [% CASE 'error_on_insert' %]
89             <span>An error occurred when adding this authority type. The authority type code might already exist.</span>
90         [% CASE 'error_on_delete' %]
91             <span>An error occurred when deleting this authority type. Check the logs.</span>
92         [% CASE 'success_on_update' %]
93             <span>Authority type updated successfully.</span>
94         [% CASE 'success_on_insert' %]
95             <span>Authority type added successfully.</span>
96         [% CASE 'success_on_delete' %]
97             <span>Authority type deleted successfully.</span>
98         [% CASE %]
99             [% m.code | html %]
100         [% END %]
101     </div>
102 [% END %]
103
104
105
106 [% IF op == 'add_form' %]
107     <form action="/cgi-bin/koha/admin/authtypes.pl" name="Aform" method="post" class="validated">
108         <h1>
109             [% IF authority_type.authtypecode.defined %]
110                 [% IF authority_type.authtypecode %]
111                     [% tx("Modify authority type '{authority_type_code}'", { authority_type_code= authority_type.authtypecode }) | html %]
112                 [% ELSE %]
113                     [% t("Modify default authority type") | html %]
114                 [% END %]
115             [% ELSE %]
116                 <span>New authority type</span>
117             [% END %]
118         </h1>
119         <fieldset class="rows">
120             <legend class="sr-only">Enter authority type details</legend>
121             <ol>
122                 <li>
123                     [% IF authority_type.authtypecode.defined %]
124                             <span class="label">Authority type</span>
125                             <input type="hidden" name="op" value="add_validate" />
126                             <input type="hidden" name="checked" value="0" />
127                             <input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" />[% authority_type.authtypecode | html %]
128                     [% ELSE %]
129                             <label for="authtypecode" class="required">Authority type: </label>
130                             <input id="authtypecode" type="text" class="required focus" required="required" name="authtypecode" size="20" maxlength="10" />
131                             <span class="required">Required</span>
132                             <div class="hint">10 characters maximum</div>
133                     [% END %]
134                 </li>
135                 <li>
136                     <label for="authtypetext" class="required">Description: </label>
137                     <input type="text" id="authtypetext" name="authtypetext" size="40" maxlength="80" value="[% authority_type.authtypetext | html %]" class="required" required="required" />
138                     <span class="required">Required</span>
139                 </li>
140                 <li>
141                     <label for="summary">Summary: </label>
142                     <textarea id="summary" name="summary" cols="55" rows="7">[% authority_type.summary | html %]</textarea>
143                 </li>
144                 <li>
145                     <label for="auth_tag_to_report">Authority field to copy: </label>
146                     <input type="text" id="auth_tag_to_report" name="auth_tag_to_report" size="5" maxlength="3" value="[% authority_type.auth_tag_to_report | html %]" />
147                     <div class="hint">Note: for 'Authority field to copy', enter the authority field that should be copied from the authority record to the bibliographic record. E.g., in MARC21, field 100 in the authority record should be copied to field 100 in the bibliographic record</div>
148                     <input type="hidden" name="op" value="add_validate" />
149                     [% IF authority_type.authtypecode.defined %]
150                         <input type="hidden" name="is_a_modif" value="1" />
151                     [% END %]
152                 </li>
153             </ol>
154         </fieldset>
155         <fieldset class="action">
156             <input type="submit" class="btn btn-primary" value="Submit" />
157             <a class="cancel" href="/cgi-bin/koha/admin/authtypes.pl">Cancel</a>
158         </fieldset>
159     </form>
160 [% END %]
161
162 [% IF op == 'delete_confirm' %]
163     <div class="dialog alert">
164         [% IF authorities_using_it %]
165             <h1>This authority type cannot be deleted</h1>
166             <p><strong><span class="ex">[% authority_type.authtypecode | html %]</span></strong></p>
167             <p>[% tnx('This authority type is used {count} time.', 'This authority type is used {count} times.', authorities_using_it, { count = authorities_using_it }) %]</p>
168             <form action="/cgi-bin/koha/admin/authtypes.pl" method="get">
169                 <button type="submit"><i class="fa fa-fw fa-arrow-left"></i> Return to authority types</button>
170             </form>
171         [% ELSE %]
172             <h1>Confirm deletion of authority structure definition for <span class="ex">'[% authority_type.authtypetext | html %]' ([% authority_type.authtypecode | html %])</span></h1>
173             <form action="/cgi-bin/koha/admin/authtypes.pl" method="post">
174                 <input type="hidden" name="op" value="delete_confirmed" />
175                 <input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" />
176                 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete</button>
177             </form>
178             <form action="/cgi-bin/koha/admin/authtypes.pl" method="get">
179                 <button type="submit" class="deny"><i class="fa fa-fw fa-times"></i> No, do not delete</button>
180             </form>
181         [% END %]
182     </div>
183 [% END %]
184
185 [% IF op == 'list' %]
186     <div id="toolbar" class="btn-toolbar">
187         <a id="authtype" class="btn btn-default" href="/cgi-bin/koha/admin/authtypes.pl?op=add_form"><i class="fa fa-plus"></i> New authority type</a>
188     </div>
189
190     <h1>Authority types</h1>
191     <p>Define authority types, then authority MARC structure in the same way you define itemtypes and bibliographic MARC tag structure. Authority values are managed through plugins</p>
192
193     <div class="page-section">
194         <table id="authtypes">
195             <thead>
196             <tr>
197                 <th>Code</th>
198                 <th>Description</th>
199                 <th>Summary</th>
200                 <th>Auth field copied</th>
201                 <th>&nbsp;</th>
202             </tr>
203             </thead>
204             <tbody>
205             [% FOREACH authority_type IN authority_types %]
206                 <tr>
207                     <td>[% authority_type.authtypecode | html %]</td>
208                     <td>[% authority_type.authtypetext | html %]</td>
209                     <td>[% authority_type.summary | html %]</td>
210                     <td>[% authority_type.auth_tag_to_report | html %]</td>
211                     <td>
212                     <div class="btn-group dropup">
213                         <a class="btn btn-default btn-xs dropdown-toggle" id="authtypeactions[% authority_type.authtypecode | html %]" role="button" data-toggle="dropdown" href="#">
214                         Actions <b class="caret"></b></a>
215                         <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="authtypeactions[% authority_type.authtypecode | html %]">
216                         <li><a href="auth_tag_structure.pl?authtypecode=[% authority_type.authtypecode | uri %]" class="button parameters"><i class="fa-solid fa-eye"></i> MARC structure</a></li>
217                         <li><a href="/cgi-bin/koha/admin/authtypes.pl?op=add_form&amp;authtypecode=[% authority_type.authtypecode | uri %]"><i class="fa-solid fa-pencil" aria-hidden="true"></i> Edit</a></li>
218                         [% IF authority_type.authtypecode %]<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=delete_confirm&amp;authtypecode=[% authority_type.authtypecode | uri %]"><i class="fa fa-trash-can"></i> Delete</a></li>[% END %]
219                         <!-- Button to trigger modal -->
220                         <li><a href="#" data-toggle="modal" data-target="#exportModal_[% authority_type.authtypecode | html %][% loop.count | html %]" title="Export authority type (fields, subfields) to a spreadsheet file (.csv, .ods)"><i class="fa fa-upload"></i> Export</a></li>
221                         <!-- Button to trigger modal -->
222                         <li><a href="#" data-toggle="modal" data-target="#importModal_[% authority_type.authtypecode | html %][% loop.count | html %]" title="Import authority type (fields, subfields) from a spreadsheet file (.csv, .ods)"><i class="fa fa-download"></i> Import</a></li>
223                         </ul>
224                     </div>
225
226                     <!-- Modal for export -->
227                     <div class="modal" id="exportModal_[% authority_type.authtypecode | html %][% loop.count | html %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% authority_type.authtypecode | html %][% loop.count | html %]" aria-hidden="true">
228                         <div class="modal-dialog">
229                             <div class="modal-content">
230                                 <div class="modal-header">
231                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
232                                     <h3 id="exportLabelexportModal_[% authority_type.authtypecode | html %][% loop.count | html %]">Export [% authority_type.authtypetext | html %] authority type</h3>
233                                 </div>
234                                 <form action="/cgi-bin/koha/admin/import_export_authtype.pl" name="form_[% authority_type.authtypecode | html %]" method="get" target="_blank" class="form_export">
235                                     <div class="modal-body">
236                                         <fieldset>
237                                             <input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" />
238                                             <p><label for="csv_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% authority_type.authtypecode | html %]" value="csv" id="csv_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]" checked="checked" /> Export to CSV spreadsheet</label></p>
239                                             <p><label for="ods_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% authority_type.authtypecode | html %]" value="ods" id="ods_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]" /> Export to OpenDocument spreadsheet format</label></p>
240                                         </fieldset>
241                                     </div>
242                                     <div class="modal-footer">
243                                         <button type="submit" class="btn btn-default">Export</button>
244                                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
245                                     </div>
246                                 </form>
247                             </div>
248                         </div>
249                     </div>
250
251                     <!-- Modal for import -->
252                     <div class="modal" id="importModal_[% authority_type.authtypecode | html %][% loop.count | html %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_[% authority_type.authtypecode | html %][% loop.count | html %]" aria-hidden="true">
253                         <div class="modal-dialog">
254                             <div class="modal-content">
255                                 <div class="modal-header">
256                                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
257                                     <h3 id="importLabelexportModal_[% authority_type.authtypecode | html %][% loop.count | html %]">Import [% authority_type.authtypecode | html %] authority type (fields and subfields) from a spreadsheet file (.csv, .ods)</h3>
258                                 </div>
259                                 <form action="/cgi-bin/koha/admin/import_export_authtype.pl" name="form_i_[% authority_type.authtypecode | html %]" id="form_i_[% authority_type.authtypecode | html %]" method="post" enctype="multipart/form-data" class="form_import">
260                                     <div class="modal-body">
261                                         <input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" />
262                                         <input type="hidden" name="action" value="import" />
263                                         <p><label for="file_import_[% authority_type.authtypecode | html %]">Upload file:</label> <input type="file" name="file_import_[% authority_type.authtypecode | html %]" id="file_import_[% authority_type.authtypecode | html %]" class="input_import" /></p>
264                                         <div id="importing_[% authority_type.authtypecode | html %]" style="display:none" class="importing"><img src="[% interface | html %]/[% theme | html %]/img/loading-small.gif" alt="" /><span class="importing_msg"></span></div>
265                                     </div>
266                                     <div class="modal-footer">
267                                         <button type="submit" class="btn btn-default">Import</button>
268                                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
269                                     </div>
270                                 </form>
271                             </div>
272                         </div>
273                     </div>
274
275                     </td>
276                 </tr>
277             [% END %]
278             <tbody>
279         </table>
280     </div> <!-- /.page-section -->
281 [% END %]
282
283             </main>
284         </div> <!-- /.col-sm-10.col-sm-push-2 -->
285
286         <div class="col-sm-2 col-sm-pull-10">
287             <aside>
288                 [% INCLUDE 'admin-menu.inc' %]
289             </aside>
290         </div> <!-- /.col-sm-2.col-sm-pull-10 -->
291      </div> <!-- /.row -->
292
293 [% MACRO jsinclude BLOCK %]
294     [% INCLUDE 'datatables.inc' %]
295     [% Asset.js("js/admin-menu.js") | $raw %]
296     [% Asset.js("js/authtype.js") | $raw %]
297 [% END %]
298 [% INCLUDE 'intranet-bottom.inc' %]