|
Lines 158-183
Link Here
|
| 158 |
<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=add_form&authtypecode=[% authority_type.authtypecode | uri %]"><i class="fa fa-pencil"></i> Edit</a></li> |
158 |
<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=add_form&authtypecode=[% authority_type.authtypecode | uri %]"><i class="fa fa-pencil"></i> Edit</a></li> |
| 159 |
[% IF authority_type.authtypecode %]<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=delete_confirm&authtypecode=[% authority_type.authtypecode | uri %]"><i class="fa fa-trash"></i> Delete</a></li>[% END %] |
159 |
[% IF authority_type.authtypecode %]<li><a href="/cgi-bin/koha/admin/authtypes.pl?op=delete_confirm&authtypecode=[% authority_type.authtypecode | uri %]"><i class="fa fa-trash"></i> Delete</a></li>[% END %] |
| 160 |
<!-- Button to trigger modal --> |
160 |
<!-- Button to trigger modal --> |
| 161 |
<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> |
161 |
<li><a href="#" data-toggle="modal" data-target="#exportModal_[% authority_type.authtypecode | html %][% loop.count | html %]" title="Export authority type (fields, subfields) to a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-upload"></i> Export</a></li> |
| 162 |
<!-- Button to trigger modal --> |
162 |
<!-- Button to trigger modal --> |
| 163 |
<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> |
163 |
<li><a href="#" data-toggle="modal" data-target="#importModal_[% authority_type.authtypecode | html %][% loop.count | html %]" title="Import authority type (fields, subfields) from a spreadsheet file (.csv, .xml, .ods)"><i class="fa fa-download"></i> Import</a></li> |
| 164 |
</ul> |
164 |
</ul> |
| 165 |
|
165 |
|
| 166 |
<!-- Modal for export --> |
166 |
<!-- Modal for export --> |
| 167 |
<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"> |
167 |
<div class="modal" id="exportModal_[% authority_type.authtypecode | html %][% loop.count | html %]" tabindex="-1" role="dialog" aria-labelledby="exportLabelexportModal_[% authority_type.authtypecode | html %][% loop.count | html %]" aria-hidden="true"> |
| 168 |
<div class="modal-dialog"> |
168 |
<div class="modal-dialog"> |
| 169 |
<div class="modal-content"> |
169 |
<div class="modal-content"> |
| 170 |
<div class="modal-header"> |
170 |
<div class="modal-header"> |
| 171 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
171 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 172 |
<h3 id="exportLabelexportModal_[% authority_type.authtypecode %][% loop.count %]">Export [% authority_type.authtypetext %] authority type</h3> |
172 |
<h3 id="exportLabelexportModal_[% authority_type.authtypecode | html %][% loop.count | html %]">Export [% authority_type.authtypetext | html %] authority type</h3> |
| 173 |
</div> |
173 |
</div> |
| 174 |
<form action="import_export_authtype.pl" name="form_[% authority_type.authtypecode %]" method="get" target="_blank" class="form_export"> |
174 |
<form action="/cgi-bin/koha/admin/import_export_authtype.pl" name="form_[% authority_type.authtypecode | html %]" method="get" target="_blank" class="form_export"> |
| 175 |
<div class="modal-body"> |
175 |
<div class="modal-body"> |
| 176 |
<fieldset> |
176 |
<fieldset> |
| 177 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" /> |
177 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" /> |
| 178 |
<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> |
178 |
<p><label for="csv_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% authority_type.authtypecode | html %]" value="csv" id="csv_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]" checked="checked" /> Export to CSV spreadsheet</label></p> |
| 179 |
<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> |
179 |
<p><label for="xml_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% authority_type.authtypecode | html %]" value="excel" id="xml_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]" /> Export to Excel with XML format, compatible with OpenOffice/LibreOffice as well</label></p> |
| 180 |
<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> |
180 |
<p><label for="ods_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]"><input type="radio" name="type_export_[% authority_type.authtypecode | html %]" value="ods" id="ods_type_export_[% authority_type.authtypecode | html %][% loop.count | html %]" /> Export to OpenDocument spreadsheet format</label></p> |
| 181 |
</fieldset> |
181 |
</fieldset> |
| 182 |
</div> |
182 |
</div> |
| 183 |
<div class="modal-footer"> |
183 |
<div class="modal-footer"> |
|
Lines 190-208
Link Here
|
| 190 |
</div> |
190 |
</div> |
| 191 |
|
191 |
|
| 192 |
<!-- Modal for import --> |
192 |
<!-- Modal for import --> |
| 193 |
<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"> |
193 |
<div class="modal" id="importModal_[% authority_type.authtypecode | html %][% loop.count | html %]" tabindex="-1" role="dialog" aria-labelledby="importLabelexportModal_[% authority_type.authtypecode | html %][% loop.count | html %]" aria-hidden="true"> |
| 194 |
<div class="modal-dialog"> |
194 |
<div class="modal-dialog"> |
| 195 |
<div class="modal-content"> |
195 |
<div class="modal-content"> |
| 196 |
<div class="modal-header"> |
196 |
<div class="modal-header"> |
| 197 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
197 |
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button> |
| 198 |
<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> |
198 |
<h3 id="importLabelexportModal_[% authority_type.authtypecode | html %][% loop.count | html %]">Import [% authority_type.authtypecode | html %] authority type (fields and subfields) from a spreadsheet file (.csv, .xml, .ods)</h3> |
| 199 |
</div> |
199 |
</div> |
| 200 |
<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"> |
200 |
<form action="/cgi-bin/koha/admin/import_export_authtype.pl" name="form_i_[% authority_type.authtypecode | html %]" id="form_i_[% authority_type.authtypecode | html %]" method="post" enctype="multipart/form-data" class="form_import"> |
| 201 |
<div class="modal-body"> |
201 |
<div class="modal-body"> |
| 202 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode %]" /> |
202 |
<input type="hidden" name="authtypecode" value="[% authority_type.authtypecode | html %]" /> |
| 203 |
<input type="hidden" name="action" value="import" /> |
203 |
<input type="hidden" name="action" value="import" /> |
| 204 |
<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> |
204 |
<p><label for="file_import_[% authority_type.authtypecode | html %]">Upload file:</label> <input type="file" name="file_import_[% authority_type.authtypecode | html %]" id="file_import_[% authority_type.authtypecode | html %]" class="input_import" /></p> |
| 205 |
<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> |
205 |
<div id="importing_[% authority_type.authtypecode | html %]" style="display:none" class="importing"><img src="[% interface | html %]/[% theme | html %]/img/loading-small.gif" alt="" /><span class="importing_msg"></span></div> |
| 206 |
</div> |
206 |
</div> |
| 207 |
<div class="modal-footer"> |
207 |
<div class="modal-footer"> |
| 208 |
<button type="submit" class="btn btn-default">Import</button> |
208 |
<button type="submit" class="btn btn-default">Import</button> |
|
Lines 233-318
Link Here
|
| 233 |
[% MACRO jsinclude BLOCK %] |
233 |
[% MACRO jsinclude BLOCK %] |
| 234 |
[% INCLUDE 'datatables.inc' %] |
234 |
[% INCLUDE 'datatables.inc' %] |
| 235 |
[% Asset.js("js/admin-menu.js") | $raw %] |
235 |
[% Asset.js("js/admin-menu.js") | $raw %] |
| 236 |
<script> |
236 |
[% Asset.js("js/authtype.js") | $raw %] |
| 237 |
var importing = false; |
|
|
| 238 |
|
| 239 |
$(document).ready(function() { |
| 240 |
$("#authtypes").dataTable($.extend(true, {}, dataTablesDefaults, { |
| 241 |
"aoColumnDefs": [ |
| 242 |
{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }, |
| 243 |
{ "aTargets": [ 0, 1 ], "sType": "natural" }, |
| 244 |
], |
| 245 |
"bSort": true, |
| 246 |
"sPaginationType": "four_button" |
| 247 |
})); |
| 248 |
$("#authtypecode").on("blur",function(){ |
| 249 |
toUC(this); |
| 250 |
}); |
| 251 |
|
| 252 |
$("body").css("cursor", "auto"); |
| 253 |
$('.import_export_options').hide(); |
| 254 |
$('a.import_export_fw').click(function() { |
| 255 |
if (!importing) { |
| 256 |
$('.import_export_options').hide(); |
| 257 |
$(this).next().show('slide'); |
| 258 |
} |
| 259 |
return false; |
| 260 |
}); |
| 261 |
|
| 262 |
$('.import_export_close').click(function() { |
| 263 |
if (!importing) { |
| 264 |
$('.import_export_options').fadeOut('fast'); |
| 265 |
$("body").css("cursor", "auto"); |
| 266 |
return false; |
| 267 |
} |
| 268 |
}); |
| 269 |
$('.input_import').val(""); |
| 270 |
|
| 271 |
var matches = new RegExp("\\?error_import_export=(.+)$").exec(window.location.search); |
| 272 |
if (matches && matches.length > 1) { |
| 273 |
alert(_("Error importing the authority type %s").format(decodeURIComponent(matches[1]))); |
| 274 |
} |
| 275 |
|
| 276 |
$('input.input_import').change( function() { |
| 277 |
var filename = $(this).val(); |
| 278 |
if ( ! /(?:\.csv|\.ods|\.xml)$/.test(filename)) { |
| 279 |
$(this).css("background-color","yellow"); |
| 280 |
alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file.")); |
| 281 |
$(this).val(""); |
| 282 |
$(this).css("background-color","white"); |
| 283 |
} |
| 284 |
}); |
| 285 |
$('form.form_export').submit(function() { |
| 286 |
$('.modal').modal("hide"); |
| 287 |
return true; |
| 288 |
}); |
| 289 |
$('form.form_import').submit(function() { |
| 290 |
var id = $(this).attr('id'); |
| 291 |
var obj = $('#' + id + ' input:file'); |
| 292 |
if (/(?:\.csv|\.ods|\.xml)$/.test(obj.val())) { |
| 293 |
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"))) { |
| 294 |
var authtypecode = $('#' + id + ' input:hidden[name=authtypecode]').val(); |
| 295 |
$('#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>")); |
| 296 |
if (navigator.userAgent.toLowerCase().indexOf('msie') != -1) { |
| 297 |
var timestamp = new Date().getTime(); |
| 298 |
$('#importing_' + authtypecode).find("img").attr('src', '[% interface %]/[% theme %]/img/loading-small.gif' + '?' +timestamp); |
| 299 |
} |
| 300 |
$('#importing_' + authtypecode).css('display', 'block'); |
| 301 |
if (navigator.userAgent.toLowerCase().indexOf('firefox') == -1) $("body").css("cursor", "progress"); |
| 302 |
importing = true; |
| 303 |
$(".modal-footer,.closebtn").hide(); |
| 304 |
return true; |
| 305 |
} else { |
| 306 |
return false; |
| 307 |
} |
| 308 |
} |
| 309 |
obj.css("background-color","yellow"); |
| 310 |
alert(_("Please select a CSV (.csv), ODS (.ods) or XML (.xml) spreadsheet file.")); |
| 311 |
obj.val(""); |
| 312 |
obj.css("background-color","white"); |
| 313 |
return false; |
| 314 |
}); |
| 315 |
}); |
| 316 |
</script> |
| 317 |
[% END %] |
237 |
[% END %] |
| 318 |
[% INCLUDE 'intranet-bottom.inc' %] |
238 |
[% INCLUDE 'intranet-bottom.inc' %] |