Skip to content

Added form to load raml file or url inside the index.phtml #20

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions config.php
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<?php

// Source of Your RAML file (local or http)
$RAMLsource = 'raml/twitter.raml';

// Types of Action Verbs Allowed
$RAMLactionVerbs = array('get', 'post', 'put', 'patch', 'delete', 'connect', 'trace');

// APC Cache Time Limit - set to "0" to disable
$cacheTimeLimit = '36000';

// Path to the theme file for the docs
$docsTheme = 'templates/grey/index.phtml';
$docsTheme = 'templates/orange/index.phtml';

// Enable Try It (alpha)
$tryIt = false;
Expand Down
17 changes: 17 additions & 0 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,23 @@
* @license http://www.gnu.org/licenses/gpl-2.0.html GPL v2
*/

if (!empty($_FILES)){
apc_delete('RAMLsource');
$RAMLsource=$_FILES['name']['tmp_name'];
apc_store('RAMLsource' , $RAMLsource);

}

if (isset($_POST["name"])) {
apc_delete('RAMLsource');
$RAMLsource = $_POST["name"];
apc_store('RAMLsource' , $RAMLsource);

} else {
$RAMLsource = apc_fetch('RAMLsource' );
}


require_once('inc/spyc.php');
require_once('inc/ramlDataObject.php');
require_once('inc/raml.php');
Expand Down
14 changes: 14 additions & 0 deletions templates/grey/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,20 @@
<p>version <?php echo $RAML->get('version'); ?> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <?php echo $RAML->get('baseUri'); ?></p>
</header>

<div id="container">
<article><h2>
Introduce your RAML file location
<form enctype="multipart/form-data" action="index.php" method="POST">
File: <br/><input name="name" type="file" size=100/>
<input type="submit" value="Send" />
</form>
<form enctype="multipart/form-data" action="index.php" method="POST">
URL: <input name="name" type="text" size=100/>
<input type="submit" value="Send" />
</form>
</h2>
</article>
</div>

<div id="container">

Expand Down
14 changes: 12 additions & 2 deletions templates/orange/index.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -250,13 +250,13 @@ ul.verbs li {
</head>

<body>

<div class="container">

<header>
<h1><a href="<?php echo $_SERVER['PHP_SELF']; ?>"><?php echo $RAML->get('title'); ?></a></h1>
<span>version <?php echo $RAML->get('version'); ?></span><span style="margin-left: 40px;"><?php echo $RAML->get('baseUri'); ?></span>
</header>

<nav>
<?php
include('_menu.phtml');
Expand Down Expand Up @@ -285,7 +285,17 @@ ul.verbs li {
endif;
?>


<h3>
Introduce your RAML file location
<form enctype="multipart/form-data" action="index.php" method="POST">
File: <br/><input name="name" type="file" size=100/>
<input type="submit" value="Send" />
</form>
<form enctype="multipart/form-data" action="index.php" method="POST">
URL: <input name="name" type="text" size=100/>
<input type="submit" value="Send" />
</form>
</h3>
<?php
if ($validPath && $RAML->path()->getVerbs() && !$RAML->getCurrentAction()):
include('_verbs.phtml');
Expand Down