Lines 159-184
Link Here
|
159 |
<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=add_form&authtypecode=[% authority_type.authtypecode | uri %]"><i class="fa fa-pencil"></i> Edit</a></li> |
159 |
<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=add_form&authtypecode=[% authority_type.authtypecode | uri %]"><i class="fa fa-pencil"></i> Edit</a></li> |
160 |
[% IF authority_type.authtypecode %]<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=delete_confirm&authtypecode=[% authority_type.authtypecode | uri %]"><i class="fa fa-trash"></i> Delete</a></li>[% END %] |
160 |
[% IF authority_type.authtypecode %]<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=delete_confirm&authtypecode=[% authority_type.authtypecode | uri %]"><i class="fa fa-trash"></i> Delete</a></li>[% END %] |
161 |
<!-- Button to trigger modal --> |
161 |
<!-- Button to trigger modal --> |
162 |
<li><a href="#" data-toggle="modal" data-target="#exportModal_[% authority_type.authtypecode %][% loop.count %]" title="Export authority type (fields, subfields) to a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-upload"></i> Export</a></li> |
162 |
<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, .xml, .ods)"><i class="fa fa-upload"></i> Export</a></li> |
163 |
<!-- Button to trigger modal --> |
163 |
<!-- Button to trigger modal --> |
164 |
<li><a href="#" data-toggle="modal" data-target="#importModal_[% authority_type.authtypecode %][% loop.count %]" title="Import authority type (fields, subfields) from a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-download"></i> Import</a></li> |
164 |
<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, .xml, .ods)"><i class="fa fa-download"></i> Import</a></li> |
165 |
</ul> |
165 |
</ul> |
166 |
|
166 |
|
167 |
<!-- Modal for export --> |
167 |
<!-- Modal for export --> |
168 |
<div class="modal" id="exportModal_[% authority_type.authtypecode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% authority_type.authtypecode %][% loop.count %]" aria-hidden="true"> |
168 |
<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"> |
169 |
<div class="modal-dialog"> |
169 |
<div class="modal-dialog"> |
170 |
<div class="modal-content"> |
170 |
<div class="modal-content"> |
171 |
<div class="modal-header"> |
171 |
<div class="modal-header"> |
172 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
172 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
173 |
<h3 id="exportLabelexportModal_[% authority_type.authtypecode %][% loop.count %]">Export [% authority_type.authtypetext %] authority type</h3> |
173 |
<h3 id="exportLabelexportModal_[% authority_type.authtypecode | html %][% loop.count | html %]">Export [% authority_type.authtypetext | html %] authority type</h3> |
174 |
</div> |
174 |
</div> |
175 |
<form action="import_export_authtype.pl" name="form_[% authority_type.authtypecode %]" method="get" target="_blank" class="form_export"> |
175 |
<form action="/cgi-bin/koha/admin/import_export_authtype.pl" name="form_[% authority_type.authtypecode | html %]" method="get" target="_blank" class="form_export"> |
176 |
<div class="modal-body"> |
176 |
<div class="modal-body"> |
177 |
<fieldset> |
177 |
<fieldset> |
178 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" /> |
178 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" /> |
179 |
<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> |
179 |
<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> |
180 |
<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> |
180 |
<p><label for="xml_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% authority_type.authtypecode | html %]" value="excel" id="xml_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]" /> Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label></p> |
181 |
<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> |
181 |
<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> |
182 |
</fieldset> |
182 |
</fieldset> |
183 |
</div> |
183 |
</div> |
184 |
<div class="modal-footer"> |
184 |
<div class="modal-footer"> |
Lines 191-209
Link Here
|
191 |
</div> |
191 |
</div> |
192 |
|
192 |
|
193 |
<!-- Modal for import --> |
193 |
<!-- Modal for import --> |
194 |
<div class="modal" id="importModal_[% authority_type.authtypecode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_[% authority_type.authtypecode %][% loop.count %]" aria-hidden="true"> |
194 |
<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"> |
195 |
<div class="modal-dialog"> |
195 |
<div class="modal-dialog"> |
196 |
<div class="modal-content"> |
196 |
<div class="modal-content"> |
197 |
<div class="modal-header"> |
197 |
<div class="modal-header"> |
198 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
198 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
199 |
<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> |
199 |
<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, .xml, .ods)</h3> |
200 |
</div> |
200 |
</div> |
201 |
<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"> |
201 |
<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"> |
202 |
<div class="modal-body"> |
202 |
<div class="modal-body"> |
203 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" /> |
203 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" /> |
204 |
<input type="hidden" name="action" value="import" /> |
204 |
<input type="hidden" name="action" value="import" /> |
205 |
<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> |
205 |
<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> |
206 |
<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> |
206 |
<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> |
207 |
</div> |
207 |
</div> |
208 |
<div class="modal-footer"> |
208 |
<div class="modal-footer"> |
209 |
<button type="submit" class="btn btn-default">Import</button> |
209 |
<button type="submit" class="btn btn-default">Import</button> |
Lines 234-319
Link Here
|
234 |
[% MACRO jsinclude BLOCK %] |
234 |
[% MACRO jsinclude BLOCK %] |
235 |
[% INCLUDE 'datatables.inc' %] |
235 |
[% INCLUDE 'datatables.inc' %] |
236 |
[% Asset.js("js/admin-menu.js") | $raw %] |
236 |
[% Asset.js("js/admin-menu.js") | $raw %] |
237 |
<script> |
237 |
[% Asset.js("js/authtype.js") | $raw %] |
238 |
var importing = false; |
|
|
239 |
|
240 |
$(document).ready(function() { |
241 |
$("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, { |
242 |
"aoColumnDefs": [ |
243 |
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, |
244 |
{ "aTargets": [ 0, 1 ], "sType": "natural" }, |
245 |
], |
246 |
"bSort": true, |
247 |
"sPaginationType": "four_button" |
248 |
})); |
249 |
$("#authtypecode").on("blur",function(){ |
250 |
toUC(this); |
251 |
}); |
252 |
|
253 |
$("body").css("cursor", "auto"); |
254 |
$('.import_export_options').hide(); |
255 |
$('a.import_export_fw').click(function() { |
256 |
if (!importing) { |
257 |
$('.import_export_options').hide(); |
258 |
$(this).next().show('slide'); |
259 |
} |
260 |
return false; |
261 |
}); |
262 |
|
263 |
$('.import_export_close').click(function() { |
264 |
if (!importing) { |
265 |
$('.import_export_options').fadeOut('fast'); |
266 |
$("body").css("cursor", "auto"); |
267 |
return false; |
268 |
} |
269 |
}); |
270 |
$('.input_import').val(""); |
271 |
|
272 |
var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search); |
273 |
if (matches && matches.length > 1) { |
274 |
alert(_("Error importing the authority type %s").format(decodeURIComponent(matches[1]))); |
275 |
} |
276 |
|
277 |
$('input.input_import').change( function() { |
278 |
var filename = $(this).val(); |
279 |
if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) { |
280 |
$(this).css("background-color","yellow"); |
281 |
alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file.")); |
282 |
$(this).val(""); |
283 |
$(this).css("background-color","white"); |
284 |
} |
285 |
}); |
286 |
$('form.form_export').submit(function() { |
287 |
$('.modal').modal("hide"); |
288 |
return true; |
289 |
}); |
290 |
$('form.form_import').submit(function() { |
291 |
var id = $(this).attr('id'); |
292 |
var obj = $('#' + id + ' input:file'); |
293 |
if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) { |
294 |
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"))) { |
295 |
var authtypecode = $('#' + id + ' input:hidden[name=authtypecode]').val(); |
296 |
$('#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>")); |
297 |
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) { |
298 |
var timestamp = new Date().getTime(); |
299 |
$('#importing_' + authtypecode).find("img").attr('src', '[% interface %]/[% theme %]/img/loading-small.gif' + '?' +timestamp); |
300 |
} |
301 |
$('#importing_' + authtypecode).css('display', 'block'); |
302 |
if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress"); |
303 |
importing = true; |
304 |
$(".modal-footer,.closebtn").hide(); |
305 |
return true; |
306 |
} else { |
307 |
return false; |
308 |
} |
309 |
} |
310 |
obj.css("background-color","yellow"); |
311 |
alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file.")); |
312 |
obj.val(""); |
313 |
obj.css("background-color","white"); |
314 |
return false; |
315 |
}); |
316 |
}); |
317 |
</script> |
318 |
[% END %] |
238 |
[% END %] |
319 |
[% INCLUDE 'intranet-bottom.inc' %] |
239 |
[% INCLUDE 'intranet-bottom.inc' %] |