Bug 15598: Also fixing space near exclamation mark in other files
[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 an ods or xml 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 an spreadsheet (csv, ods, xml) 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         <h3>Delete framework for [% framework.frameworktext %] ([% framework.frameworkcode %])?</h3>
179         [% IF biblios_use_this_framework %]
180            <p><strong>This framework is used [% biblios_use_this_framework %] times</strong>.</p>
181         [% END %]
182         <form class="inline" action="/cgi-bin/koha/admin/biblio_framework.pl" method="post">
183             <input type="hidden" name="op" value="delete_confirmed" />
184             <input type="hidden" name="frameworkcode" value="[% framework.frameworkcode %]" />
185             <input type="submit" class="approve" value="Yes, delete this framework!" />
186         </form>
187         <form class="inline" action="/cgi-bin/koha/admin/biblio_framework.pl" method="get">
188             <input type="submit" class="deny" value="No, do not delete!" />
189         </form>
190     </div>
191 [% END %]
192
193 [% IF op == 'list' %]
194 <h1>MARC frameworks</h1>
195 <p>Framework name, then go to MARC biblio to set MARC editor parameters</p>
196 <table id="table_biblio_frameworks">
197     <thead>
198     <tr>
199         <th>Code</th>
200         <th>Description</th>
201         <th>&nbsp;</th>
202         <th>Edit</th>
203         <th>Delete</th>
204         <th title="Export framework structure (fields, subfields) to a spreadsheet file (.csv, .xml, .ods)">Export</th>
205         <th title="Import framework structure (fields, subfields) from a spreadsheet file (.csv, .xml, .ods)">Import</th>
206     </tr>
207     </thead>
208     <tbody>
209     <tr>
210         <td>&nbsp;</td>
211         <td>Default framework</td>
212         <td><a href="marctagstructure.pl?frameworkcode=">MARC structure</a></td>
213         <td>&nbsp;</td>
214         <td>&nbsp;</td>
215         <td>
216
217             <!-- Button to trigger modal -->
218             <a href="#" data-toggle="modal" data-target="#exportModal_default">Export</a>
219             <!-- Modal -->
220             <div class="modal hide" id="exportModal_default" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_default" aria-hidden="true">
221                 <div class="modal-header">
222                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
223                     <h3 id="exportLabelexportModal_default">Export default framework</h3>
224                 </div>
225                 <form action="import_export_framework.pl" name="form_defaul" method="get" target="_blank"  class="form_export">
226                     <div class="modal-body">
227                         <fieldset>
228                             <input type="hidden" name="frameworkcode" value="" />
229                             <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>
230                             <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>
231                             <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>
232
233                         </fieldset>
234                     </div>
235                     <div class="modal-footer">
236                         <button type="submit" class="btn">Export</button>
237                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
238                     </div>
239                 </form>
240             </div>
241
242         </td>
243         <td>
244
245             <!-- Button to trigger modal -->
246             <a href="#" data-toggle="modal" data-target="#importModal_[% framework.frameworkcode %][% frameworks.count %]">Import</a>
247             <!-- Modal -->
248             <div class="modal hide" id="importModal_[% framework.frameworkcode %][% frameworks.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_default[% frameworks.count %]" aria-hidden="true">
249                 <div class="modal-header">
250                     <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
251                     <h3 id="importLabelexportModal_[% framework.frameworkcode %][% frameworks.count %]">Import default framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h3>
252                 </div>
253                 <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">
254                     <div class="modal-body">
255                             <input type="hidden" name="frameworkcode" value="default" />
256                             <input type="hidden" name="action" value="import" />
257                             <p><label for="file_import_default">Upload file:</label> <input type="file" name="file_import_default" id="file_import_default" class="input_import" /></p>
258                             <div id="importing_default" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /><span class="importing_msg"></span></div>
259                     </div>
260                     <div class="modal-footer">
261                         <button type="submit" class="btn">Import</button>
262                         <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
263                     </div>
264                 </form>
265             </div>
266
267         </td>
268     </tr>
269     <!-- note highlight assignment appears backwards because we already have a normal row for Default -->
270     [% FOREACH loo IN frameworks %]
271         <tr>
272             <td>[% loo.frameworkcode %]</td>
273             <td>[% loo.frameworktext %]</td>
274             <td><a href="marctagstructure.pl?frameworkcode=[% loo.frameworkcode %]" >MARC structure</a></td>
275             <td><a href="/cgi-bin/koha/admin/biblio_framework.pl?op=add_form&amp;frameworkcode=[% loo.frameworkcode |html %]">Edit</a></td>
276             <td><a href="/cgi-bin/koha/admin/biblio_framework.pl?op=delete_confirm&amp;frameworkcode=[% loo.frameworkcode |html %]">Delete</a></td>
277             <td>
278
279                 <!-- Button to trigger modal -->
280                 <a href="#" data-toggle="modal" data-target="#exportModal_[% loo.frameworkcode %][% loop.count %]">Export</a>
281                 <!-- Modal -->
282                 <div class="modal hide" id="exportModal_[% loo.frameworkcode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]" aria-hidden="true">
283                     <div class="modal-header">
284                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
285                         <h3 id="exportLabelexportModal_[% loo.frameworkcode %][% loop.count %]">Export [% loo.frameworktext %] framework</h3>
286                     </div>
287                     <form action="import_export_framework.pl" name="form_[% loo.frameworkcode %]" method="get" target="_blank"  class="form_export">
288                         <div class="modal-body">
289                             <fieldset>
290                                 <input type="hidden" name="frameworkcode" value="[% loo.frameworkcode %]" />
291                                 <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>
292                                 <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>
293                                 <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>
294
295                             </fieldset>
296                         </div>
297                         <div class="modal-footer">
298                             <button type="submit" class="btn">Export</button>
299                             <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
300                         </div>
301                     </form>
302                 </div>
303             </td>
304             <td>
305
306                 <!-- Button to trigger modal -->
307                 <a href="#" data-toggle="modal" data-target="#importModal_[% loo.frameworkcode %][% loop.count %]">Import</a>
308                 <!-- Modal -->
309                 <div class="modal hide" id="importModal_[% loo.frameworkcode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_[% loo.frameworkcode %][% loop.count %]" aria-hidden="true">
310                     <div class="modal-header">
311                         <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
312                         <h3 id="importLabelexportModal_[% loo.frameworkcode %][% loop.count %]">Import [% loo.frameworkcode %] framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h3>
313                     </div>
314                     <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">
315                         <div class="modal-body">
316                                 <input type="hidden" name="frameworkcode" value="[% loo.frameworkcode %]" />
317                                 <input type="hidden" name="action" value="import" />
318                                 <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>
319                                 <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>
320                         </div>
321                         <div class="modal-footer">
322                             <button type="submit" class="btn">Import</button>
323                             <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
324                         </div>
325                     </form>
326                 </div>
327         </td>
328         </tr>
329     [% END %]
330 </table>
331
332 [% END %]
333     </div>
334   </div>
335 <div class="yui-b">
336 [% INCLUDE 'admin-menu.inc' %]
337   </div>
338 </div>
339 [% INCLUDE 'intranet-bottom.inc' %]