mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
Some fixes, thanks Arturo.
This commit is contained in:
parent
c5f6259fce
commit
fb3b4d8a6f
@ -83,15 +83,43 @@ abstract class Map {
|
||||
|
||||
abstract function printJSInit();
|
||||
|
||||
public function writeJSGraph() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
echo "var nodes = " . json_encode($this->nodes) . ";";
|
||||
echo "var edges = " . json_encode($this->edges) . ";";
|
||||
?>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function show() {
|
||||
foreach ($this->requires_js as $js) {
|
||||
echo "<script type='text/javascript' src='$js'></script>" . "\n";
|
||||
}
|
||||
|
||||
$this->writeJSContants();
|
||||
$this->writeJSGraph();
|
||||
|
||||
?>
|
||||
|
||||
<div id="map" data-id="<?php echo $this->id;?>" >
|
||||
<svg style="border: 2px solid red;" pointer-events="all" width="<?php echo $this->width;?>px" height="<?php echo $this->height;?>px">
|
||||
<?php
|
||||
if ($this->width == 0) {
|
||||
$width = "100%";
|
||||
}
|
||||
else {
|
||||
$width = $this->width . "px";
|
||||
}
|
||||
if ($this->height == 0) {
|
||||
$height = "500px";
|
||||
}
|
||||
else {
|
||||
$height = $this->height . "px";
|
||||
}
|
||||
?>
|
||||
<svg style="border: 2px solid red;" pointer-events="all" width="<?php echo $width;?>" height="<?php echo $height;?>">
|
||||
</svg>
|
||||
</div>
|
||||
|
||||
@ -99,6 +127,16 @@ abstract class Map {
|
||||
$this->printJSInit();
|
||||
}
|
||||
|
||||
public function writeJSContants() {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
<?php
|
||||
|
||||
?>
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
|
||||
public function getType() {
|
||||
return $this->type;
|
||||
}
|
||||
|
@ -43,6 +43,8 @@ class Networkmap extends Map {
|
||||
$filter = json_decode($dbValues['filter'], true);
|
||||
|
||||
$this->filter = $filter;
|
||||
if (!isset($this->filter['only_snmp_modules']))
|
||||
$this->filter['only_snmp_modules'] = false;
|
||||
|
||||
switch ($dbValues['source_data']) {
|
||||
case MAP_SOURCE_GROUP:
|
||||
@ -111,6 +113,7 @@ class Networkmap extends Map {
|
||||
$line = preg_replace('/[ ]+/', ' ', $line);
|
||||
|
||||
if (preg_match('/^node.*$/', $line) != 0) {
|
||||
$items = explode(' ', $line);
|
||||
$graphviz_id = $items[1];
|
||||
|
||||
$nodes[$graphviz_id]['x'] = $items[2] * 100; //200 is for show more big
|
||||
@ -119,13 +122,13 @@ class Networkmap extends Map {
|
||||
}
|
||||
|
||||
foreach ($nodes as $graphviz_id => $node) {
|
||||
$graph->$nodes[$graphviz_id] = $node;
|
||||
$this->nodes[$graphviz_id] = $node;
|
||||
}
|
||||
|
||||
foreach ($edges as $edge) {
|
||||
$graph->nodes[] = array('type' => ITEM_TYPE_EDGE_NETWORKMAP);
|
||||
$this->nodes[] = array('type' => ITEM_TYPE_EDGE_NETWORKMAP);
|
||||
$edge['id_item'] = key(end($graph->nodes[]));
|
||||
$graph->edges[] = $edge;
|
||||
$this->edges[] = $edge;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user