|
|
|
@ -19,6 +19,11 @@ function block_Update(blockdata) {
|
|
|
|
|
if (blockdata.name == blocks[i].name) {
|
|
|
|
|
blocks[i].name = blockdata.name;
|
|
|
|
|
blocks[i].flags = blockdata.flags;
|
|
|
|
|
blocks[i].lockedby = blockdata.lockedby;
|
|
|
|
|
blocks[i].sensor_pos_1 = blockdata.sensor_pos_1,
|
|
|
|
|
blocks[i].sensor_center = blockdata.sensor_center,
|
|
|
|
|
blocks[i].sensor_neg_1 = blockdata.sensor_neg_1
|
|
|
|
|
blockdetail_setData(blocks[i]);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -27,7 +32,10 @@ function block_Update(blockdata) {
|
|
|
|
|
//debug ("Add Interface:" + intdata.name + "(" + intdata.host + ")");
|
|
|
|
|
blocks.push ({
|
|
|
|
|
name: blockdata.name,
|
|
|
|
|
flags: blockdata.flags
|
|
|
|
|
flags: blockdata.flags,
|
|
|
|
|
sensor_pos_1: blockdata.sensor_pos_1,
|
|
|
|
|
sensor_center: blockdata.sensor_center,
|
|
|
|
|
sensor_neg_1: blockdata.sensor_neg_1
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -63,27 +71,27 @@ function block_contextmenu(name) {
|
|
|
|
|
innerhtml += "<option value=\""+locomotives[i].name+"\">"+locomotives[i].name+"</option>";
|
|
|
|
|
}
|
|
|
|
|
innerhtml += "</select></label><br>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_AsgnLD\" type=\"button\">Assign ⇐⇓</button><br>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_AsgnRU\" type=\"button\">Assign ⇒⇑</button><br>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_SetDLD\" type=\"button\">Go ⇐⇓</button><br>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_SetDRU\" type=\"button\">Go ⇒⇑</button><hr>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_AsgnLU\" type=\"button\">Assign ⇐⇑</button><br>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_AsgnRD\" type=\"button\">Assign ⇒⇓</button><br>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_SetDLU\" type=\"button\">Go ⇐⇑</button><br>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_SetDRD\" type=\"button\">Go ⇒⇓</button><hr>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_Clear\" type=\"button\">Clear</button><br>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_Off\" type=\"button\">Off</button><hr>";
|
|
|
|
|
innerhtml += "<button id=\"contextbox_Close\" type=\"button\">Close</button></center>";
|
|
|
|
|
|
|
|
|
|
gContextmenuCreate(name, innerhtml);
|
|
|
|
|
|
|
|
|
|
gAddEventListener("contextbox_AsgnLD", 'click', block_ctxmenu_AssignLD);
|
|
|
|
|
gAddEventListener("contextbox_AsgnRU", 'click', block_ctxmenu_AssignRU);
|
|
|
|
|
gAddEventListener("contextbox_SetDLD", 'click', block_ctxmenu_DestinationLD);
|
|
|
|
|
gAddEventListener("contextbox_SetDRU", 'click', block_ctxmenu_DestinationRU);
|
|
|
|
|
gAddEventListener("contextbox_AsgnLU", 'click', block_ctxmenu_AssignLU);
|
|
|
|
|
gAddEventListener("contextbox_AsgnRD", 'click', block_ctxmenu_AssignRD);
|
|
|
|
|
gAddEventListener("contextbox_SetDLU", 'click', block_ctxmenu_DestinationLU);
|
|
|
|
|
gAddEventListener("contextbox_SetDRD", 'click', block_ctxmenu_DestinationRD);
|
|
|
|
|
gAddEventListener("contextbox_Clear", 'click', block_ctxmenu_Clear);
|
|
|
|
|
gAddEventListener("contextbox_Off", 'click', block_ctxmenu_Off);
|
|
|
|
|
gAddEventListener("contextbox_Close", 'click', gContextmenuClose);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_ctxmenu_DestinationLD (element, value) {
|
|
|
|
|
function block_ctxmenu_DestinationLU (element, value) {
|
|
|
|
|
let loc = document.getElementById("contextbox_loc");
|
|
|
|
|
if (loc) {
|
|
|
|
|
locomotive_server_Dest(loc.value, element.name, 1);
|
|
|
|
@ -92,7 +100,7 @@ function block_ctxmenu_DestinationLD (element, value) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_ctxmenu_DestinationRU (element, value) {
|
|
|
|
|
function block_ctxmenu_DestinationRD (element, value) {
|
|
|
|
|
let loc = document.getElementById("contextbox_loc");
|
|
|
|
|
if (loc) {
|
|
|
|
|
locomotive_server_Dest(loc.value, element.name, 0);
|
|
|
|
@ -101,7 +109,7 @@ function block_ctxmenu_DestinationRU (element, value) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_ctxmenu_AssignLD (element, value) {
|
|
|
|
|
function block_ctxmenu_AssignLU (element, value) {
|
|
|
|
|
let loc = document.getElementById("contextbox_loc");
|
|
|
|
|
let name = document.getElementById("ConextMenuHead").innerHTML;
|
|
|
|
|
if (loc) {
|
|
|
|
@ -111,7 +119,7 @@ function block_ctxmenu_AssignLD (element, value) {
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_ctxmenu_AssignRU (element, value) {
|
|
|
|
|
function block_ctxmenu_AssignRD (element, value) {
|
|
|
|
|
let loc = document.getElementById("contextbox_loc");
|
|
|
|
|
let name = document.getElementById("ConextMenuHead").innerHTML;
|
|
|
|
|
if (loc) {
|
|
|
|
@ -175,12 +183,7 @@ function block_server_Off(blockname) {
|
|
|
|
|
// if create is set the name should be filled in
|
|
|
|
|
function blockdetail_show(name, create) {
|
|
|
|
|
var win = document.getElementById("blockdetail");
|
|
|
|
|
|
|
|
|
|
debug ("blockdetail_show");
|
|
|
|
|
|
|
|
|
|
if (!win) {
|
|
|
|
|
debug ("blockdetail_show create window");
|
|
|
|
|
win = gWindowCreate("blockdetail", "Block", 400, 300, " \
|
|
|
|
|
let innerHTML = " \
|
|
|
|
|
<div style=\"float: left\"> \
|
|
|
|
|
Block Name: <input id=\"blockdet_name\" style=\"width: 100\"> \
|
|
|
|
|
</div> <div style=\"float: right\"> \
|
|
|
|
@ -188,15 +191,59 @@ function blockdetail_show(name, create) {
|
|
|
|
|
<button id=\"blockdet_NEXT\">></button> \
|
|
|
|
|
</div><br><hr>\
|
|
|
|
|
<div>\
|
|
|
|
|
<table><tr><td><table>\
|
|
|
|
|
</td></tr></table> </div> <hr>\
|
|
|
|
|
\
|
|
|
|
|
<table><tr><td>\
|
|
|
|
|
\
|
|
|
|
|
<table><tr><td> \
|
|
|
|
|
<label><input id=\"blockdet_flagoff\" type=\"checkbox\" value=\"\" disabled>Off Service</label><br> \
|
|
|
|
|
<label><input id=\"blockdet_flagshort\" type=\"checkbox\" value=\"\">Short</label><br>\
|
|
|
|
|
<label><input id=\"blockdet_flaglong\" type=\"checkbox\" value=\"\">Long</label> \
|
|
|
|
|
</td><td> \
|
|
|
|
|
<label><input id=\"blockdet_flagend\" type=\"checkbox\" value=\"\">End</label><br> \
|
|
|
|
|
<label><input id=\"blockdet_flagspeedlimit\" type=\"checkbox\" value=\"\">Speed Limit</label><br> \
|
|
|
|
|
</td></tr></table> \
|
|
|
|
|
\
|
|
|
|
|
</td><td></td></tr></table> \
|
|
|
|
|
<fieldset><legend>Automatic Mode</legend><table> \
|
|
|
|
|
<tr><td>Lockedby:</td><td><input id=\"blockdet_lockedby\" style=\"width: 100\" disabled></td></tr>\
|
|
|
|
|
<tr><td>Sensor ←↑:</td><td><label><select id=\"blockdet_sensorLU\">";
|
|
|
|
|
innerHTML += "<option value=\"\"></option>";
|
|
|
|
|
for (var i = 0; i < sensors.length; i++) {
|
|
|
|
|
if (sensors[i].name)
|
|
|
|
|
innerHTML += "<option value=\""+sensors[i].name+"\">"+sensors[i].name+"</option>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
innerHTML += "</select></label></td></tr>\
|
|
|
|
|
<tr><td>Sensor Center:</td><td><label><select id=\"blockdet_sensorC\">";
|
|
|
|
|
innerHTML += "<option value=\"\"></option>";
|
|
|
|
|
for (var i = 0; i < sensors.length; i++) {
|
|
|
|
|
if (sensors[i].name)
|
|
|
|
|
innerHTML += "<option value=\""+sensors[i].name+"\">"+sensors[i].name+"</option>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
innerHTML += "</select></label></td></tr>\
|
|
|
|
|
<tr><td>Sensor →↓:</td><td><label><select id=\"blockdet_sensorRD\">";
|
|
|
|
|
innerHTML += "<option value=\"\"></option>";
|
|
|
|
|
for (var i = 0; i < sensors.length; i++) {
|
|
|
|
|
if (sensors[i].name)
|
|
|
|
|
innerHTML += "<option value=\""+sensors[i].name+"\">"+sensors[i].name+"</option>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
innerHTML += "</select></label></td></tr>\
|
|
|
|
|
</table></fileset>\
|
|
|
|
|
</div> <hr>\
|
|
|
|
|
<div align=right> \
|
|
|
|
|
<button id=\"blockdet_SAVE\" type=\"button\">Save</button> \
|
|
|
|
|
<button id=\"blockdet_DELETE\" type=\"button\">Delete</button> \
|
|
|
|
|
<button id=\"blockdet_CLOSE\">Close</button> \
|
|
|
|
|
</div> \
|
|
|
|
|
\
|
|
|
|
|
");
|
|
|
|
|
";
|
|
|
|
|
debug ("blockdetail_show");
|
|
|
|
|
|
|
|
|
|
if (!win) {
|
|
|
|
|
debug ("blockdetail_show create window");
|
|
|
|
|
win = gWindowCreate("blockdetail", "Block", 450, 300, innerHTML);
|
|
|
|
|
|
|
|
|
|
gAddEventListener("blockdet_CLOSE", 'click', blockdetail_cb_close);
|
|
|
|
|
gAddEventListener("blockdet_DELETE", 'click', blockdetail_cb_delete);
|
|
|
|
@ -301,11 +348,25 @@ function blockdetail_cb_prev () {
|
|
|
|
|
//
|
|
|
|
|
function blockdetail_setData(elm) {
|
|
|
|
|
var name = document.getElementById("blockdet_name");
|
|
|
|
|
var flags = document.getElementById("blockdet_flags");
|
|
|
|
|
var flagoff = document.getElementById("blockdet_flagoff");
|
|
|
|
|
var flagshort = document.getElementById("blockdet_flagshort");
|
|
|
|
|
var flaglong = document.getElementById("blockdet_flaglong");
|
|
|
|
|
var flagend = document.getElementById("blockdet_flagend");
|
|
|
|
|
var flagspeedlimit = document.getElementById("blockdet_flagspeedlimit");
|
|
|
|
|
var sensorLU = document.getElementById("blockdet_sensorLU");
|
|
|
|
|
var sensorC = document.getElementById("blockdet_sensorC");
|
|
|
|
|
var sensorRD = document.getElementById("blockdet_sensorRD");
|
|
|
|
|
|
|
|
|
|
if (elm) {
|
|
|
|
|
if (name) name.value = elm.name;
|
|
|
|
|
if (flags) flags.value = elm.flags;
|
|
|
|
|
if (flagoff) flagoff.checked = Number(elm.flags) & BLOCK_F_OFF;
|
|
|
|
|
if (flagshort) flagshort.checked = Number(elm.flags) & BLOCK_F_SHORT;
|
|
|
|
|
if (flaglong) flaglong.checked = Number(elm.flags) & BLOCK_F_LONG;
|
|
|
|
|
if (flagend) flagend.checked = Number(elm.flags) & BLOCK_F_ENDSTATION;
|
|
|
|
|
if (flagspeedlimit) flagspeedlimit.checked = Number(elm.flags) & BLOCK_F_SPEEDLIMIT;
|
|
|
|
|
if (sensorLU) sensorLU.value = elm.sensor_pos_1;
|
|
|
|
|
if (sensorC) sensorC.value = elm.sensor_center;
|
|
|
|
|
if (sensorRD) sensorRD.value = elm.sensor_neg_1;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
@ -317,11 +378,24 @@ function blockdetail_setData(elm) {
|
|
|
|
|
function blockdetail_getData() {
|
|
|
|
|
var res = { name: "", flags:0 };
|
|
|
|
|
var name = document.getElementById("blockdet_name");
|
|
|
|
|
var flags = document.getElementById("blockdet_flags");
|
|
|
|
|
var flagoff = document.getElementById("blockdet_flagoff");
|
|
|
|
|
var flagshort = document.getElementById("blockdet_flagshort");
|
|
|
|
|
var flaglong = document.getElementById("blockdet_flaglong");
|
|
|
|
|
var flagend = document.getElementById("blockdet_flagend");
|
|
|
|
|
var flagspeedlimit = document.getElementById("blockdet_flagspeedlimit");
|
|
|
|
|
var sensorLU = document.getElementById("blockdet_sensorLU");
|
|
|
|
|
var sensorC = document.getElementById("blockdet_sensorC");
|
|
|
|
|
var sensorRD = document.getElementById("blockdet_sensorRD");
|
|
|
|
|
|
|
|
|
|
if (name) res.name = name.value;
|
|
|
|
|
if (flags) res.flags = flags.value;
|
|
|
|
|
|
|
|
|
|
if (flagoff.checked) res.flags |= BLOCK_F_OFF;
|
|
|
|
|
if (flagshort.checked) res.flags |= BLOCK_F_SHORT;
|
|
|
|
|
if (flaglong.checked) res.flags |= BLOCK_F_LONG;
|
|
|
|
|
if (flagend.checked) res.flags |= BLOCK_F_ENDSTATION;
|
|
|
|
|
if (flagspeedlimit.checked) res.flags |= BLOCK_F_SPEEDLIMIT;
|
|
|
|
|
if (sensorLU) res.sensor_pos_1 = sensorLU.value;
|
|
|
|
|
if (sensorC) res.sensor_center = sensorC.value;
|
|
|
|
|
if (sensorRD) res.sensor_neg_1 = sensorRD.value;
|
|
|
|
|
return res;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|