Imported code from old repository
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<h5>Public PHP Methods</h5>
|
||||
{% if custom.methods|length > 0 %}
|
||||
<ul class="collapsible popout" data-collapsible="accordion">
|
||||
{% for m in custom.methods %}
|
||||
<li id="method-{{m.name}}">
|
||||
<div class="collapsible-header">
|
||||
<code><strong>{{m.name}}</strong>({{m.params}})</code>
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
{% if m.comment is empty %}
|
||||
<p>No documentation available.</p>
|
||||
{% else %}
|
||||
<p>{{m.comment|nl2br}}</p>
|
||||
{% endif %}
|
||||
|
||||
{% if custom.public_source_code is defined and m.can_run == true %}
|
||||
<form>
|
||||
<div class="padded">
|
||||
<input type="hidden" name="class" value="{{object.id |slice(7)}}" />
|
||||
<input type="hidden" name="method" value="{{m.name}}" />
|
||||
{% for f in m.fields %}
|
||||
<div class="input-field">
|
||||
<input type="text" id="params-{{m.name}}-{{f.name}}" name="p-{{f.name}}" />
|
||||
<label for="params-{{m.name}}-{{f.name}}">{{f.name}}</label>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button type="submit" class="btn">Execute in phpMAE</button>
|
||||
</div>
|
||||
<h6 class="console-response-status"></h6>
|
||||
<div class="padded"><pre class="console-response"></pre></div>
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>This class has no public methods yet or a problem occurred while retrieving them.</p>
|
||||
{% endif %}
|
||||
{% if custom.public_source_code is defined %}
|
||||
<h5>Source Code</h5>
|
||||
<pre class="co-console">{{ custom.public_source_code }}</pre>
|
||||
{% endif %}
|
||||
@@ -0,0 +1,24 @@
|
||||
<h5>Public PHP Methods</h5>
|
||||
{% if custom.methods|length > 0 %}
|
||||
<ul class="collapsible popout" data-collapsible="accordion">
|
||||
{% for m in custom.methods %}
|
||||
<li id="method-{{m.name}}">
|
||||
<div class="collapsible-header">
|
||||
<code><strong>{{m.name}}</strong>({{m.params}})</code>
|
||||
</div>
|
||||
<div class="collapsible-body">
|
||||
{% if m.comment is empty %}
|
||||
<p>No documentation available.</p>
|
||||
{% else %}
|
||||
<p>{{m.comment|nl2br}}</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>This interface has no public methods yet or a problem occurred while retrieving them.</p>
|
||||
{% endif %}
|
||||
<h5>Create Class from Interface (CLI)</h5>
|
||||
<p>With <a href="https://github.com/CloudObjects/phpMAE#installation">phpMAE installed locally</a>, you can create a PHP class that implements this interface with the following command:</p>
|
||||
<pre class="co-console">phpmae class:create --implements={{id}} --confjob <COID></pre>
|
||||
@@ -0,0 +1,40 @@
|
||||
<h5>Whitelisted Classes from Packages</h5>
|
||||
<ul>
|
||||
{% for className in config['coid://phpmae.dev/whitelistsClassname'] %}
|
||||
<li><code>{{ className.o_value }}</code></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
<h5>Defined Packages</h5>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Version</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for package in custom.defined %}
|
||||
<tr>
|
||||
<td><a href="https://packagist.org/packages/{{ package.name }}">{{ package.name }}</a></td>
|
||||
<td>{{ package.version }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
<h5>Actual Installed Packages</h5>
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Version</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for package in custom.actual %}
|
||||
<tr>
|
||||
<td>{% if package.defined %}<strong>{% endif %}<a href="https://packagist.org/packages/{{ package.name }}">{{ package.name }}</a>{% if package.defined %}</strong>{% endif %}</td>
|
||||
<td>{{ package.version }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
@@ -0,0 +1,54 @@
|
||||
$('.collapsible-body form').on('submit', function(event) {
|
||||
event.preventDefault();
|
||||
var form = $(this);
|
||||
form.find('.btn').addClass('disabled');
|
||||
|
||||
var fields = form.serializeArray();
|
||||
var className = "";
|
||||
var method = "";
|
||||
var params = {};
|
||||
for (var f in fields) {
|
||||
switch (fields[f].name) {
|
||||
case "method":
|
||||
method = fields[f].value;
|
||||
break;
|
||||
case "class":
|
||||
className = fields[f].value;
|
||||
break;
|
||||
default:
|
||||
params[fields[f].name.substr(2)] = fields[f].value;
|
||||
}
|
||||
}
|
||||
|
||||
axios.post('https://phpmae.dev/' + className, {
|
||||
jsonrpc : '2.0',
|
||||
id : 'COWebsite',
|
||||
method : method,
|
||||
params : params
|
||||
}).then(function(response) {
|
||||
form.find('.btn').removeClass('disabled');
|
||||
|
||||
if (typeof(response.data) == "object" && response.data.hasOwnProperty('result')) {
|
||||
form.find('.console-response-status').text('Success');
|
||||
form.find('.console-response').text(
|
||||
typeof(response.data.result) == "string" ? response.data.result
|
||||
: JSON.stringify(response.data.result, null, 4));
|
||||
} else
|
||||
if (typeof(response.data) == "object" && !response.data.hasOwnProperty('error')) {
|
||||
form.find('.console-response-status').text('Success');
|
||||
form.find('.console-response').text(JSON.stringify(response.data, null, 4));
|
||||
} else
|
||||
if (typeof(response.data) == "object") {
|
||||
form.find('.console-response-status').text('Error');
|
||||
form.find('.console-response').text(JSON.stringify(response.data.error, null, 4))
|
||||
} else {
|
||||
form.find('.console-response-status').text('Success');
|
||||
form.find('.console-response').text(response.data);
|
||||
}
|
||||
}).catch(function(error) {
|
||||
form.find('.btn').removeClass('disabled');
|
||||
|
||||
form.find('.console-response-status').text('Exception');
|
||||
form.find('.console-response').text(JSON.stringify(error, null, 4))
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user