Lines 11-25
Link Here
|
11 |
[% INCLUDE 'datatables.inc' %] |
11 |
[% INCLUDE 'datatables.inc' %] |
12 |
<script type="text/javascript"> |
12 |
<script type="text/javascript"> |
13 |
//<![CDATA[ |
13 |
//<![CDATA[ |
|
|
14 |
|
15 |
/* Import/Export from/to spreadsheet */ |
16 |
|
17 |
var importing = false; |
18 |
|
14 |
$(document).ready(function() { |
19 |
$(document).ready(function() { |
15 |
$("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, { |
20 |
$("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, { |
16 |
"aoColumnDefs": [ |
21 |
"aoColumnDefs": [ |
17 |
{ "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false }, |
22 |
{ "aTargets": [ -1, -2, -3 ], "bSortable": false, "bSearchable": false }, |
|
|
23 |
{ "aTargets": [ 0, 1 ], "sType": "natural" }, |
18 |
], |
24 |
], |
|
|
25 |
"bSort": true, |
19 |
"sPaginationType": "four_button" |
26 |
"sPaginationType": "four_button" |
20 |
})); |
27 |
})); |
|
|
28 |
|
29 |
$("body").css("cursor", "auto"); |
30 |
$('.import_export_options').hide(); |
31 |
$('a.import_export_fw').click(function() { |
32 |
if (!importing) { |
33 |
$('.import_export_options').hide(); |
34 |
$(this).next().show('slide'); |
35 |
} |
36 |
return false; |
37 |
}); |
38 |
$('.import_export_close').click(function() { |
39 |
if (!importing) { |
40 |
$('.import_export_options').fadeOut('fast'); |
41 |
$("body").css("cursor", "auto"); |
42 |
return false; |
43 |
} |
44 |
}); |
45 |
$('.input_import').val(""); |
46 |
|
47 |
var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search); |
48 |
if (matches && matches.length > 1) { |
49 |
alert(_("Error importing the authority type %s").format(decodeURIComponent(matches[1]))); |
50 |
} |
51 |
|
52 |
$('input.input_import').change( function() { |
53 |
var filename = $(this).val(); |
54 |
if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) { |
55 |
$(this).css("background-color","yellow"); |
56 |
alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) file.")); |
57 |
$(this).val(""); |
58 |
$(this).css("background-color","white"); |
59 |
} |
60 |
}); |
61 |
$('form.form_export').submit(function() { |
62 |
$('.modal').modal("hide"); |
63 |
return true; |
64 |
}); |
65 |
$('form.form_import').submit(function() { |
66 |
var id = $(this).attr('id'); |
67 |
var obj = $('#' + id + ' input:file'); |
68 |
if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) { |
69 |
if (confirm(_("Do you really want to import the authority type fields and subfields? This will overwrite the current configuration. For safety reasons please use the export option to make a backup"))) { |
70 |
var authtypecode = $('#' + id + ' input:hidden[name=authtypecode]').val(); |
71 |
$('#importing_' + authtypecode).find("span").html(_("Importing to authority type: %s. Importing from file: %s").format("<strong>" + authtypecode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>")); |
72 |
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) { |
73 |
var timestamp = new Date().getTime(); |
74 |
$('#importing_' + authtypecode).find("img").attr('src', '[% interface %]/[% theme %]/img/loading-small.gif' + '?' +timestamp); |
75 |
} |
76 |
$('#importing_' + authtypecode).css('display', 'block'); |
77 |
if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress"); |
78 |
importing = true; |
79 |
$(".modal-footer,.closebtn").hide(); |
80 |
return true; |
81 |
} else |
82 |
return false; |
83 |
} |
84 |
obj.css("background-color","yellow"); |
85 |
alert(_("Please select a spreadsheet (.csv, .ods, .xml) file.")); |
86 |
obj.val(""); |
87 |
obj.css("background-color","white"); |
88 |
return false; |
89 |
}); |
21 |
}); |
90 |
}); |
22 |
//]]> |
|
|
23 |
</script> |
91 |
</script> |
24 |
</head> |
92 |
</head> |
25 |
|
93 |
|
Lines 153-158
Link Here
|
153 |
<th> </th> |
221 |
<th> </th> |
154 |
<th>Edit</th> |
222 |
<th>Edit</th> |
155 |
<th>Delete</th> |
223 |
<th>Delete</th> |
|
|
224 |
<th title="Export authority type (fields, subfields) to a spreadsheet file (.csv, .xml, .ods)">Export</th> |
225 |
<th title="Import authority type (fields, subfields) from a spreadsheet file (.csv, .xml, .ods)">Import</th> |
156 |
</tr> |
226 |
</tr> |
157 |
</thead> |
227 |
</thead> |
158 |
<tbody> |
228 |
<tbody> |
Lines 165-170
Link Here
|
165 |
<td><a href="auth_tag_structure.pl?authtypecode=[% authority_type.authtypecode %]" class="button parameters" >MARC structure</a></td> |
235 |
<td><a href="auth_tag_structure.pl?authtypecode=[% authority_type.authtypecode %]" class="button parameters" >MARC structure</a></td> |
166 |
<td><a href="/cgi-bin/koha/admin/authtypes.pl?op=add_form&authtypecode=[% authority_type.authtypecode |html %]">Edit</a></td> |
236 |
<td><a href="/cgi-bin/koha/admin/authtypes.pl?op=add_form&authtypecode=[% authority_type.authtypecode |html %]">Edit</a></td> |
167 |
<td><a href="/cgi-bin/koha/admin/authtypes.pl?op=delete_confirm&authtypecode=[% authority_type.authtypecode |html %]">Delete</a></td> |
237 |
<td><a href="/cgi-bin/koha/admin/authtypes.pl?op=delete_confirm&authtypecode=[% authority_type.authtypecode |html %]">Delete</a></td> |
|
|
238 |
<td> |
239 |
<!-- Button to trigger modal --> |
240 |
<a href="#" data-toggle="modal" data-target="#exportModal_[% authority_type.authtypecode %][% loop.count %]">Export</a> |
241 |
<!-- Modal --> |
242 |
<div class="modal hide" id="exportModal_[% authority_type.authtypecode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% authority_type.authtypecode %][% loop.count %]" aria-hidden="true"> |
243 |
<div class="modal-header"> |
244 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
245 |
<h3 id="exportLabelexportModal_[% authority_type.authtypecode %][% loop.count %]">Export [% authority_type.authtypetext %] authority type</h3> |
246 |
</div> |
247 |
<form action="import_export_authtype.pl" name="form_[% authority_type.authtypecode %]" method="get" target="_blank" class="form_export"> |
248 |
<div class="modal-body"> |
249 |
<fieldset> |
250 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" /> |
251 |
<p><label for="csv_type_export_[% authority_type.authtypecode %][% loop.count %]"><input type="radio" name="type_export_[% authority_type.authtypecode %]" value="csv" id="csv_type_export_[% authority_type.authtypecode %][% loop.count %]" checked="checked" /> Export to CSV spreadsheet</label></p> |
252 |
<p><label for="xml_type_export_[% authority_type.authtypecode %][% loop.count %]"><input type="radio" name="type_export_[% authority_type.authtypecode %]" value="excel" id="xml_type_export_[% authority_type.authtypecode %][% loop.count %]" /> Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label></p> |
253 |
<p><label for="ods_type_export_[% authority_type.authtypecode %][% loop.count %]"><input type="radio" name="type_export_[% authority_type.authtypecode %]" value="ods" id="ods_type_export_[% authority_type.authtypecode %][% loop.count %]" /> Export to OpenDocument spreadsheet format</label></p> |
254 |
|
255 |
</fieldset> |
256 |
</div> |
257 |
<div class="modal-footer"> |
258 |
<button type="submit" class="btn">Export</button> |
259 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
260 |
</div> |
261 |
</form> |
262 |
</div> |
263 |
</td> |
264 |
<td> |
265 |
<!-- Button to trigger modal --> |
266 |
<a href="#" data-toggle="modal" data-target="#importModal_[% authority_type.authtypecode %][% loop.count %]">Import</a> |
267 |
<!-- Modal --> |
268 |
<div class="modal hide" id="importModal_[% authority_type.authtypecode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_[% authority_type.authtypecode %][% loop.count %]" aria-hidden="true"> |
269 |
<div class="modal-header"> |
270 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
271 |
<h3 id="importLabelexportModal_[% authority_type.authtypecode %][% loop.count %]">Import [% authority_type.authtypecode %] authority type (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h3> |
272 |
</div> |
273 |
<form action="/cgi-bin/koha/admin/import_export_authtype.pl" name="form_i_[% authority_type.authtypecode %]" id="form_i_[% authority_type.authtypecode %]" method="post" enctype="multipart/form-data" class="form_import"> |
274 |
<div class="modal-body"> |
275 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" /> |
276 |
<input type="hidden" name="action" value="import" /> |
277 |
<p><label for="file_import_[% authority_type.authtypecode %]">Upload file:</label> <input type="file" name="file_import_[% authority_type.authtypecode %]" id="file_import_[% authority_type.authtypecode %]" class="input_import" /></p> |
278 |
<div id="importing_[% authority_type.authtypecode %]" style="display:none" class="importing"><img src="[% interface %]/[% theme %]/img/loading-small.gif" alt="" /><span class="importing_msg"></span></div> |
279 |
</div> |
280 |
<div class="modal-footer"> |
281 |
<button type="submit" class="btn">Import</button> |
282 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button> |
283 |
</div> |
284 |
</form> |
285 |
</div> |
286 |
</td> |
168 |
</tr> |
287 |
</tr> |
169 |
[% END %] |
288 |
[% END %] |
170 |
<tbody> |
289 |
<tbody> |
171 |
- |
|
|