File api/index.php

Last commit: Sat Jun 25 01:09:29 2022 +0200	Jan Dankert	Refactoring: /api/web -> /api
1 <html> 2 <head> 3 <title>OpenRat CMS API</title> 4 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 5 <meta charset="utf-8"> 6 <meta name="robots" content="noindex,nofollow" > 7 </head> 8 <body> 9 <h1>CMS API</h1> 10 11 <p>A web interface for communicating with the CMS API.</p> 12 <hr> 13 <form action=".."> 14 <table> 15 <tr> 16 <th>Parameter</th><th>Value</th> 17 </tr> 18 <tr> 19 <td>Action</td> 20 <td><select name="action"> 21 <?php foreach( array( 22 'Alias','Configuration','Element','File','Folder','Group','Grouplist','Image','Language','Languagelist','Link','Login','Model','Modellist','Object','Page','Pageelement','Profile','Project','Projectlist','Search','Start','Template','Templatelist','Text','Url','User','Usergroup','Userlist') as $type ) { ?> 23 <option value="<?php echo strtolower($type) ?>"><?php echo $type ?></option> 24 <?php } ?> 25 </select> 26 </td> 27 </tr> 28 <tr> 29 <td>Method</td> 30 <td><input name="subaction" value="" placeholder="info" size="10" required="required"/> 31 </td> 32 </tr> 33 <tr> 34 <td>Id</td> 35 <td><input name="id" value="" placeholder="1" size="10" required="required"></td> 36 </tr> 37 38 <?php for( $i=1; $i<=5; $i++ ) { ?> 39 <tr> 40 <td><input class="dyn name" data-nr="<?php echo $i ?>" name="param-<?php echo $i ?>" value="" size="15"></td> 41 <td><input class="dyn value" data-nr="<?php echo $i ?>" name="value-<?php echo $i ?>" value="" size="50"></td> 42 </tr> 43 <?php } ?> 44 </table><br> 45 46 47 <select name="method"> 48 <option value="GET">GET</option> 49 <option value="POST">POST</option> 50 </select> 51 52 <select name="output"> 53 <?php foreach( array('JSON','XML','YAML','HTML','PLAIN',) as $type ) { ?> 54 <option value="<?php echo strtolower($type) ?>"><?php echo $type ?></option> 55 <?php } ?> 56 </select> 57 58 <hr><br /> 59 <input type="reset" /> <input type="submit" style="font-weight: bold" /> 60 61 </form> 62 63 <script type="text/javascript" src="../../modules/cms/ui/themes/default/script/jquery.min.js"></script> 64 <script type="text/javascript"> 65 66 $form = $("form"); 67 68 window.onload = function() { 69 $('.dyn').removeAttr('disabled'); 70 }; 71 window.onunload = function(){}; 72 73 $form.submit( function(e) { 74 $form.attr('method',$('select[name=method]').val() ); 75 $('input[type=hidden]').remove(); 76 $('input.dyn.name').each( function(e) { 77 $inputName = $(this); 78 let nr = $inputName.data('nr'); 79 $inputValue = $('.dyn.value[data-nr='+nr+']'); 80 81 let $hiddenInput = $('<input>'); 82 $hiddenInput.attr('type','hidden' ); 83 $hiddenInput.attr('name' ,$(this).val() ); 84 $hiddenInput.attr('value',$inputValue.val() ); 85 86 $inputName.attr('disabled','disabled'); 87 $inputValue.attr('disabled','disabled'); 88 $form.append( $hiddenInput ); 89 }); 90 // now the form is submitted. 91 } ); 92 </script> 93 94 </body> 95 </html>
Download api/index.php
History Sat, 25 Jun 2022 01:09:29 +0200 Jan Dankert Refactoring: /api/web -> /api Sun, 30 Jan 2022 23:38:42 +0100 dankert Refactoring: Only 1 http-endpoint for both the UI and the API. Path "/api" is not available any more, all API data is served under "/". Sun, 27 Sep 2020 00:48:43 +0200 Jan Dankert Fix: Treeaction is an UI action, so ist is not available via the API. Now there is an ugly workaround for that, we have to create a template for this calls. Sat, 26 Sep 2020 01:41:20 +0200 Jan Dankert Refactoring: Removing old require.php files. With class autoloading, they are not necessary any more. Sun, 23 Feb 2020 04:49:34 +0100 Jan Dankert Refactoring with Namespaces for the cms modules, part 2. Sat, 22 Feb 2020 01:58:20 +0100 Jan Dankert New: Autoloading of classes in all modules. Thu, 24 Oct 2019 21:29:55 +0200 Jan Dankert Fix: Keep trailing Slash for Cookie path. Sun, 9 Dec 2018 23:33:51 +0100 Jan Dankert Bei API-Fehlern auch Status 500 setzen Fri, 13 Jul 2018 00:50:32 +0200 Jan Dankert Das Setzen des Cookies vereinheitlicht, der Cookie-Pfad ist nun immer der gleiche, egal ob UI- oder API-Request. Formulare erhalten das Attribut 'target', abhängig davon, ob das Formular per AJAX abgeschickt wird oder direkt die gesamte Seite neu lädt. Wed, 4 Jul 2018 01:09:48 +0200 Jan Dankert Exceptions vollständig ausgeben. Sat, 30 Dec 2017 01:10:23 +0100 Jan Dankert Schreibzugriffe aus dem HTML-UI sollen die API aufrufen. Die API ist jetzt auch soweit wieder funktionsfähig. Insgesamt noch weiter aufgeräumt und nach Modulen unterteilt. Fri, 29 Dec 2017 01:35:50 +0100 Jan Dankert Großes Refactoring: Neues Modul CMS-UI. Dieses enthält sämtliche Logik für die Bedienoberfläche. TODO: Modul CMS-API.