diff options
author | Robin Appelman <icewind@owncloud.com> | 2012-02-22 22:16:33 +0100 |
---|---|---|
committer | Robin Appelman <icewind@owncloud.com> | 2012-02-22 22:20:11 +0100 |
commit | 2e05bd69f5b39f449f7e7475d81c27ee2b1f946a (patch) | |
tree | 2ff587fe53a06488bccc78ee5e2de09d39f9ee74 /core/js/config.js | |
parent | 8bfc73c188216f5f0cb21a8c2c30b145435d042b (diff) | |
download | nextcloud-server-2e05bd69f5b39f449f7e7475d81c27ee2b1f946a.tar.gz nextcloud-server-2e05bd69f5b39f449f7e7475d81c27ee2b1f946a.zip |
add javascript bindings for OC_AppConfig
Diffstat (limited to 'core/js/config.js')
-rw-r--r-- | core/js/config.js | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/core/js/config.js b/core/js/config.js new file mode 100644 index 00000000000..500fe072a64 --- /dev/null +++ b/core/js/config.js @@ -0,0 +1,55 @@ +/** + * Copyright (c) 2011, Robin Appelman <icewind1991@gmail.com> + * This file is licensed under the Affero General Public License version 3 or later. + * See the COPYING-README file. + */ + +OC.AppConfig={ + url:OC.filePath('core','ajax','appconfig.php'), + getCall:function(action,data,callback){ + data.action=action; + $.getJSON(OC.AppConfig.url,data,function(result){ + if(result.status='success'){ + if(callback){ + callback(result.data); + } + } + }); + }, + postCall:function(action,data,callback){ + data.action=action; + $.post(OC.AppConfig.url,data,function(result){ + if(result.status='success'){ + if(callback){ + callback(result.data); + } + } + },'json'); + }, + getValue:function(app,key,defaultValue,callback){ + if(typeof defaultValue=='function'){ + callback=defaultValue; + defaultValue=null; + } + OC.AppConfig.getCall('getValue',{app:app,key:key,default:defaultValue},callback); + }, + setValue:function(app,key,value){ + OC.AppConfig.postCall('setValue',{app:app,key:key,value:value}); + }, + getApps:function(callback){ + OC.AppConfig.getCall('getApps',{},callback); + }, + getKeys:function(app,callback){ + OC.AppConfig.getCall('getKeys',{app:app},callback); + }, + hasKey:function(app,key,callback){ + OC.AppConfig.getCall('hasKey',{app:app,key:key},callback); + }, + deleteKey:function(app,key){ + OC.AppConfig.postCall('deleteKey',{app:app,key:key}); + }, + deleteApp:function(app){ + OC.AppConfig.postCall('deleteApp',{app:app}); + }, +} +//TODO OC.Preferences |