Index: /trunk/tools/ws.htm
===================================================================
--- /trunk/tools/ws.htm	(revision 25729)
+++ /trunk/tools/ws.htm	(revision 25730)
@@ -4,7 +4,7 @@
   <meta charset="utf-8">
   <title>Piwigo web API (web-services) explorer</title>
-  
+
   <link rel="stylesheet" href="http://cdn.jsdelivr.net/tiptip/1.3/tipTip.css">
-  
+
   <style>
   /* BEGIN CSS RESET
@@ -13,5 +13,5 @@
   html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code,
   del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li,
-  fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, 
+  fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed,
   figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video
   {margin:0;padding:0;border:0;font-size:100%;vertical-align:baseline;}
@@ -28,5 +28,5 @@
   a {color:#247EBF;text-decoration:none;}
   a:hover {color:#EB9C39;border-bottom-width:1px;border-style:dotted;text-shadow:1px 1px 0 #ddd;}
-  
+
   blockquote {border:1px solid #cdcdcd;background:#F9F9F9;padding:8px;}
   hr {margin:10px 30px;color:#fff;}
@@ -78,5 +78,5 @@
   #testForm tr:last-child td {padding:8px 0 5px 0;}
   #testForm blockquote {width:200px;}
-  
+
   #introMessage {font-size:1.1em;}
   #urlForm {margin-bottom:10px;}
@@ -87,15 +87,15 @@
   }
   a.button:hover {color:#E5FF00;}
-  
+
   .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;}
-  
+
   div.onlys {background:#faa;color:#fff;border:1px solid #f22;padding:.25em .5em;display:table;border-radius:4px;margin-bottom:0.5em;}
   </style>
-  
+
 </head>
 
@@ -109,5 +109,5 @@
 <div id="the_methods">
   <h2>Available methods</h2>
-  
+
   <ul id="methodsList">
   </ul>
@@ -117,5 +117,5 @@
   <h2 id="methodName" style="display:none;"></h2>
   <h2 id="errorWrapper" style="display:none;"></h2>
-  
+
   <div id="the_content">
     <form id="urlForm" style="display:none;">
@@ -123,5 +123,5 @@
       <input type="submit" value="Go!">
     </form>
-    
+
     <blockquote id="introMessage">
       <p>
@@ -154,5 +154,5 @@
         <br>
       </div> <!-- methodDescription -->
-      
+
       <div id="testForm">
         <h3>Test</h3>
@@ -188,5 +188,5 @@
         </blockquote>
       </div> <!-- testForm -->
-      
+
       <div id="methodParams">
         <h3>Method parameters</h3>
@@ -201,8 +201,8 @@
             </tr>
           </thead>
-          
+
           <tbody>
           </tbody>
-          
+
           <tfoot>
             <tr>
@@ -215,7 +215,7 @@
         </table>
       </div> <!-- methodParams -->
-      
+
       <br><br>
-      
+
       <h3>Result</h3>
       <div id="iframeWrapper">
@@ -226,8 +226,8 @@
       </div>
     </form> <!-- iframeWrapper -->
-    
+
     <!-- hidden form for POST submition -->
     <form method="post" action="" target="" id="invokeForm" style="display:none;"></form>
-    
+
   </div> <!-- the_content -->
 
@@ -241,5 +241,5 @@
 <script src="https://cdn.jsdelivr.net/tiptip/1.3/jquery.tipTip.minified.js"></script>
 
-<script>  
+<script>
 // global vars
 var cachedMethods = new Array;
@@ -301,8 +301,8 @@
   $("#the_page").css('height', 'auto');
   $("#the_methods").css('height', 'auto');
-  
+
   min_h = $(window).height()-$("#the_header").outerHeight()-$("#the_footer").outerHeight()-3;
   h = Math.max(min_h, Math.max($("#the_methods").height(), $("#the_page").height()));
-  
+
   $("#the_page").css('height', h);
   $("#the_methods").css('height', h);
@@ -337,5 +337,5 @@
     resp = {"stat": "ko", "result": "null"};
   }
- 
+
   return resp.result;
 }
@@ -344,5 +344,5 @@
 function getMethodList() {
   resetDisplay();
-  
+
   $.ajax({
     type: "GET",
@@ -351,8 +351,8 @@
   }).done(function(result) {
     result = parsePwgJSON(result);
-    
+
     if (result!=null) {
       methods = result.methods;
-      
+
       var ml = '';
       for (var i=0; i<methods.length; i++)
@@ -361,7 +361,7 @@
       }
       $("#methodsList").html(ml).show();
-      
+
       adaptHeight();
-      
+
       // trigger method selection
       $("#methodsList li a").click(function() {
@@ -378,5 +378,5 @@
   $("#introMessage").hide();
   $("#tiptip_holder").fadeOut(200);
-  
+
   if (cachedMethods[ methodName ]) {
     fillNewMethod(methodName);
@@ -387,8 +387,20 @@
       url: ws_url,
       data: { format: "json", method: "reflection.getMethodDetails", methodName: methodName }
-    }).done(function(result) { 
+    }).done(function(result) {
       result = parsePwgJSON(result);
-    
+
       if (result!=null) {
+				if (result.options.post_only || result.options.admin_only) {
+					var onlys = '<div class="onlys">';
+					if (result.options.post_only) {
+						onlys+= 'POST only. ';
+					}
+					if (result.options.admin_only) {
+						onlys+= 'Admin only. ';
+					}
+					onlys+= '</div>';
+					
+					result.description = onlys + result.description;
+				}
         cachedMethods[ methodName ] = result;
         fillNewMethod(methodName);
@@ -403,29 +415,16 @@
 function fillNewMethod(methodName) {
   resetDisplay();
-  
+
   method = cachedMethods[ methodName ];
-  
+
   $("#methodName").html(method.name).show();
-  
-  if (method.options.post_only || method.options.admin_only) {
-    var onlys = '<div class="onlys">';
-    if (method.options.post_only) {
-      onlys+= 'POST only. ';
-    }
-    if (method.options.admin_only) {
-      onlys+= 'Admin only. ';
-    }
-    onlys+= '</div>';
-    
-    method.description = onlys + method.description;
-  }
-  
+
   if (method.description != "") {
     $("#methodDescription blockquote").html(method.description);
     $("#methodDescription").show();
   }
-  
+
   $("#requestFormat").val(method.options.post_only ? 'post' : 'get');
-  
+
   var methodParams = '';
   if (method.params && method.params.length>0) {
@@ -437,5 +436,5 @@
           info = param.info == null ? '' : '<a class="methodInfo" title="'+ param.info.replace(/"/g, '&quot;') + '">i</a>',
           type = '';
-      
+
       if (param.type.match(/bool/)) type+= '<span class=type>B</span>';
       if (param.type.match(/int/)) type+= '<span class=type>I</span>';
@@ -443,5 +442,5 @@
       if (param.type.match(/positive/)) type+= '<span class=subtype>+</span>';
       if (param.type.match(/notnull/)) type+= '<span class=subtype>&oslash;</span>';
-      
+
       // if an array is direclty printed, the delimiter is a comma where we use a pipe
       if (typeof defaultValue == 'object') {
@@ -461,15 +460,15 @@
     methodParams = '<tr><td colspan="4">This method takes no parameters</td></tr>';
   }
-  
+
   $("#methodParams tbody").html(methodParams);
-  $("#methodWrapper").show(); 
-  
+  $("#methodWrapper").show();
+
   adaptHeight();
-  
+
   // trigger field modification
   $("input.methodParameterValue").change(function() {
     $("input.methodParameterSend[data-id='"+ $(this).data('id') +"']").attr('checked', 'checked');
   });
-  
+
   // tiptip
   $(".methodInfo").tipTip({
@@ -485,9 +484,9 @@
 
   var reqUrl = ws_url +"?format="+ $("#responseFormat").val();
-  
+
   // GET
   if ($("#requestFormat").val() == 'get') {
     reqUrl+= "&method="+ methodName;
-    
+
     for (var i=0; i<method.params.length; i++) {
       if (! $("input.methodParameterSend[data-id='"+ i +"']").is(":checked")) {
@@ -496,5 +495,5 @@
 
       var paramValue = $("input.methodParameterValue[data-id='"+ i +"']").val();
-      
+
       var paramSplitted = paramValue.split('|');
       if (method.params[i].acceptArray &&  paramSplitted.length > 1) {
@@ -507,5 +506,5 @@
       }
     }
-    
+
     if (newWindow) {
       window.open(reqUrl);
@@ -519,7 +518,7 @@
     var form = $("#invokeForm");
     form.attr('action', reqUrl);
-    
+
     var t = '<input type="hidden" name="method" value="'+ methodName +'">';
-    
+
     for (var i=0; i<method.params.length; i++) {
       if (! $("input.methodParameterSend[data-id='"+ i +"']").is(":checked")) {
@@ -539,10 +538,10 @@
       }
     }
-    
+
     form.html(t);
     form.attr('target', newWindow ? "_blank" : "invokeFrame");
     form.submit();
   }
-  
+
   return false;
 }
