summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-30 15:12:53 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-01-30 15:12:53 +0000
commit393c9ed7f43d6d6471bfac4efaa072e1e9db0a9e (patch)
tree9ea09dc84e61db08477d68dead456761ffee8561
parentcf51431eb0610dc4f4378a61c208cc97890643a9 (diff)
downloadzabbix-393c9ed7f43d6d6471bfac4efaa072e1e9db0a9e.tar.gz
zabbix-393c9ed7f43d6d6471bfac4efaa072e1e9db0a9e.tar.xz
zabbix-393c9ed7f43d6d6471bfac4efaa072e1e9db0a9e.zip
- Frontend improvements (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@2577 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--frontends/php/actions.php24
-rw-r--r--frontends/php/css.css6
-rw-r--r--frontends/php/graph.php41
-rw-r--r--frontends/php/graphs.php59
-rw-r--r--frontends/php/include/classes/ccombobox.inc.php12
-rw-r--r--frontends/php/include/classes/ctag.inc.php12
-rw-r--r--frontends/php/items.php75
-rw-r--r--frontends/php/screens.php7
-rw-r--r--frontends/php/sysmap.php13
-rw-r--r--frontends/php/triggers.php57
10 files changed, 189 insertions, 117 deletions
diff --git a/frontends/php/actions.php b/frontends/php/actions.php
index 82ce9d75..a1addc62 100644
--- a/frontends/php/actions.php
+++ b/frontends/php/actions.php
@@ -62,22 +62,20 @@
?>
<?php
- $h1="&nbsp;".S_HISTORY_OF_ACTIONS_BIG;
-
- $h2="";
+ $form = new CForm();
+ $btnPrev = new CButton("prev","<< Prev 100");
if(isset($_REQUEST["start"]))
{
- $h2=$h2."<input class=\"biginput\" name=\"start\" type=hidden value=".$_REQUEST["start"]." size=8>";
- $h2=$h2."<input class=\"button\" type=\"submit\" name=\"prev\" value=\"<< Prev 100\">";
- }
- else
- {
- $h2=$h2."<input class=\"button\" type=\"submit\" disabled name=\"prev\" value=\"<< Prev 100\">";
+ $form->AddVar("start",$_REQUEST["start"]);
+ } else {
+ $btnPrev->SetEnable('no');
}
- $h2=$h2."<input class=\"button\" type=\"submit\" name=\"next\" value=\"Next 100 >>\">";
+ $form->AddItem($btnPrev);
+
+ $form->AddItem(new CButton("next","Next 100 >>"));
- show_header2($h1,$h2,"<form name=\"form2\" method=\"get\" action=\"actions.php\">","</form>");
+ show_header2(S_HISTORY_OF_ACTIONS_BIG,$form);
?>
@@ -87,7 +85,9 @@
{
$_REQUEST["start"]=0;
}
- $sql="select a.alertid,a.clock,mt.description,a.sendto,a.subject,a.message,a.status,a.retries,a.error from alerts a,media_type mt where mt.mediatypeid=a.mediatypeid order by a.clock desc limit ".(10*($_REQUEST["start"]+100));
+ $sql="select a.alertid,a.clock,mt.description,a.sendto,a.subject,a.message,a.status,a.retries,".
+ "a.error from alerts a,media_type mt where mt.mediatypeid=a.mediatypeid order by a.clock".
+ " desc limit ".(10*($_REQUEST["start"]+100));
$result=DBselect($sql);
$table = new CTableInfo(S_NO_ACTIONS_FOUND);
diff --git a/frontends/php/css.css b/frontends/php/css.css
index 6ef72e9c..bf8ea6d8 100644
--- a/frontends/php/css.css
+++ b/frontends/php/css.css
@@ -268,6 +268,7 @@ tr.table_even_row:hover
{
color: #00AA00;
}
+
A.enabled:link { color:#00AA00; text-decoration: none; }
A.enabled:visited { color:#00AA00; text-decoration: none; }
A.enabled:hover { color:#00AA00; text-decoration: underline; }
@@ -278,6 +279,11 @@ A.disabled:visited { color:#AA0000; text-decoration: none; }
A.disabled:hover { color:#AA0000; text-decoration: underline; }
A.disabled:active { color:#AA0000; text-decoration: underline;}
+A.uncnown:link { color:#AAAAAA; text-decoration: none; }
+A.uncnown:visited { color:#AAAAAA; text-decoration: none; }
+A.uncnown:hover { color:#AAAAAA; text-decoration: underline; }
+A.uncnown:active { color:#AAAAAA; text-decoration: underline;}
+
A.off:link { color:#00AA00; text-decoration: none; }
A.off:visited { color:#00AA00; text-decoration: none; }
A.off:hover { color:#00AA00; text-decoration: underline; }
diff --git a/frontends/php/graph.php b/frontends/php/graph.php
index 2a31526b..8e4c5116 100644
--- a/frontends/php/graph.php
+++ b/frontends/php/graph.php
@@ -27,7 +27,7 @@
?>
<?php
show_table_header(S_CONFIGURATION_OF_GRAPH_BIG);
- echo "<br>";
+ echo BR;
?>
<?php
if(!check_right("Graph","R",$_REQUEST["graphid"]))
@@ -43,28 +43,40 @@
{
if($_REQUEST["register"]=="add")
{
- add_graph_item_to_templates($_REQUEST["graphid"],$_REQUEST["itemid"],$_REQUEST["color"],$_REQUEST["drawtype"],$_REQUEST["sortorder"],$_REQUEST["yaxisside"]);
+ add_graph_item_to_templates($_REQUEST["graphid"],$_REQUEST["itemid"],
+ $_REQUEST["color"],$_REQUEST["drawtype"],$_REQUEST["sortorder"],
+ $_REQUEST["yaxisside"]);
- $gitemid=add_item_to_graph($_REQUEST["graphid"],$_REQUEST["itemid"],$_REQUEST["color"],$_REQUEST["drawtype"],$_REQUEST["sortorder"],$_REQUEST["yaxisside"]);
+ $gitemid=add_item_to_graph($_REQUEST["graphid"],$_REQUEST["itemid"],
+ $_REQUEST["color"],$_REQUEST["drawtype"],$_REQUEST["sortorder"],
+ $_REQUEST["yaxisside"]);
if($gitemid)
{
$graph=get_graph_by_graphid($_REQUEST["graphid"]);
$item=get_item_by_itemid($_REQUEST["itemid"]);
- add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_GRAPH_ELEMENT,"Graph ID [".$_REQUEST["graphid"]."] Name [".$graph["name"]."] Added [".$item["description"]."]");
+ add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_GRAPH_ELEMENT,
+ "Graph ID [".$_REQUEST["graphid"]."] Name [".$graph["name"]."]".
+ " Added [".$item["description"]."]");
}
show_messages($gitemid,S_ITEM_ADDED, S_CANNOT_ADD_ITEM);
}
if($_REQUEST["register"]=="update")
{
- update_graph_item_from_templates($_REQUEST["gitemid"],$_REQUEST["itemid"],$_REQUEST["color"],$_REQUEST["drawtype"],$_REQUEST["sortorder"],$_REQUEST["yaxisside"]);
+ update_graph_item_from_templates($_REQUEST["gitemid"],$_REQUEST["itemid"],
+ $_REQUEST["color"],$_REQUEST["drawtype"],$_REQUEST["sortorder"],
+ $_REQUEST["yaxisside"]);
- $result=update_graph_item($_REQUEST["gitemid"],$_REQUEST["itemid"],$_REQUEST["color"],$_REQUEST["drawtype"],$_REQUEST["sortorder"],$_REQUEST["yaxisside"]);
+ $result=update_graph_item($_REQUEST["gitemid"],$_REQUEST["itemid"],
+ $_REQUEST["color"],$_REQUEST["drawtype"],$_REQUEST["sortorder"],
+ $_REQUEST["yaxisside"]);
if($result)
{
$graphitem=get_graphitem_by_gitemid($_REQUEST["gitemid"]);
$graph=get_graph_by_graphid($graphitem["graphid"]);
$item=get_item_by_itemid($graphitem["itemid"]);
- add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_GRAPH_ELEMENT,"Graph ID [".$graphitem["graphid"]."] Name [".$graph["name"]."] Updated [".$item["description"]."]");
+ add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_GRAPH_ELEMENT,
+ "Graph ID [".$graphitem["graphid"]."] Name [".$graph["name"]."]".
+ " Updated [".$item["description"]."]");
}
show_messages($result, S_ITEM_UPDATED, S_CANNOT_UPDATE_ITEM);
}
@@ -77,7 +89,9 @@
$result=delete_graphs_item($_REQUEST["gitemid"]);
if($result)
{
- add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_GRAPH_ELEMENT,"Graph ID [".$graphitem["graphid"]."] Name [".$graph["name"]."] Deleted [".$item["description"]."]");
+ add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_GRAPH_ELEMENT,
+ "Graph ID [".$graphitem["graphid"]."] Name [".$graph["name"]."]".
+ " Deleted [".$item["description"]."]");
}
show_messages($result, S_ITEM_DELETED, S_CANNOT_DELETE_ITEM);
unset($_REQUEST["gitemid"]);
@@ -121,7 +135,9 @@
echo "<TD WIDTH=10% NOSAVE><B>".S_ACTIONS."</B></TD>";
echo "</TR>";
- $sql="select i.itemid,h.host,i.description,gi.gitemid,gi.color,gi.drawtype,gi.sortorder,i.key_ from hosts h,graphs_items gi,items i where i.itemid=gi.itemid and gi.graphid=".$_REQUEST["graphid"]." and h.hostid=i.hostid order by gi.sortorder";
+ $sql="select i.itemid,h.host,i.description,gi.gitemid,gi.color,gi.drawtype,gi.sortorder,i.key_".
+ " from hosts h,graphs_items gi,items i where i.itemid=gi.itemid".
+ " and gi.graphid=".$_REQUEST["graphid"]." and h.hostid=i.hostid order by gi.sortorder";
$result=DBselect($sql);
$col=0;
while($row=DBfetch($result))
@@ -151,7 +167,8 @@
if(isset($_REQUEST["gitemid"]))
{
- $sql="select itemid,color,drawtype,sortorder,yaxisside from graphs_items where gitemid=".$_REQUEST["gitemid"];
+ $sql="select itemid,color,drawtype,sortorder,yaxisside from graphs_items".
+ " where gitemid=".$_REQUEST["gitemid"];
$result=DBselect($sql);
$row=DBfetch($result);
$itemid=$row["itemid"];
@@ -179,7 +196,9 @@
echo S_PARAMETER;
show_table2_h_delimiter();
- $result=DBselect("select h.host,i.description,i.itemid,i.key_ from hosts h,items i where h.hostid=i.hostid and h.status in(".HOST_STATUS_MONITORED.",".HOST_STATUS_TEMPLATE.") and i.status=".ITEM_STATUS_ACTIVE." order by h.host,i.description");
+ $result=DBselect("select h.host,i.description,i.itemid,i.key_ from hosts h,items"
+ " where h.hostid=i.hostid and h.status in(".HOST_STATUS_MONITORED.",".HOST_STATUS_TEMPLATE.")".
+ " and i.status=".ITEM_STATUS_ACTIVE." order by h.host,i.description");
echo "<select name=\"itemid\" size=1>";
while($row=DBfetch($result))
{
diff --git a/frontends/php/graphs.php b/frontends/php/graphs.php
index b30f940a..d541ae43 100644
--- a/frontends/php/graphs.php
+++ b/frontends/php/graphs.php
@@ -37,7 +37,9 @@
show_page_footer();
exit;
}
- $_REQUEST["hostid"]=@iif(isset($_REQUEST["hostid"]),$_REQUEST["hostid"],get_profile("web.latest.hostid",0));
+
+ $_REQUEST["hostid"]=get_request("hostid",get_profile("web.latest.hostid",0));
+
update_profile("web.latest.hostid",$_REQUEST["hostid"]);
update_profile("web.menu.config.last",$page["file"]);
?>
@@ -46,21 +48,29 @@
{
if($_REQUEST["register"]=="add")
{
- $result=add_graph($_REQUEST["name"],$_REQUEST["width"],$_REQUEST["height"],$_REQUEST["yaxistype"],$_REQUEST["yaxismin"],$_REQUEST["yaxismax"]);
+ $result=add_graph($_REQUEST["name"],$_REQUEST["width"],$_REQUEST["height"],
+ $_REQUEST["yaxistype"],$_REQUEST["yaxismin"],$_REQUEST["yaxismax"]);
if($result)
{
- add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_GRAPH,"Graph [".addslashes($_REQUEST["name"])."]");
+ add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_GRAPH,
+ "Graph [".addslashes($_REQUEST["name"])."]");
}
show_messages($result, S_GRAPH_ADDED, S_CANNOT_ADD_GRAPH);
}
if($_REQUEST["register"]=="update")
{
- update_graph_from_templates($_REQUEST["graphid"],$_REQUEST["name"],$_REQUEST["width"],$_REQUEST["height"],$_REQUEST["yaxistype"],$_REQUEST["yaxismin"],$_REQUEST["yaxismax"]);
+ update_graph_from_templates($_REQUEST["graphid"],$_REQUEST["name"],
+ $_REQUEST["width"],$_REQUEST["height"],$_REQUEST["yaxistype"],
+ $_REQUEST["yaxismin"],$_REQUEST["yaxismax"]);
- $result=update_graph($_REQUEST["graphid"],$_REQUEST["name"],$_REQUEST["width"],$_REQUEST["height"],$_REQUEST["yaxistype"],$_REQUEST["yaxismin"],$_REQUEST["yaxismax"]);
+ $result=update_graph($_REQUEST["graphid"],$_REQUEST["name"],$_REQUEST["width"],
+ $_REQUEST["height"],$_REQUEST["yaxistype"],$_REQUEST["yaxismin"],
+ $_REQUEST["yaxismax"]);
if($result)
{
- add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_GRAPH,"Graph ID [".$_REQUEST["graphid"]."] Graph [".addslashes($_REQUEST["name"])."]");
+ add_audit(AUDIT_ACTION_ADD,AUDIT_RESOURCE_GRAPH,
+ "Graph ID [".$_REQUEST["graphid"]."] Graph [".
+ addslashes($_REQUEST["name"])."]");
}
show_messages($result, S_GRAPH_UPDATED, S_CANNOT_UPDATE_GRAPH);
}
@@ -71,7 +81,8 @@
$result=delete_graph($_REQUEST["graphid"]);
if($result)
{
- add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_GRAPH,"Graph [".addslashes($graph["name"])."]");
+ add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_GRAPH,
+ "Graph [".addslashes($graph["name"])."]");
}
show_messages($result, S_GRAPH_DELETED, S_CANNOT_DELETE_GRAPH);
unset($_REQUEST["graphid"]);
@@ -112,7 +123,10 @@
while($row=DBfetch($result))
{
// Check if at least one host with read permission exists for this group
- $result2=DBselect("select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.hostid=i.hostid and hg.groupid=".$row["groupid"]." and hg.hostid=h.hostid and h.status not in (".HOST_STATUS_DELETED.") group by h.hostid,h.host order by h.host");
+ $result2=DBselect("select h.hostid,h.host from hosts h,items i,hosts_groups hg".
+ " where h.hostid=i.hostid and hg.groupid=".$row["groupid"].
+ " and hg.hostid=h.hostid and h.status not in (".HOST_STATUS_DELETED.")".
+ " group by h.hostid,h.host order by h.host");
$cnt=0;
while($row2=DBfetch($result2))
{
@@ -135,20 +149,20 @@
if(isset($_REQUEST["groupid"]))
{
- $sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg where h.hostid=i.hostid and hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid and h.status not in (".HOST_STATUS_DELETED.") group by h.hostid,h.host order by h.host";
+ $sql="select h.hostid,h.host from hosts h,items i,hosts_groups hg".
+ " where h.hostid=i.hostid and hg.groupid=".$_REQUEST["groupid"]." and hg.hostid=h.hostid".
+ " and h.status not in (".HOST_STATUS_DELETED.") group by h.hostid,h.host order by h.host";
}
else
{
- $sql="select h.hostid,h.host from hosts h,items i where h.hostid=i.hostid and h.status not in (".HOST_STATUS_DELETED.") group by h.hostid,h.host order by h.host";
+ $sql="select h.hostid,h.host from hosts h,items i where h.hostid=i.hostid".
+ " and h.status not in (".HOST_STATUS_DELETED.") group by h.hostid,h.host order by h.host";
}
$result=DBselect($sql);
while($row=DBfetch($result))
{
- if(!check_right("Host","R",$row["hostid"]))
- {
- continue;
- }
+ if(!check_right("Host","R",$row["hostid"])) continue;
$h2=$h2.form_select("hostid",$row["hostid"],$row["host"]);
}
$h2=$h2."</select>";
@@ -161,18 +175,18 @@
if(isset($_REQUEST["hostid"])&&($_REQUEST["hostid"]!=0))
{
- $result=DBselect("select distinct g.graphid,g.name,g.width,g.height from graphs g,items i,graphs_items gi where gi.itemid=i.itemid and g.graphid=gi.graphid and i.hostid=".$_REQUEST["hostid"]." order by g.name");
+ $result=DBselect("select distinct g.graphid,g.name,g.width,g.height from graphs g,items i".
+ ",graphs_items gi where gi.itemid=i.itemid and g.graphid=gi.graphid".
+ " and i.hostid=".$_REQUEST["hostid"]." order by g.name");
}
else
{
- $result=DBselect("select distinct g.graphid,g.name,g.width,g.height from graphs g order by g.name");
+ $result=DBselect("select distinct g.graphid,g.name,g.width,g.height".
+ " from graphs g order by g.name");
}
while($row=DBfetch($result))
{
- if(!check_right("Graph","U",$row["graphid"]))
- {
- continue;
- }
+ if(!check_right("Graph","U",$row["graphid"])) continue;
if(!isset($_REQUEST["hostid"]))
{
@@ -183,16 +197,15 @@
$table->addRow(array(
$row["graphid"],
- "<a href=\"graph.php?graphid=".$row["graphid"]."\">".$row["name"]."</a>",
+ new CLink($row["name"],"graph.php?graphid=".$row["graphid"]),
$row["width"],
$row["height"],
- "<A HREF=\"graphs.php?graphid=".$row["graphid"]."#form\">Change</A>"
+ new CLink("Change","graphs.php?graphid=".$row["graphid"])
));
}
$table->show();
?>
<?php
- echo "<a name=\"form\"></a>";
echo BR;
insert_graph_form();
diff --git a/frontends/php/include/classes/ccombobox.inc.php b/frontends/php/include/classes/ccombobox.inc.php
index cecb45c3..849f2e5a 100644
--- a/frontends/php/include/classes/ccombobox.inc.php
+++ b/frontends/php/include/classes/ccombobox.inc.php
@@ -44,18 +44,6 @@
}
return $this->error("Incorrect value for SetCaption [$value]");
}
- function SetEnable($value='yes')
- {
- if(is_null($value))
- return 0;
- elseif((is_string($value) && ($value == 'yes' || $value == 'enabled' || $value=='on'))
- || (is_int($value) && $value<>0))
- return $this->DelOption('disabled');
- elseif((is_string($value) && ($value == 'no' || $value == 'disabled' || $value=='off'))
- || (is_int($value) && $value==0))
- return $this->AddOption('disabled','disabled');
- return $this->error("Incorrect value for SetEnable [$value]");
- }
function SetSelected($value='yes')
{
if(is_null($value))
diff --git a/frontends/php/include/classes/ctag.inc.php b/frontends/php/include/classes/ctag.inc.php
index cf31f685..56de0559 100644
--- a/frontends/php/include/classes/ctag.inc.php
+++ b/frontends/php/include/classes/ctag.inc.php
@@ -180,6 +180,18 @@
print ($this->tag_end);
}
}
+ function SetEnable($value='yes')
+ {
+ if(is_null($value))
+ return 0;
+ elseif((is_string($value) && ($value == 'yes' || $value == 'enabled' || $value=='on'))
+ || (is_int($value) && $value<>0))
+ return $this->DelOption('disabled');
+ elseif((is_string($value) && ($value == 'no' || $value == 'disabled' || $value=='off'))
+ || (is_int($value) && $value==0))
+ return $this->AddOption('disabled','disabled');
+ return $this->error("Incorrect value for SetEnable [$value]");
+ }
function error($value)
{
error("class(".get_class($this).") - ".$value);
diff --git a/frontends/php/items.php b/frontends/php/items.php
index e021b77f..50fe0ec3 100644
--- a/frontends/php/items.php
+++ b/frontends/php/items.php
@@ -104,14 +104,32 @@
{
if($_REQUEST["action"]=="add to group")
{
- $itemid=add_item_to_group($_REQUEST["groupid"],$_REQUEST["description"],$_REQUEST["key"],$_REQUEST["hostid"],$_REQUEST["delay"],$_REQUEST["history"],$_REQUEST["status"],$_REQUEST["type"],$_REQUEST["snmp_community"],$_REQUEST["snmp_oid"],$_REQUEST["value_type"],$_REQUEST["trapper_hosts"],$_REQUEST["snmp_port"],$_REQUEST["units"],$_REQUEST["multiplier"],$_REQUEST["delta"],$_REQUEST["snmpv3_securityname"],$_REQUEST["snmpv3_securitylevel"],$_REQUEST["snmpv3_authpassphrase"],$_REQUEST["snmpv3_privpassphrase"],$_REQUEST["formula"],$_REQUEST["trends"],$_REQUEST["logtimefmt"]);
+ $itemid=add_item_to_group(
+ $_REQUEST["groupid"],$_REQUEST["description"],$_REQUEST["key"],
+ $_REQUEST["hostid"],$_REQUEST["delay"],$_REQUEST["history"],
+ $_REQUEST["status"],$_REQUEST["type"],$_REQUEST["snmp_community"],
+ $_REQUEST["snmp_oid"],$_REQUEST["value_type"],$_REQUEST["trapper_hosts"],
+ $_REQUEST["snmp_port"],$_REQUEST["units"],$_REQUEST["multiplier"],
+ $_REQUEST["delta"],$_REQUEST["snmpv3_securityname"],
+ $_REQUEST["snmpv3_securitylevel"],$_REQUEST["snmpv3_authpassphrase"],
+ $_REQUEST["snmpv3_privpassphrase"],$_REQUEST["formula"],
+ $_REQUEST["trends"],$_REQUEST["logtimefmt"]);
show_messages($itemid, S_ITEM_ADDED, S_CANNOT_ADD_ITEM);
unset($_REQUEST["itemid"]);
unset($itemid);
}
if($_REQUEST["action"]=="update in group")
{
- $result=update_item_in_group($_REQUEST["groupid"],$_REQUEST["itemid"],$_REQUEST["description"],$_REQUEST["key"],$_REQUEST["hostid"],$_REQUEST["delay"],$_REQUEST["history"],$_REQUEST["status"],$_REQUEST["type"],$_REQUEST["snmp_community"],$_REQUEST["snmp_oid"],$_REQUEST["value_type"],$_REQUEST["trapper_hosts"],$_REQUEST["snmp_port"],$_REQUEST["units"],$_REQUEST["multiplier"],$_REQUEST["delta"],$_REQUEST["snmpv3_securityname"],$_REQUEST["snmpv3_securitylevel"],$_REQUEST["snmpv3_authpassphrase"],$_REQUEST["snmpv3_privpassphrase"],$_REQUEST["formula"],$_REQUEST["trends"],$_REQUEST["logtimefmt"]);
+ $result=update_item_in_group($_REQUEST["groupid"],
+ $_REQUEST["itemid"],$_REQUEST["description"],$_REQUEST["key"],
+ $_REQUEST["hostid"],$_REQUEST["delay"],$_REQUEST["history"],
+ $_REQUEST["status"],$_REQUEST["type"],$_REQUEST["snmp_community"],
+ $_REQUEST["snmp_oid"],$_REQUEST["value_type"],$_REQUEST["trapper_hosts"],
+ $_REQUEST["snmp_port"],$_REQUEST["units"],$_REQUEST["multiplier"],
+ $_REQUEST["delta"],$_REQUEST["snmpv3_securityname"],
+ $_REQUEST["snmpv3_securitylevel"],$_REQUEST["snmpv3_authpassphrase"],
+ $_REQUEST["snmpv3_privpassphrase"],$_REQUEST["formula"],
+ $_REQUEST["trends"],$_REQUEST["logtimefmt"]);
show_messages($result, S_ITEM_UPDATED, S_CANNOT_UPDATE_ITEM);
unset($_REQUEST["itemid"]);
}
@@ -124,7 +142,15 @@
}
else if($_REQUEST["register"]=="update")
{
- $result=update_item($_REQUEST["itemid"],$_REQUEST["description"],$_REQUEST["key"],$_REQUEST["hostid"],$_REQUEST["delay"],$_REQUEST["history"],$_REQUEST["status"],$_REQUEST["type"],$_REQUEST["snmp_community"],$_REQUEST["snmp_oid"],$_REQUEST["value_type"],$_REQUEST["trapper_hosts"],$_REQUEST["snmp_port"],$_REQUEST["units"],$_REQUEST["multiplier"],$_REQUEST["delta"],$_REQUEST["snmpv3_securityname"],$_REQUEST["snmpv3_securitylevel"],$_REQUEST["snmpv3_authpassphrase"],$_REQUEST["snmpv3_privpassphrase"],$_REQUEST["formula"],$_REQUEST["trends"],$_REQUEST["logtimefmt"]);
+ $result=update_item($_REQUEST["itemid"],
+ $_REQUEST["description"],$_REQUEST["key"],$_REQUEST["hostid"],$_REQUEST["delay"],
+ $_REQUEST["history"],$_REQUEST["status"],$_REQUEST["type"],
+ $_REQUEST["snmp_community"],$_REQUEST["snmp_oid"],$_REQUEST["value_type"],
+ $_REQUEST["trapper_hosts"],$_REQUEST["snmp_port"],$_REQUEST["units"],
+ $_REQUEST["multiplier"],$_REQUEST["delta"],$_REQUEST["snmpv3_securityname"],
+ $_REQUEST["snmpv3_securitylevel"],$_REQUEST["snmpv3_authpassphrase"],
+ $_REQUEST["snmpv3_privpassphrase"],$_REQUEST["formula"],$_REQUEST["trends"],
+ $_REQUEST["logtimefmt"]);
update_item_in_templates($_REQUEST["itemid"]);
show_messages($result, S_ITEM_UPDATED, S_CANNOT_UPDATE_ITEM);
// unset($itemid);
@@ -137,7 +163,15 @@
}
else if($_REQUEST["register"]=="add")
{
- $itemid=add_item($_REQUEST["description"],$_REQUEST["key"],$_REQUEST["hostid"],$_REQUEST["delay"],$_REQUEST["history"],$_REQUEST["status"],$_REQUEST["type"],$_REQUEST["snmp_community"],$_REQUEST["snmp_oid"],$_REQUEST["value_type"],$_REQUEST["trapper_hosts"],$_REQUEST["snmp_port"],$_REQUEST["units"],$_REQUEST["multiplier"],$_REQUEST["delta"],$_REQUEST["snmpv3_securityname"],$_REQUEST["snmpv3_securitylevel"],$_REQUEST["snmpv3_authpassphrase"],$_REQUEST["snmpv3_privpassphrase"],$_REQUEST["formula"],$_REQUEST["trends"],$_REQUEST["logtimefmt"]);
+ $itemid=add_item(
+ $_REQUEST["description"],$_REQUEST["key"],$_REQUEST["hostid"],$_REQUEST["delay"],
+ $_REQUEST["history"],$_REQUEST["status"],$_REQUEST["type"],
+ $_REQUEST["snmp_community"],$_REQUEST["snmp_oid"],$_REQUEST["value_type"],
+ $_REQUEST["trapper_hosts"],$_REQUEST["snmp_port"],$_REQUEST["units"],
+ $_REQUEST["multiplier"],$_REQUEST["delta"],$_REQUEST["snmpv3_securityname"],
+ $_REQUEST["snmpv3_securitylevel"],$_REQUEST["snmpv3_authpassphrase"],
+ $_REQUEST["snmpv3_privpassphrase"],$_REQUEST["formula"],$_REQUEST["trends"],
+ $_REQUEST["logtimefmt"]);
add_item_to_linked_hosts($itemid);
show_messages($itemid, S_ITEM_ADDED, S_CANNOT_ADD_ITEM);
unset($_REQUEST["itemid"]);
@@ -150,7 +184,15 @@
$hosts_notok="";
while($row=DBfetch($result))
{
- $result2=add_item($_REQUEST["description"],$_REQUEST["key"],$row["hostid"],$_REQUEST["delay"],$_REQUEST["history"],$_REQUEST["status"],$_REQUEST["type"],$_REQUEST["snmp_community"],$_REQUEST["snmp_oid"],$_REQUEST["value_type"],$_REQUEST["trapper_hosts"],$_REQUEST["snmp_port"],$_REQUEST["units"],$_REQUEST["multiplier"],$_REQUEST["delta"],$_REQUEST["snmpv3_securityname"],$_REQUEST["snmpv3_securitylevel"],$_REQUEST["snmpv3_authpassphrase"],$_REQUEST["snmpv3_privpassphrase"],$_REQUEST["formula"],$_REQUEST["trends"],$_REQUEST["logtimefmt"]);
+ $result2=add_item(
+ $_REQUEST["description"],$_REQUEST["key"],$row["hostid"],
+ $_REQUEST["delay"],$_REQUEST["history"],$_REQUEST["status"],
+ $_REQUEST["type"],$_REQUEST["snmp_community"],$_REQUEST["snmp_oid"],
+ $_REQUEST["value_type"],$_REQUEST["trapper_hosts"],$_REQUEST["snmp_port"],
+ $_REQUEST["units"],$_REQUEST["multiplier"],$_REQUEST["delta"],
+ $_REQUEST["snmpv3_securityname"],$_REQUEST["snmpv3_securitylevel"],
+ $_REQUEST["snmpv3_authpassphrase"],$_REQUEST["snmpv3_privpassphrase"],
+ $_REQUEST["formula"],$_REQUEST["trends"],$_REQUEST["logtimefmt"]);
if($result2)
{
$hosts_ok=$hosts_ok." ".$row["host"];
@@ -160,7 +202,8 @@
$hosts_notok=$hosts_notok." ".$row["host"];
}
}
- show_messages(TRUE,"Items added]<br>[Success for '$hosts_ok']<br>[Failed for '$hosts_notok'","Cannot add item");
+ show_messages(TRUE,"Items added]<br>[Success for '$hosts_ok']<br>".
+ "[Failed for '$hosts_notok'","Cannot add item");
unset($_REQUEST["itemid"]);
}
else if($_REQUEST["register"]=="Delete selected")
@@ -169,11 +212,9 @@
while($row=DBfetch($result))
{
// $$ is correct here
- if(isset($_REQUEST[$row["itemid"]]))
- {
- delete_item_from_templates($row["itemid"]);
- $result2=delete_item($row["itemid"]);
- }
+ if(!isset($_REQUEST[$row["itemid"]])) continue;
+ delete_item_from_templates($row["itemid"]);
+ $result2=delete_item($row["itemid"]);
}
show_messages(TRUE, S_ITEMS_DELETED, S_CANNOT_DELETE_ITEMS);
}
@@ -183,10 +224,8 @@
while($row=DBfetch($result))
{
// $$ is correct here
- if(isset($_REQUEST[$row["itemid"]]))
- {
- $result2=activate_item($row["itemid"]);
- }
+ if(!isset($_REQUEST[$row["itemid"]])) continue;
+ $result2=activate_item($row["itemid"]);
}
show_messages(TRUE, S_ITEMS_ACTIVATED, S_CANNOT_ACTIVATE_ITEMS);
}
@@ -196,10 +235,8 @@
while($row=DBfetch($result))
{
// $$ is correct here
- if(isset($_REQUEST[$row["itemid"]]))
- {
- $result2=disable_item($row["itemid"]);
- }
+ if(!isset($_REQUEST[$row["itemid"]])) continue;
+ $result2=disable_item($row["itemid"]);
}
show_messages(TRUE, S_ITEMS_DISABLED, S_CANNOT_DISABLE_ITEMS);
}
diff --git a/frontends/php/screens.php b/frontends/php/screens.php
index 0e6072a3..4ff461a1 100644
--- a/frontends/php/screens.php
+++ b/frontends/php/screens.php
@@ -43,7 +43,7 @@
?>
<?php
- $_REQUEST["screenid"]=@iif(isset($_REQUEST["screenid"]),$_REQUEST["screenid"],get_profile("web.screens.screenid",0));
+ $_REQUEST["screenid"]=get_request("screenid",get_profile("web.screens.screenid",0));
update_profile("web.screens.screenid",$_REQUEST["screenid"]);
update_profile("web.menu.view.last",$page["file"]);
?>
@@ -136,7 +136,7 @@
}
}
- echo "<TABLE BORDER=1 COLS=".$row["cols"]." align=center WIDTH=100% BGCOLOR=\"#FFFFFF\">\n";
+ echo "<TABLE COLS=".$row["cols"]." align=center WIDTH=100% BGCOLOR=\"#FFFFFF\">\n";
for($r=0;$r<$row["rows"];$r++)
{
echo "<TR>\n";
@@ -193,7 +193,8 @@
}
else if($resource == 3)
{
- show_screen_plaintext($resourceid,$elements);
+ $ptext =& get_screen_plaintext($resourceid,$elements);
+ $ptext->Show();
}
}
else
diff --git a/frontends/php/sysmap.php b/frontends/php/sysmap.php
index 1de1c012..4d426872 100644
--- a/frontends/php/sysmap.php
+++ b/frontends/php/sysmap.php
@@ -46,18 +46,23 @@
{
if($_REQUEST["register"]=="add")
{
- $result=add_host_to_sysmap($_REQUEST["sysmapid"],$_REQUEST["hostid"],$_REQUEST["label"],$_REQUEST["x"],$_REQUEST["y"],$_REQUEST["icon"],$_REQUEST["url"],$_REQUEST["icon_on"]);
+ $result=add_host_to_sysmap($_REQUEST["sysmapid"],$_REQUEST["hostid"],
+ $_REQUEST["label"],$_REQUEST["x"],$_REQUEST["y"],$_REQUEST["icon"],
+ $_REQUEST["url"],$_REQUEST["icon_on"]);
show_messages($result,"Host added","Cannot add host");
}
if($_REQUEST["register"]=="update")
{
- $result=update_sysmap_host($_REQUEST["shostid"],$_REQUEST["sysmapid"],$_REQUEST["hostid"],$_REQUEST["label"],$_REQUEST["x"],$_REQUEST["y"],$_REQUEST["icon"],$_REQUEST["url"],$_REQUEST["icon_on"]);
+ $result=update_sysmap_host($_REQUEST["shostid"],$_REQUEST["sysmapid"],
+ $_REQUEST["hostid"],$_REQUEST["label"],$_REQUEST["x"],$_REQUEST["y"],
+ $_REQUEST["icon"],$_REQUEST["url"],$_REQUEST["icon_on"]);
show_messages($result,"Host updated","Cannot update host");
}
if($_REQUEST["register"]=="add link")
{
- $result=add_link($_REQUEST["sysmapid"],$_REQUEST["shostid1"],$_REQUEST["shostid2"],$_REQUEST["triggerid"],
- $_REQUEST["drawtype_off"],$_REQUEST["color_off"],$_REQUEST["drawtype_on"],$_REQUEST["color_on"]);
+ $result=add_link($_REQUEST["sysmapid"],$_REQUEST["shostid1"],$_REQUEST["shostid2"],
+ $_REQUEST["triggerid"], $_REQUEST["drawtype_off"],$_REQUEST["color_off"],
+ $_REQUEST["drawtype_on"],$_REQUEST["color_on"]);
show_messages($result,"Link added","Cannot add link");
}
if($_REQUEST["register"]=="delete_link")
diff --git a/frontends/php/triggers.php b/frontends/php/triggers.php
index 837e2956..9640b7f6 100644
--- a/frontends/php/triggers.php
+++ b/frontends/php/triggers.php
@@ -259,7 +259,10 @@
S_ID),
S_NAME,S_EXPRESSION, S_SEVERITY, S_STATUS, S_ERROR));
- $result=DBselect("select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,t.status,t.value,t.priority,t.error 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=".$_REQUEST["hostid"]." order by h.host,t.description");
+ $result=DBselect("select distinct h.hostid,h.host,t.triggerid,t.expression,t.description,".
+ "t.status,t.value,t.priority,t.error 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=".$_REQUEST["hostid"]." order by h.host,t.description");
while($row=DBfetch($result))
{
if(check_right_on_trigger("R",$row["triggerid"]) == 0)
@@ -267,30 +270,22 @@
continue;
}
- $description=expand_trigger_description($row["triggerid"]);
- if(isset($_REQUEST["hostid"]))
- {
- $description="<A HREF=\"triggers.php?form=0&triggerid=".$row["triggerid"]."&hostid=".$row["hostid"]."\">$description</A>";
- }
- else
- {
- $description="<A HREF=\"triggers.php?form=0&triggerid=".$row["triggerid"]."\">$description</A>";
- }
+ $description = array(new CLink(expand_trigger_description($row["triggerid"]),
+ "triggers.php?form=0&triggerid=".$row["triggerid"]."&hostid=".$row["hostid"]));
$id= array(new CCheckBox($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"];
+ $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)
{
- $description=$description."<p><strong>".S_DEPENDS_ON."</strong>:&nbsp;<br>";
+ array_push($description,BR.BR."<strong>".S_DEPENDS_ON."</strong>:&nbsp;".BR);
while($row1=DBfetch($result1))
{
- $depid=$row1["triggerid"];
- $depdescr=expand_trigger_description($depid);
- $description=$description."$depdescr<br>";
+ array_push($description,expand_trigger_description($row1["triggerid"]).BR);
}
- $description=$description."</p>";
+ array_push($description,BR);
}
if($row["priority"]==0) $priority=S_NOT_CLASSIFIED;
@@ -303,32 +298,28 @@
if($row["status"] == 1)
{
- $status="<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=0&hostid=".$row["hostid"]."\"><font color=\"AA0000\">".S_DISABLED."</font></a>";
+ $status= new CLink(S_DISABLED,
+ "triggers.php?register=changestatus&triggerid=".
+ $row["triggerid"]."&status=0&hostid=".$row["hostid"],
+ 'disabled');
}
else if($row["status"] == 2)
{
- $status="<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=1&hostid=".$row["hostid"]."\"><font color=\"AAAAAA\">".S_UNKNOWN."</font></a>";
+ $status= new CLink(S_UNCNOWN,
+ "triggers.php?register=changestatus&triggerid=".
+ $row["triggerid"]."&status=1&hostid=".$row["hostid"],
+ 'uncnown');
}
else
{
- $status="<a href=\"triggers.php?register=changestatus&triggerid=".$row["triggerid"]."&status=1&hostid=".$row["hostid"]."\"><font color=\"00AA00\">".S_ENABLED."</font></a>";
+ $status= new CLink(S_ENABLED,
+ "triggers.php?register=changestatus&triggerid=".
+ $row["triggerid"]."&status=1&hostid=".$row["hostid"],
+ 'enabled');
}
-// $expression=rawurlencode($row["expression"]);
- if($row["error"]=="")
- {
- $row["error"]="&nbsp;";
- }
+ if($row["error"]=="") $row["error"]="&nbsp;";
-// $actions=$actions." :: ";
-// if(get_action_count_by_triggerid($row["triggerid"])>0)
-// {
-// $actions=$actions."<A HREF=\"actions.php?triggerid=".$row["triggerid"]."\"><b>A</b>ctions</A>";
-// }
-// else
-// {
-// $actions=$actions."<A HREF=\"actions.php?triggerid=".$row["triggerid"]."\">".S_ACTIONS."</A>";
-// }
$table->addRow(array(
$id,
$description,