2012-06-21 17:53:58 +04:00
|
|
|
// TODO: allow the button to be clicked only once
|
2012-06-20 21:25:12 +04:00
|
|
|
|
2012-06-21 17:53:58 +04:00
|
|
|
$( document ).ready(function(){
|
2012-06-20 21:25:12 +04:00
|
|
|
//
|
2012-08-29 10:42:49 +04:00
|
|
|
$( '#expireAllBtn' ).click(
|
|
|
|
|
2012-06-21 17:53:58 +04:00
|
|
|
function( event ) {
|
2012-08-29 10:42:49 +04:00
|
|
|
|
2012-06-21 17:53:58 +04:00
|
|
|
// Prevent page from reloading
|
|
|
|
event.preventDefault();
|
2012-08-29 10:42:49 +04:00
|
|
|
|
2012-06-21 17:53:58 +04:00
|
|
|
// Show loading gif
|
|
|
|
$('.expireAllLoading').show();
|
2012-08-29 10:42:49 +04:00
|
|
|
|
2012-06-21 17:53:58 +04:00
|
|
|
$.getJSON(
|
|
|
|
OC.filePath('files_versions','ajax','expireAll.php'),
|
|
|
|
function(result){
|
|
|
|
if (result.status == 'success') {
|
|
|
|
$('.expireAllLoading').hide();
|
|
|
|
$('#expireAllBtn').html('Expiration successful');
|
|
|
|
} else {
|
2012-08-29 10:42:49 +04:00
|
|
|
|
2012-06-21 17:53:58 +04:00
|
|
|
// Cancel loading
|
|
|
|
$('#expireAllBtn').html('Expiration failed');
|
2012-08-29 10:42:49 +04:00
|
|
|
|
2012-06-21 17:53:58 +04:00
|
|
|
// Show Dialog
|
|
|
|
OC.dialogs.alert(
|
2012-08-29 10:42:49 +04:00
|
|
|
'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')+'" />');
|
|
|
|
}
|
|
|
|
);
|
2012-06-21 17:53:58 +04:00
|
|
|
}
|
2012-08-29 10:42:49 +04:00
|
|
|
}
|
2012-06-21 17:53:58 +04:00
|
|
|
);
|
|
|
|
}
|
|
|
|
);
|
2012-06-20 21:25:12 +04:00
|
|
|
});
|