From 703a997f6ae9c884b82a11dfc102de65936501c0 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Sat, 17 May 2014 15:15:13 +0000 Subject: display request url and params in WS explorer git-svn-id: http://piwigo.org/svn/trunk@28495 68402e56-0260-453c-a942-63ccdbb3a9ee --- tools/ws.htm | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'tools') 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 @@ + + -

- +

Result

@@ -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+= ''; + params[paramName] = []; + + $.each(paramSplitted, function(i, value) { + params[paramName].push(value); + t+= ''; }); } else { - t+= ''; + params[paramName] = paramValue; + t+= ''; } } 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; -- cgit v1.2.3