Blame view

sources/apps/user_migrate/js/export.js 1.06 KB
42e4f8d60   Kload   add all apps
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  $(document).ready(function(){
      // Do the export
  	$('#exportbtn').click(function(){
  		// Show loader
  		$('.loadingexport').show();
  		$.getJSON(
  			OC.filePath('user_migrate','ajax','export.php'),
  			{operation:'create'},
  			function(result){
  				if(result.status == 'success'){
  					// Download the file
  					window.location = OC.linkTo('user_migrate','ajax/export.php') + '?operation=download&requesttoken=' + oc_requesttoken;
  					$('.loading').hide();
  					$('#exportbtn').val(t('user_migrate', 'Export'));
  				} else {
  					// Cancel loading
  					$('#exportbtn').html('Failed');
  					// Show Dialog
  					OC.dialogs.alert(t('user_migrate', 'Something went wrong while the export file was being generated'), t('user_migrate', 'An error has occurred'), function(){
  						$('#exportbtn').html(t('user_migrate', 'Export')+'<img class="loadingexport" src="'+OC.filePath('core','img','loading.gif')+'" />');
  					});
  				}
  			}
  		// End ajax
  		);
  	});
  	
  	// Do the import
  	$('#importbtn').click(function(){
  		// Show loader
  		$('.loadingimport').show();
  		$('#import').submit();
  		
  	});
  });