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

(-)a/C4/ImportExportFramework.pm (-22 / +43 lines)
Lines 193-199 Functions for handling import/export. Link Here
193
193
194
=head2 ExportFramework
194
=head2 ExportFramework
195
195
196
Export all the information of a Framework to an excel "xml" file or OpenDocument SpreadSheet "ods" file.
196
Export all the information of a MARC or Authority Type Framework to an excel "xml" file, comma separated values "csv" file or OpenDocument SpreadSheet "ods" file.
197
197
198
return :
198
return :
199
succes
199
succes
Lines 202-208 succes Link Here
202
202
203
sub ExportFramework
203
sub ExportFramework
204
{
204
{
205
    my ($frameworkcode, $xmlStrRef, $mode) = @_;
205
    my ($frameworkcode, $xmlStrRef, $mode, $frameworktype) = @_;
206
206
207
    my $dbh = C4::Context->dbh;
207
    my $dbh = C4::Context->dbh;
208
    if ($dbh) {
208
    if ($dbh) {
Lines 229-236 sub ExportFramework Link Here
229
            }
229
            }
230
        }
230
        }
231
231
232
        if (_export_table('marc_tag_structure', $dbh, ($mode eq 'csv')?$xmlStrRef:$dom, ($mode eq 'ods')?$elementSS:$root, $frameworkcode, $mode)) {
232
        my $table = 'marc_tag_structure';
233
            if (_export_table('marc_subfield_structure', $dbh, ($mode eq 'csv')?$xmlStrRef:$dom, ($mode eq 'ods')?$elementSS:$root, $frameworkcode, $mode)) {
233
        my $subtable = 'marc_subfield_structure';
234
        if ($frameworktype eq "authority") {
235
            $table = 'auth_tag_structure';
236
            $subtable = 'auth_subfield_structure';
237
        }
238
239
        if (_export_table($table, $dbh, ($mode eq 'csv')?$xmlStrRef:$dom, ($mode eq 'ods')?$elementSS:$root, $frameworkcode, $mode, $frameworktype)) {
240
            if (_export_table($subtable, $dbh, ($mode eq 'csv')?$xmlStrRef:$dom, ($mode eq 'ods')?$elementSS:$root, $frameworkcode, $mode, $frameworktype)) {
234
                $$xmlStrRef = $dom->toString(1) if ($mode eq 'ods' || $mode eq 'excel');
241
                $$xmlStrRef = $dom->toString(1) if ($mode eq 'ods' || $mode eq 'excel');
235
                return 1;
242
                return 1;
236
            }
243
            }
Lines 245-264 sub ExportFramework Link Here
245
# Export all the data from a mysql table to an spreadsheet.
252
# Export all the data from a mysql table to an spreadsheet.
246
sub _export_table
253
sub _export_table
247
{
254
{
248
    my ($table, $dbh, $dom, $root, $frameworkcode, $mode) = @_;
255
    my ($table, $dbh, $dom, $root, $frameworkcode, $mode, $frameworktype) = @_;
249
    if ($mode eq 'csv') {
256
    if ($mode eq 'csv') {
250
        _export_table_csv($table, $dbh, $dom, $root, $frameworkcode);
257
        _export_table_csv($table, $dbh, $dom, $root, $frameworkcode, $frameworktype);
251
    } elsif ($mode eq 'ods') {
258
    } elsif ($mode eq 'ods') {
252
        _export_table_ods($table, $dbh, $dom, $root, $frameworkcode);
259
        _export_table_ods($table, $dbh, $dom, $root, $frameworkcode, $frameworktype);
253
    } else {
260
    } else {
254
        _export_table_excel($table, $dbh, $dom, $root, $frameworkcode);
261
        _export_table_excel($table, $dbh, $dom, $root, $frameworkcode, $frameworktype);
255
    }
262
    }
256
}
263
}
257
264
258
# Export the mysql table to an csv file
265
# Export the mysql table to an csv file
259
sub _export_table_csv
266
sub _export_table_csv
260
{
267
{
261
    my ($table, $dbh, $strCSV, $root, $frameworkcode) = @_;
268
    my ($table, $dbh, $strCSV, $root, $frameworkcode, $frameworktype) = @_;
262
269
263
    eval {
270
    eval {
264
        # First row with the name of the columns
271
        # First row with the name of the columns
Lines 274-279 sub _export_table_csv Link Here
274
        $$strCSV .= chr(10);
281
        $$strCSV .= chr(10);
275
        # Populate rows with the data from mysql
282
        # Populate rows with the data from mysql
276
        $query = 'SELECT * FROM ' . $table . ' WHERE frameworkcode=?';
283
        $query = 'SELECT * FROM ' . $table . ' WHERE frameworkcode=?';
284
        if ($frameworktype eq "authority") {
285
            $query = 'SELECT * FROM ' . $table . ' WHERE authtypecode=?';
286
        }
277
        $sth = $dbh->prepare($query);
287
        $sth = $dbh->prepare($query);
278
        $sth->execute($frameworkcode);
288
        $sth->execute($frameworkcode);
279
        my $data;
289
        my $data;
Lines 306-312 sub _export_table_csv Link Here
306
# Export the mysql table to an ods file
316
# Export the mysql table to an ods file
307
sub _export_table_ods
317
sub _export_table_ods
308
{
318
{
309
    my ($table, $dbh, $dom, $root, $frameworkcode) = @_;
319
    my ($table, $dbh, $dom, $root, $frameworkcode, $frameworktype) = @_;
310
320
311
    eval {
321
    eval {
312
        my $elementTable = $dom->createElement('table:table');
322
        my $elementTable = $dom->createElement('table:table');
Lines 335-340 sub _export_table_ods Link Here
335
        }
345
        }
336
        # Populate rows with the data from mysql
346
        # Populate rows with the data from mysql
337
        $query = 'SELECT * FROM ' . $table . ' WHERE frameworkcode=?';
347
        $query = 'SELECT * FROM ' . $table . ' WHERE frameworkcode=?';
348
        if ($frameworktype eq "authority") {
349
            $query = 'SELECT * FROM ' . $table . ' WHERE authtypecode=?';
350
        }
338
        $sth = $dbh->prepare($query);
351
        $sth = $dbh->prepare($query);
339
        $sth->execute($frameworkcode);
352
        $sth->execute($frameworkcode);
340
        my $data;
353
        my $data;
Lines 370-376 sub _export_table_ods Link Here
370
# Export the mysql table to an excel-xml (openoffice/libreoffice compatible) file
383
# Export the mysql table to an excel-xml (openoffice/libreoffice compatible) file
371
sub _export_table_excel
384
sub _export_table_excel
372
{
385
{
373
    my ($table, $dbh, $dom, $root, $frameworkcode) = @_;
386
    my ($table, $dbh, $dom, $root, $frameworkcode, $frameworktype) = @_;
374
387
375
    eval {
388
    eval {
376
        my $elementWS = $dom->createElement('Worksheet');
389
        my $elementWS = $dom->createElement('Worksheet');
Lines 400-405 sub _export_table_excel Link Here
400
        }
413
        }
401
        # Populate rows with the data from mysql
414
        # Populate rows with the data from mysql
402
        $query = 'SELECT * FROM ' . $table . ' WHERE frameworkcode=?';
415
        $query = 'SELECT * FROM ' . $table . ' WHERE frameworkcode=?';
416
        if ($frameworktype eq "authority") {
417
            $query = 'SELECT * FROM ' . $table . ' WHERE authtypecode=?';
418
        }
403
        $sth = $dbh->prepare($query);
419
        $sth = $dbh->prepare($query);
404
        $sth->execute($frameworkcode);
420
        $sth->execute($frameworkcode);
405
        my $data;
421
        my $data;
Lines 429-440 sub _export_table_excel Link Here
429
    return 1;
445
    return 1;
430
}#_export_table_excel
446
}#_export_table_excel
431
447
432
433
434
435
436
437
438
# Format chars problematics to a correct format for xml.
448
# Format chars problematics to a correct format for xml.
439
sub _parseContent2Xml
449
sub _parseContent2Xml
440
{
450
{
Lines 619-625 sub _getMeta Link Here
619
629
620
=head2 ImportFramework
630
=head2 ImportFramework
621
631
622
Import all the information of a Framework from a excel-xml/ods file.
632
Import all the information of a MARC or Authority Type Framework from a excel-xml/ods file.
623
633
624
return :
634
return :
625
success
635
success
Lines 628-634 success Link Here
628
638
629
sub ImportFramework
639
sub ImportFramework
630
{
640
{
631
    my ($filename, $frameworkcode, $deleteFilename) = @_;
641
    my ($filename, $frameworkcode, $deleteFilename, $frameworktype) = @_;
632
642
633
    my $tempdir;
643
    my $tempdir;
634
    my $ok = -1;
644
    my $ok = -1;
Lines 658-670 sub ImportFramework Link Here
658
                    # They are text files, so open it to read
668
                    # They are text files, so open it to read
659
                    open($dom, '<', $filename);
669
                    open($dom, '<', $filename);
660
                }
670
                }
671
672
                my $table = 'marc_tag_structure';
673
                my $subtable = 'marc_subfield_structure';
674
                if ($frameworktype eq "authority") {
675
                    $table = 'auth_tag_structure';
676
                    $subtable = 'auth_subfield_structure';
677
                }
678
661
                if ($dom) {
679
                if ($dom) {
662
                    # Process both tables
680
                    # Process both tables
663
                    my $numDeleted = 0;
681
                    my $numDeleted = 0;
664
                    my $numDeletedAux = 0;
682
                    my $numDeletedAux = 0;
665
                    if (($numDeletedAux = _import_table($dbh, 'marc_tag_structure', $frameworkcode, $dom, ['frameworkcode', 'tagfield'], $extension)) >= 0) {
683
                    if (($numDeletedAux = _import_table($dbh, $table, $frameworkcode, $dom, ['frameworkcode', 'tagfield'], $extension, $frameworktype)) >= 0) {
666
                        $numDeleted += $numDeletedAux if ($numDeletedAux > 0);
684
                        $numDeleted += $numDeletedAux if ($numDeletedAux > 0);
667
                        if (($numDeletedAux = _import_table($dbh, 'marc_subfield_structure', $frameworkcode, $dom, ['frameworkcode', 'tagfield', 'tagsubfield'], $extension)) >= 0) {
685
                        if (($numDeletedAux = _import_table($dbh, $subtable, $frameworkcode, $dom, ['frameworkcode', 'tagfield', 'tagsubfield'], $extension, $frameworktype)) >= 0) {
668
                            $numDeleted += $numDeletedAux if ($numDeletedAux > 0);
686
                            $numDeleted += $numDeletedAux if ($numDeletedAux > 0);
669
                            $ok = ($numDeleted > 0)?$numDeleted:0;
687
                            $ok = ($numDeleted > 0)?$numDeleted:0;
670
                        }
688
                        }
Lines 785-791 sub _check_validity_worksheet Link Here
785
# Import the data from an excel-xml/ods to mysql tables.
803
# Import the data from an excel-xml/ods to mysql tables.
786
sub _import_table
804
sub _import_table
787
{
805
{
788
    my ($dbh, $table, $frameworkcode, $dom, $PKArray, $format) = @_;
806
    my ($dbh, $table, $frameworkcode, $dom, $PKArray, $format, $frameworktype) = @_;
789
    my %fields2Delete;
807
    my %fields2Delete;
790
    my $query;
808
    my $query;
791
    my @fields;
809
    my @fields;
Lines 794-799 sub _import_table Link Here
794
        @fields = @$PKArray;
812
        @fields = @$PKArray;
795
        shift @fields;
813
        shift @fields;
796
        $query = 'SELECT ' . join(',', @fields) . ' FROM ' . $table . ' WHERE frameworkcode=?';
814
        $query = 'SELECT ' . join(',', @fields) . ' FROM ' . $table . ' WHERE frameworkcode=?';
815
        if ($frameworktype eq "authority") {
816
            $query = 'SELECT ' . join(',', @fields) . ' FROM ' . $table . ' WHERE authtypecode=?';
817
        }
797
        my $sth = $dbh->prepare($query);
818
        my $sth = $dbh->prepare($query);
798
        $sth->execute($frameworkcode);
819
        $sth->execute($frameworkcode);
799
        my $field;
820
        my $field;
(-)a/admin/import_export_authtype.pl (+102 lines)
Line 0 Link Here
1
#!/usr/bin/perl
2
3
# Copyright 2016 Aleisha Amohia <aleisha@catalyst.net.nz>
4
#
5
# This file is part of Koha.
6
#
7
# Koha is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by
9
# the Free Software Foundation; either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# Koha is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with Koha; if not, see <http://www.gnu.org/licenses>.
19
20
21
use strict;
22
use warnings;
23
use CGI qw ( -utf8 );
24
use CGI::Cookie;
25
use C4::Context;
26
use C4::Auth qw/check_cookie_auth/;
27
use C4::ImportExportFramework;
28
29
my %cookies = CGI::Cookie->fetch();
30
my $authenticated = 0;
31
my ($auth_status, $sessionID);
32
if (exists $cookies{'CGISESSID'}) {
33
    ($auth_status, $sessionID) = check_cookie_auth(
34
        $cookies{'CGISESSID'}->value,
35
        { parameters => 'parameters_remaining_permissions' },
36
    );
37
}
38
if ($auth_status eq 'ok') {
39
    $authenticated = 1;
40
}
41
42
my $input = new CGI;
43
44
unless ($authenticated) {
45
    print $input->header(-type => 'text/plain', -status => '403 Forbidden');
46
    exit 0;
47
}
48
49
my $authtypecode = $input->param('authtypecode') || 'default';
50
my $action = $input->param('action') || 'export';
51
52
## Exporting
53
if ($action eq 'export' && $input->request_method() eq 'GET') {
54
    my $strXml = '';
55
    my $format = $input->param('type_export_' . $authtypecode);
56
    if ($authtypecode eq 'default') {
57
        $format = $input->param('type_export_');
58
        ExportFramework('', \$strXml, $format, 'authority');
59
    } else {
60
        ExportFramework($authtypecode, \$strXml, $format, 'authority');
61
    }
62
63
    if ($format eq 'csv') {
64
        # CSV file
65
66
        # Correctly set the encoding to output plain text in UTF-8
67
        binmode(STDOUT,':encoding(UTF-8)');
68
        print $input->header(-type => 'application/vnd.ms-excel', -attachment => 'export_' . $authtypecode . '.csv');
69
        print $strXml;
70
    } elsif ($format eq 'excel') {
71
        # Excel-xml file
72
        print $input->header(-type => 'application/excel', -attachment => 'export_' . $authtypecode . '.xml');
73
        print $strXml;
74
    } else {
75
        # ODS file
76
        my $strODS = '';
77
        createODS($strXml, 'en', \$strODS);
78
        print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $authtypecode . '.ods');
79
        print $strODS;
80
    }
81
## Importing
82
} elsif ($input->request_method() eq 'POST') {
83
    my $ok = -1;
84
    my $fieldname = 'file_import_' . $authtypecode;
85
    my $filename = $input->param($fieldname);
86
    # upload the input file
87
    if ($filename && $filename =~ /\.(csv|ods|xml)$/i) {
88
        my $extension = $1;
89
        my $uploadFd = $input->upload($fieldname);
90
        if ($uploadFd && !$input->cgi_error) {
91
            my $tmpfilename = $input->tmpFileName($input->param($fieldname));
92
            $filename = $tmpfilename . '.' . $extension; # rename the tmp file with the extension
93
            $ok = ImportFramework($filename, $authtypecode, 1, 'authority') if (rename($tmpfilename, $filename));
94
        }
95
    }
96
    if ($ok >= 0) { # If everything went ok go to the authority type marc structure
97
        print $input->redirect( -location => '/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=' . $authtypecode);
98
    } else {
99
        # If something failed go to the list of authority types and show message
100
        print $input->redirect( -location => '/cgi-bin/koha/admin/authtypes.pl?error_import_export=' . $authtypecode);
101
    }
102
}
(-)a/admin/import_export_framework.pl (-3 / +3 lines)
Lines 54-62 if ($action eq 'export' && $input->request_method() eq 'GET') { Link Here
54
    my $strXml = '';
54
    my $strXml = '';
55
    my $format = $input->param('type_export_' . $frameworkcode);
55
    my $format = $input->param('type_export_' . $frameworkcode);
56
    if ($frameworkcode eq 'default') {
56
    if ($frameworkcode eq 'default') {
57
        ExportFramework('', \$strXml, $format);
57
        ExportFramework('', \$strXml, $format, 'biblio');
58
    } else {
58
    } else {
59
        ExportFramework($frameworkcode, \$strXml, $format);
59
        ExportFramework($frameworkcode, \$strXml, $format, 'biblio');
60
    }
60
    }
61
61
62
    if ($format eq 'csv') {
62
    if ($format eq 'csv') {
Lines 89-95 if ($action eq 'export' && $input->request_method() eq 'GET') { Link Here
89
        if ($uploadFd && !$input->cgi_error) {
89
        if ($uploadFd && !$input->cgi_error) {
90
            my $tmpfilename = $input->tmpFileName($input->param($fieldname));
90
            my $tmpfilename = $input->tmpFileName($input->param($fieldname));
91
            $filename = $tmpfilename . '.' . $extension; # rename the tmp file with the extension
91
            $filename = $tmpfilename . '.' . $extension; # rename the tmp file with the extension
92
            $ok = ImportFramework($filename, $frameworkcode, 1) if (rename($tmpfilename, $filename));
92
            $ok = ImportFramework($filename, $frameworkcode, 1, 'biblio') if (rename($tmpfilename, $filename));
93
        }
93
        }
94
    }
94
    }
95
    if ($ok >= 0) { # If everything went ok go to the framework marc structure
95
    if ($ok >= 0) { # If everything went ok go to the framework marc structure
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authtypes.tt (-11 / +131 lines)
Lines 11-28 Link Here
11
[% INCLUDE 'datatables.inc' %]
11
[% INCLUDE 'datatables.inc' %]
12
<script type="text/javascript">
12
<script type="text/javascript">
13
//<![CDATA[
13
//<![CDATA[
14
15
    /* Import/Export from/to spreadsheet */
16
17
    var importing = false;
18
14
    $(document).ready(function() {
19
    $(document).ready(function() {
15
        $("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, {
20
        $("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, {
16
            "aoColumnDefs": [
21
            "aoColumnDefs": [
17
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
22
                { "aTargets": [ -1 ], "bSortable": false, "bSearchable": false },
23
                { "aTargets": [ 0, 1 ], "sType": "natural" },
18
            ],
24
            ],
25
            "bSort": true,
19
            "sPaginationType": "four_button"
26
            "sPaginationType": "four_button"
20
        }));
27
        }));
21
        $("#authtypecode").on("blur",function(){
28
        $("#authtypecode").on("blur",function(){
22
            toUC(this);
29
            toUC(this);
30
31
        $("body").css("cursor", "auto");
32
        $('.import_export_options').hide();
33
        $('a.import_export_fw').click(function() {
34
            if (!importing) {
35
                $('.import_export_options').hide();
36
                $(this).next().show('slide');
37
            }
38
            return false;
39
        });
40
        $('.import_export_close').click(function() {
41
            if (!importing) {
42
                $('.import_export_options').fadeOut('fast');
43
                $("body").css("cursor", "auto");
44
                return false;
45
            }
46
        });
47
        $('.input_import').val("");
48
49
        var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search);
50
        if (matches && matches.length > 1) {
51
            alert(_("Error importing the authority type %s").format(decodeURIComponent(matches[1])));
52
        }
53
54
        $('input.input_import').change( function() {
55
            var filename = $(this).val();
56
            if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) {
57
                $(this).css("background-color","yellow");
58
                alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file."));
59
                $(this).val("");
60
                $(this).css("background-color","white");
61
            }
62
        });
63
        $('form.form_export').submit(function() {
64
            $('.modal').modal("hide");
65
            return true;
66
        });
67
        $('form.form_import').submit(function() {
68
            var id = $(this).attr('id');
69
            var obj = $('#' + id + ' input:file');
70
            if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) {
71
                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"))) {
72
                    var authtypecode = $('#' + id + ' input:hidden[name=authtypecode]').val();
73
                    $('#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>"));
74
                    if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
75
                        var timestamp = new Date().getTime();
76
                        $('#importing_' + authtypecode).find("img").attr('src', '[% interface %]/[% theme %]/img/loading-small.gif' + '?' +timestamp);
77
                    }
78
                    $('#importing_' + authtypecode).css('display', 'block');
79
                    if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress");
80
                    importing = true;
81
                    $(".modal-footer,.closebtn").hide();
82
                    return true;
83
                } else
84
                    return false;
85
            }
86
            obj.css("background-color","yellow");
87
            alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file."));
88
            obj.val("");
89
            obj.css("background-color","white");
90
            return false;
23
        });
91
        });
24
    });
92
    });
25
//]]>
26
</script>
93
</script>
27
</head>
94
</head>
28
95
Lines 164-178 Link Here
164
                <td>[% authority_type.summary %]</td>
231
                <td>[% authority_type.summary %]</td>
165
                <td>[% authority_type.auth_tag_to_report %]</td>
232
                <td>[% authority_type.auth_tag_to_report %]</td>
166
                <td>
233
                <td>
167
                  <div class="dropdown">
234
                    <div class="dropdown">
168
                    <a class="btn btn-default btn-xs dropdown-toggle" id="authtypeactions[% authority_type.authtypecode %]" role="button" data-toggle="dropdown" href="#">
235
                        <a class="btn btn-default btn-xs dropdown-toggle" id="authtypeactions[% authority_type.authtypecode %]" role="button" data-toggle="dropdown" href="#">
169
                      Actions <b class="caret"></b></a>
236
                        Actions <b class="caret"></b></a>
170
                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="authtypeactions[% authority_type.authtypecode %]">
237
                        <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="authtypeactions[% authority_type.authtypecode %]">
171
                      <li><a href="auth_tag_structure.pl?authtypecode=[% authority_type.authtypecode %]" class="button parameters"><i class="fa fa-eye"></i> MARC structure</a></li>
238
                            <li><a href="auth_tag_structure.pl?authtypecode=[% authority_type.authtypecode %]" class="button parameters"><i class="fa fa-eye"></i> MARC structure</a></li>
172
                      <li><a href="/cgi-bin/koha/admin/authtypes.pl?op=add_form&amp;authtypecode=[% authority_type.authtypecode |html %]"><i class="fa fa-pencil"></i> Edit</a></li>
239
                            <li><a href="/cgi-bin/koha/admin/authtypes.pl?op=add_form&amp;authtypecode=[% authority_type.authtypecode |html %]"><i class="fa fa-pencil"></i> Edit</a></li>
173
                      [% IF authority_type.authtypecode %]<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=delete_confirm&amp;authtypecode=[% authority_type.authtypecode |html %]"><i class="fa fa-trash"></i> Delete</a></li>[% END %]
240
                            [% IF authority_type.authtypecode %]<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=delete_confirm&amp;authtypecode=[% authority_type.authtypecode |html %]"><i class="fa fa-trash"></i> Delete</a></li>[% END %]
174
                    </ul>
241
                            <!-- Button to trigger modal -->
175
                  </div>
242
                            <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>
243
                            <!-- Button to trigger modal -->
244
                            <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>
245
                        </ul>
246
247
                        <!-- Modal for export -->
248
                        <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">
249
                        <div class="modal-dialog">
250
                        <div class="modal-content">
251
                        <div class="modal-header">
252
                            <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
253
                            <h3 id="exportLabelexportModal_[% authority_type.authtypecode %][% loop.count %]">Export [% authority_type.authtypetext %] authority type</h3>
254
                        </div>
255
                        <form action="import_export_authtype.pl" name="form_[% authority_type.authtypecode %]" method="get" target="_blank" class="form_export">
256
                            <div class="modal-body">
257
                                <fieldset>
258
                                    <input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" />
259
                                    <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>
260
                                    <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>
261
                                    <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>
262
                                </fieldset>
263
                            </div>
264
                            <div class="modal-footer">
265
                                <button type="submit" class="btn btn-default">Export</button>
266
                                <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
267
                            </div>
268
                        </form>
269
                        </div>
270
                        </div>
271
                        </div>
272
273
                        <!-- Modal for import -->
274
                        <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">
275
                            <div class="modal-dialog">
276
                            <div class="modal-content">
277
                            <div class="modal-header">
278
                                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
279
                                <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>
280
                            </div>
281
                            <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">
282
                                <div class="modal-body">
283
                                    <input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" />
284
                                    <input type="hidden" name="action" value="import" />
285
                                    <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>
286
                                    <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>
287
                                </div>
288
                                <div class="modal-footer">
289
                                    <button type="submit" class="btn btn-default">Import</button>
290
                                    <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
291
                                </div>
292
                            </form>
293
                            </div>
294
                            </div>
295
                        </div>
296
                    </div>
176
                </td>
297
                </td>
177
            </tr>
298
            </tr>
178
        [% END %]
299
        [% END %]
179
- 

Return to bug 13952