summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-06-25 18:48:13 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2001-06-25 18:48:13 +0000
commit94356c5598c353908f8f02ea89827a57b95a0e3d (patch)
tree680f029599d77e129212798601572c518d710ba7
parent0db5010365e68d85776cc095012f95d6b2cdcd60 (diff)
downloadzabbix-94356c5598c353908f8f02ea89827a57b95a0e3d.tar.gz
zabbix-94356c5598c353908f8f02ea89827a57b95a0e3d.tar.xz
zabbix-94356c5598c353908f8f02ea89827a57b95a0e3d.zip
Support for graphs.html
git-svn-id: svn://svn.zabbix.com/trunk@108 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog1
-rw-r--r--create/mysql/schema.sql13
-rw-r--r--frontends/php/graphs.html121
-rw-r--r--frontends/php/include/config.inc40
-rw-r--r--frontends/php/sysmaps.html2
5 files changed, 176 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 47bd9e3d..7bce75c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,6 @@
Changes for 1.0alpha7:
+ - added file frontends/php/graphs.html
- added file frontends/php/images/sysmaps/host.png
- added file frontends/php/map.html
- added file frontends/php/maps.html
diff --git a/create/mysql/schema.sql b/create/mysql/schema.sql
index e37f48d7..562deb8b 100644
--- a/create/mysql/schema.sql
+++ b/create/mysql/schema.sql
@@ -1,4 +1,17 @@
#
+# Table structure for table 'graphs'
+#
+
+CREATE TABLE graphs (
+ graphid int(4) NOT NULL auto_increment,
+ name varchar(128) DEFAULT '' NOT NULL,
+ width int(4) DEFAULT '0' NOT NULL,
+ height int(4) DEFAULT '0' NOT NULL,
+ PRIMARY KEY (graphid),
+ UNIQUE (name)
+);
+
+#
# Table structure for table 'sysmaps_hosts'
#
diff --git a/frontends/php/graphs.html b/frontends/php/graphs.html
new file mode 100644
index 00000000..9f6dc59d
--- /dev/null
+++ b/frontends/php/graphs.html
@@ -0,0 +1,121 @@
+<?
+ include "include/config.inc";
+ $page["title"] = "Graphs";
+ $page["file"] = "graphs.html";
+ show_header($page["title"],0);
+?>
+
+<?
+ show_table_header("CONFIGURATION OF GRAPHS");
+ echo "<br>";
+?>
+
+<?
+ if(isset($register))
+ {
+ if($register=="add")
+ {
+ add_graph($name,$width,$height);
+ }
+ if($register=="update")
+ {
+ update_graph($graphid,$name,$width,$height);
+ }
+ if($register=="delete")
+ {
+ delete_graph($graphid);
+ }
+ }
+?>
+
+<?
+ show_table_header("GRAPHS");
+ echo "<TABLE BORDER=0 COLS=4 WIDTH=\"100%\" BGCOLOR=\"#CCCCCC\" cellspacing=1 cellpadding=3>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Name</B></TD>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Width</B></TD>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Height</B></TD>";
+ echo "<TD WIDTH=\"10%\" NOSAVE><B>Actions</B></TD>";
+ echo "</TR>";
+
+ $result=DBselect("select g.graphid,g.name,g.width,g.height from graphs g order by g.name");
+ echo "<CENTER>";
+ $col=0;
+ for($i=0;$i<DBnum_rows($result);$i++)
+ {
+ if($col==1)
+ {
+ echo "<TR BGCOLOR=#EEEEEE>";
+ $col=0;
+ } else
+ {
+ echo "<TR BGCOLOR=#DDDDDD>";
+ $col=1;
+ }
+
+ $graphid_=DBget_field($result,$i,0);
+ $name_=DBget_field($result,$i,1);
+ $width_=DBget_field($result,$i,2);
+ $height_=DBget_field($result,$i,3);
+ echo "<TD><a href=\"graph.html?graphid=$graphid_\">$name_</a></TD>";
+ echo "<TD>$width_</TD>";
+ echo "<TD>$height_</TD>";
+ echo "<TD><A HREF=\"graphs.html?graphid=$graphid_#form\">Change</A> - <A HREF=\"graphs.html?register=delete&graphid=$graphid_\">Delete</A></TD>";
+ echo "</TR>";
+ }
+ echo "</TABLE>";
+?>
+
+<?
+ echo "<a name=\"form\"></a>";
+
+ if(isset($graphid))
+ {
+ $result=DBselect("select g.graphid,g.name,g.width,g.height from graphs g where graphid=$graphid");
+ $name=DBget_field($result,0,1);
+ $width=DBget_field($result,0,2);
+ $height=DBget_field($result,0,3);
+ }
+ else
+ {
+ $name="";
+ $width=800;
+ $height=600;
+ }
+
+ echo "<br>";
+ show_table2_header_begin();
+ echo "New graph";
+
+ show_table2_v_delimiter();
+ echo "<form method=\"post\" action=\"graphs.html\">";
+ if(isset($graphid))
+ {
+ echo "<input name=\"graphid\" type=\"hidden\" value=$graphid>";
+ }
+ echo "Name";
+ show_table2_h_delimiter();
+ echo "<input name=\"name\" value=\"$name\" size=32>";
+
+ show_table2_v_delimiter();
+ echo "Width";
+ show_table2_h_delimiter();
+ echo "<input name=\"width\" size=5 value=\"$width\">";
+
+ show_table2_v_delimiter();
+ echo "Height";
+ show_table2_h_delimiter();
+ echo "<input name=\"height\" size=5 value=\"$height\">";
+
+ show_table2_v_delimiter2();
+ echo "<input type=\"submit\" name=\"register\" value=\"add\">";
+ if(isset($graphid))
+ {
+ echo "<input type=\"submit\" name=\"register\" value=\"update\">";
+ }
+
+ show_table2_header_end();
+?>
+
+<?
+ show_footer();
+?>
diff --git a/frontends/php/include/config.inc b/frontends/php/include/config.inc
index ad78f306..de060a55 100644
--- a/frontends/php/include/config.inc
+++ b/frontends/php/include/config.inc
@@ -446,6 +446,22 @@
?>
</font>
</td>
+ <td colspan=1 bgcolor=FFFFFF align=center valign="top" width="15%">
+ <font face="Arial,Helvetica" size=2>
+ <a href="graphs.html">
+<?
+ if( ($page["file"]=="graphs.html")||
+ ($page["file"]=="<change>.html"))
+ {
+ echo "<b>[GRAPHS]</b></a>";
+ }
+ else
+ {
+ echo "GRAPHS</a>";
+ }
+?>
+ </font>
+ </td>
</tr>
</table>
</td>
@@ -675,6 +691,14 @@
$result=DBexecute($sql);
}
+ # Delete Graph
+
+ function delete_graph($graphid)
+ {
+ $sql="delete from graphs where graphid=$graphid";
+ $result=DBexecute($sql);
+ }
+
# Delete System Map
function delete_sysmap( $sysmapid )
@@ -875,6 +899,14 @@
}
}
+ # Update Graph
+
+ function update_graph($graphid,$name,$width,$height)
+ {
+ $sql="update graphs set name='$name',width=$width,height=$height where graphid=$graphid";
+ $result=DBexecute($sql);
+ }
+
# Update System Map
function update_sysmap($sysmapid,$name,$width,$height)
@@ -883,6 +915,14 @@
$result=DBexecute($sql);
}
+ # Add Graph
+
+ function add_graph($name,$width,$height)
+ {
+ $sql="insert into graphs (name,width,height) values ('$name',$width,$height)";
+ $result=DBexecute($sql);
+ }
+
# Add System Map
function add_sysmap($name,$width,$height)
diff --git a/frontends/php/sysmaps.html b/frontends/php/sysmaps.html
index 69324727..2b6a136a 100644
--- a/frontends/php/sysmaps.html
+++ b/frontends/php/sysmaps.html
@@ -94,7 +94,7 @@
}
echo "Name";
show_table2_h_delimiter();
- echo "<input name=\"name\" value=\"$name\" size=20>";
+ echo "<input name=\"name\" value=\"$name\" size=32>";
show_table2_v_delimiter();
echo "Width";