This patch updates the OPAC and staff interface to use Bootstrap 5. Bootstrap CSS assets are now pulled from node_modules and compiled into staff-global.css and opac.css at build time. This update lays the foundations of some other chnages, especially the addition of a dark mode in the future. Hundreds of templates have been updated, mostly with updates to the grid markup. Most of the responsive behavior is still the same with the exception of improved flexibility of headers and footers in both the OPAC and staff interface. The other most common change is to add a new "namespace" to data attributes used by Bootstrap, e.g. "data-bs-target" or "data-bs-toggle". Modal markup has also been updated everywhere. Other common changes: dropdown button markup, alert markup (we now use Bootstrap's "alert alert-warning" and "alert alert-info" instead of our old "dialog alert" and "dialog info"). Bootstrap 5 now uses CSS variables which we can override in our own '_variables.scss' (in both the OPAC and staff) to accomplish a lot of the style overrides which we previously put in staff-global.scss. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
81 lines
3.7 KiB
JavaScript
81 lines
3.7 KiB
JavaScript
/* global __ */
|
|
/* Import/Export from/to spreadsheet */
|
|
|
|
var importing = false;
|
|
|
|
$(document).ready(function() {
|
|
$("#table_biblio_frameworks").dataTable($.extend(true, {}, dataTablesDefaults, {
|
|
"columnDefs": [
|
|
{ "targets": [ -1 ], "orderable": false, "searchable": false },
|
|
{ "targets": [ 0, 1 ], "type": "natural" },
|
|
],
|
|
"ordering": true,
|
|
"pagingType": "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( __("Error importing the framework") + " %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( __("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.") );
|
|
$(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 %s framework structure? The existing structure will be overwritten! For safety reasons, it is recommended to use the export option to make a backup first.").format( frameworkcode );
|
|
if (confirm( MSG_OVERWRITE_WARNING )) {
|
|
$('#importing_' + frameworkcode).find("span").html( __("Importing to framework: %s. Importing from file: %s.").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,.btn-close").hide();
|
|
return true;
|
|
} else
|
|
return false;
|
|
}
|
|
obj.css("background-color","yellow");
|
|
alert( __("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.") );
|
|
obj.val("");
|
|
obj.css("background-color","white");
|
|
return false;
|
|
});
|
|
$("#frameworkcode").on("blur",function(){
|
|
toUC(this);
|
|
});
|
|
});
|