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:
parent
200f778dd9
commit
c1fc8ba756
|
@ -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>
|
2012-01-09 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
|
||||||
* include/functions_api.php: Added new serialized parameter in
|
* include/functions_api.php: Added new serialized parameter in
|
||||||
set_create_network_module function from api. Without it Web console
|
set_create_network_module function from api. Without it Web console
|
||||||
|
|
|
@ -42,6 +42,7 @@ $first_update = (int) get_parameter ('first_update', 0);
|
||||||
|
|
||||||
$create_downtime = (int) get_parameter ('create_downtime');
|
$create_downtime = (int) get_parameter ('create_downtime');
|
||||||
$delete_downtime = (int) get_parameter ('delete_downtime');
|
$delete_downtime = (int) get_parameter ('delete_downtime');
|
||||||
|
$stop_downtime = (int) get_parameter ('stop_downtime');
|
||||||
$edit_downtime = (int) get_parameter ('edit_downtime');
|
$edit_downtime = (int) get_parameter ('edit_downtime');
|
||||||
$update_downtime = (int) get_parameter ('update_downtime');
|
$update_downtime = (int) get_parameter ('update_downtime');
|
||||||
$id_downtime = (int) get_parameter ('id_downtime',0);
|
$id_downtime = (int) get_parameter ('id_downtime',0);
|
||||||
|
@ -56,6 +57,33 @@ $only_alerts = (bool) get_parameter ('only_alerts', 0);
|
||||||
// Header
|
// Header
|
||||||
ui_print_page_header (__("Planned Downtime") . ui_print_help_icon ('planned_downtime', true), "images/god1.png", false, "", true, "");
|
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
|
// INSERT A NEW DOWNTIME_AGENT ASSOCIATION
|
||||||
if ($insert_downtime_agent == 1){
|
if ($insert_downtime_agent == 1){
|
||||||
$agents = $_POST["id_agent"];
|
$agents = $_POST["id_agent"];
|
||||||
|
@ -363,11 +391,13 @@ else {
|
||||||
$table->head[6] = __('Delete');
|
$table->head[6] = __('Delete');
|
||||||
$table->head[7] = __('Update');
|
$table->head[7] = __('Update');
|
||||||
$table->head[8] = __('Running');
|
$table->head[8] = __('Running');
|
||||||
|
$table->head[9] = __('Stop downtime');
|
||||||
$table->align[2] = "center";
|
$table->align[2] = "center";
|
||||||
$table->align[5] = "center";
|
$table->align[5] = "center";
|
||||||
$table->align[6] = "center";
|
$table->align[6] = "center";
|
||||||
$table->align[7] = "center";
|
$table->align[7] = "center";
|
||||||
$table->align[8] = "center";
|
$table->align[8] = "center";
|
||||||
|
$table->align[9] = "center";
|
||||||
|
|
||||||
if(!empty($groups)) {
|
if(!empty($groups)) {
|
||||||
$sql = "SELECT * FROM tplanned_downtime WHERE id_group IN (" . implode (",", array_keys ($groups)) . ")";
|
$sql = "SELECT * FROM tplanned_downtime WHERE id_group IN (" . implode (",", array_keys ($groups)) . ")";
|
||||||
|
@ -413,6 +443,9 @@ else {
|
||||||
else
|
else
|
||||||
$data[8] = html_print_image ("images/pixel_red.png", true, array ('width' => 20, 'height' => 20, 'alt' => __('Not executed')));
|
$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&sec2=godmode/agentes/planned_downtime&stop_downtime=1&id_downtime='.$downtime['id'].'">' .
|
||||||
|
html_print_image("images/cancel.png", true, array("border" => '0', "alt" => __('Stop downtime')));
|
||||||
|
|
||||||
array_push ($table->data, $data);
|
array_push ($table->data, $data);
|
||||||
}
|
}
|
||||||
html_print_table ($table);
|
html_print_table ($table);
|
||||||
|
|
Loading…
Reference in New Issue