2012-06-06 Hirofumi Kosaka <kosaka@rworks.jp>
* godmode/agentes/planned_downtime.php: fixed that 'Affect' column at 'planned downtime' may show bad values. cleaned source code style. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@6417 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
308300903b
commit
d349c0ebf3
|
@ -1,3 +1,9 @@
|
|||
2012-06-06 Hirofumi Kosaka <kosaka@rworks.jp>
|
||||
|
||||
* godmode/agentes/planned_downtime.php: fixed that 'Affect'
|
||||
column at 'planned downtime' may show bad values. cleaned
|
||||
source code style.
|
||||
|
||||
2012-06-05 Dario Rodriguez <dario.rodriguez@artica.es>
|
||||
|
||||
* operation/tree.php: Fixed a missing group icons
|
||||
|
|
|
@ -193,82 +193,82 @@ if ($create_downtime || $update_downtime) {
|
|||
////////////////////////////////
|
||||
// Show create / update form
|
||||
////////////////////////////////
|
||||
if (($first_create != 0) OR ($first_update != 0)){
|
||||
// Have any data to show ?
|
||||
if ($id_downtime > 0) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ("SELECT `id`, `name`, `description`, `date_from`, `date_to`, `id_group`, `only_alerts`
|
||||
FROM `tplanned_downtime` WHERE `id` = %d",
|
||||
$id_downtime);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ("SELECT \"id\", \"name\", \"description\", \"date_from\", \"date_to\", \"id_group\", \"only_alerts\"
|
||||
FROM \"tplanned_downtime\" WHERE \"id\" = %d",
|
||||
$id_downtime);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ("SELECT id, name, description, date_from, date_to, id_group, only_alerts
|
||||
FROM tplanned_downtime WHERE id = %d",
|
||||
$id_downtime);
|
||||
break;
|
||||
}
|
||||
|
||||
$result = db_get_row_sql ($sql);
|
||||
$name = $result["name"];
|
||||
$description = $result["description"];
|
||||
$date_from = strftime ('%Y-%m-%d', $result["date_from"]);
|
||||
$date_to = strftime ('%Y-%m-%d', $result["date_to"]);
|
||||
$time_from = strftime ('%I:%M%p', $result["date_from"]);
|
||||
$time_to = strftime ('%I:%M%p', $result["date_to"]);
|
||||
$only_alerts = $result["only_alerts"];
|
||||
|
||||
if ($id_group == 0)
|
||||
$id_group = $result['id_group'];
|
||||
if (($first_create != 0) OR ($first_update != 0)){
|
||||
// Have any data to show ?
|
||||
if ($id_downtime > 0) {
|
||||
switch ($config["dbtype"]) {
|
||||
case "mysql":
|
||||
$sql = sprintf ("SELECT `id`, `name`, `description`, `date_from`, `date_to`, `id_group`, `only_alerts`
|
||||
FROM `tplanned_downtime` WHERE `id` = %d",
|
||||
$id_downtime);
|
||||
break;
|
||||
case "postgresql":
|
||||
$sql = sprintf ("SELECT \"id\", \"name\", \"description\", \"date_from\", \"date_to\", \"id_group\", \"only_alerts\"
|
||||
FROM \"tplanned_downtime\" WHERE \"id\" = %d",
|
||||
$id_downtime);
|
||||
break;
|
||||
case "oracle":
|
||||
$sql = sprintf ("SELECT id, name, description, date_from, date_to, id_group, only_alerts
|
||||
FROM tplanned_downtime WHERE id = %d",
|
||||
$id_downtime);
|
||||
break;
|
||||
}
|
||||
|
||||
$table->class = 'databox_color';
|
||||
$table->width = '98%';
|
||||
$table->data = array ();
|
||||
$table->data[0][0] = __('Name');
|
||||
$table->data[0][1] = html_print_input_text ('name', $name, '', 25, 40, true);
|
||||
$table->data[2][0] = __('Description');
|
||||
$table->data[2][1] = html_print_textarea ('description', 3, 35, $description, '', true);
|
||||
$table->data[3][0] = __('Timestamp from');
|
||||
$table->data[3][1] = html_print_input_text ('date_from', $date_from, '', 10, 10, true);
|
||||
$table->data[3][1] .= html_print_input_text ('time_from', $time_from, '', 7, 7, true);
|
||||
$result = db_get_row_sql ($sql);
|
||||
$name = $result["name"];
|
||||
$description = $result["description"];
|
||||
$date_from = strftime ('%Y-%m-%d', $result["date_from"]);
|
||||
$date_to = strftime ('%Y-%m-%d', $result["date_to"]);
|
||||
$time_from = strftime ('%I:%M%p', $result["date_from"]);
|
||||
$time_to = strftime ('%I:%M%p', $result["date_to"]);
|
||||
$only_alerts = $result["only_alerts"];
|
||||
|
||||
$table->data[4][0] = __('Timestamp to');
|
||||
$table->data[4][1] = html_print_input_text ('date_to', $date_to, '', 10, 10, true);
|
||||
$table->data[4][1] .= html_print_input_text ('time_to', $time_to, '', 7, 7, true);
|
||||
if ($id_group == 0)
|
||||
$id_group = $result['id_group'];
|
||||
}
|
||||
|
||||
$table->data[5][0] = __('Group');
|
||||
$table->data[5][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', 0, true);
|
||||
$table->data[6][0] = __('Only alerts');
|
||||
$table->data[6][1] = html_print_checkbox('only_alerts', 1, $only_alerts, true);
|
||||
echo '<form method="POST" action="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime">';
|
||||
$table->class = 'databox_color';
|
||||
$table->width = '98%';
|
||||
$table->data = array ();
|
||||
$table->data[0][0] = __('Name');
|
||||
$table->data[0][1] = html_print_input_text ('name', $name, '', 25, 40, true);
|
||||
$table->data[2][0] = __('Description');
|
||||
$table->data[2][1] = html_print_textarea ('description', 3, 35, $description, '', true);
|
||||
$table->data[3][0] = __('Timestamp from');
|
||||
$table->data[3][1] = html_print_input_text ('date_from', $date_from, '', 10, 10, true);
|
||||
$table->data[3][1] .= html_print_input_text ('time_from', $time_from, '', 7, 7, true);
|
||||
|
||||
if ($id_downtime > 0){
|
||||
echo "<table width=100% border=0 cellpadding=4 >";
|
||||
echo "<tr><td width=75% valign='top'>";
|
||||
}
|
||||
$table->data[4][0] = __('Timestamp to');
|
||||
$table->data[4][1] = html_print_input_text ('date_to', $date_to, '', 10, 10, true);
|
||||
$table->data[4][1] .= html_print_input_text ('time_to', $time_to, '', 7, 7, true);
|
||||
|
||||
//Editor form
|
||||
html_print_table ($table);
|
||||
$table->data[5][0] = __('Group');
|
||||
$table->data[5][1] = html_print_select_groups(false, "AR", true, 'id_group', $id_group, '', '', 0, true);
|
||||
$table->data[6][0] = __('Only alerts');
|
||||
$table->data[6][1] = html_print_checkbox('only_alerts', 1, $only_alerts, true);
|
||||
echo '<form method="POST" action="index.php?sec=gagente&sec2=godmode/agentes/planned_downtime">';
|
||||
|
||||
html_print_input_hidden ('id_agent', $id_agent);
|
||||
echo '<div class="action-buttons" style="width: 90%">';
|
||||
if ($id_downtime) {
|
||||
html_print_input_hidden ('update_downtime', 1);
|
||||
html_print_input_hidden ('id_downtime', $id_downtime);
|
||||
html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
|
||||
}
|
||||
else {
|
||||
html_print_input_hidden ('create_downtime', 1);
|
||||
html_print_submit_button (__('Add'), 'crtbutton', false, 'class="sub wand"');
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
if ($id_downtime > 0){
|
||||
echo "<table width=100% border=0 cellpadding=4 >";
|
||||
echo "<tr><td width=75% valign='top'>";
|
||||
}
|
||||
|
||||
//Editor form
|
||||
html_print_table ($table);
|
||||
|
||||
html_print_input_hidden ('id_agent', $id_agent);
|
||||
echo '<div class="action-buttons" style="width: 90%">';
|
||||
if ($id_downtime) {
|
||||
html_print_input_hidden ('update_downtime', 1);
|
||||
html_print_input_hidden ('id_downtime', $id_downtime);
|
||||
html_print_submit_button (__('Update'), 'updbutton', false, 'class="sub upd"');
|
||||
}
|
||||
else {
|
||||
html_print_input_hidden ('create_downtime', 1);
|
||||
html_print_submit_button (__('Add'), 'crtbutton', false, 'class="sub wand"');
|
||||
}
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
if ($id_downtime > 0) {
|
||||
|
||||
|
@ -354,7 +354,6 @@ if ($create_downtime || $update_downtime) {
|
|||
|
||||
$data[1] = db_get_sql ("SELECT nombre FROM tgrupo WHERE id_grupo = ". $downtime["id_grupo"]);
|
||||
|
||||
|
||||
$data[2] = ui_print_os_icon ($downtime["id_os"], true, true);
|
||||
|
||||
$data[3] = $downtime["ultimo_contacto"];
|
||||
|
@ -415,7 +414,7 @@ else {
|
|||
$data[2] = ui_print_group_icon ($downtime['id_group'], true);
|
||||
$data[3] = date ("Y-m-d H:i", $downtime['date_from']);
|
||||
$data[4] = date ("Y-m-d H:i", $downtime['date_to']);
|
||||
if($only_alerts) {
|
||||
if($downtime['only_alerts']) {
|
||||
$data[5] = __('Only alerts');
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in New Issue