summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-01-04 10:13:41 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-01-04 10:13:41 +0000
commit2a4c603bb433fc21d4deaa87d1c0b41cc55a1bea (patch)
treef09277f20f2f31e37ab0833770f27aa510a78cc7
parent5d64930fe2b5ca25c3a7b4ad2182b9cb28a6dad3 (diff)
downloadzabbix-2a4c603bb433fc21d4deaa87d1c0b41cc55a1bea.tar.gz
zabbix-2a4c603bb433fc21d4deaa87d1c0b41cc55a1bea.tar.xz
zabbix-2a4c603bb433fc21d4deaa87d1c0b41cc55a1bea.zip
More support for different connector types/colors.
git-svn-id: svn://svn.zabbix.com/trunk@1130 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--create/mysql/schema.sql2
-rw-r--r--create/postgresql/schema.sql2
-rw-r--r--frontends/php/include/config.inc.php6
-rw-r--r--frontends/php/map.php44
-rw-r--r--frontends/php/sysmap.php71
-rw-r--r--upgrades/dbpatches/1.0beta12_to_1.0beta13/mysql/patch.sql2
-rw-r--r--upgrades/dbpatches/1.0beta12_to_1.0beta13/postgresql/patch.sql2
7 files changed, 81 insertions, 48 deletions
diff --git a/create/mysql/schema.sql b/create/mysql/schema.sql
index 6dd0de90..c1504b8c 100644
--- a/create/mysql/schema.sql
+++ b/create/mysql/schema.sql
@@ -90,7 +90,7 @@ CREATE TABLE sysmaps_links (
drawtype_off int(4) DEFAULT '0' NOT NULL,
color_off varchar(32) DEFAULT 'Black' NOT NULL,
drawtype_on int(4) DEFAULT '0' NOT NULL,
- color_on varchar(32) DEFAULT 'Dark Red' NOT NULL,
+ color_on varchar(32) DEFAULT 'Red' NOT NULL,
PRIMARY KEY (linkid)
) type=InnoDB;
diff --git a/create/postgresql/schema.sql b/create/postgresql/schema.sql
index d316b4a1..fd340766 100644
--- a/create/postgresql/schema.sql
+++ b/create/postgresql/schema.sql
@@ -372,7 +372,7 @@ CREATE TABLE sysmaps_links (
drawtype_off int4 DEFAULT '0' NOT NULL,
color_off varchar(32) DEFAULT 'Black' NOT NULL,
drawtype_on int4 DEFAULT '0' NOT NULL,
- color_on varchar(32) DEFAULT 'Dark Red' NOT NULL,
+ color_on varchar(32) DEFAULT 'Red' NOT NULL,
PRIMARY KEY (linkid),
FOREIGN KEY (sysmapid) REFERENCES sysmaps,
FOREIGN KEY (shostid1) REFERENCES sysmaps_hosts,
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index f99afb81..10d5e530 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -2600,15 +2600,15 @@ where h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=$triggerid";
return DBexecute($sql);
}
- function add_link($sysmapid,$shostid1,$shostid2,$triggerid)
+ function add_link($sysmapid,$shostid1,$shostid2,$triggerid,$drawtype_off,$color_off,$drawtype_on,$color_on)
{
if($triggerid == 0)
{
- $sql="insert into sysmaps_links (sysmapid,shostid1,shostid2,triggerid) values ($sysmapid,$shostid1,$shostid2,NULL)";
+ $sql="insert into sysmaps_links (sysmapid,shostid1,shostid2,triggerid,drawtype_off,color_off,drawtype_on,color_on) values ($sysmapid,$shostid1,$shostid2,NULL,$drawtype_off,'$color_off',$drawtype_on,'$color_on')";
}
else
{
- $sql="insert into sysmaps_links (sysmapid,shostid1,shostid2,triggerid) values ($sysmapid,$shostid1,$shostid2,$triggerid)";
+ $sql="insert into sysmaps_links (sysmapid,shostid1,shostid2,triggerid,drawtype_off,color_off,drawtype_on,color_on) values ($sysmapid,$shostid1,$shostid2,$triggerid,$drawtype_off,'$color_off',$drawtype_on,'$color_on')";
}
return DBexecute($sql);
}
diff --git a/frontends/php/map.php b/frontends/php/map.php
index e811201d..698f5f89 100644
--- a/frontends/php/map.php
+++ b/frontends/php/map.php
@@ -54,6 +54,19 @@
$black=ImageColorAllocate($im,0,0,0);
$gray=ImageColorAllocate($im,150,150,150);
+ $colors["Red"]=ImageColorAllocate($im,255,0,0);
+ $colors["Dark Red"]=ImageColorAllocate($im,150,0,0);
+ $colors["Green"]=ImageColorAllocate($im,0,255,0);
+ $colors["Dark Green"]=ImageColorAllocate($im,0,150,0);
+ $colors["Blue"]=ImageColorAllocate($im,0,0,255);
+ $colors["Dark Blue"]=ImageColorAllocate($im,0,0,150);
+ $colors["Yellow"]=ImageColorAllocate($im,255,255,0);
+ $colors["Dark Yellow"]=ImageColorAllocate($im,150,150,0);
+ $colors["Cyan"]=ImageColorAllocate($im,0,255,255);
+ $colors["Black"]=ImageColorAllocate($im,0,0,0);
+ $colors["Gray"]=ImageColorAllocate($im,150,150,150);
+ $colors["White"]=ImageColorAllocate($im,255,255,255);
+
$x=imagesx($im);
$y=imagesy($im);
@@ -62,11 +75,11 @@
if(!isset($HTTP_GET_VARS["border"]))
{
- ImageRectangle($im,0,0,$width-1,$height-1,$black);
+ ImageRectangle($im,0,0,$width-1,$height-1,$colors["Black"]);
}
$x=imagesx($im)/2-ImageFontWidth(4)*strlen($name)/2;
- ImageString($im, 4,$x,1, $name , $darkred);
+ ImageString($im, 4,$x,1, $name , $colors["Dark Red"]);
$str=date("m.d.Y H:i:s",time(NULL));
ImageString($im, 0,imagesx($im)-120,imagesy($im)-12,"$str", $gray);
@@ -96,12 +109,16 @@
# Draw connectors
- $result=DBselect("select shostid1,shostid2,triggerid from sysmaps_links where sysmapid=".$HTTP_GET_VARS["sysmapid"]);
+ $result=DBselect("select shostid1,shostid2,triggerid,color_off,drawtype_off,color_on,drawtype_on from sysmaps_links where sysmapid=".$HTTP_GET_VARS["sysmapid"]);
for($i=0;$i<DBnum_rows($result);$i++)
{
$shostid1=DBget_field($result,$i,0);
$shostid2=DBget_field($result,$i,1);
$triggerid=DBget_field($result,$i,2);
+ $color_off=DBget_field($result,$i,3);
+ $drawtype_off=DBget_field($result,$i,4);
+ $color_on=DBget_field($result,$i,5);
+ $drawtype_on=DBget_field($result,$i,6);
$result1=DBselect("select x,y from sysmaps_hosts where shostid=$shostid1");
$x1=DBget_field($result1,0,0);
@@ -116,16 +133,31 @@
$trigger=get_trigger_by_triggerid($triggerid);
if($trigger["value"] == TRIGGER_VALUE_TRUE)
{
- ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$red);
+ if($drawtype_on == GRAPH_DRAW_TYPE_BOLDLINE)
+ {
+ ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$colors[$color_on]);
+ ImageLine($im,$x1+16,$y1+16+1,$x2+16,$y2+16+1,$colors[$color_on]);
+ }
+ else
+ {
+ ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$colors[$color_on]);
+ }
}
else
{
- ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$black);
+ if($drawtype_off == GRAPH_DRAW_TYPE_BOLDLINE)
+ {
+ ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$colors[$color_off]);
+ }
+ else
+ {
+ ImageLine($im,$x1+16,$y1+16+1,$x2+16,$y2+16+1,$colors[$color_off]);
+ }
}
}
else
{
- ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$black);
+ ImageLine($im,$x1+16,$y1+16,$x2+16,$y2+16,$colors["Black"]);
}
}
diff --git a/frontends/php/sysmap.php b/frontends/php/sysmap.php
index bf5c8799..44448fb6 100644
--- a/frontends/php/sysmap.php
+++ b/frontends/php/sysmap.php
@@ -54,7 +54,8 @@
}
if($HTTP_GET_VARS["register"]=="add link")
{
- $result=add_link($HTTP_GET_VARS["sysmapid"],$HTTP_GET_VARS["shostid1"],$HTTP_GET_VARS["shostid2"],$HTTP_GET_VARS["triggerid"]);
+ $result=add_link($HTTP_GET_VARS["sysmapid"],$HTTP_GET_VARS["shostid1"],$HTTP_GET_VARS["shostid2"],$HTTP_GET_VARS["triggerid"],
+ $HTTP_GET_VARS["drawtype_off"],$HTTP_GET_VARS["color_off"],$HTTP_GET_VARS["drawtype_on"],$HTTP_GET_VARS["color_on"]);
show_messages($result,"Link added","Cannot add link");
}
if($HTTP_GET_VARS["register"]=="delete_link")
@@ -369,55 +370,55 @@
show_table2_v_delimiter();
echo "Type (OFF)";
show_table2_h_delimiter();
- echo "<select name=\"drawtype\" size=1>";
- echo "<OPTION VALUE='0' ".iif(isset($drawtype)&&($drawtype==0),"SELECTED","").">".get_drawtype_description(0);
- echo "<OPTION VALUE='1' ".iif(isset($drawtype)&&($drawtype==1),"SELECTED","").">".get_drawtype_description(1);
- echo "<OPTION VALUE='2' ".iif(isset($drawtype)&&($drawtype==2),"SELECTED","").">".get_drawtype_description(2);
- echo "<OPTION VALUE='3' ".iif(isset($drawtype)&&($drawtype==4),"SELECTED","").">".get_drawtype_description(3);
+ echo "<select name=\"drawtype_off\" size=1>";
+ echo "<OPTION VALUE='0' ".iif(isset($drawtype_off)&&($drawtype_off==0),"SELECTED","").">".get_drawtype_description(0);
+// echo "<OPTION VALUE='1' ".iif(isset($drawtype_off)&&($drawtype_off==1),"SELECTED","").">".get_drawtype_description(1);
+ echo "<OPTION VALUE='2' ".iif(isset($drawtype_off)&&($drawtype_off==2),"SELECTED","").">".get_drawtype_description(2);
+// echo "<OPTION VALUE='3' ".iif(isset($drawtype_off)&&($drawtype_off==4),"SELECTED","").">".get_drawtype_description(3);
echo "</SELECT>";
show_table2_v_delimiter();
echo "Color (OFF)";
show_table2_h_delimiter();
- echo "<select name=\"color\" size=1>";
- echo "<OPTION VALUE='Black' ".iif(isset($color)&&($color=="Black"),"SELECTED","").">Black";
- echo "<OPTION VALUE='Blue' ".iif(isset($color)&&($color=="Blue"),"SELECTED","").">Blue";
- echo "<OPTION VALUE='Cyan' ".iif(isset($color)&&($color=="Cyan"),"SELECTED","").">Cyan";
- echo "<OPTION VALUE='Dark Blue' ".iif(isset($color)&&($color=="Dark Blue"),"SELECTED","").">Dark blue";
- echo "<OPTION VALUE='Dark Green' ".iif(isset($color)&&($color=="Dark Green"),"SELECTED","").">Dark green";
- echo "<OPTION VALUE='Dark Red' ".iif(isset($color)&&($color=="Dark Red"),"SELECTED","").">Dark red";
- echo "<OPTION VALUE='Dark Yellow' ".iif(isset($color)&&($color=="Dark Yellow"),"SELECTED","")."'>Dark yellow";
- echo "<OPTION VALUE='Green' ".iif(isset($color)&&($color=="Green"),"SELECTED","").">Green";
- echo "<OPTION VALUE='Red' ".iif(isset($color)&&($color=="Red"),"SELECTED","").">Red";
- echo "<OPTION VALUE='White' ".iif(isset($color)&&($color=="White"),"SELECTED","").">White";
- echo "<OPTION VALUE='Yellow' ".iif(isset($color)&&($color=="Yellow"),"SELECTED","").">Yellow";
+ echo "<select name=\"color_off\" size=1>";
+ echo "<OPTION VALUE='Black' ".iif(isset($color_off)&&($color_off=="Black"),"SELECTED","").">Black";
+ echo "<OPTION VALUE='Blue' ".iif(isset($color_off)&&($color_off=="Blue"),"SELECTED","").">Blue";
+ echo "<OPTION VALUE='Cyan' ".iif(isset($color_off)&&($color_off=="Cyan"),"SELECTED","").">Cyan";
+ echo "<OPTION VALUE='Dark Blue' ".iif(isset($color_off)&&($color_off=="Dark Blue"),"SELECTED","").">Dark blue";
+ echo "<OPTION VALUE='Dark Green' ".iif(isset($color_off)&&($color_off=="Dark Green"),"SELECTED","").">Dark green";
+ echo "<OPTION VALUE='Dark Red' ".iif(isset($color_off)&&($color_off=="Dark Red"),"SELECTED","").">Dark red";
+ echo "<OPTION VALUE='Dark Yellow' ".iif(isset($color_off)&&($color_off=="Dark Yellow"),"SELECTED","")."'>Dark yellow";
+ echo "<OPTION VALUE='Green' ".iif(isset($color_off)&&($color_off=="Green"),"SELECTED","").">Green";
+ echo "<OPTION VALUE='Red' ".iif(isset($color_off)&&($color_off=="Red"),"SELECTED","").">Red";
+ echo "<OPTION VALUE='White' ".iif(isset($color_off)&&($color_off=="White"),"SELECTED","").">White";
+ echo "<OPTION VALUE='Yellow' ".iif(isset($color_off)&&($color_off=="Yellow"),"SELECTED","").">Yellow";
echo "</SELECT>";
show_table2_v_delimiter();
echo "Type (ON)";
show_table2_h_delimiter();
- echo "<select name=\"drawtype\" size=1>";
- echo "<OPTION VALUE='0' ".iif(isset($drawtype)&&($drawtype==0),"SELECTED","").">".get_drawtype_description(0);
- echo "<OPTION VALUE='1' ".iif(isset($drawtype)&&($drawtype==1),"SELECTED","").">".get_drawtype_description(1);
- echo "<OPTION VALUE='2' ".iif(isset($drawtype)&&($drawtype==2),"SELECTED","").">".get_drawtype_description(2);
- echo "<OPTION VALUE='3' ".iif(isset($drawtype)&&($drawtype==4),"SELECTED","").">".get_drawtype_description(3);
+ echo "<select name=\"drawtype_on\" size=1>";
+ echo "<OPTION VALUE='0' ".iif(isset($drawtype_on)&&($drawtype_on==0),"SELECTED","").">".get_drawtype_description(0);
+// echo "<OPTION VALUE='1' ".iif(isset($drawtype_on)&&($drawtype_on==1),"SELECTED","").">".get_drawtype_description(1);
+ echo "<OPTION VALUE='2' ".iif(isset($drawtype_on)&&($drawtype_on==2),"SELECTED","").">".get_drawtype_description(2);
+// echo "<OPTION VALUE='3' ".iif(isset($drawtype_on)&&($drawtype_on==4),"SELECTED","").">".get_drawtype_description(3);
echo "</SELECT>";
show_table2_v_delimiter();
echo "Color (ON)";
show_table2_h_delimiter();
- echo "<select name=\"color\" size=1>";
- echo "<OPTION VALUE='Dark Red' ".iif(isset($color)&&($color=="Dark Red"),"SELECTED","").">Dark red";
- echo "<OPTION VALUE='Black' ".iif(isset($color)&&($color=="Black"),"SELECTED","").">Black";
- echo "<OPTION VALUE='Blue' ".iif(isset($color)&&($color=="Blue"),"SELECTED","").">Blue";
- echo "<OPTION VALUE='Cyan' ".iif(isset($color)&&($color=="Cyan"),"SELECTED","").">Cyan";
- echo "<OPTION VALUE='Dark Blue' ".iif(isset($color)&&($color=="Dark Blue"),"SELECTED","").">Dark blue";
- echo "<OPTION VALUE='Dark Green' ".iif(isset($color)&&($color=="Dark Green"),"SELECTED","").">Dark green";
- echo "<OPTION VALUE='Dark Yellow' ".iif(isset($color)&&($color=="Dark Yellow"),"SELECTED","")."'>Dark yellow";
- echo "<OPTION VALUE='Green' ".iif(isset($color)&&($color=="Green"),"SELECTED","").">Green";
- echo "<OPTION VALUE='Red' ".iif(isset($color)&&($color=="Red"),"SELECTED","").">Red";
- echo "<OPTION VALUE='White' ".iif(isset($color)&&($color=="White"),"SELECTED","").">White";
- echo "<OPTION VALUE='Yellow' ".iif(isset($color)&&($color=="Yellow"),"SELECTED","").">Yellow";
+ echo "<select name=\"color_on\" size=1>";
+ echo "<OPTION VALUE='Red' ".iif(isset($color_on)&&($color_on=="Red"),"SELECTED","").">Red";
+ echo "<OPTION VALUE='Black' ".iif(isset($color_on)&&($color_on=="Black"),"SELECTED","").">Black";
+ echo "<OPTION VALUE='Blue' ".iif(isset($color_on)&&($color_on=="Blue"),"SELECTED","").">Blue";
+ echo "<OPTION VALUE='Cyan' ".iif(isset($color_on)&&($color_on=="Cyan"),"SELECTED","").">Cyan";
+ echo "<OPTION VALUE='Dark Blue' ".iif(isset($color_on)&&($color_on=="Dark Blue"),"SELECTED","").">Dark blue";
+ echo "<OPTION VALUE='Dark Green' ".iif(isset($color_on)&&($color_on=="Dark Green"),"SELECTED","").">Dark green";
+ echo "<OPTION VALUE='Dark Yellow' ".iif(isset($color_on)&&($color_on=="Dark Yellow"),"SELECTED","")."'>Dark yellow";
+ echo "<OPTION VALUE='Green' ".iif(isset($color_on)&&($color_on=="Green"),"SELECTED","").">Green";
+ echo "<OPTION VALUE='Dark Red' ".iif(isset($color_on)&&($color_on=="Dark Red"),"SELECTED","").">Dark red";
+ echo "<OPTION VALUE='White' ".iif(isset($color_on)&&($color_on=="White"),"SELECTED","").">White";
+ echo "<OPTION VALUE='Yellow' ".iif(isset($color_on)&&($color_on=="Yellow"),"SELECTED","").">Yellow";
echo "</SELECT>";
show_table2_v_delimiter2();
diff --git a/upgrades/dbpatches/1.0beta12_to_1.0beta13/mysql/patch.sql b/upgrades/dbpatches/1.0beta12_to_1.0beta13/mysql/patch.sql
index 9e2d12e9..10c1b323 100644
--- a/upgrades/dbpatches/1.0beta12_to_1.0beta13/mysql/patch.sql
+++ b/upgrades/dbpatches/1.0beta12_to_1.0beta13/mysql/patch.sql
@@ -19,4 +19,4 @@ update actions set message=replace(message,'%s','{HOSTNAME}');
alter table sysmaps_links add drawtype_off int(4) DEFAULT '0' NOT NULL;
alter table sysmaps_links add color_off varchar(32) DEFAULT 'Black' NOT NULL;
alter table sysmaps_links add drawtype_on int(4) DEFAULT '0' NOT NULL;
-alter table sysmaps_links add color_on varchar(32) DEFAULT 'Dark Red' NOT NULL;
+alter table sysmaps_links add color_on varchar(32) DEFAULT 'Red' NOT NULL;
diff --git a/upgrades/dbpatches/1.0beta12_to_1.0beta13/postgresql/patch.sql b/upgrades/dbpatches/1.0beta12_to_1.0beta13/postgresql/patch.sql
index 87afbcc3..d07c31da 100644
--- a/upgrades/dbpatches/1.0beta12_to_1.0beta13/postgresql/patch.sql
+++ b/upgrades/dbpatches/1.0beta12_to_1.0beta13/postgresql/patch.sql
@@ -20,4 +20,4 @@ update actions set message=replace(message,'%s','{HOSTNAME}');
alter table sysmaps_links add drawtype_off int4 DEFAULT '0' NOT NULL;
alter table sysmaps_links add color_off varchar(32) DEFAULT 'Black' NOT NULL;
alter table sysmaps_links add drawtype_on int4 DEFAULT '0' NOT NULL;
-alter table sysmaps_links add color_on varchar(32) DEFAULT 'Dark Red' NOT NULL;
+alter table sysmaps_links add color_on varchar(32) DEFAULT 'Red' NOT NULL;