diff options
Diffstat (limited to 'template-common/scripts.js')
-rw-r--r-- | template-common/scripts.js | 58 |
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() { |