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 305-311 sub _export_table_csv Link Here
305
# Export the mysql table to an ods file
315
# Export the mysql table to an ods file
306
sub _export_table_ods
316
sub _export_table_ods
307
{
317
{
308
    my ($table, $dbh, $dom, $root, $frameworkcode) = @_;
318
    my ($table, $dbh, $dom, $root, $frameworkcode, $frameworktype) = @_;
309
319
310
    eval {
320
    eval {
311
        my $elementTable = $dom->createElement('table:table');
321
        my $elementTable = $dom->createElement('table:table');
Lines 334-339 sub _export_table_ods Link Here
334
        }
344
        }
335
        # Populate rows with the data from mysql
345
        # Populate rows with the data from mysql
336
        $query = 'SELECT * FROM ' . $table . ' WHERE frameworkcode=?';
346
        $query = 'SELECT * FROM ' . $table . ' WHERE frameworkcode=?';
347
        if ($frameworktype eq "authority") {
348
            $query = 'SELECT * FROM ' . $table . ' WHERE authtypecode=?';
349
        }
337
        $sth = $dbh->prepare($query);
350
        $sth = $dbh->prepare($query);
338
        $sth->execute($frameworkcode);
351
        $sth->execute($frameworkcode);
339
        my $data;
352
        my $data;
Lines 369-375 sub _export_table_ods Link Here
369
# Export the mysql table to an excel-xml (openoffice/libreoffice compatible) file
382
# Export the mysql table to an excel-xml (openoffice/libreoffice compatible) file
370
sub _export_table_excel
383
sub _export_table_excel
371
{
384
{
372
    my ($table, $dbh, $dom, $root, $frameworkcode) = @_;
385
    my ($table, $dbh, $dom, $root, $frameworkcode, $frameworktype) = @_;
373
386
374
    eval {
387
    eval {
375
        my $elementWS = $dom->createElement('Worksheet');
388
        my $elementWS = $dom->createElement('Worksheet');
Lines 399-404 sub _export_table_excel Link Here
399
        }
412
        }
400
        # Populate rows with the data from mysql
413
        # Populate rows with the data from mysql
401
        $query = 'SELECT * FROM ' . $table . ' WHERE frameworkcode=?';
414
        $query = 'SELECT * FROM ' . $table . ' WHERE frameworkcode=?';
415
        if ($frameworktype eq "authority") {
416
            $query = 'SELECT * FROM ' . $table . ' WHERE authtypecode=?';
417
        }
402
        $sth = $dbh->prepare($query);
418
        $sth = $dbh->prepare($query);
403
        $sth->execute($frameworkcode);
419
        $sth->execute($frameworkcode);
404
        my $data;
420
        my $data;
Lines 428-439 sub _export_table_excel Link Here
428
    return 1;
444
    return 1;
429
}#_export_table_excel
445
}#_export_table_excel
430
446
431
432
433
434
435
436
437
# Format chars problematics to a correct format for xml.
447
# Format chars problematics to a correct format for xml.
438
sub _parseContent2Xml
448
sub _parseContent2Xml
439
{
449
{
Lines 618-624 sub _getMeta Link Here
618
628
619
=head2 ImportFramework
629
=head2 ImportFramework
620
630
621
Import all the information of a Framework from a excel-xml/ods file.
631
Import all the information of a MARC or Authority Type Framework from a excel-xml/ods file.
622
632
623
return :
633
return :
624
success
634
success
Lines 627-633 success Link Here
627
637
628
sub ImportFramework
638
sub ImportFramework
629
{
639
{
630
    my ($filename, $frameworkcode, $deleteFilename) = @_;
640
    my ($filename, $frameworkcode, $deleteFilename, $frameworktype) = @_;
631
641
632
    my $tempdir;
642
    my $tempdir;
633
    my $ok = -1;
643
    my $ok = -1;
Lines 657-669 sub ImportFramework Link Here
657
                    # They are text files, so open it to read
667
                    # They are text files, so open it to read
658
                    open($dom, '<', $filename);
668
                    open($dom, '<', $filename);
659
                }
669
                }
670
671
                my $table = 'marc_tag_structure';
672
                my $subtable = 'marc_subfield_structure';
673
                if ($frameworktype eq "authority") {
674
                    $table = 'auth_tag_structure';
675
                    $subtable = 'auth_subfield_structure';
676
                }
677
660
                if ($dom) {
678
                if ($dom) {
661
                    # Process both tables
679
                    # Process both tables
662
                    my $numDeleted = 0;
680
                    my $numDeleted = 0;
663
                    my $numDeletedAux = 0;
681
                    my $numDeletedAux = 0;
664
                    if (($numDeletedAux = _import_table($dbh, 'marc_tag_structure', $frameworkcode, $dom, ['frameworkcode', 'tagfield'], $extension)) >= 0) {
682
                    if (($numDeletedAux = _import_table($dbh, $table, $frameworkcode, $dom, ['frameworkcode', 'tagfield'], $extension, $frameworktype)) >= 0) {
665
                        $numDeleted += $numDeletedAux if ($numDeletedAux > 0);
683
                        $numDeleted += $numDeletedAux if ($numDeletedAux > 0);
666
                        if (($numDeletedAux = _import_table($dbh, 'marc_subfield_structure', $frameworkcode, $dom, ['frameworkcode', 'tagfield', 'tagsubfield'], $extension)) >= 0) {
684
                        if (($numDeletedAux = _import_table($dbh, $subtable, $frameworkcode, $dom, ['frameworkcode', 'tagfield', 'tagsubfield'], $extension, $frameworktype)) >= 0) {
667
                            $numDeleted += $numDeletedAux if ($numDeletedAux > 0);
685
                            $numDeleted += $numDeletedAux if ($numDeletedAux > 0);
668
                            $ok = ($numDeleted > 0)?$numDeleted:0;
686
                            $ok = ($numDeleted > 0)?$numDeleted:0;
669
                        }
687
                        }
Lines 784-790 sub _check_validity_worksheet Link Here
784
# Import the data from an excel-xml/ods to mysql tables.
802
# Import the data from an excel-xml/ods to mysql tables.
785
sub _import_table
803
sub _import_table
786
{
804
{
787
    my ($dbh, $table, $frameworkcode, $dom, $PKArray, $format) = @_;
805
    my ($dbh, $table, $frameworkcode, $dom, $PKArray, $format, $frameworktype) = @_;
788
    my %fields2Delete;
806
    my %fields2Delete;
789
    my $query;
807
    my $query;
790
    my @fields;
808
    my @fields;
Lines 793-798 sub _import_table Link Here
793
        @fields = @$PKArray;
811
        @fields = @$PKArray;
794
        shift @fields;
812
        shift @fields;
795
        $query = 'SELECT ' . join(',', @fields) . ' FROM ' . $table . ' WHERE frameworkcode=?';
813
        $query = 'SELECT ' . join(',', @fields) . ' FROM ' . $table . ' WHERE frameworkcode=?';
814
        if ($frameworktype eq "authority") {
815
            $query = 'SELECT ' . join(',', @fields) . ' FROM ' . $table . ' WHERE authtypecode=?';
816
        }
796
        my $sth = $dbh->prepare($query);
817
        my $sth = $dbh->prepare($query);
797
        $sth->execute($frameworkcode);
818
        $sth->execute($frameworkcode);
798
        my $field;
819
        my $field;
(-)a/admin/import_export_authtype.pl (+101 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 == 'default') {
57
        ExportFramework('', \$strXml, $format, 'authority');
58
    } else {
59
        ExportFramework($authtypecode, \$strXml, $format, 'authority');
60
    }
61
62
    if ($format eq 'csv') {
63
        # CSV file
64
65
        # Correctly set the encoding to output plain text in UTF-8
66
        binmode(STDOUT,':encoding(UTF-8)');
67
        print $input->header(-type => 'application/vnd.ms-excel', -attachment => 'export_' . $authtypecode . '.csv');
68
        print $strXml;
69
    } elsif ($format eq 'excel') {
70
        # Excel-xml file
71
        print $input->header(-type => 'application/excel', -attachment => 'export_' . $authtypecode . '.xml');
72
        print $strXml;
73
    } else {
74
        # ODS file
75
        my $strODS = '';
76
        createODS($strXml, 'en', \$strODS);
77
        print $input->header(-type => 'application/vnd.oasis.opendocument.spreadsheet', -attachment => 'export_' . $authtypecode . '.ods');
78
        print $strODS;
79
    }
80
## Importing
81
} elsif ($input->request_method() eq 'POST') {
82
    my $ok = -1;
83
    my $fieldname = 'file_import_' . $authtypecode;
84
    my $filename = $input->param($fieldname);
85
    # upload the input file
86
    if ($filename && $filename =~ /\.(csv|ods|xml)$/i) {
87
        my $extension = $1;
88
        my $uploadFd = $input->upload($fieldname);
89
        if ($uploadFd && !$input->cgi_error) {
90
            my $tmpfilename = $input->tmpFileName($input->param($fieldname));
91
            $filename = $tmpfilename . '.' . $extension; # rename the tmp file with the extension
92
            $ok = ImportFramework($filename, $authtypecode, 1, 'authority') if (rename($tmpfilename, $filename));
93
        }
94
    }
95
    if ($ok >= 0) { # If everything went ok go to the authority type marc structure
96
        print $input->redirect( -location => '/cgi-bin/koha/admin/auth_tag_structure.pl?authtypecode=' . $authtypecode);
97
    } else {
98
        # If something failed go to the list of authority types and show message
99
        print $input->redirect( -location => '/cgi-bin/koha/admin/authtypes.pl?error_import_export=' . $authtypecode);
100
    }
101
}
(-)a/admin/import_export_framework.pl (-2 / +2 lines)
Lines 53-59 my $action = $input->param('action') || 'export'; Link Here
53
if ($action eq 'export' && $input->request_method() eq 'GET') {
53
if ($action eq 'export' && $input->request_method() eq 'GET') {
54
    my $strXml = '';
54
    my $strXml = '';
55
    my $format = $input->param('type_export_' . $frameworkcode);
55
    my $format = $input->param('type_export_' . $frameworkcode);
56
    ExportFramework($frameworkcode, \$strXml, $format);
56
    ExportFramework($frameworkcode, \$strXml, $format, 'biblio');
57
57
58
    if ($format eq 'csv') {
58
    if ($format eq 'csv') {
59
        # CSV file
59
        # CSV file
Lines 85-91 if ($action eq 'export' && $input->request_method() eq 'GET') { Link Here
85
        if ($uploadFd && !$input->cgi_error) {
85
        if ($uploadFd && !$input->cgi_error) {
86
            my $tmpfilename = $input->tmpFileName($input->param($fieldname));
86
            my $tmpfilename = $input->tmpFileName($input->param($fieldname));
87
            $filename = $tmpfilename . '.' . $extension; # rename the tmp file with the extension
87
            $filename = $tmpfilename . '.' . $extension; # rename the tmp file with the extension
88
            $ok = ImportFramework($filename, $frameworkcode, 1) if (rename($tmpfilename, $filename));
88
            $ok = ImportFramework($filename, $frameworkcode, 1, 'biblio') if (rename($tmpfilename, $filename));
89
        }
89
        }
90
    }
90
    }
91
    if ($ok >= 0) { # If everything went ok go to the framework marc structure
91
    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 / +123 lines)
Lines 11-25 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
        }));
28
29
        $("body").css("cursor", "auto");
30
        $('.import_export_options').hide();
31
        $('a.import_export_fw').click(function() {
32
            if (!importing) {
33
                $('.import_export_options').hide();
34
                $(this).next().show('slide');
35
            }
36
            return false;
37
        });
38
        $('.import_export_close').click(function() {
39
            if (!importing) {
40
                $('.import_export_options').fadeOut('fast');
41
                $("body").css("cursor", "auto");
42
                return false;
43
            }
44
        });
45
        $('.input_import').val("");
46
47
        var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search);
48
        if (matches && matches.length > 1) {
49
            alert(_("Error importing the authority type %s").format(decodeURIComponent(matches[1])));
50
        }
51
52
        $('input.input_import').change( function() {
53
            var filename = $(this).val();
54
            if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) {
55
                $(this).css("background-color","yellow");
56
                alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file."));
57
                $(this).val("");
58
                $(this).css("background-color","white");
59
            }
60
        });
61
        $('form.form_export').submit(function() {
62
            $('.modal').modal("hide");
63
            return true;
64
        });
65
        $('form.form_import').submit(function() {
66
            var id = $(this).attr('id');
67
            var obj = $('#' + id + ' input:file');
68
            if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) {
69
                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"))) {
70
                    var authtypecode = $('#' + id + ' input:hidden[name=authtypecode]').val();
71
                    $('#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>"));
72
                    if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
73
                        var timestamp = new Date().getTime();
74
                        $('#importing_' + authtypecode).find("img").attr('src', '[% interface %]/[% theme %]/img/loading-small.gif' + '?' +timestamp);
75
                    }
76
                    $('#importing_' + authtypecode).css('display', 'block');
77
                    if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress");
78
                    importing = true;
79
                    $(".modal-footer,.closebtn").hide();
80
                    return true;
81
                } else
82
                    return false;
83
            }
84
            obj.css("background-color","yellow");
85
            alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file."));
86
            obj.val("");
87
            obj.css("background-color","white");
88
            return false;
89
        });
21
    });
90
    });
22
//]]>
23
</script>
91
</script>
24
</head>
92
</head>
25
93
Lines 161-175 Link Here
161
                <td>[% authority_type.summary %]</td>
229
                <td>[% authority_type.summary %]</td>
162
                <td>[% authority_type.auth_tag_to_report %]</td>
230
                <td>[% authority_type.auth_tag_to_report %]</td>
163
                <td>
231
                <td>
164
                  <div class="dropdown">
232
                    <div class="dropdown">
165
                    <a class="btn btn-mini dropdown-toggle" id="authtypeactions[% authority_type.authtypecode %]" role="button" data-toggle="dropdown" href="#">
233
                        <a class="btn btn-mini dropdown-toggle" id="authtypeactions[% authority_type.authtypecode %]" role="button" data-toggle="dropdown" href="#">
166
                      Actions <b class="caret"></b></a>
234
                        Actions <b class="caret"></b></a>
167
                    <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="authtypeactions[% authority_type.authtypecode %]">
235
                        <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="authtypeactions[% authority_type.authtypecode %]">
168
                      <li><a href="auth_tag_structure.pl?authtypecode=[% authority_type.authtypecode %]" class="button parameters"><i class="fa fa-eye"></i> MARC structure</a></li>
236
                            <li><a href="auth_tag_structure.pl?authtypecode=[% authority_type.authtypecode %]" class="button parameters"><i class="fa fa-eye"></i> MARC structure</a></li>
169
                      <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>
237
                            <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>
170
                      [% 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 %]
238
                            <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>
171
                    </ul>
239
                            <!-- Button to trigger modal -->
172
                  </div>
240
                            <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>
241
                            <!-- Button to trigger modal -->
242
                            <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>
243
                        </ul>
244
                    </div>
245
                    <!-- Modal for export -->
246
                    <div class="modal hide" id="exportModal_[% authority_type.authtypecode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% authority_type.authtypecode %][% loop.count %]" aria-hidden="true">
247
                    <div class="modal-header">
248
                        <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
249
                        <h3 id="exportLabelexportModal_[% authority_type.authtypecode %][% loop.count %]">Export [% authority_type.authtypetext %] authority type</h3>
250
                    </div>
251
                    <form action="import_export_authtype.pl" name="form_[% authority_type.authtypecode %]" method="get" target="_blank"  class="form_export">
252
                        <div class="modal-body">
253
                            <fieldset>
254
                                <input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" />
255
                                <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>
256
                                <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>
257
                                <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>
258
259
                            </fieldset>
260
                        </div>
261
                        <div class="modal-footer">
262
                            <button type="submit" class="btn">Export</button>
263
                            <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Cancel</button>
264
                        </div>
265
                    </form>
266
                    </div>
267
                    <!-- Modal for import -->
268
                    <div class="modal hide" id="importModal_[% authority_type.authtypecode %][% loop.count %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_[% authority_type.authtypecode %][% loop.count %]" aria-hidden="true">
269
                    <div class="modal-header">
270
                        <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
271
                        <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>
272
                    </div>
273
                    <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">
274
                        <div class="modal-body">
275
                                <input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" />
276
                                <input type="hidden" name="action" value="import" />
277
                                <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>
278
                                <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>
279
                        </div>
280
                        <div class="modal-footer">
281
                            <button type="submit" class="btn">Import</button>
282
                            <button class="btn btn-link" data-dismiss="modal" aria-hidden="true">Close</button>
283
                        </div>
284
                    </form>
285
                    </div>
173
                </td>
286
                </td>
174
            </tr>
287
            </tr>
175
        [% END %]
288
        [% END %]
176
- 

Return to bug 13952