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

(-)a/admin/import_export_framework.pl (-5 / +1 lines)
Lines 62-71 if ($action eq 'export' && $input->request_method() eq 'GET') { Link Here
62
        binmode(STDOUT,':encoding(UTF-8)');
62
        binmode(STDOUT,':encoding(UTF-8)');
63
        print $input->header(-type => 'application/vnd.ms-excel', -attachment => 'export_' . $framework_name . '.csv');
63
        print $input->header(-type => 'application/vnd.ms-excel', -attachment => 'export_' . $framework_name . '.csv');
64
        print $strXml;
64
        print $strXml;
65
    } elsif ($format eq 'excel') {
66
        # Excel-xml file
67
        print $input->header(-type => 'application/excel', -attachment => 'export_' . $framework_name . '.xml');
68
        print $strXml;
69
    } else {
65
    } else {
70
        # ODS file
66
        # ODS file
71
        my $strODS = '';
67
        my $strODS = '';
Lines 79-85 if ($action eq 'export' && $input->request_method() eq 'GET') { Link Here
79
    my $fieldname = 'file_import_' . $framework_name;
75
    my $fieldname = 'file_import_' . $framework_name;
80
    my $filename = $input->param($fieldname);
76
    my $filename = $input->param($fieldname);
81
    # upload the input file
77
    # upload the input file
82
    if ($filename && $filename =~ /\.(csv|ods|xml)$/i) {
78
    if ($filename && $filename =~ /\.(csv|ods)$/i) {
83
        my $extension = $1;
79
        my $extension = $1;
84
        my $uploadFd = $input->upload($fieldname);
80
        my $uploadFd = $input->upload($fieldname);
85
        if ($uploadFd && !$input->cgi_error) {
81
        if ($uploadFd && !$input->cgi_error) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/biblio_framework.tt (-10 / +7 lines)
Lines 141-149 Link Here
141
            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="frameworkactions[% loo.frameworkcode | html %]">
141
            <ul class="dropdown-menu pull-right" role="menu" aria-labelledby="frameworkactions[% loo.frameworkcode | html %]">
142
              <li><a href="marctagstructure.pl?frameworkcode="><i class="fa fa-eye"></i> MARC structure</a></li>
142
              <li><a href="marctagstructure.pl?frameworkcode="><i class="fa fa-eye"></i> MARC structure</a></li>
143
              <!-- Trigger modal -->
143
              <!-- Trigger modal -->
144
              <li><a href="#" data-toggle="modal" data-target="#exportModal_default" title="Export framework structure (fields, subfields) to a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-upload"></i> Export</a></li>
144
              <li><a href="#" data-toggle="modal" data-target="#exportModal_default" title="Export framework structure (fields, subfields) to a spreadsheet file (.csv or .ods)"><i class="fa fa-upload"></i> Export</a></li>
145
              <!-- Trigger modal -->
145
              <!-- Trigger modal -->
146
              <li><a href="#" data-toggle="modal" data-target="#importModal_[% framework.frameworkcode | html %][% frameworks.count | html %]" title="Import framework structure (fields, subfields) from a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-download"></i> Import</a></li>
146
              <li><a href="#" data-toggle="modal" data-target="#importModal_[% framework.frameworkcode | html %][% frameworks.count | html %]" title="Import framework structure (fields, subfields) from a spreadsheet file (.csv or .ods)"><i class="fa fa-download"></i> Import</a></li>
147
            </ul>
147
            </ul>
148
            <!-- Modal to export default framework -->
148
            <!-- Modal to export default framework -->
149
            <div class="modal" id="exportModal_default" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_default" aria-hidden="true">
149
            <div class="modal" id="exportModal_default" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_default" aria-hidden="true">
Lines 158-164 Link Here
158
                  <fieldset>
158
                  <fieldset>
159
                    <input type="hidden" name="frameworkcode" value="" />
159
                    <input type="hidden" name="frameworkcode" value="" />
160
                    <p><label for="csv_type_export_default"><input type="radio" name="type_export_default" value="csv" id="csv_type_export_default" checked="checked" /> Export to CSV spreadsheet</label></p>
160
                    <p><label for="csv_type_export_default"><input type="radio" name="type_export_default" value="csv" id="csv_type_export_default" checked="checked" /> Export to CSV spreadsheet</label></p>
161
                    <p><label for="xml_type_export_default"><input type="radio" name="type_export_default" value="excel" id="xml_type_export_default" /> Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label></p>
162
                    <p><label for="ods_type_export_default"><input type="radio" name="type_export_default" value="ods" id="ods_type_export_default" /> Export to OpenDocument spreadsheet format</label></p>
161
                    <p><label for="ods_type_export_default"><input type="radio" name="type_export_default" value="ods" id="ods_type_export_default" /> Export to OpenDocument spreadsheet format</label></p>
163
                  </fieldset>
162
                  </fieldset>
164
                </div>
163
                </div>
Lines 177-183 Link Here
177
              <div class="modal-content">
176
              <div class="modal-content">
178
              <div class="modal-header">
177
              <div class="modal-header">
179
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
178
                <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
180
                <h3 id="importLabelexportModal_[% framework.frameworkcode | html %][% frameworks.count | html %]">Import default framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h>
179
                <h3 id="importLabelexportModal_[% framework.frameworkcode | html %][% frameworks.count | html %]">Import default framework structure (fields and subfields) from a spreadsheet file (.csv or .ods)</h>
181
              </div>
180
              </div>
182
              <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_default" id="form_i_default" method="post" enctype="multipart/form-data" class="form_import">
181
              <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_default" id="form_i_default" method="post" enctype="multipart/form-data" class="form_import">
183
                <div class="modal-body">
182
                <div class="modal-body">
Lines 212-220 Link Here
212
                  <li><a href="/cgi-bin/koha/admin/biblio_framework.pl?op=add_form&amp;frameworkcode=[% loo.frameworkcode | uri %]"><i class="fa fa-pencil"></i> Edit</a></li>
211
                  <li><a href="/cgi-bin/koha/admin/biblio_framework.pl?op=add_form&amp;frameworkcode=[% loo.frameworkcode | uri %]"><i class="fa fa-pencil"></i> Edit</a></li>
213
                  <li><a href="/cgi-bin/koha/admin/biblio_framework.pl?op=delete_confirm&amp;frameworkcode=[% loo.frameworkcode | uri %]"><i class="fa fa-trash"></i> Delete</a></li>
212
                  <li><a href="/cgi-bin/koha/admin/biblio_framework.pl?op=delete_confirm&amp;frameworkcode=[% loo.frameworkcode | uri %]"><i class="fa fa-trash"></i> Delete</a></li>
214
                  <!-- Trigger modal -->
213
                  <!-- Trigger modal -->
215
                  <li><a href="#" data-toggle="modal" data-target="#exportModal_[% loo.frameworkcode | html %][% loop.count | html %]" title="Export framework structure (fields, subfields) to a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-upload"></i> Export</a></li>
214
                  <li><a href="#" data-toggle="modal" data-target="#exportModal_[% loo.frameworkcode | html %][% loop.count | html %]" title="Export framework structure (fields, subfields) to a spreadsheet file (.csv or .ods)"><i class="fa fa-upload"></i> Export</a></li>
216
                  <!-- Trigger modal -->
215
                  <!-- Trigger modal -->
217
                  <li><a href="#" data-toggle="modal" data-target="#importModal_[% loo.frameworkcode | html %][% loop.count | html %]" title="Import framework structure (fields, subfields) from a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-download"></i> Import</a></li>
216
                  <li><a href="#" data-toggle="modal" data-target="#importModal_[% loo.frameworkcode | html %][% loop.count | html %]" title="Import framework structure (fields, subfields) from a spreadsheet file (.csv or .ods)"><i class="fa fa-download"></i> Import</a></li>
218
                </ul>
217
                </ul>
219
                <!-- Modal to export other framework -->
218
                <!-- Modal to export other framework -->
220
                <div class="modal" id="exportModal_[% loo.frameworkcode | html %][% loop.count | html %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% loo.frameworkcode | html %][% loop.count | html %]" aria-hidden="true">
219
                <div class="modal" id="exportModal_[% loo.frameworkcode | html %][% loop.count | html %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% loo.frameworkcode | html %][% loop.count | html %]" aria-hidden="true">
Lines 229-235 Link Here
229
                      <fieldset>
228
                      <fieldset>
230
                        <input type="hidden" name="frameworkcode" value="[% loo.frameworkcode | html %]" />
229
                        <input type="hidden" name="frameworkcode" value="[% loo.frameworkcode | html %]" />
231
                        <p><label for="csv_type_export_[% loo.frameworkcode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% loo.frameworkcode | html %]" value="csv" id="csv_type_export_[% loo.frameworkcode | html %][% loop.count | html %]" checked="checked" /> Export to CSV spreadsheet</label></p>
230
                        <p><label for="csv_type_export_[% loo.frameworkcode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% loo.frameworkcode | html %]" value="csv" id="csv_type_export_[% loo.frameworkcode | html %][% loop.count | html %]" checked="checked" /> Export to CSV spreadsheet</label></p>
232
                        <p><label for="xml_type_export_[% loo.frameworkcode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% loo.frameworkcode | html %]" value="excel" id="xml_type_export_[% loo.frameworkcode | html %][% loop.count | html %]" /> Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label></p>
233
                        <p><label for="ods_type_export_[% loo.frameworkcode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% loo.frameworkcode | html %]" value="ods" id="ods_type_export_[% loo.frameworkcode | html %][% loop.count | html %]" /> Export to OpenDocument spreadsheet format</label></p>
231
                        <p><label for="ods_type_export_[% loo.frameworkcode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% loo.frameworkcode | html %]" value="ods" id="ods_type_export_[% loo.frameworkcode | html %][% loop.count | html %]" /> Export to OpenDocument spreadsheet format</label></p>
234
                      </fieldset>
232
                      </fieldset>
235
                    </div>
233
                    </div>
Lines 248-254 Link Here
248
                  <div class="modal-content">
246
                  <div class="modal-content">
249
                  <div class="modal-header">
247
                  <div class="modal-header">
250
                    <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
248
                    <button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
251
                    <h3 id="importLabelexportModal_[% loo.frameworkcode | html %][% loop.count | html %]">Import [% loo.frameworkcode | html %] framework structure (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h3>
249
                    <h3 id="importLabelexportModal_[% loo.frameworkcode | html %][% loop.count | html %]">Import [% loo.frameworkcode | html %] framework structure (fields and subfields) from a spreadsheet file (.csv or .ods)</h3>
252
                  </div>
250
                  </div>
253
                  <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_[% loo.frameworkcode | html %]" id="form_i_[% loo.frameworkcode | html %]" method="post" enctype="multipart/form-data" class="form_import">
251
                  <form action="/cgi-bin/koha/admin/import_export_framework.pl" name="form_i_[% loo.frameworkcode | html %]" id="form_i_[% loo.frameworkcode | html %]" method="post" enctype="multipart/form-data" class="form_import">
254
                    <div class="modal-body">
252
                    <div class="modal-body">
Lines 290-296 Link Here
290
    <script>
288
    <script>
291
        /* Set some variable needed in biblio_framework.js */
289
        /* Set some variable needed in biblio_framework.js */
292
        var MSG_IMPORT_ERROR = _("Error importing the framework");
290
        var MSG_IMPORT_ERROR = _("Error importing the framework");
293
        var MSG_SELECT_FILE_FORMAT = _("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file.");
291
        var MSG_SELECT_FILE_FORMAT = _("Please select a CSV (.csv) or ODS (.ods) spreadsheet file.");
294
        var MSG_IMPORTING_TO_FRAMEWORK = _("Importing to framework: %s. Importing from file: %s.");
292
        var MSG_IMPORTING_TO_FRAMEWORK = _("Importing to framework: %s. Importing from file: %s.");
295
        var template_path = "[% interface | html %]/[% theme | html %]";
293
        var template_path = "[% interface | html %]/[% theme | html %]";
296
    </script>
294
    </script>
297
- 

Return to bug 23398