Set text and color of Gateways Widget Status

getstats.php calls functions.inc.php get_stats(), which calls get_gatewaystats().
get_gatewaystats() now returns the text for each field and an optional color separated by "/" - "text/color" e.g. "Online/#90EE90"
Parse the the new format, separating out text and color.
If color is specified, then also set it with jQuery to css.
This commit is contained in:
Phil Davis 2014-12-05 17:54:30 +05:45
parent beb7d9e332
commit 95d045fcd7

View File

@ -111,8 +111,12 @@ function updateGatewayStats(x){
if (widgetActive("gateways")){
gateways_split = x.split(",");
for (var y=0; y<gateways_split.length; y++){
gateways_field_split = gateways_split[y].split("/");
if(jQuery('#gateway' + (y + 1))) {
jQuery('#gateway' + (y + 1)).html(gateways_split[y]);
jQuery('#gateway' + (y + 1)).html(gateways_field_split[0]);
if(gateways_field_split[1]) {
jQuery('#gateway' + (y + 1)).css('background-color',gateways_field_split[1]);
}
}
}
}