View | Details | Raw Unified | Return to bug 26226
Collapse All | Expand All

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt (-4 lines)
Lines 286-295 Link Here
286
    [% INCLUDE 'datatables.inc' %]
286
    [% INCLUDE 'datatables.inc' %]
287
    [% Asset.js("js/admin-menu.js") | $raw %]
287
    [% Asset.js("js/admin-menu.js") | $raw %]
288
    <script>
288
    <script>
289
        /* Set some variable needed in biblio_framework.js */
290
        var MSG_IMPORT_ERROR = _("Error importing the framework");
291
        var MSG_SELECT_FILE_FORMAT = _("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.");
292
        var MSG_IMPORTING_TO_FRAMEWORK = _("Importing to framework: %s. Importing from file: %s.");
293
        var template_path = "[% interface | html %]/[% theme | html %]";
289
        var template_path = "[% interface | html %]/[% theme | html %]";
294
    </script>
290
    </script>
295
    [% Asset.js("js/biblio_framework.js") | $raw %]
291
    [% Asset.js("js/biblio_framework.js") | $raw %]
(-)a/koha-tmpl/intranet-tmpl/prog/js/biblio_framework.js (-6 / +6 lines)
Lines 1-3 Link Here
1
/* global __ */
1
/* Import/Export from/to spreadsheet */
2
/* Import/Export from/to spreadsheet */
2
3
3
    var importing = false;
4
    var importing = false;
Lines 32-45 Link Here
32
33
33
        var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search);
34
        var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search);
34
        if (matches && matches.length > 1) {
35
        if (matches && matches.length > 1) {
35
            alert( MSG_IMPORT_ERROR + " %s".format(decodeURIComponent(matches[1])));
36
            alert( __("Error importing the framework") + " %s".format(decodeURIComponent(matches[1])));
36
        }
37
        }
37
38
38
        $('input.input_import').change( function() {
39
        $('input.input_import').change( function() {
39
            var filename = $(this).val();
40
            var filename = $(this).val();
40
            if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) {
41
            if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) {
41
                $(this).css("background-color","yellow");
42
                $(this).css("background-color","yellow");
42
                alert( MSG_SELECT_FILE_FORMAT );
43
                alert( __("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.") );
43
                $(this).val("");
44
                $(this).val("");
44
                $(this).css("background-color","white");
45
                $(this).css("background-color","white");
45
            }
46
            }
Lines 53-61 Link Here
53
            var obj = $('#' + id + ' input:file');
54
            var obj = $('#' + id + ' input:file');
54
            if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) {
55
            if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) {
55
                var frameworkcode = $('#' + id + ' input:hidden[name=frameworkcode]').val();
56
                var frameworkcode = $('#' + id + ' input:hidden[name=frameworkcode]').val();
56
                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.");
57
                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 );
57
                if (confirm( MSG_OVERWRITE_WARNING )) {
58
                if (confirm( MSG_OVERWRITE_WARNING )) {
58
                    $('#importing_' + frameworkcode).find("span").html(MSG_IMPORTING_TO_FRAMEWORK.format("<strong>" + frameworkcode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"),"") + "</i>"));
59
                    $('#importing_' + frameworkcode).find("span").html( __("Importing to framework: %s. Importing from file: %s.").format("<strong>" + frameworkcode + "</strong>", "<i>" + obj.val().replace(new RegExp("^.+[/\\\\]"), "") + "</i>"));
59
                    if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
60
                    if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
60
                        var timestamp = new Date().getTime();
61
                        var timestamp = new Date().getTime();
61
                        $('#importing_' + frameworkcode).find("img").attr('src', template_path + '/img/spinner-small.gif' + '?' +timestamp);
62
                        $('#importing_' + frameworkcode).find("img").attr('src', template_path + '/img/spinner-small.gif' + '?' +timestamp);
Lines 69-75 Link Here
69
                    return false;
70
                    return false;
70
            }
71
            }
71
            obj.css("background-color","yellow");
72
            obj.css("background-color","yellow");
72
            alert( MSG_SELECT_FILE_FORMAT );
73
            alert( __("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.") );
73
            obj.val("");
74
            obj.val("");
74
            obj.css("background-color","white");
75
            obj.css("background-color","white");
75
            return false;
76
            return false;
76
- 

Return to bug 26226