summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-03-07 09:18:28 +0000
committerosmiy <osmiy@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2007-03-07 09:18:28 +0000
commitb9a000e8a8ecf3534478ecb04e6e5cc9a18cc3bf (patch)
treeb200e1d3ed10b1094d31dcc180a4473a1f4b481d
parent78742376ffa7f0d503885646b130d1238761b94b (diff)
added user group for database down messages [GUI]
git-svn-id: svn://svn.zabbix.com/trunk@3878 97f52cf1-0a1b-0410-bd0e-c28be96e8082
-rw-r--r--ChangeLog4
-rw-r--r--frontends/php/config.php56
-rw-r--r--frontends/php/include/config.inc.php46
-rw-r--r--frontends/php/include/forms.inc.php36
-rw-r--r--frontends/php/include/locales/en_gb.inc.php4
5 files changed, 105 insertions, 41 deletions
diff --git a/ChangeLog b/ChangeLog
index 110ebdc7..2f75a58d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,6 @@
Changes for 1.3.4:
- - added support of AND, OR, AND/OR calculation of action conditions [GUI] (Eugene)
+ - added user group for database down messages (Alexei/Eugene)
- removed support of action repeats (Alexei)
- fixed upgrade of rights,sysmaps,sysmaps_elements (Alexei)
- fixed initial creation of user rights in data.sql (Alexei)
@@ -8,7 +8,7 @@ Changes for 1.3.4:
- added icons for elements of map having Unknown status (Eugene)
- added installation check for 'BC math' (Eugene)
- added actions.evaltype (Alexei)
- - added support of all AND, all OR and AND/OR action conditions (Alexei)
+ - added support of all AND, all OR and AND/OR action conditions (Alexei/Eugene)
- fixed processing of Text items (Alexei)
- NetBSD compilation fixes (Alexei)
diff --git a/frontends/php/config.php b/frontends/php/config.php
index 76150646..72f78f49 100644
--- a/frontends/php/config.php
+++ b/frontends/php/config.php
@@ -38,14 +38,11 @@ include_once "include/page_header.php";
"config"=> array(T_ZBX_INT, O_OPT, NULL, IN("0,3,4,5,6,7"), NULL),
// other form
- "alert_history"=> array(T_ZBX_INT, O_NO, NULL, BETWEEN(0,65535),
- 'in_array({config},array(0,5,7))&&({save}=="Save")'),
- "event_history"=> array(T_ZBX_INT, O_NO, NULL, BETWEEN(0,65535),
- 'in_array({config},array(0,5,7))&&({save}=="Save")'),
- "refresh_unsupported"=> array(T_ZBX_INT, O_NO, NULL, BETWEEN(0,65535),
- 'in_array({config},array(0,5,7))&&({save}=="Save")'),
- "work_period"=> array(T_ZBX_STR, O_NO, NULL, NULL,
- 'in_array({config},array(0,5,7))&&({save}=="Save")'),
+ "alert_history"=> array(T_ZBX_INT, O_NO, NULL, BETWEEN(0,65535), '({config}==0)&&({save}=="Save")'),
+ "event_history"=> array(T_ZBX_INT, O_NO, NULL, BETWEEN(0,65535), '({config}==0)&&({save}=="Save")'),
+ "work_period"=> array(T_ZBX_STR, O_NO, NULL, NULL, '({config}==7)&&({save}=="Save")'),
+ "refresh_unsupported"=> array(T_ZBX_INT, O_NO, NULL, BETWEEN(0,65535), '({config}==5)&&({save}=="Save")'),
+ "alert_usrgrpid"=> array(T_ZBX_INT, O_NO, NULL, DB_ID, '({config}==5)&&({save}=="Save")'),
// image form
"imageid"=> array(T_ZBX_INT, O_NO, P_SYS, DB_ID,
@@ -93,9 +90,6 @@ include_once "include/page_header.php";
$result = 0;
if($_REQUEST["config"]==3)
{
-
-
-
/* IMAGES ACTIONS */
if(isset($_REQUEST["save"]))
{
@@ -144,9 +138,6 @@ include_once "include/page_header.php";
}
elseif($_REQUEST["config"]==4)
{
-
-
-
/* AUTOREG ACTIONS */
if(isset($_REQUEST["save"]))
{
@@ -202,16 +193,41 @@ include_once "include/page_header.php";
access_deny();
/* OTHER ACTIONS */
- $result=update_config($_REQUEST["event_history"],$_REQUEST["alert_history"],
- $_REQUEST["refresh_unsupported"],$_REQUEST["work_period"]);
+ $result=update_config(
+ get_request('event_history'),
+ get_request('alert_history'),
+ get_request('refresh_unsupported'),
+ get_request('work_period'),
+ get_request('alert_usrgrpid'));
show_messages($result, S_CONFIGURATION_UPDATED, S_CONFIGURATION_WAS_NOT_UPDATED);
if($result)
{
- add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ZABBIX_CONFIG,
- "Alarm history [".$_REQUEST["event_history"]."]".
- " alert history [".$_REQUEST["alert_history"]."]".
- " refresh unsupported items [".$_REQUEST["refresh_unsupported"]."]");
+ $msg = array();
+ if(!is_null($val = get_request('event_history')))
+ $msg[] = S_DO_NOT_KEEP_EVENTS_OLDER_THAN.' ['.$val.']';
+ if(!is_null($val = get_request('alert_history')))
+ $msg[] = S_DO_NOT_KEEP_ACTIONS_OLDER_THAN.' ['.$val.']';
+ if(!is_null($val = get_request('refresh_unsupported')))
+ $msg[] = S_REFRESH_UNSUPPORTED_ITEMS.' ['.$val.']';
+ if(!is_null($val = get_request('work_period')))
+ $msg[] = S_WORKING_TIME.' ['.$val.']';
+ if(!is_null($val = get_request('alert_usrgrpid')))
+ {
+ if(0 == $val)
+ {
+ $val = S_NONE;
+ }
+ else
+ {
+ $val = DBfetch(DBselect('select name from usrgrp where usrgrpid='.$val));
+ $val = $val['name'];
+ }
+
+ $msg[] = S_USER_GROUP_FOR_DATABASE_DOWN_MESSAGE.' ['.$val.']';
+ }
+
+ add_audit(AUDIT_ACTION_UPDATE,AUDIT_RESOURCE_ZABBIX_CONFIG,implode('; ',$msg));
}
}
elseif($_REQUEST["config"]==6)
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index b8c2b0ac..fd1ee764 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -1011,17 +1011,51 @@ else
# Update configuration
- function update_config($event_history,$alert_history,$refresh_unsupported,$work_period)
+ function update_config($event_history,$alert_history,$refresh_unsupported,$work_period,$alert_usrgrpid)
{
- if(validate_period($work_period) != 0)
+ global $ZBX_CURNODEID;
+
+ $update = array();
+
+ if(!is_null($event_history))
+ {
+ $update[] = 'event_history='.$event_history;
+ }
+ if(!is_null($alert_history))
+ {
+ $update[] = 'alert_history='.$alert_history;
+ }
+ if(!is_null($refresh_unsupported))
+ {
+ $update[] = 'refresh_unsupported='.$refresh_unsupported;
+ }
+ if(!is_null($work_period))
+ {
+ if(validate_period($work_period) != 0)
+ {
+ error(S_ICORRECT_WORK_PERIOD);
+ return NULL;
+ }
+ $update[] = 'work_period='.zbx_dbstr($work_period);
+ }
+ if(!is_null($alert_usrgrpid))
+ {
+ if($alert_usrgrpid != 0 && !DBfetch(DBselect('select usrgrpid from usrgrp where usrgrpid='.$alert_usrgrpid)))
+ {
+ error(S_INCORRECT_GROUP);;
+ return NULL;
+ }
+ $update[] = 'alert_usrgrpid='.$alert_usrgrpid;
+ }
+ if(count($update) == 0)
{
- error("Icorrect work period");
+ error(S_NOTHING_TO_DO);
return NULL;
}
- return DBexecute("update config set event_history=$event_history,alert_history=$alert_history,".
- " refresh_unsupported=$refresh_unsupported,".
- " work_period=".zbx_dbstr($work_period));
+ return DBexecute('update config set '.implode(',',$update).
+ ' where '.DBid2nodeid('configid')."=".$ZBX_CURNODEID);
+
}
function &get_table_header($col1, $col2=SPACE)
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index 8f002940..f9a2bd29 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -3396,12 +3396,13 @@
$frmHouseKeep = new CFormTable(S_HOUSEKEEPER,"config.php");
$frmHouseKeep->SetHelp("web.config.housekeeper.php");
$frmHouseKeep->AddVar("config",get_request("config",0));
- $frmHouseKeep->AddVar("refresh_unsupported",$config["refresh_unsupported"]);
- $frmHouseKeep->AddVar("work_period",$config["work_period"]);
+
$frmHouseKeep->AddRow(S_DO_NOT_KEEP_ACTIONS_OLDER_THAN,
new CTextBox("alert_history",$config["alert_history"],8));
+
$frmHouseKeep->AddRow(S_DO_NOT_KEEP_EVENTS_OLDER_THAN,
new CTextBox("event_history",$config["event_history"],8));
+
$frmHouseKeep->AddItemToBottomRow(new CButton("save",S_SAVE));
$frmHouseKeep->Show();
}
@@ -3413,28 +3414,37 @@
$frmHouseKeep = new CFormTable(S_WORKING_TIME,"config.php");
$frmHouseKeep->SetHelp("web.config.workperiod.php");
$frmHouseKeep->AddVar("config",get_request("config",7));
- $frmHouseKeep->AddVar("alert_history",$config["alert_history"]);
- $frmHouseKeep->AddVar("event_history",$config["event_history"]);
- $frmHouseKeep->AddVar("refresh_unsupported",$config["refresh_unsupported"]);
+
$frmHouseKeep->AddRow(S_WORKING_TIME,
new CTextBox("work_period",$config["work_period"],35));
+
$frmHouseKeep->AddItemToBottomRow(new CButton("save",S_SAVE));
$frmHouseKeep->Show();
}
function insert_other_parameters_form()
{
+ global $ZBX_CURNODEID;
+
$config=select_config();
- $frmHouseKeep = new CFormTable(S_OTHER_PARAMETERS,"config.php");
- $frmHouseKeep->SetHelp("web.config.other.php");
- $frmHouseKeep->AddVar("config",get_request("config",5));
- $frmHouseKeep->AddVar("alert_history",$config["alert_history"]);
- $frmHouseKeep->AddVar("event_history",$config["event_history"]);
- $frmHouseKeep->AddVar("work_period",$config["work_period"]);
+ $frmHouseKeep = new CFormTable(S_OTHER_PARAMETERS,'config.php');
+ $frmHouseKeep->SetHelp('web.config.other.php');
+ $frmHouseKeep->AddVar('config',get_request('config',5));
+
$frmHouseKeep->AddRow(S_REFRESH_UNSUPPORTED_ITEMS,
- new CTextBox("refresh_unsupported",$config["refresh_unsupported"],8));
- $frmHouseKeep->AddItemToBottomRow(new CButton("save",S_SAVE));
+ new CTextBox('refresh_unsupported',$config['refresh_unsupported'],8));
+
+ $cmbUsrGrp = new CComboBox('alert_usrgrpid', $config['alert_usrgrpid']);
+ $cmbUsrGrp->AddItem(0, S_NONE);
+ $result=DBselect('select usrgrpid,name from usrgrp'.
+ ' where '.DBid2nodeid('usrgrpid').'='.$ZBX_CURNODEID.
+ ' order by name');
+ while($row=DBfetch($result))
+ $cmbUsrGrp->AddItem($row['usrgrpid'], $row['name']);
+ $frmHouseKeep->AddRow(S_USER_GROUP_FOR_DATABASE_DOWN_MESSAGE,$cmbUsrGrp);
+
+ $frmHouseKeep->AddItemToBottomRow(new CButton('save',S_SAVE));
$frmHouseKeep->Show();
}
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index 98cec786..c30f697c 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -376,6 +376,10 @@
"S_CREATE_IMAGE"=> "Create Image",
"S_CREATE_RULE"=> "Create Rule",
"S_WORKING_TIME"=> "Working time",
+ "S_USER_GROUP_FOR_DATABASE_DOWN_MESSAGE"=>"User group for database down message",
+ "S_INCORRECT_GROUP"=> "Incorrect group",
+ "S_NOTHING_TO_DO"=> "Nothing to do",
+ "S_ICORRECT_WORK_PERIOD"=> "Icorrect work period",
// nodes.php
"S_NODE"=> "Node",