summaryrefslogtreecommitdiffstats
path: root/frontends/php/include
diff options
context:
space:
mode:
authorartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-06-18 12:32:02 +0000
committerartem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082>2008-06-18 12:32:02 +0000
commit4f1f420a91e557c2ab4a7ff9605fba260931bbdc (patch)
tree48ff179492d1d1ae1d93061ec618392d281fef3a /frontends/php/include
parent01e94d67317be183b74fa97bd3d15ee99ab27d69 (diff)
downloadzabbix-4f1f420a91e557c2ab4a7ff9605fba260931bbdc.tar.gz
zabbix-4f1f420a91e557c2ab4a7ff9605fba260931bbdc.tar.xz
zabbix-4f1f420a91e557c2ab4a7ff9605fba260931bbdc.zip
- [DEV-171] improvements to escalation form (Artem)
- [DEV-137] small fixes (Artem) git-svn-id: svn://svn.zabbix.com/trunk@5778 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
-rw-r--r--frontends/php/include/blocks.inc.php6
-rw-r--r--frontends/php/include/config.inc.php6
-rw-r--r--frontends/php/include/forms.inc.php37
-rw-r--r--frontends/php/include/locales/en_gb.inc.php3
-rw-r--r--frontends/php/include/page_header.php14
5 files changed, 34 insertions, 32 deletions
diff --git a/frontends/php/include/blocks.inc.php b/frontends/php/include/blocks.inc.php
index e8ce905c..a63dce73 100644
--- a/frontends/php/include/blocks.inc.php
+++ b/frontends/php/include/blocks.inc.php
@@ -374,11 +374,11 @@ function make_status_of_zbx(){
$table->AddRow(array(S_NUMBER_OF_ALERTS,$status['alerts_count'],' - '));*/
//Log Out 10min
- $sql = 'SELECT DISTINCT u.userid, MAX(s.lastaccess) as lastaccess, u.autologout '.
+ $sql = 'SELECT DISTINCT u.userid, MAX(s.lastaccess) as lastaccess, u.autologout, s.status '.
' FROM users u '.
' LEFT JOIN sessions s ON s.userid=u.userid'.
' WHERE '.DBin_node('u.userid').
- ' GROUP BY u.userid,u.autologout';
+ ' GROUP BY u.userid';
$db_users = DBSelect($sql);
@@ -386,7 +386,7 @@ function make_status_of_zbx(){
$online_cnt = 0;
while($user=DBFetch($db_users)){
$online_time = (($user['autologout'] == 0) || (ZBX_USER_ONLINE_TIME<$user['autologout']))?ZBX_USER_ONLINE_TIME:$user['autologout'];
- if(!is_null($user['lastaccess']) && (($user['lastaccess']+$online_time)>=time())) $online_cnt++;
+ if(!is_null($user['lastaccess']) && (($user['lastaccess']+$online_time)>=time()) && (ZBX_SESSION_ACTIVE == $user['status'])) $online_cnt++;
$usr_cnt++;
}
diff --git a/frontends/php/include/config.inc.php b/frontends/php/include/config.inc.php
index 6ce15123..adea212c 100644
--- a/frontends/php/include/config.inc.php
+++ b/frontends/php/include/config.inc.php
@@ -284,7 +284,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
$result = ( is_show_subnodes($forse_with_subnodes) ? $ZBX_CURRENT_SUBNODES : $ZBX_CURRENT_NODEID );
if(!is_null($perm)){
- $result = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_ONLY, null, $result);
+ $result = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_ONLY);
}
return $result;
@@ -1106,7 +1106,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
/* $row=DBfetch(DBselect("select count(alertid) as cnt from alerts"));
$status["alerts_count"]=$row["cnt"];*/
// triggers
- $sql = 'SELECT COUNT(t.triggerid) as cnt '.
+ $sql = 'SELECT COUNT(DISTINCT t.triggerid) as cnt '.
' FROM triggers t, functions f, items i, hosts h'.
' WHERE t.triggerid=f.triggerid '.
' AND f.itemid=i.itemid '.
@@ -1132,7 +1132,7 @@ function TODO($msg) { echo "TODO: ".$msg.SBR; } // DEBUG INFO!!!
$row=DBfetch(DBselect($sql." and t.status=0 and t.value=2"));
$status["triggers_count_unknown"]=$row["cnt"];
// items
- $sql = 'SELECT COUNT(i.itemid) as cnt '.
+ $sql = 'SELECT COUNT(DISTINCT i.itemid) as cnt '.
' FROM items i, hosts h '.
' WHERE i.hostid=h.hostid '.
' AND h.status='.HOST_STATUS_MONITORED;
diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php
index 898d359e..6bf36327 100644
--- a/frontends/php/include/forms.inc.php
+++ b/frontends/php/include/forms.inc.php
@@ -818,7 +818,7 @@
}
$lstGroups = new CListBox('user_groups_to_del[]');
- $lstGroups->options['style'] = 'width: 280px';
+ $lstGroups->options['style'] = 'width: 320px';
foreach($user_groups as $groupid => $group_name){
$lstGroups->AddItem($groupid, $group_name);
@@ -2795,8 +2795,14 @@
$recovery_msg = $action['recovery_msg'];
$r_shortdata = $action['r_shortdata'];
$r_longdata = $action['r_longdata'];
+
+ if($esc_period) $_REQUEST['escalation'] = 1;
}
else{
+
+ if(isset($_REQUEST['escalation']) && (0 == $_REQUEST['esc_period']))
+ $_REQUEST['esc_period'] = 3600;
+
$name = get_request('name');
$eventsource = get_request('eventsource');
$esc_period = get_request('esc_period',0);
@@ -2808,6 +2814,8 @@
$recovery_msg = get_request('recovery_msg',0);
$r_shortdata = get_request('r_shortdata','');
$r_longdata = get_request('r_longdata','');
+
+ if(!$esc_period) unset($_REQUEST['escalation']);
}
$tblAct->AddRow(array(S_NAME, new CTextBox('name', $name, 50)));
@@ -2819,19 +2827,22 @@
$cmbSource->AddItem(EVENT_SOURCE_DISCOVERY, S_DISCOVERY);
$tblAct->AddRow(array(S_EVENT_SOURCE, $cmbSource));
+
if(EVENT_SOURCE_TRIGGERS == $eventsource){
- $period_box = new CNumericBox('esc_period', $esc_period, 6, 'no');
- $period_box->AddAction('onchange','javascript: '.$period_box->GetOption('onchange').'submit();');
+ $tblAct->AddRow(array(S_ENABLE_ESCALATIONS, new CCheckBox('escalation',isset($_REQUEST['escalation']),'javascript: submit();',1)));
- $tblAct->AddRow(array(S_PERIOD.' ('.S_SECONDS_SMALL.')', $period_box));
+ if(isset($_REQUEST['escalation'])){
+ $tblAct->AddRow(array(S_PERIOD.' ('.S_SECONDS_SMALL.')', array(new CNumericBox('esc_period', $esc_period, 6, 'no'), '['.S_MIN_SMALL.' 60]')));
+ }
+ else{
+ $tblAct->AddItem(new CVar('esc_period',$esc_period));
+ }
}
else{
- $esc_period = 0;
- $_REQUEST['esc_period'] = 0;
- $tblAct->AddItem(new CVar('esc_period',0));
+ $tblAct->AddItem(new CVar('esc_period',$esc_period));
}
- if(0 == $esc_period){
+ if(isset($_REQUEST['escalation'])){
unset($_REQUEST['new_opcondition']);
}
@@ -3235,10 +3246,10 @@
$tblOper->SetHeader(array(
new CCheckBox('all_operations',null,'CheckAll("'.S_ACTION.'","all_operations","g_operationid");'),
- $esc_period?S_STEPS:null,
+ isset($_REQUEST['escalation'])?S_STEPS:null,
S_DETAILS,
- $esc_period?S_PERIOD.' ('.S_SEC_SMALL.')':null,
- $esc_period?S_DELAY:null,
+ isset($_REQUEST['escalation'])?S_PERIOD.' ('.S_SEC_SMALL.')':null,
+ isset($_REQUEST['escalation'])?S_DELAY:null,
S_ACTION
));
@@ -3262,7 +3273,7 @@
if($val['esc_step_from'] < 1) $val['esc_step_from'] = 1;
- if($esc_period){
+ if(isset($_REQUEST['escalation'])){
$esc_steps_txt = $val['esc_step_from'].' - '.$val['esc_step_to'];
$esc_period_txt = $val['esc_period']?$val['esc_period']:S_DEFAULT;
$esc_delay_txt = $delay[$val['esc_step_from']]?convert_units($delay[$val['esc_step_from']],'uptime'):S_AT_MOMENT;
@@ -3306,7 +3317,7 @@
}
$td = new CCol($oper_buttons);
- $td->AddOption('colspan',$esc_period?6:3);
+ $td->AddOption('colspan',isset($_REQUEST['escalation'])?6:3);
$td->AddOption('style','text-align: right;');
$tblOper->SetFooter($td);
diff --git a/frontends/php/include/locales/en_gb.inc.php b/frontends/php/include/locales/en_gb.inc.php
index df735d25..2c0c22c1 100644
--- a/frontends/php/include/locales/en_gb.inc.php
+++ b/frontends/php/include/locales/en_gb.inc.php
@@ -453,7 +453,8 @@
'S_HOUSEKEEPER'=> 'Housekeeper',
'S_MEDIA_TYPES'=> 'Media types',
'S_ESCALATION_RULES'=> 'Escalation rules',
- 'S_ESCALATION'=> 'Escalation',
+ 'S_ENABLE_ESCALATIONS'=> 'Enable escalations',
+ 'S_ESCALATION'=> 'Escalation',
'S_ESCALATION_RULES_BIG'=> 'ESCALATION RULES',
'S_NO_ESCALATION_RULES_DEFINED'=> 'No escalation rules defined',
'S_NO_ESCALATION_DETAILS'=> 'No escalation details',
diff --git a/frontends/php/include/page_header.php b/frontends/php/include/page_header.php
index 0424153f..ec92dc94 100644
--- a/frontends/php/include/page_header.php
+++ b/frontends/php/include/page_header.php
@@ -257,12 +257,7 @@ COpt::profiling_start("page");
}
if(isset($sub['node_perm'])){
- if(0 == count(get_accessible_nodes_by_user(
- $USER_DETAILS,
- $sub['node_perm'],
- PERM_RES_IDS_ARRAY,
- get_current_nodeid(false))))
- {
+ if(0 == count(get_accessible_nodes_by_user($USER_DETAILS,$sub['node_perm'],PERM_RES_IDS_ARRAY))){
$deny = true;
}
}
@@ -291,12 +286,7 @@ COpt::profiling_start("page");
}
if(isset($sub_pages['node_perm'])){
- if ( 0 == count(get_accessible_nodes_by_user(
- $USER_DETAILS,
- $sub_pages['node_perm'],
- PERM_RES_IDS_ARRAY,
- get_current_nodeid(false))))
- {
+ if ( 0 == count(get_accessible_nodes_by_user($USER_DETAILS,$sub_pages['node_perm'],PERM_RES_IDS_ARRAY))){
unset($sub['pages'][$id]);
continue;
}