improve export backend template

This commit is contained in:
Daniel Seifert 2021-04-19 22:52:46 +02:00
parent 3fe68ef996
commit e052d44e59
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170

View File

@ -6,12 +6,10 @@
[{oxscript include="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"}] [{oxscript include="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"}]
[{oxstyle include="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/solid.min.css"}] [{oxstyle include="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/solid.min.css"}]
<style type="text/css"> <style>
button { button {
margin: 1em; margin: 1em 1em 1em 5em;
margin-left: 5em;
} }
html { html {
font-size: 0.8em; font-size: 0.8em;
} }
@ -24,9 +22,27 @@
h5.card-header { h5.card-header {
font-size: 1.1rem; font-size: 1.1rem;
} }
</style> </style>
[{capture name="d3script"}][{strip}]
function startExport(id, format) {
let elements = document.getElementsByClassName('errorbox');
for (var i = 0; i < elements.length; i++){
elements[i].style.display = 'none';
}
setTimeout(function(){
document.getElementById('mask').className='';
document.getElementById('popup2').className='d3loader-2';
}, 3000);
document.getElementById('mask').className='on';
document.getElementById('popup2').className='d3loader-2 on';
document.getElementById('exportid').value = id;
document.getElementById('exportformat').value = format;
document.getElementById('myedit').submit();
}
[{/strip}][{/capture}]
[{oxscript add=$smarty.capture.d3script}]
<form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post" style="padding: 0;margin: 0;height:0;"> <form name="myedit" id="myedit" action="[{$oViewConf->getSelfLink()}]" method="post" style="padding: 0;margin: 0;height:0;">
[{$oViewConf->getHiddenSid()}] [{$oViewConf->getHiddenSid()}]
<input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]"> <input type="hidden" name="cl" value="[{$oViewConf->getActiveClassName()}]">
@ -62,18 +78,7 @@
</p> </p>
<div class="btn-group"> <div class="btn-group">
<button type="button" class="btn btn-primary" onclick=" <button type="button" class="btn btn-primary" onclick="startExport('[{$id}]', 'CSV')">
setTimeout(function(){
document.getElementById('mask').className='';
document.getElementById('popup2').className='d3loader-2';
}, 3000);
document.getElementById('mask').className='on';
document.getElementById('popup2').className='d3loader-2 on';
document.getElementById('exportid').value = '[{$id}]';
document.getElementById('exportformat').value = 'CSV';
document.getElementById('myedit').submit();
"
>
<i class="fas fa-magic"></i> <i class="fas fa-magic"></i>
[{oxmultilang ident=$export->getButtonText()}] [{oxmultilang ident=$export->getButtonText()}]
</button> </button>
@ -85,30 +90,12 @@
</button> </button>
<div class="dropdown-menu"> <div class="dropdown-menu">
[{block name="dataWizardExportFormat"}] [{block name="dataWizardExportFormat"}]
<button class="dropdown-item" onclick=" <button class="dropdown-item" onclick="startExport('[{$id}]', 'CSV')">
setTimeout(function(){ [{oxmultilang ident="D3_DATAWIZARD_EXPORT_FORMAT_CSV"}]
document.getElementById('mask').className=''; </button>
document.getElementById('popup2').className='d3loader-2'; <button class="dropdown-item" onclick="startExport('[{$id}]', 'Pretty')">
}, 3000); [{oxmultilang ident="D3_DATAWIZARD_EXPORT_FORMAT_PRETTY"}]
document.getElementById('mask').className='on'; </button>
document.getElementById('popup2').className='d3loader-2 on';
document.getElementById('exportid').value = '[{$id}]';
document.getElementById('exportformat').value = 'CSV';
document.getElementById('myedit').submit();
"
>[{oxmultilang ident="D3_DATAWIZARD_EXPORT_FORMAT_CSV"}]</button>
<button class="dropdown-item" onclick="
setTimeout(function(){
document.getElementById('mask').className='';
document.getElementById('popup2').className='d3loader-2';
}, 3000);
document.getElementById('mask').className='on';
document.getElementById('popup2').className='d3loader-2 on';
document.getElementById('exportid').value = '[{$id}]';
document.getElementById('exportformat').value = 'Pretty';
document.getElementById('myedit').submit();
"
>[{oxmultilang ident="D3_DATAWIZARD_EXPORT_FORMAT_PRETTY"}]</button>
[{/block}] [{/block}]
</div> </div>
</div> </div>