2009-01-21 Esteban Sanchez <estebans@artica.es>
* godmode/agentes/alert_manager.php: Added the hability to delete actions and alert (only when it has no actions). * include/functions_alerts.php: Added delete_alert_agent_module() and delete_alert_agent_module_action(). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@1377 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
497488da98
commit
2ec9a60273
|
@ -1,3 +1,11 @@
|
||||||
|
2009-01-21 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
|
* godmode/agentes/alert_manager.php: Added the hability to delete
|
||||||
|
actions and alert (only when it has no actions).
|
||||||
|
|
||||||
|
* include/functions_alerts.php: Added delete_alert_agent_module() and
|
||||||
|
delete_alert_agent_module_action().
|
||||||
|
|
||||||
2009-01-21 Esteban Sanchez <estebans@artica.es>
|
2009-01-21 Esteban Sanchez <estebans@artica.es>
|
||||||
|
|
||||||
* godmode/alerts/configure_alert_template.php,
|
* godmode/alerts/configure_alert_template.php,
|
||||||
|
|
|
@ -28,6 +28,8 @@ echo "<h2>".__('Agent configuration')." > ".__('Alerts')."</h2>";
|
||||||
|
|
||||||
$create_alert = (bool) get_parameter ('create_alert');
|
$create_alert = (bool) get_parameter ('create_alert');
|
||||||
$add_action = (bool) get_parameter ('add_action');
|
$add_action = (bool) get_parameter ('add_action');
|
||||||
|
$delete_action = (bool) get_parameter ('delete_action');
|
||||||
|
$delete_alert = (bool) get_parameter ('delete_alert');
|
||||||
|
|
||||||
if ($create_alert) {
|
if ($create_alert) {
|
||||||
$id_alert_template = (int) get_parameter ('template');
|
$id_alert_template = (int) get_parameter ('template');
|
||||||
|
@ -50,6 +52,14 @@ if ($create_alert) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($delete_alert) {
|
||||||
|
$id_alert_agent_module = (int) get_parameter ('id_alert');
|
||||||
|
|
||||||
|
$result = delete_alert_agent_module ($id_alert_agent_module);
|
||||||
|
print_error_message ($id, __('Successfully deleted'),
|
||||||
|
__('Could not be deleted'));
|
||||||
|
}
|
||||||
|
|
||||||
if ($add_action) {
|
if ($add_action) {
|
||||||
$id_action = (int) get_parameter ('action');
|
$id_action = (int) get_parameter ('action');
|
||||||
$id_alert_module = (int) get_parameter ('id_alert_module');
|
$id_alert_module = (int) get_parameter ('id_alert_module');
|
||||||
|
@ -66,6 +76,15 @@ if ($add_action) {
|
||||||
__('Could not be added'));
|
__('Could not be added'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($delete_action) {
|
||||||
|
$id_action = (int) get_parameter ('id_action');
|
||||||
|
$id_alert = (int) get_parameter ('id_alert');
|
||||||
|
|
||||||
|
$result = delete_alert_agent_module_action ($id_alert, $id_action);
|
||||||
|
print_error_message ($id, __('Successfully deleted'),
|
||||||
|
__('Could not be deleted'));
|
||||||
|
}
|
||||||
|
|
||||||
$modules = get_agent_modules ($id_agente,
|
$modules = get_agent_modules ($id_agente,
|
||||||
array ('id_tipo_modulo', 'nombre', 'id_agente'));
|
array ('id_tipo_modulo', 'nombre', 'id_agente'));
|
||||||
|
|
||||||
|
@ -132,7 +151,16 @@ foreach ($modules as $id_agent_module => $module) {
|
||||||
|
|
||||||
$alert_data[0] = get_alert_template_name ($alert['id_alert_template']);
|
$alert_data[0] = get_alert_template_name ($alert['id_alert_template']);
|
||||||
$alert_data[0] .= '<span class="actions" style="visibility: hidden">';
|
$alert_data[0] .= '<span class="actions" style="visibility: hidden">';
|
||||||
$alert_data[0] .= '<a href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'"
|
|
||||||
|
if (empty ($alert_actions)) {
|
||||||
|
$alert_data[0] .= '<form style="display: inline" action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.'" method="post" class="delete_link">';
|
||||||
|
$alert_data[0] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
|
||||||
|
$alert_data[0] .= print_input_hidden ('delete_alert', 1, true);
|
||||||
|
$alert_data[0] .= print_input_hidden ('id_alert', $alert['id'], true);
|
||||||
|
$alert_data[0] .= '</form>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$alert_data[0] .= '<a href="ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_action='.$alert['id_alert_template'].'"
|
||||||
class="template_details">';
|
class="template_details">';
|
||||||
$alert_data[0] .= print_image ("images/zoom.png", true,
|
$alert_data[0] .= print_image ("images/zoom.png", true,
|
||||||
array ("id" => 'template-details-'.$alert['id'],
|
array ("id" => 'template-details-'.$alert['id'],
|
||||||
|
@ -159,14 +187,17 @@ foreach ($modules as $id_agent_module => $module) {
|
||||||
$alert_data[1] .= __('From').' '.$action['fires_min'].
|
$alert_data[1] .= __('From').' '.$action['fires_min'].
|
||||||
' '.__('to').' '.$action['fires_max'];
|
' '.__('to').' '.$action['fires_max'];
|
||||||
}
|
}
|
||||||
|
$url = '&delete_action=1&id_alert='.$alert['id'].'&id_action='.$action['id'];
|
||||||
$alert_data[1] .= ')</em>';
|
$alert_data[1] .= ')</em>';
|
||||||
$alert_data[1] .= '</span>';
|
$alert_data[1] .= '</span>';
|
||||||
$alert_data[1] .= ' <span class="actions" style="visibility: hidden">';
|
$alert_data[1] .= ' <span class="actions" style="visibility: hidden">';
|
||||||
$alert_data[1] .= '<span class="delete">';
|
$alert_data[1] .= '<span class="delete">';
|
||||||
$alert_data[1] .= '<a href="#">';
|
$alert_data[1] .= '<form action="index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente='.$id_agente.'" method="post" class="delete_link">';
|
||||||
$alert_data[1] .= '<img src="images/cross.png" />';
|
$alert_data[1] .= print_input_image ('delete', 'images/cross.png', 1, '', true);
|
||||||
$alert_data[1] .= '</a>';
|
$alert_data[1] .= print_input_hidden ('delete_action', 1, true);
|
||||||
|
$alert_data[1] .= print_input_hidden ('id_alert', $alert['id'], true);
|
||||||
|
$alert_data[1] .= print_input_hidden ('id_action', $action['id'], true);
|
||||||
|
$alert_data[1] .= '</form>';
|
||||||
$alert_data[1] .= '</span>';
|
$alert_data[1] .= '</span>';
|
||||||
$alert_data[1] .= '</span>';
|
$alert_data[1] .= '</span>';
|
||||||
$alert_data[1] .= '</div></li>';
|
$alert_data[1] .= '</div></li>';
|
||||||
|
@ -323,5 +354,10 @@ $(document).ready (function () {
|
||||||
"ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template=" + this.value);
|
"ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template=" + this.value);
|
||||||
$(this).after (details);
|
$(this).after (details);
|
||||||
});
|
});
|
||||||
|
$("form.delete_link").submit (function () {
|
||||||
|
if (! confirm ("<?php echo __('Are you sure?')?>"))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -590,6 +590,17 @@ function update_alert_agent_module ($id_alert_agent_module, $values = false) {
|
||||||
return process_sql ($sql) !== false;
|
return process_sql ($sql) !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function delete_alert_agent_module ($id_alert_agent_module) {
|
||||||
|
if (empty ($id_alert_agent_module))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$sql = sprintf ('DELETE FROM talert_template_modules
|
||||||
|
WHERE id = %d',
|
||||||
|
$id_alert_agent_module);
|
||||||
|
|
||||||
|
return process_sql ($sql) !== false;
|
||||||
|
}
|
||||||
|
|
||||||
function get_alert_agent_module ($id_alert_agent_module) {
|
function get_alert_agent_module ($id_alert_agent_module) {
|
||||||
$id_alert_agent_module = safe_int ($id_alert_agent_module, 1);
|
$id_alert_agent_module = safe_int ($id_alert_agent_module, 1);
|
||||||
if (empty ($id_alert_agent_module))
|
if (empty ($id_alert_agent_module))
|
||||||
|
@ -655,6 +666,20 @@ function add_alert_agent_module_action ($id_alert_agent_module, $id_alert_action
|
||||||
return process_sql ($sql) !== false;
|
return process_sql ($sql) !== false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function delete_alert_agent_module_action ($id_alert_agent_module, $id_alert_action) {
|
||||||
|
if (empty ($id_alert_agent_module))
|
||||||
|
return false;
|
||||||
|
if (empty ($id_alert_action))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$sql = sprintf ('DELETE FROM talert_template_module_actions
|
||||||
|
WHERE id_alert_template_module = %d
|
||||||
|
AND id_alert_action = %d',
|
||||||
|
$id_alert_agent_module, $id_alert_action);
|
||||||
|
|
||||||
|
return process_sql ($sql) !== false;
|
||||||
|
}
|
||||||
|
|
||||||
function get_alert_agent_module_actions ($id_alert_agent_module) {
|
function get_alert_agent_module_actions ($id_alert_agent_module) {
|
||||||
if (empty ($id_alert_agent_module))
|
if (empty ($id_alert_agent_module))
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue