2012-01-09 Vanessa Gil <vanessa.gil@artica.es>

* godmode/agentes/planned_downtime.php: allow cancelling scheduled
	downtime once it has started.


git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5332 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
vgilc 2012-01-09 17:54:31 +00:00
parent 200f778dd9
commit c1fc8ba756
2 changed files with 38 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2012-01-09 Vanessa Gil <vanessa.gil@artica.es>
* godmode/agentes/planned_downtime.php: allow cancelling scheduled
downtime once it has started.
2012-01-09 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* include/functions_api.php: Added new serialized parameter in
set_create_network_module function from api. Without it Web console

View File

@ -42,6 +42,7 @@ $first_update = (int) get_parameter ('first_update', 0);
$create_downtime = (int) get_parameter ('create_downtime');
$delete_downtime = (int) get_parameter ('delete_downtime');
$stop_downtime = (int) get_parameter ('stop_downtime');
$edit_downtime = (int) get_parameter ('edit_downtime');
$update_downtime = (int) get_parameter ('update_downtime');
$id_downtime = (int) get_parameter ('id_downtime',0);
@ -56,6 +57,33 @@ $only_alerts = (bool) get_parameter ('only_alerts', 0);
// Header
ui_print_page_header (__("Planned Downtime") . ui_print_help_icon ('planned_downtime', true), "images/god1.png", false, "", true, "");
// STOP DOWNTIME
if ($stop_downtime == 1){
$sql = "SELECT * FROM tplanned_downtime where id=$id_downtime";
$result = db_get_row_sql($sql);
$name = $result['name'];
$description = $result['description'];
$date_from = $result['date_from'];
$executed = $result['executed'];
$id_group = $result['id_group'];
$only_alerts = $result['only_alerts'];
$date_stop = date ("Y-m-j",get_system_time ());
$time_stop = date ("h:iA",get_system_time ());
$date_time_stop = strtotime ($date_stop.' '.$time_stop);
$values = array(
'id' => $id_downtime,
'name' => $name,
'description' => $description,
'date_from' => $date_from,
'date_to' => $date_time_stop,
'executed' => 0,
'id_group' => $id_group,
'only_alerts' => $only_alerts);
$result = db_process_sql_update('tplanned_downtime', $values, array ('id' => $id_downtime));
}
// INSERT A NEW DOWNTIME_AGENT ASSOCIATION
if ($insert_downtime_agent == 1){
$agents = $_POST["id_agent"];
@ -363,11 +391,13 @@ else {
$table->head[6] = __('Delete');
$table->head[7] = __('Update');
$table->head[8] = __('Running');
$table->head[9] = __('Stop downtime');
$table->align[2] = "center";
$table->align[5] = "center";
$table->align[6] = "center";
$table->align[7] = "center";
$table->align[8] = "center";
$table->align[9] = "center";
if(!empty($groups)) {
$sql = "SELECT * FROM tplanned_downtime WHERE id_group IN (" . implode (",", array_keys ($groups)) . ")";
@ -413,6 +443,9 @@ else {
else
$data[8] = html_print_image ("images/pixel_red.png", true, array ('width' => 20, 'height' => 20, 'alt' => __('Not executed')));
$data[9] = '<a href="index.php?sec=gagente&amp;sec2=godmode/agentes/planned_downtime&amp;stop_downtime=1&amp;id_downtime='.$downtime['id'].'">' .
html_print_image("images/cancel.png", true, array("border" => '0', "alt" => __('Stop downtime')));
array_push ($table->data, $data);
}
html_print_table ($table);