summaryrefslogtreecommitdiffstats
path: root/frontends/php/hosts.php
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-07-18 13:20:33 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2006-07-18 13:20:33 +0000
commitdef2e0a7def21050b352556ceb7c31cea4ebbb1c (patch)
tree16e811bda782fde81debd4199f2015fcdb103836 /frontends/php/hosts.php
parent125d97877ec6846cd8be946eb786621e3debec81 (diff)
downloadzabbix-def2e0a7def21050b352556ceb7c31cea4ebbb1c.tar.gz
zabbix-def2e0a7def21050b352556ceb7c31cea4ebbb1c.tar.xz
zabbix-def2e0a7def21050b352556ceb7c31cea4ebbb1c.zip
- developed template unlinking feature (Eugene)
git-svn-id: svn://svn.zabbix.com/trunk@3057 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/hosts.php')
-rw-r--r--frontends/php/hosts.php39
1 files changed, 33 insertions, 6 deletions
diff --git a/frontends/php/hosts.php b/frontends/php/hosts.php
index a9b7ac60..3f6a6db3 100644
--- a/frontends/php/hosts.php
+++ b/frontends/php/hosts.php
@@ -84,8 +84,12 @@
"activate"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
"disable"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
+ "unlink"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
+ "unlink_and_clear"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
+
"save"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
- "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
+ "delete"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
+ "delete_and_clear"=> array(T_ZBX_STR, O_OPT, P_SYS|P_ACT, NULL, NULL),
"cancel"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL),
/* other */
"form"=> array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL),
@@ -105,8 +109,21 @@
<?php
/************ ACTIONS FOR HOSTS ****************/
+/* UNLINK HOST */
+ if(($_REQUEST["config"]==0 || $_REQUEST["config"]==3) && (isset($_REQUEST["unlink"]) || isset($_REQUEST["unlink_and_clear"]))
+ && isset($_REQUEST["hostid"]))
+ {
+ $unlink_mode = true;
+ if(isset($_REQUEST["unlink"]))
+ {
+ $unlink_mode = false;
+ }
+
+ unlink_template($_REQUEST["hostid"], NULL /* future usage -> $_REQUEST["templateid"]*/, $unlink_mode);
+ unset($_REQUEST["templateid"]);
+ }
/* SAVE HOST */
- if(($_REQUEST["config"]==0 || $_REQUEST["config"]==3) && isset($_REQUEST["save"]))
+ elseif(($_REQUEST["config"]==0 || $_REQUEST["config"]==3) && isset($_REQUEST["save"]))
{
$useip = get_request("useip","no");
@@ -160,11 +177,17 @@
}
/* DELETE HOST */
- elseif(($_REQUEST["config"]==0 || $_REQUEST["config"]==3) && isset($_REQUEST["delete"]))
+ elseif(($_REQUEST["config"]==0 || $_REQUEST["config"]==3) && (isset($_REQUEST["delete"]) || isset($_REQUEST["delete_and_clear"])))
{
+ $unlink_mode = false;
+ if(isset($_REQUEST["delete"]))
+ {
+ $unlink_mode = true;
+ }
+
if(isset($_REQUEST["hostid"])){
$host=get_host_by_hostid($_REQUEST["hostid"]);
- $result=delete_host($_REQUEST["hostid"]);
+ $result=delete_host($_REQUEST["hostid"], $unlink_mode);
show_messages($result, S_HOST_DELETED, S_CANNOT_DELETE_HOST);
if($result)
@@ -185,7 +208,7 @@
$host=get_host_by_hostid($db_host["hostid"]);
if(!in_array($db_host["hostid"],$hosts)) continue;
- if(!delete_host($db_host["hostid"])) continue;
+ if(!delete_host($db_host["hostid"], $unlink_mode)) continue;
$result = 1;
add_audit(AUDIT_ACTION_DELETE,AUDIT_RESOURCE_HOST,
@@ -580,7 +603,11 @@
"return Confirm('".S_DISABLE_SELECTED_HOSTS_Q."');"),
$show_only_tmp ? NULL : SPACE,
new CButton('delete','Delete selected',
- "return Confirm('".S_DELETE_SELECTED_HOSTS_Q."');"));
+ "return Confirm('".S_DELETE_SELECTED_HOSTS_Q."');"),
+ $show_only_tmp ? SPACE : NULL,
+ $show_only_tmp ? new CButton('delete_and_clear','Delete selected with linked elements',
+ "return Confirm('".S_DELETE_SELECTED_HOSTS_Q."');") : NULL
+ );
$table->SetFooter(new CCol($footerButtons));
$form->AddItem($table);