diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-09-07 15:42:37 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-09-07 15:51:44 +0200 |
commit | 5eba5798274823fe3147a8d671ca5e15b3eb7843 (patch) | |
tree | eb9cfb3fc687b8be26dde07a08fd23ca3455991f /core/js/js.js | |
parent | b483f2aab856e3324026588a9702043072fd7ad2 (diff) | |
parent | 3829460ab8cbb6de65c53583a20fd04cbe7927dd (diff) | |
download | nextcloud-server-5eba5798274823fe3147a8d671ca5e15b3eb7843.tar.gz nextcloud-server-5eba5798274823fe3147a8d671ca5e15b3eb7843.zip |
Merge branch 'master' into routing
Conflicts:
apps/files/js/fileactions.js
lib/base.php
lib/helper.php
lib/ocs.php
Diffstat (limited to 'core/js/js.js')
-rw-r--r-- | core/js/js.js | 46 |
1 files changed, 45 insertions, 1 deletions
diff --git a/core/js/js.js b/core/js/js.js index f1ed6070c32..c392991d456 100644 --- a/core/js/js.js +++ b/core/js/js.js @@ -4,6 +4,8 @@ * @param text the string to translate * @return string */ +var OC; + function t(app,text){ if( !( app in t.cache )){ $.ajax(OC.filePath('core','ajax','translations.php'),{ @@ -40,6 +42,11 @@ function fileDownloadPath(dir, file) { } OC={ + PERMISSION_CREATE:4, + PERMISSION_READ:1, + PERMISSION_UPDATE:2, + PERMISSION_DELETE:8, + PERMISSION_SHARE:16, webroot:oc_webroot, appswebroots:oc_appswebroots, currentUser:(typeof oc_current_user!=='undefined')?oc_current_user:false, @@ -201,7 +208,7 @@ OC={ popup.prepend('<span class="arrow '+arrowclass+'"></span><h2>'+t('core', 'Settings')+'</h2><a class="close svg"></a>').show(); popup.find('.close').bind('click', function() { popup.remove(); - }) + }); if(typeof props.loadJS !== 'undefined') { var scriptname; if(props.loadJS === true) { @@ -587,3 +594,40 @@ function formatDate(date){ t('files','July'), t('files','August'), t('files','September'), t('files','October'), t('files','November'), t('files','December') ]; return monthNames[date.getMonth()]+' '+date.getDate()+', '+date.getFullYear()+', '+((date.getHours()<10)?'0':'')+date.getHours()+':'+((date.getMinutes()<10)?'0':'')+date.getMinutes(); } + +/** + * get a variable by name + * @param string name + */ +OC.get=function(name) { + var namespaces = name.split("."); + var tail = namespaces.pop(); + var context=window; + + for(var i = 0; i < namespaces.length; i++) { + context = context[namespaces[i]]; + if(!context){ + return false; + } + } + return context[tail]; +} + +/** + * set a variable by name + * @param string name + * @param mixed value + */ +OC.set=function(name, value) { + var namespaces = name.split("."); + var tail = namespaces.pop(); + var context=window; + + for(var i = 0; i < namespaces.length; i++) { + if(!context[namespaces[i]]){ + context[namespaces[i]]={}; + } + context = context[namespaces[i]]; + } + context[tail]=value; +} |