summaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorThomas Mueller <thomas.mueller@tmit.eu>2013-01-28 09:57:24 +0100
committerThomas Mueller <thomas.mueller@tmit.eu>2013-01-28 09:57:24 +0100
commit1d44a99ebb5f00b3b9550f4c281db7519cec3c75 (patch)
tree43a6ab3a67421bbf6589f757a97088eb16dff08b /core/js
parentdbc13cf6ee775745c86f92d97d636f9ed3cf5432 (diff)
parent31d83fddc482959d7fb4f7377cc7020c59c30951 (diff)
downloadnextcloud-server-1d44a99ebb5f00b3b9550f4c281db7519cec3c75.tar.gz
nextcloud-server-1d44a99ebb5f00b3b9550f4c281db7519cec3c75.zip
Merge branch 'master' into updater-CSP
Conflicts: core/templates/update.php
Diffstat (limited to 'core/js')
-rw-r--r--core/js/config.php10
-rw-r--r--core/js/eventsource.js2
-rw-r--r--core/js/js.js53
-rw-r--r--core/js/update.js1
4 files changed, 52 insertions, 14 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/js.js b/core/js/js.js
index 6e0a405114b..01e47edf268 100644
--- a/core/js/js.js
+++ b/core/js/js.js
@@ -37,14 +37,14 @@ function t(app,text, vars){
t.cache[app] = [];
}
}
- var _build = function(text, vars) {
- return text.replace(/{([^{}]*)}/g,
- function (a, b) {
- var r = vars[b];
- return typeof r === 'string' || typeof r === 'number' ? r : a;
- }
- );
- }
+ var _build = function (text, vars) {
+ return text.replace(/{([^{}]*)}/g,
+ function (a, b) {
+ var r = vars[b];
+ return typeof r === 'string' || typeof r === 'number' ? r : a;
+ }
+ );
+ };
if( typeof( t.cache[app][text] ) !== 'undefined' ){
if(typeof vars === 'object') {
return _build(t.cache[app][text], vars);
@@ -268,7 +268,7 @@ var OC={
var popup = $('#appsettings_popup');
if(popup.length == 0) {
$('body').prepend('<div class="popup hidden" id="appsettings_popup"></div>');
- popup = $('#appsettings_popup');
+ popup = $('#appsettings_popup');
popup.addClass(settings.hasClass('topright') ? 'topright' : 'bottomleft');
}
if(popup.is(':visible')) {
@@ -310,6 +310,41 @@ OC.search.lastResults={};
OC.addStyle.loaded=[];
OC.addScript.loaded=[];
+OC.Notification={
+ getDefaultNotificationFunction: null,
+ setDefault: function(callback) {
+ OC.Notification.getDefaultNotificationFunction = callback;
+ },
+ hide: function(callback) {
+ $("#notification").text('');
+ $('#notification').fadeOut('400', function(){
+ if (OC.Notification.isHidden()) {
+ if (OC.Notification.getDefaultNotificationFunction) {
+ OC.Notification.getDefaultNotificationFunction.call();
+ }
+ }
+ if (callback) {
+ callback.call();
+ }
+ });
+ },
+ showHtml: function(html) {
+ var notification = $('#notification');
+ notification.hide();
+ notification.html(html);
+ notification.fadeIn().css("display","inline");
+ },
+ show: function(text) {
+ var notification = $('#notification');
+ notification.hide();
+ notification.text(text);
+ notification.fadeIn().css("display","inline");
+ },
+ isHidden: function() {
+ return ($("#notification").text() === '');
+ }
+};
+
OC.Breadcrumb={
container:null,
crumbs:[],
diff --git a/core/js/update.js b/core/js/update.js
index c10aa013e6a..8ab02bbf935 100644
--- a/core/js/update.js
+++ b/core/js/update.js
@@ -1,5 +1,4 @@
$(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'));