mirror of
https://github.com/Hopiu/webapi-eca.git
synced 2026-04-25 17:14:49 +00:00
66 lines
No EOL
1.7 KiB
HTML
66 lines
No EOL
1.7 KiB
HTML
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>Forge A Rule</title>
|
|
{{{head_requires}}}
|
|
</head>
|
|
<body>
|
|
{{{div_menubar}}}
|
|
<div id="mainbody">
|
|
<div id="pagetitle">Hi {{user.username}}, forge your own rules!</div>
|
|
<p>
|
|
<div id="div_left">
|
|
<textarea id="textarea_module" rows="20" cols="100"> </textarea>
|
|
<p>
|
|
<button id="but_submit">save</button>
|
|
</p>
|
|
</div>
|
|
<div id="div_right">
|
|
<p><b>Available Event Modules:</b></p>
|
|
<ul> </ul>
|
|
</div>
|
|
</p>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
$('#but_submit').click(function() {
|
|
var obj = {
|
|
command : 'store_rule',
|
|
data: $('#textarea_event').val()
|
|
};
|
|
$.post('/usercommand', obj)
|
|
.done(function(data) {
|
|
alert(data);
|
|
})
|
|
.fail(function(err) {
|
|
console.log(err);
|
|
alert('Posting of rule failed: ' + err.responseText);
|
|
});
|
|
});
|
|
$.post('/usercommand', { command: 'get_actionmodules' })
|
|
.done(function(data) {
|
|
for(var el in data) {
|
|
|
|
}
|
|
});
|
|
$.post('/usercommand', { command: 'get_eventmodules' })
|
|
.done(function(data) {
|
|
for(var mod in data) {
|
|
var mthds = data[mod].methods;
|
|
if(mthds) {
|
|
var arr = mthds.split(',');
|
|
for(var i = 0; i < arr.length; i++) {
|
|
$('#div_right ul').append($('<li>').text(mod + '->' + arr[i]));
|
|
}
|
|
}
|
|
}
|
|
});
|
|
$('#input_event').focus(function() {
|
|
$('#radio_input').prop('checked', true);
|
|
});
|
|
$('#select_event').focus(function() {
|
|
$('#radio_select').prop('checked', true);
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |