From 24b977d8775e70e15b60cbd5143e84f4c08d4e23 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Tue, 22 Oct 2013 12:58:58 +0000 Subject: feature:2982 API: add high-level type check introduces some constants fro bool, int, float, positive and notnull parameters types are tested in PwgServer::invoke and no in each method + some optimizations + update methods descriptions git-svn-id: http://piwigo.org/svn/trunk@25077 68402e56-0260-453c-a942-63ccdbb3a9ee --- tools/ws.htm | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) (limited to 'tools') diff --git a/tools/ws.htm b/tools/ws.htm index ba285c0d0..de23c3e67 100644 --- a/tools/ws.htm +++ b/tools/ws.htm @@ -53,9 +53,9 @@ #the_methods {width:250px;float:left;border-style:solid;border-color:#cdcdcd;border-width:1px 1px 0 0; background-image:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAADCAIAAADZSiLoAAAAH0lEQVQImSXHMQEAMAwCMOrfK0jIjuVL2gLBzyHJtgd7wBdU3Vt/7AAAAABJRU5ErkJggg==); } - #the_methods ul {font-size:1.1em;margin:5px 0 10px 10px;list-style:none;} - #the_methods li:before {content:"\203A\00A0";font-weight:bold;color:#EB9C39;font-size:1.1em;} - #the_methods li:hover:before {content:"\00A0\203A";} + #methodsList {font-size:1.1em;margin:5px 0 10px 10px;list-style:none;} + #methodsList li:before {content:"\203A\00A0";font-weight:bold;color:#EB9C39;font-size:1.1em;} + #methodsList li:hover:before {content:"\00A0\203A";} #the_page {margin-left:252px;border-style:solid;border-color:#cdcdcd;border-width:1px 0 0 1px;} #the_content {padding:10px;} @@ -70,6 +70,8 @@ #methodParams td.input {text-align:center;} #methodParams td.input input[type="text"] {width:97%;font-size:0.9em;background:#f7f7f7;border:1px solid #ccc;border-radius:2px;} #methodParams td.input input[type="text"]:hover, #methodParams td.input input[type="text"]:focus {border-color:#C7E2F1;border-top-color:#96BCD7;background:#fff;} + #methodParams .type {display:inline-block;width:16px;height:16px;font-size:12px;line-height:16px;background:#ddd;border-radius:8px;font-weight:bold;text-align:center;color:#222;} + #methodParams .subtype {vertical-align:super;} #testForm {display:inline-block;margin-left:15px;} #testForm td {padding:2px 0;} @@ -87,6 +89,7 @@ .methodInfo {float:right;display:inline-block;width:16px;height:16px;font-size:12px;line-height:16px;background:#555;border-radius:8px;font-family:"Times New Roman",sans-serif;font-style:italic;font-weight:bold;text-align:center;color:#fff;} .methodInfo:hover {border:none;text-shadow:none;background:#888;cursor:pointer;color:#fff;} + #tiptip_content { font-size:12px; } #iframeWrapper {width:100%;height:300px;padding:3px 3px 20px 3px;background:#F9F9F9;border:1px solid #cdcdcd;overflow:hidden;position:relative;} iframe {width:100%;height:100%;background:#fff;} @@ -155,6 +158,7 @@ Name Extra + Type Value Send @@ -165,7 +169,10 @@ - *: required parameter, ?: optional parameter, []: parameter can be an array (use a pipe | to split values) + + *: required, ?: optional, []: can be an array (use a pipe | to split values)
+ B: boolean, I: integer, F: float, +: positive, ø: not null + @@ -305,11 +312,11 @@ function displayError(error) { // display ws_url form function askForUrl() { + displayError("can't contact web-services, please give absolute url to 'ws.php'"); if ($("#urlForm input[name='ws_url']").val() == "") { $("#urlForm input[name='ws_url']").val(ws_url); } $("#urlForm").show(); - displayError("can't contact web-services, please give absolute url to 'ws.php'"); } // parse Piwigo JSON @@ -404,10 +411,18 @@ function fillNewMethod(methodName) { var methodParams = ''; if (method.params && method.params.length>0) { for (var i=0; ii'; + var param = method.params[i], + isOptional = param.optional, + acceptArray = param.acceptArray, + defaultValue = param.defaultValue == null ? '' : param.defaultValue, + info = param.info == null ? '' : 'i', + type = ''; + + if (param.type.match(/bool/)) type+= 'B'; + if (param.type.match(/int/)) type+= 'I'; + if (param.type.match(/float/)) type+= 'F'; + if (param.type.match(/positive/)) type+= '+'; + if (param.type.match(/notnull/)) type+= 'ø'; // if an array is direclty printed, the delimiter is a comma where we use a pipe if (typeof defaultValue == 'object') { @@ -415,8 +430,9 @@ function fillNewMethod(methodName) { } methodParams+= ''+ - ''+ method.params[i].name + info +''+ + ''+ param.name + info +''+ ''+ (isOptional ? '?':'*') + (acceptArray ? ' []':'') +''+ + ''+ type +''+ ''+ ''+ ''; @@ -438,10 +454,8 @@ function fillNewMethod(methodName) { // tiptip $(".methodInfo").tipTip({ - activation:"click", maxWidth:"300px", defaultPosition:"right", - keepAlive:true, delay:0 }); } -- cgit v1.2.3