openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

index.php (2701B)


      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>