Owen Leonard
247dca3064
This patch upgrades DataTables and makes some style changes to the default DataTables toolbar style. DataTables assets are now combined and minified using their download customizer, bundling together these elements: - JSZip 2.5.0 - pdfmake 0.1.36 - DataTables 1.10.18 - Buttons 1.5.6 - Column visibility 1.5.6 - HTML5 export 1.5.6 - Print view 1.5.6 - FixedHeader 3.1.4 DataTables assets have been moved from lib/jquery/plugins to lib/datatables. The global header and footer include files are updated correspondingly. This patch removes the custom "four_button" pagination configuration and updates pages which used it to use the built-in "full" type instead. This is done for the sake of consistency and upgradability. This change touches a lot of files. Table-specific CSS has been moved from staff-global.scss to a new include, _tables.scss. A second common include, _mixins.scss has some variable definitions used in both files. Many images have been made obsolete by this change and have been removed. To test, apply the patch and regenerate the staff client CSS. View various pages in the staff client with tables: - Not formatted by DataTables: - Reports -> Most circulated items - Catalog -> Search results - Formatted by DataTables without column configuration - Acquisitions -> Vendor search - Lists - Formatted by DataTables with column configuration - Administration -> Libraries - Administration -> Item types - Reports -> Saved SQL reports - Non-standard DataTables configurations: - Circulation -> Checkouts - Administration -> System preferences - Reports -> Lost items Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
80 lines
3.6 KiB
JavaScript
80 lines
3.6 KiB
JavaScript
/* Import/Export from/to spreadsheet */
|
|
|
|
var importing = false;
|
|
|
|
$(document).ready(function() {
|
|
$("#table_biblio_frameworks").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"aoColumnDefs": [
|
|
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
|
|
{ "aTargets": [ 0, 1 ], "sType": "natural" },
|
|
],
|
|
"bSort": true,
|
|
"sPaginationType": "full"
|
|
}));
|
|
|
|
$("body").css("cursor", "auto");
|
|
$('.import_export_options').hide();
|
|
$('a.import_export_fw').click(function() {
|
|
if (!importing) {
|
|
$('.import_export_options').hide();
|
|
$(this).next().show('slide');
|
|
}
|
|
return false;
|
|
});
|
|
$('.import_export_close').click(function() {
|
|
if (!importing) {
|
|
$('.import_export_options').fadeOut('fast');
|
|
$("body").css("cursor", "auto");
|
|
return false;
|
|
}
|
|
});
|
|
$('.input_import').val("");
|
|
|
|
var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search);
|
|
if (matches && matches.length > 1) {
|
|
alert( MSG_IMPORT_ERROR + " %s".format(decodeURIComponent(matches[1])));
|
|
}
|
|
|
|
$('input.input_import').change( function() {
|
|
var filename = $(this).val();
|
|
if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) {
|
|
$(this).css("background-color","yellow");
|
|
alert( MSG_SELECT_FILE_FORMAT );
|
|
$(this).val("");
|
|
$(this).css("background-color","white");
|
|
}
|
|
});
|
|
$('form.form_export').submit(function() {
|
|
$('.modal').modal("hide");
|
|
return true;
|
|
});
|
|
$('form.form_import').submit(function() {
|
|
var id = $(this).attr('id');
|
|
var obj = $('#' + id + ' input:file');
|
|
if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) {
|
|
var frameworkcode = $('#' + id + ' input:hidden[name=frameworkcode]').val();
|
|
var MSG_OVERWRITE_WARNING = _("Are you sure you want to replace the fields and subfields for the " + frameworkcode + " framework structure? The existing structure will be overwritten! For safety reasons, it is recommended to use the export option to make a backup first.");
|
|
if (confirm( MSG_OVERWRITE_WARNING )) {
|
|
$('#importing_' + frameworkcode).find("span").html(MSG_IMPORTING_TO_FRAMEWORK.format("<strong>" + frameworkcode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>"));
|
|
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
|
|
var timestamp = new Date().getTime();
|
|
$('#importing_' + frameworkcode).find("img").attr('src', template_path + '/img/spinner-small.gif' + '?' +timestamp);
|
|
}
|
|
$('#importing_' + frameworkcode).css('display', 'block');
|
|
if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress");
|
|
importing = true;
|
|
$(".modal-footer,.closebtn").hide();
|
|
return true;
|
|
} else
|
|
return false;
|
|
}
|
|
obj.css("background-color","yellow");
|
|
alert( MSG_SELECT_FILE_FORMAT );
|
|
obj.val("");
|
|
obj.css("background-color","white");
|
|
return false;
|
|
});
|
|
$("#frameworkcode").on("blur",function(){
|
|
toUC(this);
|
|
});
|
|
});
|