Commit 2122fee7 authored by ueli heuer's avatar ueli heuer 👾
Browse files

show individual MAX-Parameter for the arguments of a probe

parent 2b60ee7c
......@@ -300,11 +300,12 @@ function show_probe($probe_id,$action = 'detail')
list($probe_name,$probe_ord,$probe_type,$graph_id,$has_link,$has_status,
$start_date,$stop_date,$probe_user,$probe_changed) = get_probe($probe_id);
$args_r = $CONFIG->DB->query(sprintf('select id, seq, name, oid, oid_type,
max_param
from dvg_probe_args
where probe_id = \'%d\'
order by seq',$probe_id));
$args_r = $CONFIG->DB->query(sprintf(
'SELECT `dpa`.`id`, `dpa`.`seq`, `dpa`.`name`, `dpa`.`oid`, `dpa`.`oid_type`, `dpa`.`max_param`, `dpp`.`name`
FROM dvg_probe_args dpa
LEFT JOIN dvg_probe_param dpp ON (`dpa`.`max_param` = `dpp`.`id`)
WHERE `dpa`.`probe_id` = \'%d\'
ORDER BY `dpa`.`seq`',$probe_id));
DVG_error::check($args_r);
$arg_count = $args_r->rowCount();
......@@ -316,76 +317,86 @@ function show_probe($probe_id,$action = 'detail')
DVG_error::check($param_r);
$param_count = $param_r->rowCount();
$table = new DVG_table (4);
$table = new DVG_table (6);
$table->add_row('tableborder');
$table->add_cell(sprintf(gettext('Probe :: %s'),$probe_name),3,'pagetitle');
$table->add_cell(sprintf(gettext('Probe :: %s'),$probe_name),5,'pagetitle');
$table->add_cell(sprintf('<a href="%s?action=edit;probe_id=%s">%s</a>',
PROBE_PHP,$probe_id,EDIT_IMAGE) ,1,'right');
$table->add_row('tablehead');
$table->add_cell(gettext('Probe'),1,'subtitle');
$table->add_cell($device_count ? sprintf('<a href="%s?probe_id=%s;action=listbyprobe">#activ devices</a>:',PROBE_PHP,$probe_id) : '#activ devices' ,2,'right small');
$table->add_cell($device_count,1,'left');
$table->add_cell($device_count ?
sprintf('<a href="%s?probe_id=%s;action=listbyprobe">#activ devices</a>:',PROBE_PHP,$probe_id) : '#activ devices' ,4,'right');
$table->add_cell($device_count,DVG_table::WHOLE_ROW,'left');
$table->add_row('userdark');
$table->add_cell(gettext('Name:'),1,'description');
$table->add_cell($probe_name,3,'value');
$table->add_cell($probe_name,DVG_table::WHOLE_ROW,'value');
$table->add_row('userdark');
$table->add_cell(gettext('Type:'),1,'description');
$table->add_cell($probe_type,3,'value');
$table->add_cell($probe_type,DVG_table::WHOLE_ROW,'value');
$table->add_row('userdark');
$table->add_cell(gettext('Link:'),1,'description');
$table->add_cell($has_link,2,'value');
$table->add_cell();
// $table->add_cell('&nbsp;',1,'value');
$table->add_cell($has_link,DVG_table::WHOLE_ROW,'value');
$table->add_row('userdark');
$table->add_cell(gettext('Status:'),1,'description');
$table->add_cell($has_status,3,'value');
$table->add_cell($has_status,DVG_table::WHOLE_ROW,'value');
$table->add_row('userdark');
$table->add_cell(gettext('Order:'),1,'description');
$table->add_cell($probe_ord,3,'value');
$table->add_cell($probe_ord,DVG_table::WHOLE_ROW,'value');
$table->add_row('value');
$table->add_cell(gettext('Graph Id:'),1,'description');
$table->add_cell($graph_id,1,'value');
$table->add_cell(gettext('#values:'),1,'right small');
$table->add_cell($arg_count,1,'right');
$table->add_cell(sprintf('%d (%d #values)',$graph_id, $arg_count),DVG_table::WHOLE_ROW,'value');
$table->add_row('value');
$table->add_cell(gettext('in use:'),1,'description');
$table->add_cell(sprintf('%s &hellip; %s',$start_date,$stop_date),DVG_table::WHOLE_ROW,'value');
$edit_arg = DVG_input::check(DVG_input::CHECK_UNSIGNED_INTEGER,'arg_id',DVG_input::SRC_REQUEST);
$edit_param = DVG_input::check(DVG_input::CHECK_UNSIGNED_INTEGER,'param_id',DVG_input::SRC_REQUEST);
$doit = DVG_input::check(DVG_input::CHECK_LOWSTRING,'doit',DVG_input::SRC_REQUEST);
$table->add_row('tablehead');
$table->add_cell(gettext('Arguments'),1,'subtitle');
$table->add_cell(gettext('Value'));
$table->add_cell(gettext('Type'));
$table->add_cell(sprintf('<a href="%s?probe_id=%s;arg_id=0;action=detail;doit=editarg">%s</a>',
$table->add_cell(gettext('Min-'));
$table->add_cell(gettext('Max-Parameter'));
$table->add_cell(
sprintf('<a href="%s?probe_id=%s;arg_id=0;action=detail;doit=editarg">%s</a>',
PROBE_PHP,$probe_id,DVG_init::add_image(gettext('Add an argument'))),1,'right');
if ( $arg_count ) {
while (list($args_id,$args_seq,$args_name,$args_value,$args_type,$args_max_param) = $args_r->fetch()) {
while (list($args_id,$args_seq,$args_name,$args_value,
$args_type,$args_max_param,$args_max_param_name) = $args_r->fetch()) {
$table->add_row('value');
if ( $args_id == $edit_arg ) {
$table->add_cell(DVG_interface::input('text','arg_name',$args_name,gettext('Name of the argument'),16),1,'description');
$table->add_cell(DVG_interface::input('text','arg_value',$args_value,gettext('Value of the argument'),128));
$table->add_cell(DVG_interface::input('text','arg_name',
$args_name,gettext('Name of the argument'),16),1,'description');
$table->add_cell(DVG_interface::input('text','arg_value',
$args_value,gettext('Value of the argument'),128));
$table->add_cell(select_argtype('arg_type',$args_type));
$table->add_cell(DVG_interface::input('text','arg_seq',$args_seq,gettext('Sequence of the argument'),4));
// grab minimal Paramameter from database: default: `0`
$table->add_cell(DVG_interface::input('text','arg_min',
isset($args_min_value) ? $args_min_value : '',gettext('Minimal Value'),6));
// grab maximal Paramameter from database: default: `#MAX#`
$table->add_cell(DVG_interface::input('text','arg_max',
isset($args_max_param) ? $args_max_param_name : '',gettext('Maximal Value'),6));
$table->add_cell(DVG_interface::input('text','arg_seq',
$args_seq,gettext('Sequence of the argument'),4));
} else {
$table->add_cell(sprintf('%s:',$args_name),1,'description');
$table->add_cell($args_value);
$table->add_cell($args_type);
$table->add_cell(sprintf('<a href="%s?probe_id=%s;arg_id=%s;action=save;doit=delarg">%s</a>
$table->add_cell('0',1,'right');
$table->add_cell(is_null($args_max_param_name) ? 'Maximum' : $args_max_param_name, 1,'right' );
$table->add_cell(
sprintf('<a href="%s?probe_id=%s;arg_id=%s;action=save;doit=delarg">%s</a>
<a href="%s?probe_id=%s;arg_id=%s;action=detail;doit=editarg">%s</a>',
PROBE_PHP,$probe_id,$args_id,DELETE_IMAGE,
PROBE_PHP,$probe_id,$args_id,EDIT_IMAGE),1,'right');
......@@ -394,14 +405,21 @@ function show_probe($probe_id,$action = 'detail')
}
if ($doit == 'editarg' && $edit_arg == 0 ) {
$table->add_row('value');
$table->add_cell(DVG_interface::input('text','arg_name',isset($args_name) ? $args_name : '',gettext('Name of the argument'),16),1,'description');
$table->add_cell(DVG_interface::input('text','arg_value',isset($args_value) ? $args_value : '',gettext('Value of the argument'),128));
$table->add_cell(DVG_interface::input('text','arg_name',
isset($args_name) ? $args_name : '',gettext('Name of the argument'),16),1,'description');
$table->add_cell(DVG_interface::input('text','arg_value',
isset($args_value) ? $args_value : '',gettext('Value of the argument'),128));
$table->add_cell(select_argtype('arg_type',isset($args_type) ? $args_type : '' ));
$table->add_cell(DVG_interface::input('text','arg_seq',isset($args_seq) ? $args_seq : '',gettext('Sequence of the argument'),4));
$table->add_cell(DVG_interface::input('text','arg_min',
$args_min_value,gettext('Minimal Value'),6));
$table->add_cell(DVG_interface::input('text','arg_max',
$args_max_value,gettext('Maximal Value'),6));
$table->add_cell(DVG_interface::input('text','arg_seq',
isset($args_seq) ? $args_seq : '',gettext('Sequence of the argument'),4));
}
if (preg_match('/arg/',$doit) ) {
$table->add_row('tablehead');
$table->add_cell(DVG_interface::submit_button(TRUE),4,'right');
$table->add_cell(DVG_interface::submit_button(TRUE),DVG_table::WHOLE_ROW,'right');
$doit='savearg';
$add_form = TRUE;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment