Skip to content

Commit

Permalink
revert changes to $widget.id, fix block display issue
Browse files Browse the repository at this point in the history
  • Loading branch information
mstevetodd committed Dec 5, 2019
1 parent 88ec7d7 commit c5a2a09
Showing 1 changed file with 20 additions and 14 deletions.
34 changes: 20 additions & 14 deletions web/js/panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ function processPanelXML($returnedData, $success, $xhr) {
$preloadWidgetImages($widget); //start loading all images
$widget['safeName'] = $safeName($widget.name); //add a html-safe version of name
$widget["systemName"] = $widget.name;
$widget['id'] = $widget.ident;
// $widget['id'] = $widget.ident;
$gWidgets[$widget.id] = $widget; //store widget in persistent array
$drawIcon($widget); //actually place and position the widget on the panel
jmri.getSensor($widget["systemName"]);
Expand Down Expand Up @@ -1280,7 +1280,7 @@ function processPanelXML($returnedData, $success, $xhr) {
}
$preloadWidgetImages($widget); //start loading all images
$widget['safeName'] = $safeName($widget.name); //add a html-safe version of name
$widget['id'] = $widget.ident;
// $widget['id'] = $widget.ident;
$gWidgets[$widget.id] = $widget; //store widget in persistent array
$drawIcon($widget); //actually place and position the widget on the panel
break;
Expand Down Expand Up @@ -1422,7 +1422,7 @@ function processPanelXML($returnedData, $success, $xhr) {
case "vertical_up" : $widget.degrees = 270;
case "vertical_down" : $widget.degrees = 90;
}
$widget['id'] = $widget.ident;
// $widget['id'] = $widget.ident;
$gWidgets[$widget.id] = $widget; //store widget in persistent array
//put the text element on the page
$("#panel-area").append("<div id=" + $widget.id + " class='" + $widget.classes + "'>" + $widget.text + "</div>");
Expand Down Expand Up @@ -1458,7 +1458,7 @@ function processPanelXML($returnedData, $success, $xhr) {
jmri.getLayoutBlock($widget.systemName);
break;
case "layoutturnout" :
$widget['id'] = $widget.ident;
// $widget['id'] = $widget.ident;
$widget['name'] = $widget.turnoutname; //normalize name
$widget['safeName'] = $safeName($widget.name); //add a html-safe version of name
$widget.jsonType = "turnout"; // JSON object type
Expand Down Expand Up @@ -1710,7 +1710,7 @@ function processPanelXML($returnedData, $success, $xhr) {
$widget['occupancystateBD'] = $gBlks[$widget.blocknamebd].state;
}
//store widget in persistent array
$widget['id'] = $widget.ident;
// $widget['id'] = $widget.ident;
$gWidgets[$widget.id] = $widget;
//also store the xing's 4 end points for other connections
$storeLevelXingPoints($widget);
Expand Down Expand Up @@ -3441,7 +3441,9 @@ var $setWidgetState = function($id, $newState, data) {
// set $id to slip id
$id = slipID;
} else {
jmri.log("$setWidgetState unknown $id: '" + $id + "'.");
if (jmri_logging) {
jmri.log("$setWidgetState unknown $id: '" + $id + "'.");
}
return;
}
} else if ($widget.widgetType == 'layoutSlip') {
Expand Down Expand Up @@ -3986,21 +3988,25 @@ $(document).ready(function() {
updateWidgets(name, state, data);
},
block: function(name, value, data) {
if (value.type == "idTag") {
value = value.data.userName; //for idTags, use the value in userName instead
} else if (value.type == "reporter"){
value = value.data.value; //for reporters, use the value in data instead
if (value !== null) {
if (value.type == "idTag") {
value = value.data.userName; //for idTags, use the value in userName instead
} else if (value.type == "reporter"){
value = value.data.value; //for reporters, use the value in data instead
}
}
updateWidgets(name, value, data);
},
layoutBlock: function(name, value, data) {
setBlockColor(name, data.blockColor);
},
memory: function(name, value, data) {
if (value.type == "idTag") {
value = value.data.userName; //for idTags, use the value in userName instead
} else if (value.type == "reporter"){
value = value.data.value; //for reporters, use the value in data instead
if (value !== null) {
if (value.type == "idTag") {
value = value.data.userName; //for idTags, use the value in userName instead
} else if (value.type == "reporter"){
value = value.data.value; //for reporters, use the value in data instead
}
}
updateWidgets(name, value, data);
},
Expand Down

0 comments on commit c5a2a09

Please sign in to comment.