diff options
| author | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-06-03 07:23:52 +0000 |
|---|---|---|
| committer | artem <artem@97f52cf1-0a1b-0410-bd0e-c28be96e8082> | 2008-06-03 07:23:52 +0000 |
| commit | 1333c00671afca3228b1521687b8b7a1bcd95f30 (patch) | |
| tree | 9453dd7e1e4b6f6124f2aee8935eaff05321cc23 /frontends/php/include | |
| parent | 27187bf82da381f0bdcbbbb5ed0035e1f452b2d9 (diff) | |
| download | zabbix-1333c00671afca3228b1521687b8b7a1bcd95f30.tar.gz zabbix-1333c00671afca3228b1521687b8b7a1bcd95f30.tar.xz zabbix-1333c00671afca3228b1521687b8b7a1bcd95f30.zip | |
- [DEV-171] fix and improvements to escalation form (Artem)
git-svn-id: svn://svn.zabbix.com/trunk@5745 97f52cf1-0a1b-0410-bd0e-c28be96e8082
Diffstat (limited to 'frontends/php/include')
| -rw-r--r-- | frontends/php/include/actions.inc.php | 28 | ||||
| -rw-r--r-- | frontends/php/include/forms.inc.php | 24 |
2 files changed, 43 insertions, 9 deletions
diff --git a/frontends/php/include/actions.inc.php b/frontends/php/include/actions.inc.php index eceaabfe..bf61e287 100644 --- a/frontends/php/include/actions.inc.php +++ b/frontends/php/include/actions.inc.php @@ -840,6 +840,34 @@ function validate_commands($commands){ return TRUE; } +function count_operations_delay($operations, $def_period=0){ + $delays = array(0,0); + $periods = array(); + $max_step = 0; + foreach($operations as $num => $operation){ + $step_from = $operation['esc_step_from']?$operation['esc_step_from']:1; + $step_to = $operation['esc_step_to']?$operation['esc_step_to']:9999; + $esc_period = $operation['esc_period']?$operation['esc_period']:$def_period; + + $max_step = ($max_step>$step_from)?$max_step:$step_from; + + for($i=$step_from; $i<$step_to; $i++){ + if(isset($periods[$i]) && ($periods[$i] < $esc_period)){ + } + else{ + $periods[$i]= $esc_period; + } + } + } + + for($i=1; $i<=$max_step; $i++){ + $esc_period = isset($periods[$i])?$periods[$i]:$def_period; + $delays[$i+1] = $delays[$i] + $esc_period; + } + +return $delays; +} + function get_history_of_actions($start,$num,$sql_cond=''){ $available_triggers = get_accessible_triggers(PERM_READ_ONLY, PERM_RES_IDS_ARRAY); diff --git a/frontends/php/include/forms.inc.php b/frontends/php/include/forms.inc.php index 88d200dc..69a82f56 100644 --- a/frontends/php/include/forms.inc.php +++ b/frontends/php/include/forms.inc.php @@ -3210,7 +3210,7 @@ $db_operations = DBselect('SELECT * '. ' FROM operations'. ' WHERE actionid='.$_REQUEST['actionid']. - ' ORDER BY operationtype,object,operationid'); + ' ORDER BY esc_step_from,operationtype,object,operationid'); while($operation_data = DBfetch($db_operations)){ $operation_data = array( @@ -3259,7 +3259,7 @@ zbx_rksort($operations); - $delay = 0; + $delay = count_operations_delay($operations,$esc_period); foreach($operations as $id => $val){ if( !str_in_array($val['operationtype'], $allowed_operations) ) continue; @@ -3273,13 +3273,12 @@ $esc_period_txt = null; $esc_delay_txt = null; + if($val['esc_step_from'] < 1) $val['esc_step_from'] = 1; + if($esc_period){ $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?convert_units($delay,'uptime'):S_AT_MOMENT; - - $delay_period = $val['esc_period']?$val['esc_period']:$esc_period; - $delay += $delay_period*abs($val['esc_step_from']-$val['esc_step_to']); + $esc_delay_txt = $delay[$val['esc_step_from']]?convert_units($delay[$val['esc_step_from']],'uptime'):S_AT_MOMENT; } $tblOper->AddRow(array( @@ -3349,7 +3348,11 @@ /* init new_operation variable */ $new_operation = get_request('new_operation', array()); - if( !is_array($new_operation) ) $new_operation = array(); + + if(!is_array($new_operation)){ + $new_operation = array(); + $new_operation['default_msg'] = 1; + } if(!isset($new_operation['operationtype'])) $new_operation['operationtype'] = OPERATION_TYPE_MESSAGE; if(!isset($new_operation['object'])) $new_operation['object'] = OPERATION_OBJECT_GROUP; @@ -3379,11 +3382,14 @@ if(isset($_REQUEST['esc_period']) && ($_REQUEST['esc_period']>0)){ $tblStep = new CTable(null,'nowrap'); - $tblStep->AddRow(array(S_FROM, new CNumericBox('new_operation[esc_step_from]', $new_operation['esc_step_from'],5))); + $step_from = new CNumericBox('new_operation[esc_step_from]', $new_operation['esc_step_from'],4); + $step_from->AddAction('onchange','javascript:'.$step_from->GetOption('onchange').' if(this.value == 0) this.value=1;'); + + $tblStep->AddRow(array(S_FROM, $step_from)); $tblStep->AddRow(array( S_TO, new CCol(array( - new CNumericBox('new_operation[esc_step_to]', $new_operation['esc_step_to'],5), + new CNumericBox('new_operation[esc_step_to]', $new_operation['esc_step_to'],4), ' [0-'.S_INFINITY.']')) )); |
