function indexCtrl($scope) {
}
;
function updateCtrl($scope, $routeParams) {
$scope.update = function() {
$('#upd-progress').show();
$('#updater-start').hide();
var updateEventSource = new OC.EventSource(OC.filePath('updater', 'ajax', 'update.php'));
updateEventSource.listen('success', function(message) {
$('').append(message).append('
').appendTo($('#upd-progress'));
});
updateEventSource.listen('error', function(message) {
$('').addClass('error').append(message).append('
').appendTo($('#upd-progress'));
message .= 'Please fix this and retry.';
$('').addClass('error').append(message).append('
').appendTo($('#upd-progress'));
updateEventSource.close();
});
updateEventSource.listen('failure', function(message) {
$('').addClass('error').append(message).append('
').appendTo($('#upd-progress'));
$('')
.addClass('error bold')
.append('
')
.append(t('updater', 'The update was unsuccessful. Please report this issue to the ownCloud community.'))
.appendTo($('#upd-progress'));
});
updateEventSource.listen('done', function(message) {
$('').addClass('bold').append('
').append('' + OC.webroot + '').appendTo($('#upd-progress'));
});
};
}
;
function backupCtrl($scope, $http) {
$http.get(OC.filePath('updater', 'ajax', 'backup/list.php'), {headers: {'requesttoken': oc_requesttoken}})
.success(function(data) {
$scope.entries = data.data;
});
$scope.doDelete = function(name) {
$http.get(OC.filePath('updater', 'ajax', 'backup/delete.php'), {
headers: {'requesttoken': oc_requesttoken},
params: {'filename': name}
}).success(function(data) {
$http.get(OC.filePath('updater', 'ajax', 'backup/list.php'), {headers: {'requesttoken': oc_requesttoken}})
.success(function(data) {
$scope.entries = data.data;
});
});
}
$scope.doDownload = function(name) {
window.open(OC.filePath('updater', 'ajax', 'backup/download.php')
+ '?requesttoken=' + oc_requesttoken
+ '&filename=' + name
);
}
}
;