2013-01-30 Miguel de Dios <miguel.dedios@artica.es>

* godmode/agentes/planned_downtime.list.php, include/db/oracle.php,
	include/Image/image_functions.php,
	operation/events/events.build_table.php,
	operation/messages/message_edit.php, operation/users/user_edit.php,
	operation/tree.php: improved the source style.
	
	* include/constants.php: added constants for the subtype of modules.




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7550 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2013-01-30 13:53:02 +00:00
parent 33ce5037e3
commit c13245dd00
9 changed files with 85 additions and 65 deletions

View File

@ -1,3 +1,13 @@
2013-01-30 Miguel de Dios <miguel.dedios@artica.es>
* godmode/agentes/planned_downtime.list.php, include/db/oracle.php,
include/Image/image_functions.php,
operation/events/events.build_table.php,
operation/messages/message_edit.php, operation/users/user_edit.php,
operation/tree.php: improved the source style.
* include/constants.php: added constants for the subtype of modules.
2013-01-30 Sergio Martin <sergio.martin@artica.es>
* godmode/events/event_responses.editor.php: Little fix

View File

@ -153,7 +153,7 @@ else {
$data[5] .= "&nbsp;";
}
$data[5] .= "&nbsp;(" . $downtime['periodically_time_from'];
$data[5] .= "-" . $downtime['periodically_time_to'] . ")";
$data[5] .= "-" . $downtime['periodically_time_to'] . ")";
break;
case 'monthly':
$data[5] = __('Monthly:');

View File

@ -1,7 +1,7 @@
<?php
/**
* @category Images
* @package Image_Graph
* @category Images
* @package Image_Graph
*/
/**

View File

@ -208,6 +208,8 @@ define ('STATUS_ALERT_DISABLED', 'alert_disabled.png');
define ('STATUS_SERVER_OK', 'server_ok.png');
define ('STATUS_SERVER_DOWN', 'server_down.png');
/* Events criticity */
define ('EVENT_CRIT_MAINTENANCE', 0);
define ('EVENT_CRIT_INFORMATIONAL', 1);
@ -219,4 +221,9 @@ define ('EVENT_CRIT_CRITICAL', 4);
define ('EVENT_CRIT_WARNING_OR_CRITICAL', 34);
define ('EVENT_CRIT_NOT_NORMAL', 20);
?>
/* Id Module (more use in component)*/
define ('MODULE_WMI', 6);
define ('MODULE_NETWORK', 2);
define ('MODULE_PLUGIN', 4);
define ('MODULE_WEB', 7);
?>

View File

@ -590,14 +590,14 @@ function oracle_db_format_array_where_clause_sql ($values, $join = 'AND', $prefi
}
if ($i == $max) {
$query .= ' ) ';
}
}
$i++;
continue;
}
else if (is_numeric ($field)) {
/* User provide the exact operation to do */
$query .= $value;
if ($i < $max) {
$query .= ' '.$join.' ';
}
@ -621,12 +621,12 @@ function oracle_db_format_array_where_clause_sql ($values, $join = 'AND', $prefi
$query .= sprintf ("%s IN ('%s')", $field, implode ("', '", $value));
}
else {
if ($value[0] == ">"){
if ($value[0] == ">") {
$value = substr($value,1,strlen($value)-1);
$query .= sprintf ("%s > '%s'", $field, $value);
}
else if ($value[0] == "<"){
if ($value[1] == ">"){
else if ($value[0] == "<") {
if ($value[1] == ">") {
$value = substr($value,2,strlen($value)-2);
$query .= sprintf ("%s <> '%s'", $field, $value);
}
@ -707,11 +707,11 @@ function oracle_db_format_array_where_clause_sql ($values, $join = 'AND', $prefi
**/
function oracle_recode_query ($sql, $values, $join = 'AND', $return = true) {
$fields = array ();
if (! is_array ($values) || empty($sql)) {
return '';
}
$query = '';
$limit = '';
$offset = '';
@ -736,7 +736,7 @@ function oracle_recode_query ($sql, $values, $join = 'AND', $return = true) {
else if (isset ($values['offset'])) {
unset ($values['offset']);
}
if (isset ($values['order'])) {
if (is_array($values['order'])) {
if (!isset($values['order']['order'])) {
@ -755,19 +755,19 @@ function oracle_recode_query ($sql, $values, $join = 'AND', $return = true) {
}
unset ($values['order']);
}
if (isset ($values['group'])) {
$group = sprintf (' GROUP BY %s', $values['group']);
unset ($values['group']);
}
$i = 1;
$max = count ($values);
foreach ($values as $field => $value) {
if ($i == 1) {
$query .= ' ( ';
}
if (is_numeric ($field)) {
/* User provide the exact operation to do */
$query .= $value;
@ -778,7 +778,7 @@ function oracle_recode_query ($sql, $values, $join = 'AND', $return = true) {
$i++;
continue;
}
if (is_null ($value)) {
$query .= sprintf ("%s IS NULL", $field);
}
@ -867,10 +867,10 @@ function oracle_db_get_value_sql($sql, $dbconnection = false) {
function oracle_db_get_row_sql ($sql, $search_history_db = false) {
$sql = "SELECT * FROM (" . $sql . ") WHERE rownum < 2";
$result = oracle_db_get_all_rows_sql($sql, $search_history_db);
if($result === false)
return false;
return $result[0];
}
@ -904,11 +904,11 @@ function oracle_db_get_row_filter ($table, $filter, $fields = false, $where_join
}
else {
if (is_array ($fields))
$fields = implode (',', $fields);
$fields = implode (',', $fields);
else if (! is_string ($fields))
return false;
return false;
}
if (is_array ($filter))
$filter = db_format_array_where_clause_sql ($filter, $where_join, ' WHERE ');
else if (is_string ($filter))
@ -917,7 +917,7 @@ function oracle_db_get_row_filter ($table, $filter, $fields = false, $where_join
$filter = '';
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
return db_get_row_sql ($sql);
}
@ -956,7 +956,7 @@ function oracle_db_get_all_rows_filter ($table, $filter = array(), $fields = fal
elseif (!is_string($fields)) {
return false;
}
//TODO: Validate and clean filter options
if (is_array ($filter)) {
$filter = db_format_array_where_clause_sql ($filter, $where_join, ' WHERE ');
@ -967,9 +967,9 @@ function oracle_db_get_all_rows_filter ($table, $filter = array(), $fields = fal
else {
$filter = '';
}
$sql = sprintf ('SELECT %s FROM %s %s', $fields, $table, $filter);
if ($returnSQL)
return $sql;
else
@ -984,7 +984,7 @@ function oracle_db_get_all_rows_filter ($table, $filter = array(), $fields = fal
*/
function oracle_db_get_num_rows ($sql) {
global $config;
$type = explode(' ',strtoupper(trim($sql)));
if ($type[0] == 'SELECT'){
$sql = "SELECT count(*) as NUM FROM (" . $sql . ")";
@ -1000,7 +1000,7 @@ function oracle_db_get_num_rows ($sql) {
}
oci_free_statement($query);
return $rows;
}
@ -1024,10 +1024,10 @@ function oracle_db_get_all_rows_field_filter ($table, $field, $condition, $order
else {
$sql = sprintf ("SELECT * FROM %s WHERE %s = '%s'", $table, $field, $condition);
}
if ($order_field != "")
$sql .= sprintf (" ORDER BY %s", $order_field);
return db_get_all_rows_sql ($sql);
}
@ -1045,10 +1045,10 @@ function oracle_db_get_all_fields_in_table ($table, $field = '', $condition = ''
if ($condition != '') {
$sql .= sprintf (" WHERE %s = '%s'", $field, $condition);
}
if ($order_field != "")
$sql .= sprintf (" ORDER BY %s", $order_field);
return db_get_all_rows_sql ($sql);
}
@ -1077,7 +1077,7 @@ function oracle_db_get_all_fields_in_table ($table, $field = '', $condition = ''
*/
function oracle_db_format_array_to_update_sql ($values) {
$fields = array ();
foreach ($values as $field => $value) {
if (is_numeric($field)) {
array_push ($fields, $value);
@ -1086,7 +1086,7 @@ function oracle_db_format_array_to_update_sql ($values) {
else if ($field[0] == "`") {
$field = str_replace('`', '', $field);
}
if ($value === NULL) {
$sql = sprintf ("%s = NULL", $field);
}
@ -1110,7 +1110,7 @@ function oracle_db_format_array_to_update_sql ($values) {
}
array_push ($fields, $sql);
}
return implode (", ", $fields);
}
@ -1142,7 +1142,7 @@ function oracle_db_process_sql_update($table, $values, $where = false, $where_jo
$query = sprintf ("UPDATE %s SET %s",
$table,
db_format_array_to_update_sql ($values));
if ($where) {
if (is_string ($where)) {
// No clean, the caller should make sure all input is clean, this is a raw function
@ -1188,9 +1188,9 @@ function oracle_db_process_sql_delete($table, $where, $where_join = 'AND') {
if (empty ($where))
/* Should avoid any mistake that lead to deleting all data */
return false;
$query = sprintf ("DELETE FROM %s WHERE ", $table);
if ($where) {
if (is_string ($where)) {
/* FIXME: Should we clean the string for sanity?
@ -1201,7 +1201,7 @@ function oracle_db_process_sql_delete($table, $where, $where_join = 'AND') {
$query .= db_format_array_where_clause_sql ($where, $where_join);
}
}
return db_process_sql ($query);
}
@ -1209,9 +1209,9 @@ function oracle_db_process_sql_delete_temp ($table, $where, $where_join = 'AND')
if (empty ($where))
/* Should avoid any mistake that lead to deleting all data */
return false;
$query = sprintf ("DELETE FROM %s WHERE ", $table);
if ($where) {
if (is_string ($where)) {
/* FIXME: Should we clean the string for sanity?
@ -1222,8 +1222,9 @@ function oracle_db_process_sql_delete_temp ($table, $where, $where_join = 'AND')
$query .= db_format_array_where_clause_sql ($where, $where_join);
}
}
$result = '';
return db_process_sql ($query, "affected_rows", '', true, $result, false);
}

View File

@ -289,7 +289,7 @@ foreach ($result as $event) {
$data[$i] = '<b><a href="'.$event["server_url"].'/index.php?sec=estado&amp;sec2=operation/agentes/ver_agente&amp;id_agente=' . $event["id_agente"] . $event["server_url_hash"] . '">';
$data[$i] .= $event["agent_name"];
$data[$i] .= "</a></b>";
}
}
else {
$data[$i] .= ui_print_agent_name ($event["id_agente"], true);
}

View File

@ -82,8 +82,8 @@ if ($read_message) {
$table->data[2][0] = __('Subject');
$table->data[2][1] = html_print_input_text_extended ("subject", $message["subject"], 'text-subject', '', 50, 70, true, false, '', 'readonly');
$order = array("\r\n", "\n", "\r");
$order = array("\r\n", "\n", "\r");
$replace = '<br />';
$parsed_message = str_replace($order, $replace, $message["mensaje"]);
@ -124,7 +124,7 @@ if ($read_message) {
// Create message (destination user)
if (($new_msg) && (!empty ($dst_user)) && (!$reply)) {
$return = messages_create_message ($config["id_user"], $dst_user, $subject, $message);
$user_name = get_user_fullname ($dst_user);
if (!$user_name) {
$user_name = $dst_user;

View File

@ -561,8 +561,8 @@ if (! defined ('METACONSOLE')) {
$img_style = array ("class" => "top", "width" => 16);
$activeTab = get_parameter('tab','group');
$group_tab = array('text' => "<a href='index.php?sec=monitoring&sec2=operation/tree&refr=0&tab=group&pure=$pure'>"
. html_print_image ("images/group.png", true, array ("title" => __('Groups'))) . "</a>",
'active' => $activeTab == "group");
. html_print_image ("images/group.png", true, array ("title" => __('Groups'))) . "</a>",
'active' => $activeTab == "group");
$tags_tab = array('text' => "<a href='index.php?&sec=monitoring&sec2=operation/tree&refr=0&tab=tag&pure=$pure'>"
. html_print_image ("images/tag_red.png", true, array ("title" => __('Tags'))) . "</a>", 'active' => $activeTab == "tag");
$subsections = array('group' => $group_tab, 'tag' => $tags_tab);
@ -586,7 +586,8 @@ if(tags_has_user_acl_tags()) {
echo "<br>";
if (! defined ('METACONSOLE')) {
echo '<form id="tree_search" method="post" action="index.php?extension_in_menu=estado&sec=estado&sec2=operation/tree&refr=0&sort_by='.$activeTab.'&pure='.$pure.'">';
} else {
}
else {
echo '<form id="tree_search" method="post" action="index.php?sec=monitoring&sec2=operation/tree&refr=0&tab='.$activeTab.'&pure='.$pure.'">';
}
echo "<b>" . __('Agent status') . "</b>";
@ -635,7 +636,7 @@ treeview_printTree($activeTab);
* less_branchs int use in ajax php as binary structure 0b00, 0b01, 0b10 and 0b11
* id_father int use in js and ajax php, its useful when you have a two subtrees with same agent for diferent each one
*/
function loadSubTree(type, div_id, less_branchs, id_father, server_name) {
function loadSubTree(type, div_id, less_branchs, id_father, server_name) {
hiddenDiv = $('#tree_div'+id_father+'_'+type+'_'+div_id).attr('hiddenDiv');
loadDiv = $('#tree_div'+id_father+'_'+type+'_'+div_id).attr('loadDiv');
pos = parseInt($('#tree_image'+id_father+'_'+type+'_'+div_id).attr('pos_tree'));
@ -690,9 +691,11 @@ treeview_printTree($activeTab);
});
}
else {
<?php if (! defined ('METACONSOLE')) {
<?php
if (! defined ('METACONSOLE')) {
echo 'var icon_path = \'operation/tree\';';
} else {
}
else {
echo 'var icon_path = \'../../operation/tree\';';
}
?>
@ -781,7 +784,7 @@ treeview_printTree($activeTab);
success: function(data){
$('#cont').html(data);
}
});
});
}
function loadModuleTable(id_module, server_name) {
@ -792,6 +795,6 @@ treeview_printTree($activeTab);
success: function(data){
$('#cont').html(data);
}
});
});
}
</script>

View File

@ -226,7 +226,7 @@ echo html_print_select_from_sql ('SELECT id_language, name FROM tlanguage',
echo '</td></tr><tr><td class="datos2">'.__('Comments').'</td><td class="datos">';
html_print_textarea ("comments", 2, 60, $user_info["comments"], ($view_mode ? 'readonly="readonly"' : ''));
html_print_input_hidden('quick_language_change', 1);
$own_info = get_user_info ($config['id_user']);
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
$display_all_group = true;
@ -237,8 +237,7 @@ $usr_groups = (users_get_groups($config['id_user'], 'AR', $display_all_group));
$id_usr = $config['id_user'];
// User only can change skins if has more than one group
if (count($usr_groups) > 1){
if (count($usr_groups) > 1) {
$isFunctionSkins = enterprise_include_once ('include/functions_skins.php');
if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK) {
echo '</td></tr><tr><td class="datos">' . __('Skin') . '</td><td class="datos2">';
@ -250,7 +249,7 @@ echo '</td></tr><tr><td class="datos">'.__('Interactive charts') . ui_print_help
$values = array(-1 => __('Default'),1 => __('Yes'),0 => __('No'));
echo html_print_select($values, 'flash_charts', $user_info["flash_chart"], '', '', -1, true, false, false);
echo '</td></tr><tr><td class="datos">'.__('Block size for pagination'). ui_print_help_tip(__('If checkbox is clicked then block size global configuration is used'), true) . '</td><td class="datos2">';
if($user_info["block_size"] == 0) {
if ($user_info["block_size"] == 0) {
$block_size = $config["global_block_size"];
}
else {
@ -371,42 +370,42 @@ $(document).ready (function () {
function show_data_section () {
section=$("#section").val();
switch (section) {
case <?php echo "'".__('Dashboard')."'"; ?>:
case <?php echo "'" . __('Dashboard') . "'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "");
$("#visual_console").css("display", "none");
break;
case <?php echo "'".__('Visual console')."'"; ?>:
case <?php echo "'" . __('Visual console') . "'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "");
break;
case <?php echo "'".__('Event list')."'"; ?>:
case <?php echo "'" . __('Event list') . "'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
break;
case <?php echo "'".__('Group view')."'"; ?>:
case <?php echo "'" . __('Group view') . "'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
break;
case <?php echo "'".__('Tactical view')."'"; ?>:
case <?php echo "'" . __('Tactical view') . "'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
break;
case <?php echo "'".__('Alert detail')."'"; ?>:
case <?php echo "'" . __('Alert detail') . "'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
break;
case <?php echo "'".__('Other')."'"; ?>:
case <?php echo "'" . __('Other') . "'"; ?>:
$("#text-data_section").css("display", "");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");
break;
case <?php echo "'".__('Default')."'"; ?>:
case <?php echo "'" . __('Default') . "'"; ?>:
$("#text-data_section").css("display", "none");
$("#dashboard").css("display", "none");
$("#visual_console").css("display", "none");