Lines 192-252
Authority types › Administration › Koha
Link Here
|
192 |
<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> |
192 |
<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> |
193 |
[% 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 %] |
193 |
[% 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 %] |
194 |
<!-- Button to trigger modal --> |
194 |
<!-- Button to trigger modal --> |
195 |
<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> |
195 |
<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> |
196 |
<!-- Button to trigger modal --> |
196 |
<!-- Button to trigger modal --> |
197 |
<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> |
197 |
<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> |
198 |
</ul> |
198 |
</ul> |
199 |
</div> |
199 |
</div> |
200 |
|
200 |
|
201 |
<!-- Modal for export --> |
201 |
<!-- Modal for export --> |
202 |
<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"> |
202 |
<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"> |
203 |
<div class="modal-dialog"> |
203 |
<div class="modal-dialog"> |
204 |
<div class="modal-content"> |
204 |
<div class="modal-content"> |
205 |
<div class="modal-header"> |
205 |
<div class="modal-header"> |
206 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
206 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
207 |
<h3 id="exportLabelexportModal_[% authority_type.authtypecode %][% loop.count %]">Export [% authority_type.authtypetext %] authority type</h3> |
207 |
<h3 id="exportLabelexportModal_[% authority_type.authtypecode | html %][% loop.count | html %]">Export [% authority_type.authtypetext | html %] authority type</h3> |
208 |
</div> |
208 |
</div> |
209 |
<form action="import_export_authtype.pl" name="form_[% authority_type.authtypecode %]" method="get" target="_blank" class="form_export"> |
209 |
<form action="/cgi-bin/koha/admin/import_export_authtype.pl" name="form_[% authority_type.authtypecode | html %]" method="get" target="_blank" class="form_export"> |
210 |
<div class="modal-body"> |
210 |
<div class="modal-body"> |
211 |
<fieldset> |
211 |
<fieldset> |
212 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" /> |
212 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" /> |
213 |
<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> |
213 |
<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> |
214 |
<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> |
214 |
<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> |
215 |
<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> |
215 |
<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> |
216 |
</fieldset> |
216 |
</fieldset> |
217 |
</div> |
217 |
</div> |
218 |
<div class="modal-footer"> |
218 |
<div class="modal-footer"> |
219 |
<button type="submit" class="btn btn-default">Export</button> |
219 |
<button type="submit" class="btn btn-default">Export</button> |
220 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
220 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button> |
221 |
</div> |
221 |
</div> |
222 |
</form> |
222 |
</form> |
223 |
</div> |
223 |
</div> |
224 |
</div> |
224 |
</div> |
225 |
</div> |
225 |
</div> |
226 |
|
226 |
|
227 |
<!-- Modal for import --> |
227 |
<!-- Modal for import --> |
228 |
<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"> |
228 |
<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"> |
229 |
<div class="modal-dialog"> |
229 |
<div class="modal-dialog"> |
230 |
<div class="modal-content"> |
230 |
<div class="modal-content"> |
231 |
<div class="modal-header"> |
231 |
<div class="modal-header"> |
232 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
232 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
233 |
<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> |
233 |
<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> |
234 |
</div> |
234 |
</div> |
235 |
<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"> |
235 |
<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"> |
236 |
<div class="modal-body"> |
236 |
<div class="modal-body"> |
237 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" /> |
237 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" /> |
238 |
<input type="hidden" name="action" value="import" /> |
238 |
<input type="hidden" name="action" value="import" /> |
239 |
<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> |
239 |
<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> |
240 |
<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> |
240 |
<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> |
241 |
</div> |
241 |
</div> |
242 |
<div class="modal-footer"> |
242 |
<div class="modal-footer"> |
243 |
<button type="submit" class="btn btn-default">Import</button> |
243 |
<button type="submit" class="btn btn-default">Import</button> |
244 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button> |
244 |
<button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button> |
245 |
</div> |
245 |
</div> |
246 |
</form> |
246 |
</form> |
247 |
</div> |
247 |
</div> |
248 |
</div> |
248 |
</div> |
249 |
</div> |
249 |
</div> |
250 |
</td> |
250 |
</td> |
251 |
</tr> |
251 |
</tr> |
252 |
[% END %] |
252 |
[% END %] |
Lines 267-351
Authority types › Administration › Koha
Link Here
|
267 |
[% MACRO jsinclude BLOCK %] |
267 |
[% MACRO jsinclude BLOCK %] |
268 |
[% INCLUDE 'datatables.inc' %] |
268 |
[% INCLUDE 'datatables.inc' %] |
269 |
[% Asset.js("js/admin-menu.js") | $raw %] |
269 |
[% Asset.js("js/admin-menu.js") | $raw %] |
270 |
<script> |
270 |
[% Asset.js("js/authtype.js") | $raw %] |
271 |
var importing = false; |
|
|
272 |
|
273 |
$(document).ready(function() { |
274 |
$("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, { |
275 |
"aoColumnDefs": [ |
276 |
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, |
277 |
{ "aTargets": [ 0, 1 ], "sType": "natural" }, |
278 |
], |
279 |
"sPaginationType": "full" |
280 |
})); |
281 |
$("#authtypecode").on("blur",function(){ |
282 |
toUC(this); |
283 |
}); |
284 |
|
285 |
$("body").css("cursor", "auto"); |
286 |
$('.import_export_options').hide(); |
287 |
$('a.import_export_fw').click(function() { |
288 |
if (!importing) { |
289 |
$('.import_export_options').hide(); |
290 |
$(this).next().show('slide'); |
291 |
} |
292 |
return false; |
293 |
}); |
294 |
|
295 |
$('.import_export_close').click(function() { |
296 |
if (!importing) { |
297 |
$('.import_export_options').fadeOut('fast'); |
298 |
$("body").css("cursor", "auto"); |
299 |
return false; |
300 |
} |
301 |
}); |
302 |
$('.input_import').val(""); |
303 |
|
304 |
var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search); |
305 |
if (matches && matches.length > 1) { |
306 |
alert(_("Error importing the authority type %s").format(decodeURIComponent(matches[1]))); |
307 |
} |
308 |
|
309 |
$('input.input_import').change( function() { |
310 |
var filename = $(this).val(); |
311 |
if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) { |
312 |
$(this).css("background-color","yellow"); |
313 |
alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file.")); |
314 |
$(this).val(""); |
315 |
$(this).css("background-color","white"); |
316 |
} |
317 |
}); |
318 |
$('form.form_export').submit(function() { |
319 |
$('.modal').modal("hide"); |
320 |
return true; |
321 |
}); |
322 |
$('form.form_import').submit(function() { |
323 |
var id = $(this).attr('id'); |
324 |
var obj = $('#' + id + ' input:file'); |
325 |
if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) { |
326 |
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"))) { |
327 |
var authtypecode = $('#' + id + ' input:hidden[name=authtypecode]').val(); |
328 |
$('#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>")); |
329 |
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) { |
330 |
var timestamp = new Date().getTime(); |
331 |
$('#importing_' + authtypecode).find("img").attr('src', '[% interface %]/[% theme %]/img/loading-small.gif' + '?' +timestamp); |
332 |
} |
333 |
$('#importing_' + authtypecode).css('display', 'block'); |
334 |
if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress"); |
335 |
importing = true; |
336 |
$(".modal-footer,.closebtn").hide(); |
337 |
return true; |
338 |
} else { |
339 |
return false; |
340 |
} |
341 |
} |
342 |
obj.css("background-color","yellow"); |
343 |
alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file.")); |
344 |
obj.val(""); |
345 |
obj.css("background-color","white"); |
346 |
return false; |
347 |
}); |
348 |
}); |
349 |
</script> |
350 |
[% END %] |
271 |
[% END %] |
351 |
[% INCLUDE 'intranet-bottom.inc' %] |
272 |
[% INCLUDE 'intranet-bottom.inc' %] |