diff options
author | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2004-09-28 18:58:14 +0000 |
---|---|---|
committer | hugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2004-09-28 18:58:14 +0000 |
commit | 912e94abef222ad26380220fdb601e2b400ed849 (patch) | |
tree | 3019f6212d14d7ab1c6f7c7a7ef9934a38b8f23c /frontends/php | |
parent | 594d295bea0f6093915ee7f08313c0d00a5129dc (diff) | |
download | zabbix-912e94abef222ad26380220fdb601e2b400ed849.tar.gz zabbix-912e94abef222ad26380220fdb601e2b400ed849.tar.xz zabbix-912e94abef222ad26380220fdb601e2b400ed849.zip |
Frontend improvements.
git-svn-id: svn://svn.zabbix.com/trunk@1441 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php')
-rw-r--r-- | frontends/php/alarms.php | 38 | ||||
-rw-r--r-- | frontends/php/include/local_en.inc.php | 9 | ||||
-rw-r--r-- | frontends/php/items.php | 64 | ||||
-rw-r--r-- | frontends/php/sysmap.php | 101 | ||||
-rw-r--r-- | frontends/php/sysmaps.php | 35 |
5 files changed, 94 insertions, 153 deletions
diff --git a/frontends/php/alarms.php b/frontends/php/alarms.php index b0df35a5..8f1ec5e9 100644 --- a/frontends/php/alarms.php +++ b/frontends/php/alarms.php @@ -91,29 +91,24 @@ $sql="select clock,value,triggerid from alarms where triggerid=".$_GET["triggerid"]." order by clock desc $limit"; $result=DBselect($sql); - echo "<TABLE WIDTH=100% align=center BORDER=0 BGCOLOR=\"#AAAAAA\" cellspacing=1 cellpadding=3>"; - echo "<TR BGCOLOR=\"#CCCCCC\">"; - table_td("<B>".S_TIME."</B>",""); - table_td("<B>".S_STATUS."</B>",""); - table_td("<B>".S_DURATION."</B>",""); - table_td("<B>".S_SUM."</B>",""); - table_td("<B>%</B>",""); - echo "</TR>"; + table_begin(); + table_header(array(S_TIME,S_STATUS,S_DURATION,S_SUM,"%")); $truesum=0; $falsesum=0; $dissum=0; $clock=mktime(); + $col=0; while($row=DBfetch($result)) { $lclock=$clock; $clock=$row["clock"]; $leng=$lclock-$row["clock"]; - if($row["value"]==0) { echo "<TR BGCOLOR=#EEFFEE>"; } - elseif($row["value"]==2) { echo "<TR BGCOLOR=#EEEEEE>"; } - else { echo "<TR BGCOLOR=#FFDDDD>"; } +// if($row["value"]==0) { echo "<TR BGCOLOR=#EEFFEE>"; } +// elseif($row["value"]==2) { echo "<TR BGCOLOR=#EEEEEE>"; } +// else { echo "<TR BGCOLOR=#FFDDDD>"; } - table_td(date("Y.M.d H:i:s",$row["clock"]),""); +// table_td(date("Y.M.d H:i:s",$row["clock"]),""); if($row["value"]==1) { $istrue=S_TRUE_BIG; @@ -143,7 +138,7 @@ $proc=round($proc*100)/100; $proc="$proc%"; - table_td("<B>$istrue</B>",""); +// table_td("<B>$istrue</B>",""); if($leng>60*60*24) { $leng= round(($leng/(60*60*24))*10)/10; @@ -184,12 +179,19 @@ $sum="$sum secs"; } - table_td($leng,""); - table_td($sum,""); - table_td($proc,""); - echo "</TR>"; +// table_td($leng,""); +// table_td($sum,""); +// table_td($proc,""); +// echo "</TR>"; + table_row(array( + date("Y.M.d H:i:s",$row["clock"]), + $istrue, + $leng, + $sum, + $proc + ),$col++); } - echo "</TABLE>"; + table_end(); ?> <?php diff --git a/frontends/php/include/local_en.inc.php b/frontends/php/include/local_en.inc.php index 80484086..c362e4e4 100644 --- a/frontends/php/include/local_en.inc.php +++ b/frontends/php/include/local_en.inc.php @@ -319,6 +319,15 @@ define("S_LAST_CHECK_BIG", "LAST CHECK"); define("S_LAST_VALUE", "Last value"); +// sysmap.php + define("S_LABEL", "Label"); + define("S_X", "X"); + define("S_Y", "Y"); + define("S_ICON", "Icon"); + define("S_HOST_1", "Host 1"); + define("S_HOST_2", "Host 2"); + define("S_LINK_STATUS_INDICATOR", "Link status indicator"); + // map.php define("S_OK_BIG", "OK"); define("S_PROBLEMS_SMALL", "problems"); diff --git a/frontends/php/items.php b/frontends/php/items.php index c5ecc536..e229f446 100644 --- a/frontends/php/items.php +++ b/frontends/php/items.php @@ -229,72 +229,66 @@ table_header(array(S_ID,S_KEY,S_DESCRIPTION,nbsp(S_UPDATE_INTERVAL),S_HISTORY,S_TRENDS,S_SHORT_NAME,S_TYPE,S_STATUS,S_ACTIONS)); } $lasthost=$row["host"]; - iif_echo($col++%2 == 1, - "<TR BGCOLOR=#DDDDDD>", - "<TR BGCOLOR=#EEEEEE>"); - echo "<TD><INPUT TYPE=\"CHECKBOX\" class=\"biginput\" NAME=\"".$row["itemid"]."\"> ".$row["itemid"]."</TD>"; -// echo "<TD>".$row["itemid"]."</TD>"; -// echo "<TD>".$row["host"]."</TD>"; - echo "<TD>".$row["key_"]."</TD>"; - echo "<TD>".$row["description"]."</TD>"; - echo "<TD>".$row["delay"]."</TD>"; - echo "<TD>".$row["history"]."</TD>"; - echo "<TD>".$row["trends"]."</TD>"; - echo "<TD>".$row["host"].":".$row["key_"]."</TD>"; - - echo "<td align=center>"; + $input="<INPUT TYPE=\"CHECKBOX\" class=\"biginput\" NAME=\"".$row["itemid"]."\"> ".$row["itemid"]; + switch($row["type"]) { case 0: - echo S_ZABBIX_AGENT; + $type=S_ZABBIX_AGENT; break; case 1: - echo S_SNMPV1_AGENT; + $type=S_SNMPV1_AGENT; break; case 2: - echo S_ZABBIX_TRAPPER; + $type=S_ZABBIX_TRAPPER; break; case 3: - echo S_SIMPLE_CHECK; + $type=S_SIMPLE_CHECK; break; case 4: - echo S_SNMPV2_AGENT; + $type=S_SNMPV2_AGENT; break; case 5: - echo S_ZABBIX_INTERNAL; + $type=S_ZABBIX_INTERNAL; break; default: - echo S_UNKNOWN; + $type=S_UNKNOWN; break; } - echo "</td>"; - echo "<td align=center>"; switch($row["status"]) { case 0: - echo "<a href=\"items.php?itemid=".$row["itemid"]."&hostid=".$_GET["hostid"]."®ister=changestatus&status=1\"><font color=\"00AA00\">".S_ACTIVE."</font></a>"; + $status=array("value"=>"<a href=\"items.php?itemid=".$row["itemid"]."&hostid=".$_GET["hostid"]."®ister=changestatus&status=1\">".S_ACTIVE."</a>","class"=>"off"); break; case 1: - echo "<a href=\"items.php?itemid=".$row["itemid"]."&hostid=".$_GET["hostid"]."®ister=changestatus&status=0\"><font color=\"AA0000\">".S_NOT_ACTIVE."</font></a>"; + $status=array("value"=>"<a href=\"items.php?itemid=".$row["itemid"]."&hostid=".$_GET["hostid"]."®ister=changestatus&status=0\">".S_NOT_ACTIVE."</a>","class"=>"on"); break; -# case 2: -# echo "Trapper"; -# break; case 3: - echo "<font color=\"AAAAAA\">".S_NOT_SUPPORTED."</font>"; + $status=array("value"=>S_NOT_SUPPORTED,"class"=>"unknown"); break; default: - echo S_UNKNOWN; + $status=S_UNKNOWN; } - echo "</td>"; - iif_echo(check_right("Item","U",$row["itemid"]), - "<TD><A HREF=\"items.php?register=change&itemid=".$row["itemid"]."#form\">".S_CHANGE."</A></TD>", - "<TD>".S_CHANGE."</TD>"); - echo "</TR>"; + $actions=iif(check_right("Item","U",$row["itemid"]), + "<A HREF=\"items.php?register=change&itemid=".$row["itemid"]."#form\">".S_CHANGE."</A>", + S_CHANGE); + + table_row(array( + $input, + $row["key_"], + $row["description"], + $row["delay"], + $row["history"], + $row["trends"], + $row["host"].":".$row["key_"], + $type, + $status, + $actions + ),$col++); } table_end(); show_table2_header_begin(); diff --git a/frontends/php/sysmap.php b/frontends/php/sysmap.php index e17fce12..7f73d1f2 100644 --- a/frontends/php/sysmap.php +++ b/frontends/php/sysmap.php @@ -114,105 +114,56 @@ echo "</TABLE>"; show_table_header("DISPLAYED HOSTS"); - echo "<TABLE BORDER=0 COLS=4 align=center WIDTH=100% BGCOLOR=\"#AAAAAA\" cellspacing=1 cellpadding=3>"; - echo "<TR BGCOLOR=\"#CCCCCC\">"; - echo "<TD WIDTH=10% NOSAVE><B>Host</B></TD>"; - echo "<TD><B>Label</B></TD>"; - echo "<TD WIDTH=5% NOSAVE><B>X</B></TD>"; - echo "<TD WIDTH=5% NOSAVE><B>Y</B></TD>"; - echo "<TD WIDTH=10% NOSAVE><B>Icon</B></TD>"; - echo "<TD WIDTH=15% NOSAVE><B>Actions</B></TD>"; - echo "</TR>"; + table_begin(); + table_header(array(S_HOST,S_LABEL,S_X,S_Y,S_ICON,S_ACTIONS)); $result=DBselect("select h.host,sh.shostid,sh.sysmapid,sh.hostid,sh.label,sh.x,sh.y,sh.icon from sysmaps_hosts sh,hosts h where sh.sysmapid=".$_GET["sysmapid"]." and h.hostid=sh.hostid order by h.host"); $col=0; - for($i=0;$i<DBnum_rows($result);$i++) + while($row=DBfetch($result)) { - if($col==1) - { - echo "<TR BGCOLOR=#EEEEEE>"; - $col=0; - } else - { - echo "<TR BGCOLOR=#DDDDDD>"; - $col=1; - } - - $host=DBget_field($result,$i,0); - $shostid_=DBget_field($result,$i,1); - $sysmapid_=DBget_field($result,$i,2); - $hostid_=DBget_field($result,$i,3); - $label_=DBget_field($result,$i,4); - $x_=DBget_field($result,$i,5); - $y_=DBget_field($result,$i,6); - $icon_=DBget_field($result,$i,7); - - echo "<TD>$host</TD>"; - echo "<TD>$label_</TD>"; - echo "<TD>$x_</TD>"; - echo "<TD>$y_</TD>"; - echo "<TD>".nbsp($icon_)."</TD>"; - echo "<TD><A HREF=\"sysmap.php?sysmapid=$sysmapid_&shostid=$shostid_#form\">Change</A> - <A HREF=\"sysmap.php?register=delete&sysmapid=$sysmapid_&shostid=$shostid_\">Delete</A></TD>"; - echo "</TR>"; + table_row(array( + $row["host"], + $row["label"], + $row["x"], + $row["y"], + nbsp($row["icon"]), + "<A HREF=\"sysmap.php?sysmapid=".$row["sysmapid"]."&shostid=".$row["shostid"]."#form\">Change</A> - <A HREF=\"sysmap.php?register=delete&sysmapid=".$row["sysmapid"]."&shostid=".$row["shostid"]."\">Delete</A>" + ),$col++); } - echo "</TABLE>"; + table_end(); ?> <?php show_table_header("CONNECTORS"); - echo "<TABLE BORDER=0 COLS=4 align=center WIDTH=100% BGCOLOR=\"#AAAAAA\" cellspacing=1 cellpadding=3>"; - echo "<TR BGCOLOR=\"#CCCCCC\">"; - echo "<TD WIDTH=10% NOSAVE><B>Host 1</B></TD>"; - echo "<TD WIDTH=10% NOSAVE><B>Host 2</B></TD>"; - echo "<TD><B>Link status indicator</B></TD>"; - echo "<TD WIDTH=10% NOSAVE><B>Actions</B></TD>"; - echo "</TR>"; + table_begin(); + table_header(array(S_HOST_1,S_HOST_2,S_LINK_STATUS_INDICATOR,S_ACTIONS)); $result=DBselect("select linkid,shostid1,shostid2,triggerid from sysmaps_links where sysmapid=".$_GET["sysmapid"]." order by linkid"); $col=0; - for($i=0;$i<DBnum_rows($result);$i++) + while($row=DBfetch($result)) { - if($col==1) - { - echo "<TR BGCOLOR=#EEEEEE>"; - $col=0; - } else - { - echo "<TR BGCOLOR=#DDDDDD>"; - $col=1; - } - - $linkid=DBget_field($result,$i,0); - $shostid1=DBget_field($result,$i,1); - $shostid2=DBget_field($result,$i,2); - $triggerid=DBget_field($result,$i,3); - - $result1=DBselect("select label from sysmaps_hosts where shostid=$shostid1"); + $result1=DBselect("select label from sysmaps_hosts where shostid=".$row["shostid1"]); $label1=DBget_field($result1,0,0); - $result1=DBselect("select label from sysmaps_hosts where shostid=$shostid2"); + $result1=DBselect("select label from sysmaps_hosts where shostid=".$row["shostid2"]); $label2=DBget_field($result1,0,0); - if(isset($triggerid)) + if(isset($row["triggerid"])) { -// $trigger=get_trigger_by_triggerid($triggerid); -// $description=$trigger["description"]; -// if( strstr($description,"%s")) -// { - $description=expand_trigger_description($triggerid); -// } + $description=expand_trigger_description($row["triggerid"]); } else { $description="-"; } - echo "<TD>$label1</TD>"; - echo "<TD>$label2</TD>"; - echo "<TD>$description</TD>"; - echo "<TD><A HREF=\"sysmap.php?sysmapid=".$_GET["sysmapid"]."®ister=delete_link&linkid=$linkid\">Delete</A></TD>"; - echo "</TR>"; + table_row(array( + $label1, + $label2, + $description, + "<A HREF=\"sysmap.php?sysmapid=".$_GET["sysmapid"]."®ister=delete_link&linkid=".$row["linkid"]."\">Delete</A>" + ),$col++); } - echo "</TABLE>"; + table_end(); ?> <?php diff --git a/frontends/php/sysmaps.php b/frontends/php/sysmaps.php index 3599407d..bde13f2d 100644 --- a/frontends/php/sysmaps.php +++ b/frontends/php/sysmaps.php @@ -66,14 +66,8 @@ <?php show_table_header("NETWORK MAPS"); - echo "<TABLE BORDER=0 align=center COLS=4 WIDTH=100% BGCOLOR=\"#AAAAAA\" cellspacing=1 cellpadding=3>"; - echo "<TR BGCOLOR=\"#CCCCCC\">"; - echo "<TD WIDTH=3% NOSAVE><B>Id</B></TD>"; - echo "<TD><B>Name</B></TD>"; - echo "<TD WIDTH=5% NOSAVE><B>Width</B></TD>"; - echo "<TD WIDTH=5% NOSAVE><B>Height</B></TD>"; - echo "<TD WIDTH=15% NOSAVE><B>Actions</B></TD>"; - echo "</TR>"; + table_begin(); + table_header(array(S_ID,S_NAME,S_WIDTH,S_HEIGHT,S_ACTIONS)); $result=DBselect("select s.sysmapid,s.name,s.width,s.height from sysmaps s order by s.name"); $col=0; @@ -84,22 +78,13 @@ continue; } - if($col==1) - { - echo "<TR BGCOLOR=#EEEEEE>"; - $col=0; - } else - { - echo "<TR BGCOLOR=#DDDDDD>"; - $col=1; - } - - echo "<TD>".$row["sysmapid"]."</TD>"; - echo "<TD><a href=\"sysmap.php?sysmapid=".$row["sysmapid"]."\">".$row["name"]."</a></TD>"; - echo "<TD>".$row["width"]."</TD>"; - echo "<TD>".$row["height"]."</TD>"; - echo "<TD><A HREF=\"sysmaps.php?sysmapid=".$row["sysmapid"]."#form\">Change</A></TD>"; - echo "</TR>"; + table_row(array( + $row["sysmapid"], + "<a href=\"sysmap.php?sysmapid=".$row["sysmapid"]."\">".$row["name"]."</a>", + $row["width"], + $row["height"], + "<A HREF=\"sysmaps.php?sysmapid=".$row["sysmapid"]."#form\">Change</A>" + ),$col++); } if(DBnum_rows($result)==0) { @@ -107,7 +92,7 @@ echo "<TD COLSPAN=5 ALIGN=CENTER>-No maps defined-</TD>"; echo "<TR>"; } - echo "</TABLE>"; + table_end(); ?> <?php |