aboutsummaryrefslogtreecommitdiffstats
path: root/template-common/scripts.js
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2009-12-19 21:46:19 +0000
committerplegall <plg@piwigo.org>2009-12-19 21:46:19 +0000
commitaa42c1556ddd72b6c8daf944febe406406278385 (patch)
tree3e0f735be710a0ad844e755ee073cd4144727f61 /template-common/scripts.js
parent86d300541b8dc1a5d25d7a34134608c02245a218 (diff)
parent4a272ac9504d9fe7b98df5d33d5534b314dc0527 (diff)
Create release 2.0.7 from branch 2.0 r4533
git-svn-id: http://piwigo.org/svn/tags/2.0.7@4534 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'template-common/scripts.js')
-rw-r--r--template-common/scripts.js58
1 files changed, 35 insertions, 23 deletions
diff --git a/template-common/scripts.js b/template-common/scripts.js
index f6b22b41c..389ed1b21 100644
--- a/template-common/scripts.js
+++ b/template-common/scripts.js
@@ -71,6 +71,23 @@ function popuphelp(url)
}
+function blockToggleDisplay(headerId, contentId)
+{
+ var revHeader = document.getElementById(headerId);
+ var revContent = document.getElementById(contentId);
+
+ if (revContent.style.display == 'none')
+ {
+ revContent.style.display = 'block';
+ revHeader.className = 'instructionBlockHeaderExpanded';
+ }
+ else
+ {
+ revContent.style.display = 'none';
+ revHeader.className = 'instructionBlockHeaderCollapsed';
+ }
+}
+
Function.prototype.pwgBind = function() {
var __method = this, object = arguments[0], args = new Array();
@@ -90,23 +107,6 @@ function PwgWS(urlRoot)
};
};
-function blockToggleDisplay(headerId, contentId)
-{
- var revHeader = document.getElementById(headerId);
- var revContent = document.getElementById(contentId);
-
- if (revContent.style.display == 'none')
- {
- revContent.style.display = 'block';
- revHeader.className = 'instructionBlockHeaderExpanded';
- }
- else
- {
- revContent.style.display = 'none';
- revHeader.className = 'instructionBlockHeaderCollapsed';
- }
-}
-
PwgWS.prototype = {
@@ -129,8 +129,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)
@@ -138,14 +139,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() {