Bug 15927 - Remove use of <tr class="highlight"> for alternating row colors
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / admin / biblio_framework.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Administration &rsaquo; MARC frameworks
3 [% IF op == 'add_form' %]
4 &rsaquo; [% IF framework %]Modify framework text[% ELSE %]Add framework[% END %]
5 [% ELSIF op == 'delete_confirm' %]
6 &rsaquo; Delete framework for [% framework.frameworktext %] ([% framework.frameworkcode %])?
7 [% END %]
8 </title>
9 [% INCLUDE 'doc-head-close.inc' %]
10 <link rel="stylesheet" type="text/css" href="[% themelang %]/css/datatables.css" />
11 [% INCLUDE 'datatables.inc' %]
12 <script type="text/javascript">
13 /* Import/Export from/to spreadsheet */
14
15     var importing = false;
16
17     $(document).ready(function() {
18         $("#table_biblio_frameworks").dataTable($.extend(true, {}, dataTablesDefaults, {
19             "aoColumnDefs": [
20                 { "aTargets": [ -1, -2, -3, -4, -5 ], "bSortable": false, "bSearchable": false },
21                 { "aTargets": [ 0, 1 ], "sType": "natural" },
22             ],
23             "bSort": true,
24             "sPaginationType": "four_button"
25         }));
26
27         $("body").css("cursor", "auto");
28         $('.import_export_options').hide();
29         $('a.import_export_fw').click(function() {
30             if (!importing) {
31                 $('.import_export_options').hide();
32                 $(this).next().show('slide');
33             }
34             return false;
35         });
36         $('.import_export_close').click(function() {
37             if (!importing) {
38                 $('.import_export_options').fadeOut('fast');
39                 $("body").css("cursor", "auto");
40                 return false;
41             }
42         });
43         $('.input_import').val("");
44
45         var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search);
46         if (matches && matches.length > 1) {
47             alert(_("Error importing the framework %s").format(decodeURIComponent(matches[1])));
48         }
49
50         $('input.input_import').change( function() {
51             var filename = $(this).val();
52             if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) {
53                 $(this).css("background-color","yellow");
54                 alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file."));
55                 $(this).val("");
56                 $(this).css("background-color","white");
57             }
58         });
59         $('form.form_export').submit(function() {
60             $('.modal').modal("hide");
61             return true;
62         });
63         $('form.form_import').submit(function() {
64             var id = $(this).attr('id');
65             var obj = $('#' + id + ' input:file');
66             if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) {
67                 if (confirm(_("Do you really want to import the framework fields and subfields? This will overwrite the current configuration. For safety reasons please use the export option to make a backup"))) {
68                     var frameworkcode = $('#' + id + ' input:hidden[name=frameworkcode]').val();
69                     $('#importing_' + frameworkcode).find("span").html(_("Importing to framework: %s. Importing from file: %s").format("<strong>" + frameworkcode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>"));
70                     if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
71                         var timestamp = new Date().getTime();
72                         $('#importing_' + frameworkcode).find("img").attr('src', '[% interface %]/[% theme %]/img/loading-small.gif' + '?' +timestamp);
73                     }
74                     $('#importing_' + frameworkcode).css('display', 'block');
75                     if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress");
76                     importing = true;
77                     $(".modal-footer,.closebtn").hide();
78                     return true;
79                 } else
80                     return false;
81             }
82             obj.css("background-color","yellow");
83             alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file."));
84             obj.val("");
85             obj.css("background-color","white");
86             return false;
87         });
88     });
89
90 </script>
91
92 </head>
93 <body id="admin_biblio_framework" class="admin">
94 [% INCLUDE 'header.inc' %]
95 [% INCLUDE 'cat-search.inc' %]
96
97 <div id="breadcrumbs">
98         <a href="/cgi-bin/koha/mainpage.pl">Home</a>
99 &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
100 &rsaquo; <a href="/cgi-bin/koha/admin/biblio_framework.pl">MARC frameworks</a>
101 [% IF op == 'add_form' %]
102 &rsaquo; [% IF framework %]Modify framework text[% ELSE %]Add framework[% END %]
103 [% ELSIF op == 'delete_confirm' %]
104 &rsaquo; Delete framework for [% framework.frameworktext %] ([% framework.frameworkcode %])?
105 [% END %]
106 </div>
107
108 <div id="doc3" class="yui-t2">
109   <div id="bd">
110     <div id="yui-main">
111       <div class="yui-b">
112
113 [% FOR m IN messages %]
114     <div class="dialog [% m.type %]">
115         [% SWITCH m.code %]
116         [% CASE 'error_on_update' %]
117             An error occurred when updating this framework. Perhaps it already exists.
118         [% CASE 'error_on_insert' %]
119             An error occurred when adding this framework. The framework might already exist.
120         [% CASE 'error_on_delete' %]
121             An error occurred when deleting this framework. Check the logs.
122         [% CASE 'success_on_update' %]
123             Framework updated successfully.
124         [% CASE 'success_on_insert' %]
125             Framework added successfully.
126         [% CASE 'success_on_delete' %]
127             Framework deleted successfully.
128         [% CASE 'already_exists' %]
129             This framework code already exists.
130         [% CASE %]
131             [% m.code %]
132         [% END %]
133     </div>
134 [% END %]
135
136
137
138 [% IF op == 'list'%]
139     <div id="toolbar" class="btn-toolbar">
140         <a class="btn btn-small" id="newframework" href="/cgi-bin/koha/admin/biblio_framework.pl?op=add_form"><i class="fa fa-plus"></i> New framework</a>
141     </div>
142 [% END %]
143
144 [% IF op == 'add_form' %]
145     <h1>[% IF framework %]Modify framework text[% ELSE %]Add framework[% END %]</h1>
146     <form action="/cgi-bin/koha/admin/biblio_framework.pl" name="Aform" method="post" class="validated">
147         <input type="hidden" name="op" value="add_validate" />
148         <fieldset class="rows">
149             <ol>
150                 [% IF framework %]
151                     <li>
152                         <span class="label">Framework code: </span>
153                         <input type="hidden" id="frameworkcode" name="frameworkcode" value="[% framework.frameworkcode %]" />[% framework.frameworkcode %]
154                         <input type="hidden" name="is_a_modif" value="1" />
155                     </li>
156                 [% ELSE %]
157                     <li>
158                         <label for="frameworkcode" class="required">Framework code: </label>
159                         <input type="text" id="frameworkcode" name="frameworkcode" size="4" maxlength="4" onblur="toUC(this)" required="required" class="required" />
160                         <span class="required">Required</span>
161                     </li>
162                 [% END %]
163                 <li>
164                     <label for="description" class="required">Description: </label>
165                     <input type="text" name="frameworktext" id="description" size="40" maxlength="80" value="[% framework.frameworktext |html %]" required="required" class="required" />
166                     <span class="required">Required</span>
167                 </li>
168             </ol>
169         </fieldset>
170         <fieldset class="action">
171             <input type="submit" value="Submit" class="submit" />
172         </fieldset>
173     </form>
174 [% END %]
175
176 [% IF op == 'delete_confirm' %]
177     <div class="dialog alert">
178         [% IF biblios_use_this_framework %]
179             <h3>This framework cannot be deleted</h3>
180             <p><strong><span class="ex">[% framework.frameworktext %] ([% framework.frameworkcode %])</span></strong></p>
181             <p>The framework is used [% biblios_use_this_framework %] times.</p>
182             <form action="/cgi-bin/koha/admin/biblio_framework.pl" method="get">
183                 <button type="submit"><i class="fa fa-fw fa-arrow-left"></i> Return to frameworks</button>
184             </form>
185         [% ELSE %]
186             <h3>Delete framework for [% framework.frameworktext %] ([% framework.frameworkcode %])?</h3>
187             <form class="inline" action="/cgi-bin/koha/admin/biblio_framework.pl" method="post">
188                 <input type="hidden" name="op" value="delete_confirmed" />
189                 <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
190                 <button type="submit" class="approve"><i class="fa fa-fw fa-check"></i> Yes, delete this framework</button>
191             </form>
192             <form class="inline" action="/cgi-bin/koha/admin/biblio_framework.pl" method="get">
193                 <button type="submit" class="deny"><i class="fa fa-fw fa-remove"></i> No, do not delete</button>
194             </form>
195         [% END %]
196     </div>
197 [% END %]
198
199 [% IF op == 'list' %]
200 <h1>MARC frameworks</h1>
201 <p>Framework name, then go to MARC biblio to set MARC editor parameters</p>
202 <table id="table_biblio_frameworks">
203     <thead>
204     <tr>
205         <th>Code</th>
206         <th>Description</th>
207         <th>&nbsp;</th>
208         <th>Edit</th>
209         <th>Delete</th>
210         <th title="Export framework structure (fields, subfields) to a spreadsheet file (.csv, .xml, .ods)">Export</th>
211         <th title="Import framework structure (fields, subfields) from a spreadsheet file (.csv, .xml, .ods)">Import</th>
212     </tr>
213     </thead>
214     <tbody>
215     <tr>
216         <td>&nbsp;</td>
217         <td>Default framework</td>
218         <td><a href="marctagstructure.pl?frameworkcode=">MARC structure</a></td>
219         <td>&nbsp;</td>
220         <td>&nbsp;</td>
221         <td>
222
223             <!-- Button to trigger modal -->
224             <a href="#" data-toggle="modal" data-target="#exportModal_default">Export</a>
225             <!-- Modal -->
226             <div class="modal hide" id="exportModal_default" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_default" aria-hidden="true">
227                 <div class="modal-header">
228                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
229                     <h3 id="exportLabelexportModal_default">Export default framework</h3>
230                 </div>
231                 <form action="import_export_framework.pl" name="form_defaul" method="get" target="_blank"  class="form_export">
232                     <div class="modal-body">
233                         <fieldset>
234                             <input type="hidden" name="frameworkcode" value="" />
235                             <p><label for="csv_type_export_default"><input type="radio" name="type_export_defaul" value="csv" id="csv_type_export_default" checked="checked" /> Export to CSV spreadsheet</label></p>
236                             <p><label for="xml_type_export_default"><input type="radio" name="type_export_default" value="excel" id="xml_type_export_default" /> Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label></p>
237                             <p><label for="ods_type_export_default"><input type="radio" name="type_export_default" value="ods" id="ods_type_export_default" /> Export to OpenDocument spreadsheet format</label></p>
238
239                         </fieldset>
240                     </div>
241                     <div class="modal-footer">
242                         <button type="submit" class="btn">Export</button>
243                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
244                     </div>
245                 </form>
246             </div>
247
248         </td>
249         <td>
250
251             <!-- Button to trigger modal -->
252             <a href="#" data-toggle="modal" data-target="#importModal_[% framework.frameworkcode %][% frameworks.count %]">Import</a>
253             <!-- Modal -->
254             <div class="modal hide" id="importModal_[% framework.frameworkcode %][% frameworks.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_default[% frameworks.count %]" aria-hidden="true">
255                 <div class="modal-header">
256                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
257                     <h3 id="importLabelexportModal_[% framework.frameworkcode %][% frameworks.count %]">Import default framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h3>
258                 </div>
259                 <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_default" id="form_i_default" method="post" enctype="multipart/form-data" class="form_import">
260                     <div class="modal-body">
261                             <input type="hidden" name="frameworkcode" value="default" />
262                             <input type="hidden" name="action" value="import" />
263                             <p><label for="file_import_default">Upload file:</label> <input type="file" name="file_import_default" id="file_import_default" class="input_import" /></p>
264                             <div id="importing_default" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /><span class="importing_msg"></span></div>
265                     </div>
266                     <div class="modal-footer">
267                         <button type="submit" class="btn">Import</button>
268                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
269                     </div>
270                 </form>
271             </div>
272
273         </td>
274     </tr>
275
276     [% FOREACH loo IN frameworks %]
277         <tr>
278             <td>[% loo.frameworkcode %]</td>
279             <td>[% loo.frameworktext %]</td>
280             <td><a href="marctagstructure.pl?frameworkcode=[% loo.frameworkcode %]" >MARC structure</a></td>
281             <td><a href="/cgi-bin/koha/admin/biblio_framework.pl?op=add_form&amp;frameworkcode=[% loo.frameworkcode |html %]">Edit</a></td>
282             <td><a href="/cgi-bin/koha/admin/biblio_framework.pl?op=delete_confirm&amp;frameworkcode=[% loo.frameworkcode |html %]">Delete</a></td>
283             <td>
284
285                 <!-- Button to trigger modal -->
286                 <a href="#" data-toggle="modal" data-target="#exportModal_[% loo.frameworkcode %][% loop.count %]">Export</a>
287                 <!-- Modal -->
288                 <div class="modal hide" id="exportModal_[% loo.frameworkcode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]" aria-hidden="true">
289                     <div class="modal-header">
290                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
291                         <h3 id="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]">Export [% loo.frameworktext %] framework</h3>
292                     </div>
293                     <form action="import_export_framework.pl" name="form_[% loo.frameworkcode %]" method="get" target="_blank"  class="form_export">
294                         <div class="modal-body">
295                             <fieldset>
296                                 <input type="hidden" name="frameworkcode" value="[% loo.frameworkcode %]" />
297                                 <p><label for="csv_type_export_[% loo.frameworkcode %][% loop.count %]"><input type="radio" name="type_export_[% loo.frameworkcode %]" value="csv" id="csv_type_export_[% loo.frameworkcode %][% loop.count %]" checked="checked" /> Export to CSV spreadsheet</label></p>
298                                 <p><label for="xml_type_export_[% loo.frameworkcode %][% loop.count %]"><input type="radio" name="type_export_[% loo.frameworkcode %]" value="excel" id="xml_type_export_[% loo.frameworkcode %][% loop.count %]" /> Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label></p>
299                                 <p><label for="ods_type_export_[% loo.frameworkcode %][% loop.count %]"><input type="radio" name="type_export_[% loo.frameworkcode %]" value="ods" id="ods_type_export_[% loo.frameworkcode %][% loop.count %]" /> Export to OpenDocument spreadsheet format</label></p>
300
301                             </fieldset>
302                         </div>
303                         <div class="modal-footer">
304                             <button type="submit" class="btn">Export</button>
305                             <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
306                         </div>
307                     </form>
308                 </div>
309             </td>
310             <td>
311
312                 <!-- Button to trigger modal -->
313                 <a href="#" data-toggle="modal" data-target="#importModal_[% loo.frameworkcode %][% loop.count %]">Import</a>
314                 <!-- Modal -->
315                 <div class="modal hide" id="importModal_[% loo.frameworkcode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_[% loo.frameworkcode %][% loop.count %]" aria-hidden="true">
316                     <div class="modal-header">
317                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
318                         <h3 id="importLabelexportModal_[% loo.frameworkcode %][% loop.count %]">Import [% loo.frameworkcode %] framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h3>
319                     </div>
320                     <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_[% loo.frameworkcode %]" id="form_i_[% loo.frameworkcode %]" method="post" enctype="multipart/form-data" class="form_import">
321                         <div class="modal-body">
322                                 <input type="hidden" name="frameworkcode" value="[% loo.frameworkcode %]" />
323                                 <input type="hidden" name="action" value="import" />
324                                 <p><label for="file_import_[% loo.frameworkcode %]">Upload file:</label> <input type="file" name="file_import_[% loo.frameworkcode %]" id="file_import_[% loo.frameworkcode %]" class="input_import" /></p>
325                                 <div id="importing_[% loo.frameworkcode %]" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /><span class="importing_msg"></span></div>
326                         </div>
327                         <div class="modal-footer">
328                             <button type="submit" class="btn">Import</button>
329                             <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
330                         </div>
331                     </form>
332                 </div>
333         </td>
334         </tr>
335     [% END %]
336 </table>
337
338 [% END %]
339     </div>
340   </div>
341 <div class="yui-b">
342 [% INCLUDE 'admin-menu.inc' %]
343   </div>
344 </div>
345 [% INCLUDE 'intranet-bottom.inc' %]