Browse Source

Move update inline JS

tags/v5.0.0alpha1
Lukas Reschke 11 years ago
parent
commit
dbc13cf6ee
3 changed files with 26 additions and 27 deletions
  1. 24
    0
      core/js/update.js
  2. 1
    27
      core/templates/update.php
  3. 1
    0
      lib/base.php

+ 24
- 0
core/js/update.js View File

@@ -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);
});
});

+ 1
- 27
core/templates/update.php View 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>
</ul>

+ 1
- 0
lib/base.php View 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();

Loading…
Cancel
Save