diff options
author | Christopher Lenz <cmlenz@apache.org> | 2009-01-14 16:48:07 +0000 |
---|---|---|
committer | Christopher Lenz <cmlenz@apache.org> | 2009-01-14 16:48:07 +0000 |
commit | fe135f33f6c817b96ff0f59f93c1040a087491e8 (patch) | |
tree | f39ac9d3b70ad6ce64398e7d744e393364f298e0 /share/www/script | |
parent | 75ab4ae3e4a423c0f85cd87a2237453fd43bfba8 (diff) |
Allow modification of existing config option values from Futon.
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@734443 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script')
-rw-r--r-- | share/www/script/jquery.couch.js | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/share/www/script/jquery.couch.js b/share/www/script/jquery.couch.js index 915918d8..f3547b8d 100644 --- a/share/www/script/jquery.couch.js +++ b/share/www/script/jquery.couch.js @@ -33,8 +33,23 @@ }, config: function(options, section, option, value) { + options = options || {}; + var url = "/_config/"; + if (section) { + url += encodeURIComponent(section) + "/"; + if (option) { + url += encodeURIComponent(option); + } + } + if (value === undefined) { + var method = "GET"; + } else { + var method = "PUT"; + var data = toJSON(value); + } $.ajax({ - type: "GET", url: "/_config/", + type: method, url: url, contentType: "application/json", + dataType: "json", data: toJSON(value), processData: false, complete: function(req) { var resp = $.httpData(req, "json"); if (req.status == 200) { @@ -42,8 +57,8 @@ } else if (options.error) { options.error(req.status, resp.error, resp.reason); } else { - alert("An error occurred retrieving the server configuration: " + - resp.reason); + alert("An error occurred retrieving/updating the server " + + "configuration: " + resp.reason); } } }); @@ -76,7 +91,7 @@ options = options || {}; $.ajax({ type: "PUT", url: this.uri, contentType: "application/json", - dataType: "json", data: "", processData: false, + dataType: "json", data: "", processData: false, complete: function(req) { var resp = $.httpData(req, "json"); if (req.status == 201) { |