function Panel($x, $y, $t, $s, $i, $z) { global $fmt, $pos; $pnl = DevPanel($t, $i, $z); if ($fmt == "json") { if ($pos == "D") { $sc = 10; } elseif ($pos == "p") { $sc = 20; } else { $sc = 80; } return "\t{\"type\":\"panel\",\"height\":" . ($z ? $z * $sc : $sc) . ",\"width\":" . ($z ? 2 * $sc : $sc) . ",\"style\":\"{$pnl}\"\n"; } elseif ($fmt == "svg") { $stk = ""; if ($s > 1) { $stk = DrawLabel($x + 55, $y, $s, 2, "blue"); } if ($pos == "D") { $sc = 12; } elseif ($pos == "p") { $sc = 50; } else { $sc = 100; } return "<image x=\"" . ($x - $sc) . "\" y=\"" . ($y - $sc / 2) . "\" width=\"" . $sc * 2 . "\" height=\"{$sc}\" xlink:href=\"../{$pnl}\"/>{$stk}\n"; } else { if ($pos == "D") { $sc = 10; } elseif ($pos == "p") { $sc = 5; } else { $sc = 2; } $icon = "\$icon = imagecreatefromjpeg(\"../{$pnl}\");\n"; $icon .= "\$w = Imagesx(\$icon);\n"; $icon .= "\$h = Imagesy(\$icon);\n"; for ($c = 1; $c <= $s; $c++) { $icon .= "imagecopyresized(\$image, \$icon,intval({$x}-\$w/{$sc}), intval({$y}-{$c}*\$h/" . $sc / 2 . "+({$s}*\$h/{$sc}) ),0,0,intval(\$w/" . $sc / 2 . "),intval(\$h/" . $sc / 2 . "+1),\$w,\$h );\n"; } $icon .= "Imagedestroy(\$icon);\n"; return $icon; } }
function TopoLocErr($siz = 0) { global $noloc, $img, $debug, $manlbl, $bg2, $loclbl, $errlbl; if (!count($noloc)) { return; } echo "<br><p><h2>{$loclbl} {$errlbl}</h2>\n"; echo "<table class=\"content fixed\"><tr>\n"; $col = 0; foreach (array_keys($noloc) as $d) { $ip = $noloc[$d]['ip']; $ty = $noloc[$d]['ty']; $di = $noloc[$d]['ic']; $lo = $noloc[$d]['lo']; $co = $noloc[$d]['co']; $po = $noloc[$d]['po']; $mn = $noloc[$d]['mn']; $al = $noloc[$d]['al']; list($statbg, $stat) = StatusBg(1, $mn, $al, 'imga'); $tit = $stat ? $stat : $ty; $ud = urlencode($d); if ($col == $_SESSION['col']) { $col = 0; echo "\n</tr><tr>\n"; } if ($siz) { echo "<th class=\"{$statbg}\" valign=\"top\"><img src=\"img/dev/{$di}.png\" title=\"{$lo}, {$co}\"><br>{$d}</th>\n"; } else { echo "<td class=\"{$statbg}\" valign=\"top\"><div style=\"text-align:center;\">\n"; echo "<a href=\"Devices-Status.php?dev={$ud}\">"; echo "<img src=\"" . ($img ? DevPanel($ty, $di, $sz) . "\" width=\"" . (preg_match('/^ph|^wa|^ca/', $di) ? 40 : 100) . "\"" : "img/dev/{$di}.png\"") . " title=\"{$tit}\"></a>{$sk}<br><b>{$d}</b><br>\n"; echo Devcli($ip, $po); echo "<br>{$lo}<br><span class=\"gry\">{$co}</span></div></td>\n"; } $col++; } echo "</tr></table>\n"; }
$oi = long2ip($dev[19]); $ud = urlencode($dev[0]); $stk = ($dev[29] > 1)?"<img src=\"img/$dev[29].png\" title=\"Stack\">":""; list($fc,$lc) = Agecol($dev[4],$dev[5],$row % 2); if( in_array("device",$col) ){ if( $moq and $dev[34] and $dev[34] != 'none' ){ list($statbg,$stat) = StatusBg(1,1,$dev[35],$bi); }else{ $statbg = $bi; $stat = ''; } TblCell($dev[0],'',"class=\"$statbg\" width=\"100px\"","<a href=\"Devices-Status.php?dev=$ud\"><img src=\"img/dev/$dev[18].png\" title=\"$dev[3] $stat\"></a>$stk $most<br>","th-img"); } if( in_array("imgNS",$col) ){ TblCell('','',"bgcolor=\"white\"","<a href=\"Devices-Status.php?dev=$ud\"><img width=\"".(preg_match('/^ph|^wa|^ca/',$dev[18])?40:100)."\" src=\"".DevPanel($dev[3],$dev[18],$dev[28])."\" title=\"$dev[3]\"></a>$stk $most","th-img"); } if(in_array("devip",$col)){ $dvip = Devcli( $ip, $dev[16] ); if( !in_array("device",$col) ){$dvip .= " ($dev[0])";} TblCell($dvip); } if(in_array("origip",$col)){ TblCell( Devcli($oi,$dev[16]) ); } if(in_array("serial",$col)){ TblCell($dev[2]); } if(in_array("type",$col)){ list($vn,$ic) = DevVendor($dev[25],substr($dev[18],2,1) ); TblCell( $dev[3],"?in[]=type&op[]==&st[]=".urlencode($dev[3]),'',"<a href=\"http://www.google.com/search?q=".urlencode($dev[3])."&btnI=1\" target=\"window\"><img src=\"img/oui/$ic.png\" title=\"$vn\"></a> ");