Changeset 25394
- Timestamp:
- Nov 8, 2013, 1:16:14 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/ws_core.inc.php
r25115 r25394 390 390 return isset($signature) ? $signature : array(); 391 391 } 392 393 /** 394 * @since 2.6 395 */ 396 function getMethodOptions($methodName) 397 { 398 $options = @$this->_methods[$methodName]['options']; 399 return isset($options) ? $options : array(); 400 } 392 401 393 402 static function isPost() … … 629 638 'description' => $service->getMethodDescription($methodName), 630 639 'params' => array(), 640 'options' => $service->getMethodOptions($methodName), 631 641 ); 632 642 … … 644 654 $param_data['defaultValue'] = $options['default']; 645 655 } 656 if (isset($options['maxValue'])) 657 { 658 $param_data['maxValue'] = $options['maxValue']; 659 } 646 660 if (isset($options['info'])) 647 661 { -
trunk/tools/ws.htm
r25077 r25394 1 1 <!DOCTYPE html> 2 <html xmlns="http://www.w3.org/1999/xhtml"lang="en" dir="ltr">2 <html lang="en" dir="ltr"> 3 3 <head> 4 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">4 <meta charset="utf-8"> 5 5 <title>Piwigo web API (web-services) explorer</title> 6 6 7 <link rel="stylesheet" type="text/css"href="http://cdn.jsdelivr.net/tiptip/1.3/tipTip.css">8 9 <style type="text/css">7 <link rel="stylesheet" href="http://cdn.jsdelivr.net/tiptip/1.3/tipTip.css"> 8 9 <style> 10 10 /* BEGIN CSS RESET 11 11 http://meyerweb.com/eric/tools/css/reset … … 61 61 #the_content {padding:10px;} 62 62 63 #methodParams { display:inline-block;}63 #methodParams {margin-right:230px;} 64 64 #methodParams thead td {background:#DEE3E9;font-weight:bold;padding:2px 5px;} 65 65 #methodParams td {padding:2px;border:1px solid #cdcdcd;vertical-align:middle;} … … 74 74 #methodParams .subtype {vertical-align:super;} 75 75 76 #testForm { display:inline-block;margin-left:15px;}76 #testForm {float:right;} 77 77 #testForm td {padding:2px 0;} 78 78 #testForm tr:last-child td {padding:8px 0 5px 0;} … … 94 94 #iframeWrapper {width:100%;height:300px;padding:3px 3px 20px 3px;background:#F9F9F9;border:1px solid #cdcdcd;overflow:hidden;position:relative;} 95 95 iframe {width:100%;height:100%;background:#fff;} 96 97 div.onlys {background:#faa;color:#fff;border:1px solid #f22;padding:.25em .5em;display:table;border-radius:4px;margin-bottom:0.5em;} 96 98 </style> 97 99 … … 99 101 100 102 <body> 103 <a name="top"></a> 101 104 102 105 <div id="the_header"> … … 151 154 <br> 152 155 </div> <!-- methodDescription --> 156 157 <div id="testForm"> 158 <h3>Test</h3> 159 <blockquote> 160 <table> 161 <tr> 162 <td>Request format :</td> 163 <td> 164 <select id="requestFormat"> 165 <option value="get" selected>GET</option> 166 <option value="post">POST</option> 167 </select> 168 </td> 169 </tr> 170 <tr> 171 <td>Response format :</td> 172 <td> 173 <select id="responseFormat"> 174 <option value="rest" selected>REST (xml)</option> 175 <option value="json">JSON</option> 176 <option value="php">PHP serial</option> 177 <option value="xmlrpc">XML RPC</option> 178 </select> 179 </td> 180 </tr> 181 <tr> 182 <td colspan="2"> 183 <a href="#" class="button" id="invokeMethod">INVOKE</a> 184 <a href="#" class="button" id="invokeMethodBlank">INVOKE (new window)</a> 185 </td> 186 </tr> 187 </table> 188 </blockquote> 189 </div> <!-- testForm --> 153 190 154 191 <div id="methodParams"> … … 179 216 </div> <!-- methodParams --> 180 217 181 <div id="testForm">182 <h3>Test</h3>183 <blockquote>184 <table>185 <tr>186 <td>Request format :</td>187 <td>188 <select id="requestFormat">189 <option value="get" selected="selected">GET</option>190 <option value="post">POST</option>191 </select>192 </td>193 </tr>194 <tr>195 <td>Response format :</td>196 <td>197 <select id="responseFormat">198 <option value="rest" selected="selected">REST (xml)</option>199 <option value="json">JSON</option>200 <option value="php">PHP serial</option>201 <option value="xmlrpc">XML RPC</option>202 </select>203 </td>204 </tr>205 <tr>206 <td colspan="2">207 <a href="#" class="button" id="invokeMethod">INVOKE</a>208 <a href="#" class="button" id="invokeMethodBlank">INVOKE (new window)</a>209 </td>210 </tr>211 </table>212 </blockquote>213 </div> <!-- testForm -->214 215 218 <br><br> 216 219 … … 218 221 <div id="iframeWrapper"> 219 222 <iframe src="" id="invokeFrame" name="invokeFrame"></iframe> 220 <a href="#bottom" id="increaseIframe"><b>↓</b> increase height</a> • <a href="#bottom" id="decreaseIframe"><b>↑</b> decrease height</a> 221 <a name="bottom"></a> 223 <a href="#iframe-bottom" id="increaseIframe"><b>↓</b> increase height</a> • 224 <a href="#iframe-bottom" id="decreaseIframe"><b>↑</b> decrease height</a> 225 <a name="iframe-bottom"></a> 222 226 </div> 223 227 </form> <!-- iframeWrapper --> … … 234 238 </div> <!-- the_footer --> 235 239 236 <script type="text/javascript"src="http://code.jquery.com/jquery-1.9.1.min.js"></script>237 <script type="text/javascript"src="https://cdn.jsdelivr.net/tiptip/1.3/jquery.tipTip.minified.js"></script>238 239 <script type="text/javascript">240 <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> 241 <script src="https://cdn.jsdelivr.net/tiptip/1.3/jquery.tipTip.minified.js"></script> 242 243 <script> 240 244 // global vars 241 245 var cachedMethods = new Array; … … 287 291 $("#methodName").hide(); 288 292 $("#urlForm").hide(); 293 $("#methodDescription blockquote").empty(); 289 294 $("#methodDescription").hide(); 290 295 $("#invokeFrame").attr('src',''); … … 353 358 for (var i=0; i<methods.length; i++) 354 359 { 355 ml += '<li><a href="# ">'+ methods[i]+'</a></li>';360 ml += '<li><a href="#top">'+ methods[i]+'</a></li>'; 356 361 } 357 362 $("#methodsList").html(ml).show(); … … 362 367 $("#methodsList li a").click(function() { 363 368 selectMethod($(this).html()); 364 return false;365 369 }); 366 370 } … … 404 408 $("#methodName").html(method.name).show(); 405 409 410 if (method.options.post_only || method.options.admin_only) { 411 var onlys = '<div class="onlys">'; 412 if (method.options.post_only) { 413 onlys+= 'POST only. '; 414 } 415 if (method.options.admin_only) { 416 onlys+= 'Admin only. '; 417 } 418 onlys+= '</div>'; 419 420 method.description = onlys + method.description; 421 } 422 406 423 if (method.description != "") { 407 424 $("#methodDescription blockquote").html(method.description); 408 425 $("#methodDescription").show(); 409 426 } 427 428 $("#requestFormat").val(method.options.post_only ? 'post' : 'get'); 410 429 411 430 var methodParams = ''; -
trunk/ws.php
r25382 r25394 138 138 'ws_getInfos', 139 139 null, 140 ' <b>Admin only.</b>Returns general informations.',140 'Returns general informations.', 141 141 $ws_functions_root . 'pwg.php', 142 142 array('admin_only'=>true) … … 150 150 'type'=>WS_TYPE_ID), 151 151 ), 152 ' <b>Admin only.</b>Adds elements to the caddie. Returns the number of elements added.',152 'Adds elements to the caddie. Returns the number of elements added.', 153 153 $ws_functions_root . 'pwg.php', 154 154 array('admin_only'=>true) … … 213 213 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), 214 214 ), $f_params), 215 ' <b>Admin only.</b>Returns a list of derivatives to build.',215 'Returns a list of derivatives to build.', 216 216 $ws_functions_root . 'pwg.php', 217 217 array('admin_only'=>true) … … 227 227 'key' => array(), 228 228 ), 229 ' <b>POST only.</b>Adds a comment to an image.',229 'Adds a comment to an image.', 230 230 $ws_functions_root . 'pwg.images.php', 231 231 array('post_only'=>true) … … 284 284 'type'=>WS_TYPE_INT|WS_TYPE_POSITIVE), 285 285 ), 286 ' <b>Admin & POST only.</b>Sets the privacy levels for the images.',286 'Sets the privacy levels for the images.', 287 287 $ws_functions_root . 'pwg.images.php', 288 288 array('admin_only'=>true, 'post_only'=>true) … … 297 297 'rank' => array('type'=>WS_TYPE_INT|WS_TYPE_POSITIVE|WS_TYPE_NOTNULL) 298 298 ), 299 ' <b>Admin & POST only.</b>Sets the rank of a photo for a given album.',299 'Sets the rank of a photo for a given album.', 300 300 $ws_functions_root . 'pwg.images.php', 301 301 array('admin_only'=>true, 'post_only'=>true) … … 309 309 'anonymous_id' => array('default'=>null), 310 310 ), 311 ' <b>Admin & POST only.</b>Deletes all rates for a user.',311 'Deletes all rates for a user.', 312 312 $ws_functions_root . 'pwg.php', 313 313 array('admin_only'=>true, 'post_only'=>true) … … 326 326 'ws_session_login', 327 327 array('username', 'password'), 328 ' <b>POST only.</b>Tries to login the user.',328 'Tries to login the user.', 329 329 $ws_functions_root . 'pwg.php', 330 330 array('post_only'=>true) … … 385 385 'position' => array() 386 386 ), 387 ' <b>Admin & POST only.</b>Add a chunk of a file.',387 'Add a chunk of a file.', 388 388 $ws_functions_root . 'pwg.images.php', 389 389 array('admin_only'=>true, 'post_only'=>true) … … 399 399 'sum' => array(), 400 400 ), 401 ' <b>Admin only.</b>Add or update a file for an existing photo.401 'Add or update a file for an existing photo. 402 402 <br>pwg.images.addChunk must have been called before (maybe several times).', 403 403 $ws_functions_root . 'pwg.images.php', … … 431 431 'type'=>WS_TYPE_ID), 432 432 ), 433 ' <b>Admin only.</b>Add an image.433 'Add an image. 434 434 <br>pwg.images.addChunk must have been called before (maybe several times). 435 435 <br>Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.', … … 456 456 'type'=>WS_TYPE_ID), 457 457 ), 458 ' <b>Admin & POST only.</b>Add an image.458 'Add an image. 459 459 <br>Use the <b>$_FILES[image]</b> field for uploading file. 460 460 <br>Set the form encoding to "form-data". … … 471 471 'pwg_token' => array(), 472 472 ), 473 ' <b>Admin & POST only.</b>Deletes image(s).',473 'Deletes image(s).', 474 474 $ws_functions_root . 'pwg.images.php', 475 475 array('admin_only'=>true, 'post_only'=>true) … … 480 480 'ws_categories_getAdminList', 481 481 null, 482 ' <b>Admin only.</b>',482 'Get albums list as displayed on admin page.', 483 483 $ws_functions_root . 'pwg.categories.php', 484 484 array('admin_only'=>true) … … 500 500 'type'=>WS_TYPE_BOOL), 501 501 ), 502 ' <b>Admin only.</b>Adds an album.',502 'Adds an album.', 503 503 $ws_functions_root . 'pwg.categories.php', 504 504 array('admin_only'=>true) … … 513 513 'pwg_token' => array(), 514 514 ), 515 ' <b>Admin & POST only.</b>Deletes album(s).515 'Deletes album(s). 516 516 <br><b>photo_deletion_mode</b> can be "no_delete" (may create orphan photos), "delete_orphans" 517 517 (default mode, only deletes photos linked to no other album) or "force_delete" (delete all photos, even those linked to other albums)', … … 528 528 'pwg_token' => array(), 529 529 ), 530 ' <b>Admin & POST only.</b>Move album(s).530 'Move album(s). 531 531 <br>Set parent as 0 to move to gallery root. Only virtual categories can be moved.', 532 532 $ws_functions_root . 'pwg.categories.php', … … 541 541 'image_id' => array('type'=>WS_TYPE_ID), 542 542 ), 543 ' <b>Admin & POST only.</b>Sets the representative photo for an album. The photo doesn\'t have to belong to the album.',543 'Sets the representative photo for an album. The photo doesn\'t have to belong to the album.', 544 544 $ws_functions_root . 'pwg.categories.php', 545 545 array('admin_only'=>true, 'post_only'=>true) … … 559 559 'ws_tags_add', 560 560 array('name'), 561 ' <b>Admin only.</b>Adds a new tag.',561 'Adds a new tag.', 562 562 $ws_functions_root . 'pwg.tags.php', 563 563 array('admin_only'=>true) … … 571 571 'filename_list' => array('default'=>null), 572 572 ), 573 ' <b>Admin only.</b>Checks existence of images.573 'Checks existence of images. 574 574 <br>Give <b>md5sum_list</b> if $conf[uniqueness_mode]==md5sum. Give <b>filename_list</b> if $conf[uniqueness_mode]==filename.', 575 575 $ws_functions_root . 'pwg.images.php', … … 586 586 'high_sum' => array('default'=>null), 587 587 ), 588 ' <b>Admin only.</b>Checks if you have updated version of your files for a given photo, the answer can be "missing", "equals" or "differs".588 'Checks if you have updated version of your files for a given photo, the answer can be "missing", "equals" or "differs". 589 589 <br>Don\'t use "thumbnail_sum" and "high_sum", these parameters are here for backward compatibility.', 590 590 $ws_functions_root . 'pwg.images.php', … … 596 596 'ws_images_checkUpload', 597 597 null, 598 ' <b>Admin only.</b>Checks if Piwigo is ready for upload.',598 'Checks if Piwigo is ready for upload.', 599 599 $ws_functions_root . 'pwg.images.php', 600 600 array('admin_only'=>true) … … 621 621 'multiple_value_mode' => array('default'=>'append'), 622 622 ), 623 ' <b>Admin & POST only.</b>Changes properties of an image.623 'Changes properties of an image. 624 624 <br><b>single_value_mode</b> can be "fill_if_empty" (only use the input value if the corresponding values is currently empty) or "replace" 625 625 (overwrite any existing value) and applies to single values properties like name/author/date_creation/comment. … … 637 637 'comment' => array('default'=>null), 638 638 ), 639 ' <b>Admin & POST only.</b>Changes properties of an album.',639 'Changes properties of an album.', 640 640 $ws_functions_root . 'pwg.categories.php', 641 641 array('admin_only'=>true, 'post_only'=>true) … … 646 646 'ws_plugins_getList', 647 647 null, 648 ' <b>Admin only.</b>Gets the list of plugins with id, name, version, state and description.',648 'Gets the list of plugins with id, name, version, state and description.', 649 649 $ws_functions_root . 'pwg.extensions.php', 650 650 array('admin_only'=>true) … … 659 659 'pwg_token' => array(), 660 660 ), 661 '<b>Admin only.</b>',661 null, 662 662 $ws_functions_root . 'pwg.extensions.php', 663 663 array('admin_only'=>true) … … 672 672 'pwg_token' => array(), 673 673 ), 674 '<b>Admin only.</b>',674 null, 675 675 $ws_functions_root . 'pwg.extensions.php', 676 676 array('admin_only'=>true) … … 712 712 'ws_extensions_checkupdates', 713 713 null, 714 ' <b>Admin only.</b>Checks if piwigo or extensions are up to date.',714 'Checks if piwigo or extensions are up to date.', 715 715 $ws_functions_root . 'pwg.extensions.php', 716 716 array('admin_only'=>true) … … 733 733 'info'=>'id, name, nb_users, is_default'), 734 734 ), 735 ' <b>Admin only.</b>Retrieves a list of all groups. The list can be filtered.',735 'Retrieves a list of all groups. The list can be filtered.', 736 736 $ws_functions_root . 'pwg.groups.php', 737 737 array('admin_only'=>true) … … 746 746 'type'=>WS_TYPE_BOOL), 747 747 ), 748 ' <b>Admin & POST only.</b>Creates a group and returns the new group record.',748 'Creates a group and returns the new group record.', 749 749 $ws_functions_root . 'pwg.groups.php', 750 750 array('admin_only'=>true, 'post_only'=>true) … … 759 759 'pwg_token' => array(), 760 760 ), 761 ' <b>Admin & POST only.</b>Deletes a or more groups. Users and photos are not deleted.',761 'Deletes a or more groups. Users and photos are not deleted.', 762 762 $ws_functions_root . 'pwg.groups.php', 763 763 array('admin_only'=>true, 'post_only'=>true) … … 773 773 'type'=>WS_TYPE_BOOL), 774 774 ), 775 ' <b>Admin & POST only.</b>Updates a group. Leave a field blank to keep the current value.',775 'Updates a group. Leave a field blank to keep the current value.', 776 776 $ws_functions_root . 'pwg.groups.php', 777 777 array('admin_only'=>true, 'post_only'=>true) … … 786 786 'type'=>WS_TYPE_ID), 787 787 ), 788 ' <b>Admin only.</b>Adds one or more users to a group.',788 'Adds one or more users to a group.', 789 789 $ws_functions_root . 'pwg.groups.php', 790 790 array('admin_only'=>true, 'post_only'=>true) … … 799 799 'type'=>WS_TYPE_ID), 800 800 ), 801 ' <b>Admin & POST only.</b>Removes one or more users from a group.',801 'Removes one or more users from a group.', 802 802 $ws_functions_root . 'pwg.groups.php', 803 803 array('admin_only'=>true, 'post_only'=>true) … … 829 829 'info'=>'all,basics,none,username,email,status,level,groups,language,theme,nb_image_page,recent_period,expand,show_nb_comments,show_nb_hits,enabled_high'), 830 830 ), 831 ' <b>Admin only.</b>Retrieves a list of all the users.831 'Retrieves a list of all the users. 832 832 <br>"display" controls which data are returned, "basics" stands for "username,email,status,level,groups"', 833 833 $ws_functions_root . 'pwg.users.php', … … 845 845 'send_password_by_mail' => array('default'=>false, 'type'=>WS_TYPE_BOOL), 846 846 ), 847 ' <b>Admin & POST only.</b>Registers a new user.',847 'Registers a new user.', 848 848 $ws_functions_root . 'pwg.users.php', 849 849 array('admin_only'=>true, 'post_only'=>true) … … 858 858 'pwg_token' => array(), 859 859 ), 860 ' <b>Admin & POST only.</b>Deletes on or more users. Photos owned by this user are not deleted.',860 'Deletes on or more users. Photos owned by this user are not deleted.', 861 861 $ws_functions_root . 'pwg.users.php', 862 862 array('admin_only'=>true, 'post_only'=>true) … … 893 893 'type'=>WS_TYPE_BOOL), 894 894 ), 895 ' <b>Admin & POST only.</b>Updates a user. Leave a field blank to keep the current value.895 'Updates a user. Leave a field blank to keep the current value. 896 896 <br>"username", "password" and "email" are ignored if "user_id" is an array.', 897 897 $ws_functions_root . 'pwg.users.php', … … 910 910 'type'=>WS_TYPE_ID), 911 911 ), 912 ' <b>Admin only.</b>Returns permissions: user ids and group ids having access to each album ; this list can be filtered.912 'Returns permissions: user ids and group ids having access to each album ; this list can be filtered. 913 913 <br>Provide only one parameter!', 914 914 $ws_functions_root . 'pwg.permissions.php', … … 929 929 'type'=>WS_TYPE_BOOL), 930 930 ), 931 ' <b>Admin only.</b>Adds permissions to an album.',931 'Adds permissions to an album.', 932 932 $ws_functions_root . 'pwg.permissions.php', 933 933 array('admin_only'=>true, 'post_only'=>true) … … 945 945 'type'=>WS_TYPE_ID), 946 946 ), 947 ' <b>Admin & POST only.</b>Removes permissions from an album.',947 'Removes permissions from an album.', 948 948 $ws_functions_root . 'pwg.permissions.php', 949 949 array('admin_only'=>true, 'post_only'=>true)
Note: See TracChangeset
for help on using the changeset viewer.