|
|
@ -47,54 +47,78 @@ function block_Delete(name) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_contextmenu(name) {
|
|
|
|
function block_contextmenu(name) {
|
|
|
|
gContextmenuCreate(name);
|
|
|
|
let innerhtml = "";
|
|
|
|
|
|
|
|
|
|
|
|
gContextmenuAdd("Locomotives", 0, 0);
|
|
|
|
innerhtml = "<center><label><select id=\"contextbox_loc\">";
|
|
|
|
|
|
|
|
innerhtml += "<option value=\"\"></option>";
|
|
|
|
for (var i = 0; i < locomotives.length; i++) {
|
|
|
|
for (var i = 0; i < locomotives.length; i++) {
|
|
|
|
if (locomotives[i].name)
|
|
|
|
if (locomotives[i].name)
|
|
|
|
gContextmenuAdd(locomotives[i].name, block_ctxmenu_LocoSelect, locomotives[i].name);
|
|
|
|
innerhtml += "<option value=\""+locomotives[i].name+"\">"+locomotives[i].name+"</option>";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
gContextmenuAdd("", 0, 0);
|
|
|
|
innerhtml += "</select></label><br>";
|
|
|
|
gContextmenuAdd("Set DestinationFWD", block_ctxmenu_LocoDestinationFWD, 0);
|
|
|
|
innerhtml += "<button id=\"contextbox_AsgnLD\" type=\"button\">Assign ⇐⇓</button><br>";
|
|
|
|
gContextmenuAdd("Set DestinationREV", block_ctxmenu_LocoDestinationREV, 0);
|
|
|
|
innerhtml += "<button id=\"contextbox_AsgnRU\" type=\"button\">Assign ⇒⇑</button><br>";
|
|
|
|
gContextmenuAdd("", 0, 0);
|
|
|
|
innerhtml += "<button id=\"contextbox_SetDLD\" type=\"button\">Go ⇐⇓</button><br>";
|
|
|
|
gContextmenuAdd("AssignFWD", block_ctxmenu_LocoAssignFWD, 0);
|
|
|
|
innerhtml += "<button id=\"contextbox_SetDRU\" type=\"button\">Go ⇒⇑</button><hr>";
|
|
|
|
gContextmenuAdd("AssignREV", block_ctxmenu_LocoAssignREV, 0);
|
|
|
|
innerhtml += "<button id=\"contextbox_Clear\" type=\"button\">Clear</button><br>";
|
|
|
|
gContextmenuAdd("", 0, 0);
|
|
|
|
innerhtml += "<button id=\"contextbox_Off\" type=\"button\">Off</button><hr>";
|
|
|
|
gContextmenuAdd("Clear", block_ctxmenu_Clear, 0);
|
|
|
|
innerhtml += "<button id=\"contextbox_Close\" type=\"button\">Close</button></center>";
|
|
|
|
gContextmenuAdd("Offservice", block_ctxmenu_Clear, 1);
|
|
|
|
|
|
|
|
|
|
|
|
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_Clear", 'click', block_ctxmenu_Clear);
|
|
|
|
|
|
|
|
gAddEventListener("contextbox_Off", 'click', block_ctxmenu_Off);
|
|
|
|
|
|
|
|
gAddEventListener("contextbox_Close", 'click', gContextmenuClose);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_ctxmenu_LocoSelect (element, value) {
|
|
|
|
function block_ctxmenu_DestinationLD (element, value) {
|
|
|
|
alert ("LocoSelect:" + value);
|
|
|
|
let loc = document.getElementById("contextbox_loc");
|
|
|
|
};
|
|
|
|
if (loc) {
|
|
|
|
|
|
|
|
locomotive_server_Dest(loc.value, element.name, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
function block_ctxmenu_LocoDestinationFWD (element, value) {
|
|
|
|
|
|
|
|
alert ("DestinationFWD:" + value);
|
|
|
|
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_ctxmenu_LocoDestinationREV (element, value) {
|
|
|
|
function block_ctxmenu_DestinationRU (element, value) {
|
|
|
|
alert ("DestinationREV:" + value);
|
|
|
|
let loc = document.getElementById("contextbox_loc");
|
|
|
|
|
|
|
|
if (loc) {
|
|
|
|
|
|
|
|
locomotive_server_Dest(loc.value, element.name, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gContextmenuClose();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_ctxmenu_LocoAssignFWD (element, value) {
|
|
|
|
function block_ctxmenu_AssignLD (element, value) {
|
|
|
|
alert ("AssignFWD:" + value);
|
|
|
|
let loc = document.getElementById("contextbox_loc");
|
|
|
|
|
|
|
|
if (loc) {
|
|
|
|
|
|
|
|
locomotive_server_Assign(loc.value, element.name, 1);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gContextmenuClose();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_ctxmenu_LocoAssignREV (element, value) {
|
|
|
|
function block_ctxmenu_AssignRU (element, value) {
|
|
|
|
alert ("AssignREV:" + value);
|
|
|
|
let loc = document.getElementById("contextbox_loc");
|
|
|
|
|
|
|
|
if (loc) {
|
|
|
|
|
|
|
|
locomotive_server_Assign(loc.value, element.name, 0);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
gContextmenuClose();
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_ctxmenu_Clear (element, value) {
|
|
|
|
function block_ctxmenu_Clear (element, value) {
|
|
|
|
// value == 0 ... clear
|
|
|
|
block_server_Clear(element.name);
|
|
|
|
// value == 1 ... Put Off Service
|
|
|
|
gContextmenuClose();
|
|
|
|
alert ("Clear / Off Service");
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function block_ctxmenu_Off (element, value) {
|
|
|
|
|
|
|
|
block_server_Off(element.name);
|
|
|
|
|
|
|
|
gContextmenuClose();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -116,6 +140,23 @@ function block_server_Del(elm) {
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// send clear block
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
function block_server_Clear(blockname) {
|
|
|
|
|
|
|
|
var request = { command: "blockclear", block: blockname };
|
|
|
|
|
|
|
|
serverinout (request, serverinout_defaultCallback);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
// send put block off service
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
function block_server_Off(blockname) {
|
|
|
|
|
|
|
|
var request = { command: "blockoff", block: blockname };
|
|
|
|
|
|
|
|
serverinout (request, serverinout_defaultCallback);
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function blockdetail_show(name) {
|
|
|
|
function blockdetail_show(name) {
|
|
|
|
var win = document.getElementById("blockdetail");
|
|
|
|
var win = document.getElementById("blockdetail");
|
|
|
|