added space for the cron extended editor
This commit is contained in:
parent
4202b5348b
commit
64e19c892f
|
|
@ -7,78 +7,10 @@
|
|||
<link rel="stylesheet" href="res/iconsfont.css">
|
||||
<script src="res/main.js"></script>
|
||||
<script src="res/res.js"></script>
|
||||
<script src="res/cron.js"></script>
|
||||
<title>~name~</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
objects_test = ["scene_1","scene_2","scene_3","scene_4","scene_5","scene_6","scene_7","scene_8","scene_9","scene_10","scene_11","scene_12","scene_13","scene_14","scene_15","scene_16"];
|
||||
actions_test = ["start", "stop"];
|
||||
timarr_test = [{'num':1, 'obj':2, 'act':0, 'start':1000000000,'cron':'*/2 * * * * *'},
|
||||
{'num':2, 'obj':12,'act':1, 'start':1622222222,'cron':'6 0 12 * * *'},
|
||||
{'num':3, 'obj':8,'act':0, 'start':1675757575,'cron':'* * * * * *'}];
|
||||
function savetm(n)
|
||||
{
|
||||
|
||||
}
|
||||
function deltm(n)
|
||||
{
|
||||
alert("Delete timer "+n);
|
||||
timarr_test.splice(n-1,1);
|
||||
drawtimers(timarr_test);
|
||||
}
|
||||
function setcron(n)
|
||||
{
|
||||
|
||||
}
|
||||
function drawtimers(tarr)
|
||||
{
|
||||
var num = tarr.length;
|
||||
var target = document.getElementById("timer");
|
||||
var content = "";
|
||||
for (i = 1; i<=num; i++)
|
||||
{
|
||||
content +=("<div class=\"timer\">");
|
||||
content +=("<label class=\"tmlab\">Timer "+i+"</label>");
|
||||
content +=("<div class=\"timerrec\">");
|
||||
|
||||
content +=("<div class=\"nowrap\">");
|
||||
//content +=("<label for=\"cron"+i+"\">Cron string:</label>");
|
||||
content +=("<input type=\"text\" id=\"cron"+i+"\" value=\""+tarr[i-1].cron+"\"></input>");
|
||||
content +=("<button class=\"tmbtn btn\" type=\"button\" onclick=\"setcron("+i+")\">Set cron</button></div></div>")
|
||||
|
||||
|
||||
content +=("<input class=\"tmpick\" type=\"datetime-local\" value=\""+UnixToStr(tarr[i-1].start,10,1)+"\"></input>");
|
||||
content +=("<select id=\"action\">");
|
||||
for (k = 0; k < actions_test.length; k++){
|
||||
var selected = (tarr[i-1].act == k)?"selected":"";
|
||||
content +=("<option value=\""+(k+1)+"\" "+selected+">"+actions_test[k]+"</option>");}
|
||||
content +=("</select>");
|
||||
|
||||
content +=("<select id=\"object\">");
|
||||
for (k = 0; k < objects_test.length; k++){
|
||||
var selected = (tarr[i-1].obj == k)?"selected":"";
|
||||
content +=("<option value=\""+(k+1)+"\" "+selected+">"+objects_test[k]+"</option>");}
|
||||
content +=("</select>");
|
||||
|
||||
|
||||
content +=("<button class=\"btn\" type=\"button\" onclick=\"savetm("+i+")\">Save</button>");
|
||||
content +=("<button class=\"btn\" type=\"button\" onclick=\"deltm("+i+")\">Delete</button>");
|
||||
|
||||
content +=("</div>");
|
||||
target.innerHTML = content;
|
||||
}
|
||||
}
|
||||
function applytm()
|
||||
{
|
||||
|
||||
}
|
||||
function addtm()
|
||||
{
|
||||
var num = timarr_test.length + 1;
|
||||
timarr_test.push({'num':num,'start':1500000000,'cron':'* * * * * *'});
|
||||
drawtimers(timarr_test);
|
||||
}
|
||||
</script>
|
||||
<script>PageSurround();</script>
|
||||
<!--========== CONTENTS ==========-->
|
||||
<main>
|
||||
|
|
@ -88,14 +20,11 @@
|
|||
<div class="mlpc">
|
||||
<form name="tmr" method="post">
|
||||
<div class="mlhdr">TIMER</div>
|
||||
|
||||
<div class="container">
|
||||
<div id="timer"></div>
|
||||
</div>
|
||||
|
||||
<button type="button" class ='btn' id='bt1' onclick="applytm()">Apply</button>
|
||||
<button type="button" class ='btn' id='bt2' onclick="addtm()">Add new timer</button>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ reboot.html
|
|||
res
|
||||
res/appstyles.css
|
||||
res/ca_cert.pem
|
||||
res/cron.js
|
||||
res/iconsfont.css
|
||||
res/iconsfont.woff2
|
||||
res/logo.png
|
||||
|
|
|
|||
78
HTML/res/cron.js
Normal file
78
HTML/res/cron.js
Normal file
|
|
@ -0,0 +1,78 @@
|
|||
objects_test = ["scene_1","scene_2","scene_3","scene_4","scene_5","scene_6","scene_7","scene_8","scene_9","scene_10","scene_11","scene_12","scene_13","scene_14","scene_15","scene_16"];
|
||||
actions_test = ["start", "stop"];
|
||||
timarr_test = [{'num':1, 'obj':2, 'act':0, 'start':1000000000,'cron':'*/2 * * * * *'},
|
||||
{'num':2, 'obj':12,'act':1, 'start':1622222222,'cron':'6 0 12 * * *'},
|
||||
{'num':3, 'obj':8,'act':0, 'start':1675757575,'cron':'* * * * * *'}];
|
||||
function savetm(n)
|
||||
{
|
||||
|
||||
}
|
||||
function deltm(n)
|
||||
{
|
||||
alert("Delete timer "+n);
|
||||
timarr_test.splice(n-1,1);
|
||||
drawtimers(timarr_test);
|
||||
}
|
||||
function closecron(n)
|
||||
{
|
||||
var target = document.getElementById("cronext"+n);
|
||||
var content = "";
|
||||
target.innerHTML = content;
|
||||
}
|
||||
function setcron(n)
|
||||
{
|
||||
var target = document.getElementById("cronext"+n);
|
||||
var content = "";
|
||||
content +=("<p>Here extebnded cron editor</p>");
|
||||
content +=("<button class=\"btn\" type=\"button\" onclick=\"closecron("+n+")\">Ready</button>");
|
||||
target.innerHTML = content;
|
||||
}
|
||||
function drawtimers(tarr)
|
||||
{
|
||||
var num = tarr.length;
|
||||
var target = document.getElementById("timer");
|
||||
var content = "";
|
||||
for (i = 1; i<=num; i++)
|
||||
{
|
||||
content +=("<div class=\"timer\">");
|
||||
content +=("<label class=\"tmlab\">Timer "+i+"</label>");
|
||||
content +=("<div class=\"timerrec\">");
|
||||
|
||||
content +=("<div class=\"nowrap\">");
|
||||
//content +=("<label for=\"cron"+i+"\">Cron string:</label>");
|
||||
content +=("<input type=\"text\" id=\"cron"+i+"\" value=\""+tarr[i-1].cron+"\"></input>");
|
||||
content +=("<button class=\"tmbtn btn\" type=\"button\" onclick=\"setcron("+i+")\">Set cron</button></div></div>")
|
||||
|
||||
content +=("<div id=\"cronext"+i+"\"></div>");
|
||||
|
||||
content +=("<input class=\"tmpick\" type=\"datetime-local\" value=\""+UnixToStr(tarr[i-1].start,10,1)+"\"></input>");
|
||||
content +=("<select id=\"action\">");
|
||||
for (k = 0; k < actions_test.length; k++){
|
||||
var selected = (tarr[i-1].act == k)?"selected":"";
|
||||
content +=("<option value=\""+(k+1)+"\" "+selected+">"+actions_test[k]+"</option>");}
|
||||
content +=("</select>");
|
||||
|
||||
content +=("<select id=\"object\">");
|
||||
for (k = 0; k < objects_test.length; k++){
|
||||
var selected = (tarr[i-1].obj == k)?"selected":"";
|
||||
content +=("<option value=\""+(k+1)+"\" "+selected+">"+objects_test[k]+"</option>");}
|
||||
content +=("</select>");
|
||||
|
||||
|
||||
content +=("<button class=\"btn\" type=\"button\" onclick=\"savetm("+i+")\">Save</button>");
|
||||
content +=("<button class=\"btn\" type=\"button\" onclick=\"deltm("+i+")\">Delete</button>");
|
||||
|
||||
content +=("</div>");
|
||||
target.innerHTML = content;
|
||||
}
|
||||
}
|
||||
function applytm()
|
||||
{
|
||||
|
||||
}
|
||||
function addtm()
|
||||
{
|
||||
var num = timarr_test.length + 1;
|
||||
timarr_test.push({'num':num,'start':1500000000,'cron':'* * * * * *'});
|
||||
drawtimers(timarr_test);
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user