aboutsummaryrefslogtreecommitdiffstats
path: root/tools/ws.htm
diff options
context:
space:
mode:
authormistic100 <mistic@piwigo.org>2014-05-17 15:15:13 +0000
committermistic100 <mistic@piwigo.org>2014-05-17 15:15:13 +0000
commit703a997f6ae9c884b82a11dfc102de65936501c0 (patch)
tree2e6e1ab003360e5ffef386dee2e759d4ac7033d8 /tools/ws.htm
parentf932ee79df9ad48a16822dc12518b234836ce926 (diff)
display request url and params in WS explorer
git-svn-id: http://piwigo.org/svn/trunk@28495 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--tools/ws.htm43
1 files changed, 33 insertions, 10 deletions
diff --git a/tools/ws.htm b/tools/ws.htm
index 1c55b59cb..22af3d8e7 100644
--- a/tools/ws.htm
+++ b/tools/ws.htm
@@ -214,9 +214,17 @@
</tfoot>
</table>
</div> <!-- methodParams -->
+
+ <div id="requestDisplay" style="display:none;">
+ <br>
+ <h3>Request</h3>
+ <blockquote>
+ <pre class="url"></pre>
+ <pre class="params"></pre>
+ </blockquote>
+ </div> <!-- requestDisplay -->
- <br><br>
-
+ <br>
<h3>Result</h3>
<div id="iframeWrapper">
<iframe src="" id="invokeFrame" name="invokeFrame"></iframe>
@@ -292,12 +300,12 @@ function resetDisplay() {
$("#urlForm").hide();
$("#methodDescription blockquote").empty();
$("#methodDescription").hide();
+ $("#requestDisplay").hide();
$("#invokeFrame").attr('src','');
}
// give the same size to methods list and main page
-function adaptHeight()
-{
+function adaptHeight() {
$("#the_page").css('height', 'auto');
$("#the_methods").css('height', 'auto');
@@ -512,9 +520,15 @@ function invokeMethod(methodName, newWindow) {
else {
$("#invokeFrame").attr('src', reqUrl);
}
+
+ $('#requestDisplay').show()
+ .find('.url').html(reqUrl).end()
+ .find('.params').hide();
}
// POST
else {
+ var params = {};
+
var form = $("#invokeForm");
form.attr('action', reqUrl);
@@ -525,22 +539,31 @@ function invokeMethod(methodName, newWindow) {
continue;
}
- var paramValue = $("input.methodParameterValue[data-id='"+ i +"']").val();
-
- var paramSplitted = paramValue.split('|');
+ var paramValue = $("input.methodParameterValue[data-id='"+ i +"']").val(),
+ paramName = method.params[i].name,
+ paramSplitted = paramValue.split('|');
+
if (method.params[i].acceptArray && paramSplitted.length > 1) {
- $.each(paramSplitted, function(v) {
- t+= '<input type="hidden" name="'+ method.params[i].name +'[]" value="'+ paramSplitted[v] +'">';
+ params[paramName] = [];
+
+ $.each(paramSplitted, function(i, value) {
+ params[paramName].push(value);
+ t+= '<input type="hidden" name="'+ paramName +'[]" value="'+ value +'">';
});
}
else {
- t+= '<input type="hidden" name="'+ method.params[i].name +'" value="'+ paramValue +'">';
+ params[paramName] = paramValue;
+ t+= '<input type="hidden" name="'+ paramName +'" value="'+ paramValue +'">';
}
}
form.html(t);
form.attr('target', newWindow ? "_blank" : "invokeFrame");
form.submit();
+
+ $('#requestDisplay').show()
+ .find('.url').html(reqUrl).end()
+ .find('.params').show().html(JSON.stringify(params, null, 4));
}
return false;