2010-02-25 Sancho Lerena <slerena@artica.es>
* godmode/alerts/configure_alert_template.php, godmode/alerts/alert_templates.php, godmode/alerts/configure_alert_action.php, godmode/alerts/alert_actions.php: Show/Edit group for templates and actions. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@2429 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
0234c9e8c8
commit
8a94e178d1
|
@ -1,5 +1,10 @@
|
|||
2010-02-25 Sancho Lerena <slerena@artica.es>
|
||||
|
||||
* godmode/alerts/configure_alert_template.php,
|
||||
godmode/alerts/alert_templates.php,
|
||||
godmode/alerts/configure_alert_action.php,
|
||||
godmode/alerts/alert_actions.php: Show/Edit group for templates and actions.
|
||||
|
||||
* include/functions_ui.php: Alert information now show the default
|
||||
actions properly,and the action conditions (max/min).
|
||||
|
||||
|
|
|
@ -51,11 +51,13 @@ if ($create_action) {
|
|||
$field1 = (string) get_parameter ('field1');
|
||||
$field2 = (string) get_parameter ('field2');
|
||||
$field3 = (string) get_parameter ('field3');
|
||||
|
||||
$group = (string) get_parameter ('group');
|
||||
|
||||
$result = create_alert_action ($name, $id_alert_command,
|
||||
array ('field1' => $field1,
|
||||
'field2' => $field2,
|
||||
'field3' => $field3));
|
||||
'field3' => $field3,
|
||||
'id_group' => $group));
|
||||
|
||||
print_result_message ($result,
|
||||
__('Successfully created'),
|
||||
|
@ -69,13 +71,16 @@ if ($update_action) {
|
|||
$field1 = (string) get_parameter ('field1');
|
||||
$field2 = (string) get_parameter ('field2');
|
||||
$field3 = (string) get_parameter ('field3');
|
||||
|
||||
$group = get_parameter ('group');
|
||||
|
||||
$values = array ();
|
||||
$values['name'] = $name;
|
||||
$values['id_alert_command'] = $id_alert_command;
|
||||
$values['field1'] = $field1;
|
||||
$values['field2'] = $field2;
|
||||
$values['field3'] = $field3;
|
||||
$values['id_group'] = $group;
|
||||
|
||||
$result = update_alert_action ($id, $values);
|
||||
|
||||
print_result_message ($result,
|
||||
|
@ -97,13 +102,14 @@ $table->width = '90%';
|
|||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Delete');
|
||||
$table->head[1] = __('Group');
|
||||
$table->head[2] = __('Delete');
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->size = array ();
|
||||
$table->size[1] = '40px';
|
||||
$table->size[2] = '40px';
|
||||
$table->align = array ();
|
||||
$table->align[1] = 'center';
|
||||
$table->align[2] = 'center';
|
||||
|
||||
$actions = get_db_all_rows_in_table ('talert_actions');
|
||||
if ($actions === false)
|
||||
|
@ -123,7 +129,8 @@ foreach ($actions as $action) {
|
|||
|
||||
$data[0] = '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_action&id='.$action['id'].'">'.
|
||||
$action['name'].'</a>';
|
||||
$data[1] = '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_actions&delete_action=1&id='.$action['id'].'"
|
||||
$data[1] = print_group_icon ($action["id_group"], true) .' '. get_group_name ($action["id_group"]);
|
||||
$data[2] = '<a href="index.php?sec=galertas&sec2=godmode/alerts/alert_actions&delete_action=1&id='.$action['id'].'"
|
||||
onClick="if (!confirm(\''.__('Are you sure?').'\')) return false;">'.
|
||||
'<img src="images/cross.png"></a>';
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ $total_templates = $total_templates[0]['total'];
|
|||
$filter['offset'] = (int) get_parameter ('offset');
|
||||
$filter['limit'] = (int) $config['block_size'];
|
||||
$templates = get_alert_templates ($filter,
|
||||
array ('id', 'name', 'description', 'type'));
|
||||
array ('id', 'name', 'description', 'type', 'id_group'));
|
||||
if ($templates === false)
|
||||
$templates = array ();
|
||||
|
||||
|
@ -184,16 +184,16 @@ $table->width = '90%';
|
|||
$table->data = array ();
|
||||
$table->head = array ();
|
||||
$table->head[0] = __('Name');
|
||||
$table->head[1] = __('Description');
|
||||
$table->head[2] = __('Type');
|
||||
$table->head[3] = __('Op.');
|
||||
$table->head[1] = __('Group');
|
||||
//$table->head[2] = __('Description');
|
||||
$table->head[3] = __('Type');
|
||||
$table->head[4] = __('Op.');
|
||||
$table->style = array ();
|
||||
$table->style[0] = 'font-weight: bold';
|
||||
$table->size = array ();
|
||||
$table->size[2] = '10%';
|
||||
$table->size[3] = '50px';
|
||||
$table->size[4] = '50px';
|
||||
$table->align = array ();
|
||||
$table->align[3] = 'center';
|
||||
$table->align[4] = 'center';
|
||||
|
||||
$rowPair = true;
|
||||
$iterator = 0;
|
||||
|
@ -209,20 +209,21 @@ foreach ($templates as $template) {
|
|||
|
||||
$data[0] = '<a href="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template&id='.$template['id'].'">'.
|
||||
$template['name'].'</a>';
|
||||
|
||||
$data[1] = print_group_icon ($template["id_group"], true) .' '. get_group_name ($template['id_group']);
|
||||
$data[3] = get_alert_templates_type_name ($template['type']);
|
||||
|
||||
$data[4] = '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template" style="display: inline; float: left">';
|
||||
$data[4] .= print_input_hidden ('duplicate_template', 1, true);
|
||||
$data[4] .= print_input_hidden ('source_id', $template['id'], true);
|
||||
$data[4] .= print_input_image ('dup', 'images/copy.png', 1, '', true, array ('title' => __('Duplicate')));
|
||||
$data[4] .= '</form> ';
|
||||
|
||||
$data[1] = $template['description'];
|
||||
$data[2] = get_alert_templates_type_name ($template['type']);
|
||||
$data[3] = '<form method="post" action="index.php?sec=galertas&sec2=godmode/alerts/configure_alert_template" style="display: inline; float: left">';
|
||||
$data[3] .= print_input_hidden ('duplicate_template', 1, true);
|
||||
$data[3] .= print_input_hidden ('source_id', $template['id'], true);
|
||||
$data[3] .= print_input_image ('dup', 'images/copy.png', 1, '', true, array ('title' => __('Duplicate')));
|
||||
$data[3] .= '</form> ';
|
||||
|
||||
$data[3] .= '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
|
||||
$data[3] .= print_input_hidden ('delete_template', 1, true);
|
||||
$data[3] .= print_input_hidden ('id', $template['id'], true);
|
||||
$data[3] .= print_input_image ('del', 'images/cross.png', 1, '', true, array ('title' => __('Delete')));
|
||||
$data[3] .= '</form> ';
|
||||
$data[4] .= '<form method="post" style="display: inline; float: right" onsubmit="if (!confirm(\''.__('Are you sure?').'\')) return false;">';
|
||||
$data[4] .= print_input_hidden ('delete_template', 1, true);
|
||||
$data[4] .= print_input_hidden ('id', $template['id'], true);
|
||||
$data[4] .= print_input_image ('del', 'images/cross.png', 1, '', true, array ('title' => __('Delete')));
|
||||
$data[4] .= '</form> ';
|
||||
|
||||
array_push ($table->data, $data);
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ $id_command = '';
|
|||
$field1 = '';
|
||||
$field2 = '';
|
||||
$field3 = '';
|
||||
$group = 1;
|
||||
|
||||
if ($id) {
|
||||
$action = get_alert_action ($id);
|
||||
$name = $action['name'];
|
||||
|
@ -40,6 +42,7 @@ if ($id) {
|
|||
$field1 = $action['field1'];
|
||||
$field2 = $action['field2'];
|
||||
$field3 = $action['field3'];
|
||||
$group = $action ['group'];
|
||||
}
|
||||
|
||||
echo "<h2>".__('Alerts')." » ".__('Configure alert action')."</h2>";
|
||||
|
@ -53,18 +56,23 @@ $table->data = array ();
|
|||
$table->data[0][0] = __('Name');
|
||||
$table->data[0][1] = print_input_text ('name', $name, '', 35, 255, true);
|
||||
|
||||
$table->data[1][0] = __('Command');
|
||||
$table->data[1][1] = print_select_from_sql ('SELECT id, name FROM talert_commands',
|
||||
$table->data[1][0] = __('Group');
|
||||
|
||||
$groups = get_user_groups ();
|
||||
$table->data[1][1] = print_select ($groups, 'group', $group, '', '', 0, true);
|
||||
|
||||
$table->data[2][0] = __('Command');
|
||||
$table->data[2][1] = print_select_from_sql ('SELECT id, name FROM talert_commands',
|
||||
'id_command', $id_command, '', __('None'), 0, true);
|
||||
|
||||
$table->data[2][0] = __('Field 1');
|
||||
$table->data[2][1] = print_input_text ('field1', $field1, '', 35, 255, true);
|
||||
$table->data[3][0] = __('Field 1');
|
||||
$table->data[3][1] = print_input_text ('field1', $field1, '', 35, 255, true);
|
||||
|
||||
$table->data[3][0] = __('Field 2');
|
||||
$table->data[3][1] = print_input_text ('field2', $field2, '', 80, 255, true);
|
||||
$table->data[4][0] = __('Field 2');
|
||||
$table->data[4][1] = print_input_text ('field2', $field2, '', 80, 255, true);
|
||||
|
||||
$table->data[4][0] = __('Field 3');
|
||||
$table->data[4][1] = print_textarea ('field3', 10, 30, $field3, '', true);
|
||||
$table->data[5][0] = __('Field 3');
|
||||
$table->data[5][1] = print_textarea ('field3', 10, 30, $field3, '', true);
|
||||
|
||||
$table->data[6][0] = __('Command preview');
|
||||
$table->data[6][1] = print_textarea ('command_preview', 10, 30, '', 'disabled="disabled"', true);
|
||||
|
|
|
@ -117,7 +117,8 @@ function update_template ($step) {
|
|||
$min = (float) get_parameter ('min');
|
||||
$matches = (bool) get_parameter ('matches_value');
|
||||
$priority = (int) get_parameter ('priority');
|
||||
|
||||
$id_group = get_parameter ("id_group");
|
||||
|
||||
$result = update_alert_template ($id,
|
||||
array ('name' => $name,
|
||||
'type' => $type,
|
||||
|
@ -125,8 +126,10 @@ function update_template ($step) {
|
|||
'value' => $value,
|
||||
'max_value' => $max,
|
||||
'min_value' => $min,
|
||||
'id_group' => $id_group,
|
||||
'matches_value' => $matches,
|
||||
'priority' => $priority));
|
||||
|
||||
} elseif ($step == 2) {
|
||||
$monday = (bool) get_parameter ('monday');
|
||||
$tuesday = (bool) get_parameter ('tuesday');
|
||||
|
@ -222,6 +225,7 @@ $recovery_notify = false;
|
|||
$field2_recovery = '';
|
||||
$field3_recovery = '';
|
||||
$matches = true;
|
||||
$id_group = 0;
|
||||
|
||||
if ($create_template) {
|
||||
$name = (string) get_parameter ('name');
|
||||
|
@ -232,12 +236,14 @@ if ($create_template) {
|
|||
$min = (float) get_parameter ('min');
|
||||
$matches = (bool) get_parameter ('matches_value');
|
||||
$priority = (int) get_parameter ('priority');
|
||||
|
||||
$id_group = get_parameter ("id_group");
|
||||
|
||||
$result = create_alert_template ($name, $type,
|
||||
array ('description' => $description,
|
||||
'value' => $value,
|
||||
'max_value' => $max,
|
||||
'min_value' => $min,
|
||||
'id_group' => $id_group,
|
||||
'matches_value' => $matches,
|
||||
'priority' => $priority));
|
||||
|
||||
|
@ -292,6 +298,7 @@ if ($id && ! $create_template) {
|
|||
$field2 = $template['field2'];
|
||||
$field3 = $template['field3'];
|
||||
$priority = $template['priority'];
|
||||
$id_group = $template["id_group"];
|
||||
}
|
||||
|
||||
echo '<h2>'.__('Alerts').' » '.__('Configure alert template').'</h2>';
|
||||
|
@ -429,6 +436,10 @@ if ($step == 2) {
|
|||
$table->data[0][0] = __('Name');
|
||||
$table->data[0][1] = print_input_text ('name', $name, '', 35, 255, true);
|
||||
|
||||
$table->data[0][1] .= " ". __("Group");
|
||||
$groups = get_user_groups ();
|
||||
$table->data[0][1] .= " ".print_select ($groups, 'id_group', $id_group, '', '', 0, true);
|
||||
|
||||
$table->data[1][0] = __('Description');
|
||||
$table->data[1][1] = print_textarea ('description', 10, 30,
|
||||
$description, '', true);
|
||||
|
|
Loading…
Reference in New Issue