summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorJan-Christoph Borchardt <hey@jancborchardt.net>2013-01-28 19:39:51 +0100
committerJan-Christoph Borchardt <hey@jancborchardt.net>2013-01-28 19:39:51 +0100
commita78ae6a5cb99ede0c1404c3540dd3ed262cbb2b1 (patch)
treee4aa8196b0f27960c03dd34756fb9c17cd74edac /core/js
parent31ebea0f6a9f6e26068b819d7d5989bf42a518af (diff)
parent06c1c35ac90f7920afa637ab0b628529b4135d40 (diff)
downloadnextcloud-server-a78ae6a5cb99ede0c1404c3540dd3ed262cbb2b1.tar.gz
nextcloud-server-a78ae6a5cb99ede0c1404c3540dd3ed262cbb2b1.zip
Merge branch 'master' into permanent-share-icons
Diffstat (limited to 'core/js')
-rw-r--r--core/js/config.php10
-rw-r--r--core/js/eventsource.js2
-rw-r--r--core/js/update.js23
3 files changed, 31 insertions, 4 deletions
diff --git a/core/js/config.php b/core/js/config.php
index e838fb1cd04..9069175ed6f 100644
--- a/core/js/config.php
+++ b/core/js/config.php
@@ -17,11 +17,15 @@ header("Expires: Sat, 26 Jul 1997 05:00:00 GMT");
$l = OC_L10N::get('core');
// Get the config
-$debug = (defined('DEBUG') && DEBUG) ? 'true' : 'false';
+$apps_paths = array();
+foreach(OC_App::getEnabledApps() as $app) {
+ $apps_paths[$app] = OC_App::getAppWebPath($app);
+}
+
$array = array(
- "oc_debug" => $debug,
+ "oc_debug" => (defined('DEBUG') && DEBUG) ? 'true' : 'false',
"oc_webroot" => "\"".OC::$WEBROOT."\"",
- "oc_appswebroots" => "\"".$_['apps_paths']. "\"",
+ "oc_appswebroots" => str_replace('\\/', '/', json_encode($apps_paths)), // Ugly unescape slashes waiting for better solution
"oc_current_user" => "\"".OC_User::getUser(). "\"",
"oc_requesttoken" => "\"".OC_Util::callRegister(). "\"",
"datepickerFormatDate" => json_encode($l->l('jsdate', 'jsdate')),
diff --git a/core/js/eventsource.js b/core/js/eventsource.js
index 0c2a995f331..f783ade7ae9 100644
--- a/core/js/eventsource.js
+++ b/core/js/eventsource.js
@@ -40,7 +40,7 @@ OC.EventSource=function(src,data){
dataStr+=name+'='+encodeURIComponent(data[name])+'&';
}
}
- dataStr+='requesttoken='+OC.EventSource.requesttoken;
+ dataStr+='requesttoken='+oc_requesttoken;
if(!this.useFallBack && typeof EventSource !='undefined'){
var joinChar = '&';
if(src.indexOf('?') == -1) {
diff --git a/core/js/update.js b/core/js/update.js
new file mode 100644
index 00000000000..8ab02bbf935
--- /dev/null
+++ b/core/js/update.js
@@ -0,0 +1,23 @@
+$(document).ready(function () {
+ 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