summaryrefslogtreecommitdiffstats
path: root/apps/files_versions/js/settings-personal.js
blob: 6ea8c1a950ffb1f75f37a9207636b824ae50914a (plain)
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
36
37
38
39
// TODO: allow the button to be clicked only once

$( document ).ready(function(){
	//
	$( '#expireAllBtn' ).click( 
		
		function( event ) {
		
			// Prevent page from reloading
			event.preventDefault();
			
			// Show loading gif
			$('.expireAllLoading').show();
		
			$.getJSON(
				OC.filePath('files_versions','ajax','expireAll.php'),
				function(result){
					if (result.status == 'success') {
						$('.expireAllLoading').hide();
						$('#expireAllBtn').html('Expiration successful');
					} else {
						
						// Cancel loading
						$('#expireAllBtn').html('Expiration failed');
						
						// Show Dialog
						OC.dialogs.alert(
							'Something went wrong, your files may not have been expired', 
							'An error has occurred', 
							function(){ 
								$('#expireAllBtn').html(t('files_versions', 'Expire all versions')+'<img style="display: none;" class="loading" src="'+OC.filePath('core','img','loading.gif')+'" />'); 
							}	
						);		
					}
				}	
			);
		}
	);
});