export.js 936 B

123456789101112131415161718192021222324252627
  1. $(document).ready(function(){
  2. // Do the export
  3. $('#exportbtn').click(function(){
  4. // Show loader
  5. $('.loading').show();
  6. $.getJSON(
  7. OC.filePath('user_migrate','ajax','export.php'),
  8. {operation:'create'},
  9. function(result){
  10. if(result.status == 'success'){
  11. // Download the file
  12. window.location = OC.linkTo('user_migrate','ajax/export.php') + '?operation=download';
  13. $('.loading').hide();
  14. $('#exportbtn').val(t('user_migrate', 'Export'));
  15. } else {
  16. // Cancel loading
  17. $('#exportbtn').html('Failed');
  18. // Show Dialog
  19. OC.dialogs.alert(t('user_migrate', 'Something went wrong while the export file was being generated'), t('user_migrate', 'An error has occurred'), function(){
  20. $('#exportbtn').html(t('user_migrate', 'Export')+'<img style="display: none;" class="loading" src="'+OC.filePath('core','img','loading.gif')+'" />');
  21. });
  22. }
  23. }
  24. // End ajax
  25. );
  26. });
  27. });