Commit 4b5b7cd5 authored by Leigh B. Stoller's avatar Leigh B. Stoller

Clean up before releasing to tbadmin people.

parent 8dc9d85b
...@@ -72,8 +72,13 @@ $building = $ARGV[0]; ...@@ -72,8 +72,13 @@ $building = $ARGV[0];
# #
# Hardwire the imagemaps for now. # Hardwire the imagemaps for now.
# #
my %baseimages = ("MEB:4-East" => "$TB/www/meb-4east.png", my %baseimages = ();
"MEB:4-West" => "$TB/www/meb-4east.png"); $baseimages{"MEB"}{"4-East"} = "$TB/www/meb-4east.png";
$baseimages{"MEB"}{"4-West"} = "$TB/www/meb-4east.png";
if (!exists($baseimages{$building})) {
die("No such building: $building\n");
}
# #
# Red dot mean node is down. # Red dot mean node is down.
...@@ -103,6 +108,10 @@ my ($bluedot_width, $bluedot_height) = $bluedot->getBounds(); ...@@ -103,6 +108,10 @@ my ($bluedot_width, $bluedot_height) = $bluedot->getBounds();
# If a floor specified, then do just that floor and spit it out. # If a floor specified, then do just that floor and spit it out.
# #
if (defined($floor)) { if (defined($floor)) {
if (!exists($baseimages{$building}{$floor})) {
die("No such floor '$floor' in building: $building\n");
}
my ($floorimage, $areamap) = dofloor($building, $floor); my ($floorimage, $areamap) = dofloor($building, $floor);
$image = $floorimage; $image = $floorimage;
@areamaps = ($areamap); @areamaps = ($areamap);
...@@ -113,10 +122,7 @@ else { ...@@ -113,10 +122,7 @@ else {
# #
my @floors = (); my @floors = ();
my $query_result = foreach my $floor (sort(keys(%{ $baseimages{$building} }))) {
DBQueryFatal("select distinct floor from location_info ".
"where building='$building'");
while (my ($floor) = $query_result->fetchrow_array()) {
my ($floorimage, $areamap) = dofloor($building, $floor); my ($floorimage, $areamap) = dofloor($building, $floor);
push(@floors, [ $floorimage, $areamap ]); push(@floors, [ $floorimage, $areamap ]);
...@@ -186,12 +192,12 @@ sub dofloor($$) ...@@ -186,12 +192,12 @@ sub dofloor($$)
# #
# Grab the base image for the floor. # Grab the base image for the floor.
# #
if (! exists($baseimages{"$building:$floor"})) { if (! exists($baseimages{$building}{$floor})) {
die("*** $0:\n". die("*** $0:\n".
" No base image for $building:$floor!\n"); " No base image for $building:$floor!\n");
} }
my $baseimage = my $baseimage =
GD::Image->newFromPng($baseimages{"$building:$floor"}, 1) || GD::Image->newFromPng($baseimages{$building}{$floor}, 1) ||
die("*** $0:\n". die("*** $0:\n".
" Could not get base ". $baseimages{"$building:$floor"} ."!\n"); " Could not get base ". $baseimages{"$building:$floor"} ."!\n");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment