]> source.dussan.org Git - nextcloud-server.git/commitdiff
Move update inline JS
authorLukas Reschke <lukas@statuscode.ch>
Fri, 25 Jan 2013 18:18:16 +0000 (19:18 +0100)
committerLukas Reschke <lukas@statuscode.ch>
Fri, 25 Jan 2013 18:18:16 +0000 (19:18 +0100)
core/js/update.js [new file with mode: 0644]
core/templates/update.php
lib/base.php

diff --git a/core/js/update.js b/core/js/update.js
new file mode 100644 (file)
index 0000000..c10aa01
--- /dev/null
@@ -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
index c9f3144f25770dcc29086b64a75c0efaeaa56d01..d40341097620ced4b7596c15d4a9514362077c5a 100644 (file)
@@ -2,30 +2,4 @@
        <li class='update'>
                <?php echo $l->t('Updating ownCloud to version %s, this may take a while.', array($_['version'])); ?><br /><br />
        </li>
-</ul>
-<script>
-       $(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);
-               });
-       });
-</script>
\ No newline at end of file
+</ul>
\ No newline at end of file
index 81a5a615de4827a1c3f0a92a91ebc5cfa1810b11..402a8af4211077d2c00bdb8039ae2b43eda34223 100644 (file)
@@ -252,6 +252,7 @@ class OC
                                if ($showTemplate && !OC_Config::getValue('maintenance', false)) {
                                        OC_Config::setValue('maintenance', true);
                                        OC_Log::write('core', 'starting upgrade from ' . $installedVersion . ' to ' . $currentVersion, OC_Log::DEBUG);
+                                       OC_Util::addscript('update');
                                        $tmpl = new OC_Template('', 'update', 'guest');
                                        $tmpl->assign('version', OC_Util::getVersionString());
                                        $tmpl->printPage();