summaryrefslogtreecommitdiffstats
path: root/frontends/php/triggers.php
diff options
context:
space:
mode:
authorhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-11-20 17:08:41 +0000
committerhugetoad <hugetoad@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2004-11-20 17:08:41 +0000
commit7ce63d5fa0fa7b06e7bb125cceb2521d83a6ad83 (patch)
treeae45e08353c8e756d89d843f7316b3de08ac98b4 /frontends/php/triggers.php
parent6a36d80ad7af382a5e894b64fb4018313549a9dd (diff)
Cosmetic changes.
git-svn-id: svn://svn.zabbix.com/trunk@1498 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/triggers.php')
-rw-r--r--frontends/php/triggers.php97
1 files changed, 34 insertions, 63 deletions
diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php
index edfddc60..3aeee56d 100644
--- a/frontends/php/triggers.php
+++ b/frontends/php/triggers.php
@@ -211,9 +211,12 @@
if(isset($_GET["hostid"])&&!isset($_GET["triggerid"]))
{
+ table_begin();
+ table_header(array(S_ID,S_DESCRIPTION,S_EXPRESSION, S_SEVERITY, S_STATUS, S_ACTIONS));
+ echo "<form method=\"get\" action=\"triggers.php\">";
+ echo "<input class=\"biginput\" name=\"hostid\" type=hidden value=".$_GET["hostid"]." size=8>";
$result=DBselect("select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,t.status,t.value,t.priority from triggers t,hosts h,items i,functions f where f.itemid=i.itemid and h.hostid=i.hostid and t.triggerid=f.triggerid and h.hostid=".$_GET["hostid"]." order by h.host,t.description");
- $lasthost="";
$col=0;
while($row=DBfetch($result))
{
@@ -221,104 +224,72 @@
{
continue;
}
- if($lasthost!=$row["host"])
- {
- if($lasthost!="")
- {
- echo "</TABLE><BR>";
- }
-# echo "<br>";
-# show_table_header("<A HREF='triggers.php?hostid=".$row["hostid"]."'>".$row["host"]."</A>");
- echo "<form method=\"get\" action=\"triggers.php\">";
- echo "<input class=\"biginput\" name=\"hostid\" type=hidden value=".$_GET["hostid"]." size=8>";
- echo "<TABLE BORDER=0 COLS=3 WIDTH=100% BGCOLOR=\"#AAAAAA\" cellspacing=1 cellpadding=3>";
- echo "<TR BGCOLOR=\"#CCCCCC\">";
- echo "<TD WIDTH=\"8%\"><B>Id</B></TD>";
- echo "<TD><B>".S_DESCRIPTION."</B></TD>";
- echo "<TD><B>".S_EXPRESSION."</B></TD>";
- echo "<TD WIDTH=5%><B>".S_SEVERITY."</B></TD>";
- echo "<TD WIDTH=5%><B>".S_STATUS."</B></TD>";
- echo "<TD WIDTH=15% NOSAVE><B>".S_ACTIONS."</B></TD>";
- echo "</TR>\n";
- }
- $lasthost=$row["host"];
- if($col++%2 == 1) { echo "<TR BGCOLOR=#DDDDDD>"; }
- else { echo "<TR BGCOLOR=#EEEEEE>"; }
-
-// $description=stripslashes(htmlspecialchars($row["description"]));
-
-// if( strstr($description,"%s"))
-// {
- $description=expand_trigger_description($row["triggerid"]);
-// }
- echo "<TD><INPUT TYPE=\"CHECKBOX\" class=\"biginput\" NAME=\"".$row["triggerid"]."\"> ".$row["triggerid"]."</TD>";
- echo "<TD>";
- echo $description;
+ $description=expand_trigger_description($row["triggerid"]);
+ $id="<INPUT TYPE=\"CHECKBOX\" class=\"biginput\" NAME=\"".$row["triggerid"]."\"> ".$row["triggerid"];
$sql="select t.triggerid,t.description from triggers t,trigger_depends d where t.triggerid=d.triggerid_up and d.triggerid_down=".$row["triggerid"];
$result1=DBselect($sql);
if(DBnum_rows($result1)>0)
{
- echo "<p><strong>".S_DEPENDS_ON."</strong>:&nbsp;<br>";
+ $description=$description."<p><strong>".S_DEPENDS_ON."</strong>:&nbsp;<br>";
for($i=0;$i<DBnum_rows($result1);$i++)
{
$depid=DBget_field($result1,$i,0);
$depdescr=expand_trigger_description($depid);
- echo "$depdescr<br>";
+ $description=$description."$depdescr<br>";
}
- echo "</p>";
+ $description=$description."</p>";
}
- echo "</TD>";
-
- echo "<TD>".explode_exp($row["expression"],1)."</TD>";
-
- if($row["priority"]==0) echo "<TD ALIGN=CENTER>".S_NOT_CLASSIFIED."</TD>";
- elseif($row["priority"]==1) echo "<TD ALIGN=CENTER>".S_INFORMATION."</TD>";
- elseif($row["priority"]==2) echo "<TD ALIGN=CENTER>".S_WARNING."</TD>";
- elseif($row["priority"]==3) echo "<TD ALIGN=CENTER BGCOLOR=#DDAAAA>".S_AVERAGE."</TD>";
- elseif($row["priority"]==4) echo "<TD ALIGN=CENTER BGCOLOR=#FF8888>".S_HIGH."</TD>";
- elseif($row["priority"]==5) echo "<TD ALIGN=CENTER BGCOLOR=RED>".S_DISASTER."</TD>";
- else echo "<TD ALIGN=CENTER><B>".$row["priority"]."</B></TD>";
+ if($row["priority"]==0) $priority=S_NOT_CLASSIFIED;
+ elseif($row["priority"]==1) $priority=S_INFORMATION;
+ elseif($row["priority"]==2) $priority=S_WARNING;
+ elseif($row["priority"]==3) $priority=array("value"=>S_AVERAGE,"class"=>"average");
+ elseif($row["priority"]==4) $priority=array("value"=>S_HIGH,"class"=>"high");
+ elseif($row["priority"]==5) $priority=array("value"=>S_DISASTER,"class"=>"disaster");
+ else $priority=$row["priority"];
- echo "<TD>";
if($row["status"] == 1)
{
- echo "<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=0&hostid=".$row["hostid"]."\"><font color=\"AA0000\">".S_DISABLED."</font></a>";
+ $status="<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=0&hostid=".$row["hostid"]."\"><font color=\"AA0000\">".S_DISABLED."</font></a>";
}
else if($row["status"] == 2)
{
- echo "<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=1&hostid=".$row["hostid"]."\"><font color=\"AAAAAA\">".S_UNKNOWN."</font></a>";
+ $status="<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=1&hostid=".$row["hostid"]."\"><font color=\"AAAAAA\">".S_UNKNOWN."</font></a>";
}
else
{
- echo "<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=1&hostid=".$row["hostid"]."\"><font color=\"00AA00\">".S_ENABLED."</font></a>";
+ $status="<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=1&hostid=".$row["hostid"]."\"><font color=\"00AA00\">".S_ENABLED."</font></a>";
}
- $expression=rawurlencode($row["expression"]);
- echo "</TD>";
+// $expression=rawurlencode($row["expression"]);
- echo "<TD>";
if(isset($_GET["hostid"]))
{
- echo "<A HREF=\"triggers.php?triggerid=".$row["triggerid"]."&hostid=".$row["hostid"]."#form\">".S_CHANGE."</A> ";
+ $actions="<A HREF=\"triggers.php?triggerid=".$row["triggerid"]."&hostid=".$row["hostid"]."#form\">".S_CHANGE."</A> ";
}
else
{
- echo "<A HREF=\"triggers.php?triggerid=".$row["triggerid"]."#form\">".S_CHANGE."</A> ";
+ $actions="<A HREF=\"triggers.php?triggerid=".$row["triggerid"]."#form\">".S_CHANGE."</A> ";
}
- echo "-";
+ $actions=$actions."-";
if(get_action_count_by_triggerid($row["triggerid"])>0)
{
- echo "<A HREF=\"actions.php?triggerid=".$row["triggerid"]."\"><b>A</b>ctions</A>";
+ $actions=$actions."<A HREF=\"actions.php?triggerid=".$row["triggerid"]."\"><b>A</b>ctions</A>";
}
else
{
- echo "<A HREF=\"actions.php?triggerid=".$row["triggerid"]."\">".S_ACTIONS."</A>";
+ $actions=$actions."<A HREF=\"actions.php?triggerid=".$row["triggerid"]."\">".S_ACTIONS."</A>";
}
- echo "</TD>";
- echo "</TR>";
+ table_row(array(
+ $id,
+ $description,
+ explode_exp($row["expression"],1),
+ $priority,
+ $status,
+ $actions
+ ),$col++);
}
- echo "</table>";
+ table_end();
show_table2_header_begin();
echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"enable selected\" onClick=\"return Confirm('".S_ENABLE_SELECTED_TRIGGERS_Q."');\">";
echo "<input class=\"button\" type=\"submit\" name=\"register\" value=\"disable selected\" onClick=\"return Confirm('Disable selected triggers?');\">";