summaryrefslogtreecommitdiffstats
path: root/core/js/update.js
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2013-01-25 19:18:16 +0100
committerLukas Reschke <lukas@statuscode.ch>2013-01-25 19:18:16 +0100
commitdbc13cf6ee775745c86f92d97d636f9ed3cf5432 (patch)
treec0c37f634cc84f3c8d71d4d50cb9dafe54d2a122 /core/js/update.js
parent7f49d359306cbcd3303fcdd7feb0e6931ecffd8d (diff)
downloadnextcloud-server-dbc13cf6ee775745c86f92d97d636f9ed3cf5432.tar.gz
nextcloud-server-dbc13cf6ee775745c86f92d97d636f9ed3cf5432.zip
Move update inline JS
Diffstat (limited to 'core/js/update.js')
-rw-r--r--core/js/update.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/core/js/update.js b/core/js/update.js
new file mode 100644
index 00000000000..c10aa013e6a
--- /dev/null
+++ b/core/js/update.js
@@ -0,0 +1,24 @@
+$(document).ready(function () {
+ OC.EventSource.requesttoken = oc_requesttoken;
+ var updateEventSource = new OC.EventSource(OC.webroot+'/core/ajax/update.php');
+ updateEventSource.listen('success', function(message) {
+ $('<span>').append(message).append('<br />').appendTo($('.update'));
+ });
+ updateEventSource.listen('error', function(message) {
+ $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update'));
+ });
+ updateEventSource.listen('failure', function(message) {
+ $('<span>').addClass('error').append(message).append('<br />').appendTo($('.update'));
+ $('<span>')
+ .addClass('error bold')
+ .append('<br />')
+ .append(t('core', 'The update was unsuccessful. Please report this issue to the <a href="https://github.com/owncloud/core/issues" target="_blank">ownCloud community</a>.'))
+ .appendTo($('.update'));
+ });
+ updateEventSource.listen('done', function(message) {
+ $('<span>').addClass('bold').append('<br />').append(t('core', 'The update was successful. Redirecting you to ownCloud now.')).appendTo($('.update'));
+ setTimeout(function () {
+ window.location.href = OC.webroot;
+ }, 3000);
+ });
+}); \ No newline at end of file