aboutsummaryrefslogtreecommitdiffstats
path: root/template
diff options
context:
space:
mode:
authorrvelices <rv-github@modusoptimus.com>2009-12-18 21:12:41 +0000
committerrvelices <rv-github@modusoptimus.com>2009-12-18 21:12:41 +0000
commit8c051ea526b4c8436e5fd33c7e2deeecc278da9f (patch)
treec2a2f69df07f5752c6082e3965eaacfa9335c8da /template
parent975188d088f7dc554df05048091d6c6ebe43580d (diff)
merge -r4512 from branch 2.0 to trunk
web method images.setPrivacyLevel (ws_images_setPrivacyLevel) is POST only git-svn-id: http://piwigo.org/svn/trunk@4513 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--template-common/scripts.js24
-rw-r--r--template/yoga/picture.tpl1
2 files changed, 19 insertions, 6 deletions
diff --git a/template-common/scripts.js b/template-common/scripts.js
index 519786ab7..d4595435b 100644
--- a/template-common/scripts.js
+++ b/template-common/scripts.js
@@ -111,8 +111,9 @@ PwgWS.prototype = {
}
this.transport.onreadystatechange = this.onStateChange.pwgBind(this);
- var url = this.urlRoot;
- url += "ws.php?format=json&method="+method;
+ var url = this.urlRoot+"ws.php?format=json";
+
+ var body = "method="+method;
if (parameters)
{
for (var property in parameters)
@@ -120,14 +121,25 @@ PwgWS.prototype = {
if ( typeof parameters[property] == 'object' && parameters[property])
{
for (var i=0; i<parameters[property].length; i++)
- url += "&"+property+"[]="+encodeURIComponent(parameters[property][i]);
+ body += "&"+property+"[]="+encodeURIComponent(parameters[property][i]);
}
else
- url += "&"+property+"="+encodeURIComponent(parameters[property]);
+ body += "&"+property+"="+encodeURIComponent(parameters[property]);
}
}
- this.transport.open(this.options.method, url, this.options.async);
- this.transport.send(null);
+
+ if (this.options.method == "POST" )
+ {
+ this.transport.open(this.options.method, url, this.options.async);
+ this.transport.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
+ this.transport.send(body);
+ }
+ else
+ {
+ url += "&"+body;
+ this.transport.open(this.options.method, url, this.options.async);
+ this.transport.send(null);
+ }
},
onStateChange: function() {
diff --git a/template/yoga/picture.tpl b/template/yoga/picture.tpl
index e8c7d9609..0572c8e07 100644
--- a/template/yoga/picture.tpl
+++ b/template/yoga/picture.tpl
@@ -214,6 +214,7 @@ var y = new PwgWS(rootUrl);
y.callService(
"pwg.images.setPrivacyLevel", {image_id: id, level:level} ,
{
+ method: "POST",
onFailure: function(num, text) { selectElement.disabled = false; alert(num + " " + text); },
onSuccess: function(result) { selectElement.disabled = false; }
}