2013-01-29 Miguel de Dios <miguel.dedios@artica.es>
* general/shortcut_bar.php, godmode/alerts/alert_actions.php, godmode/category/edit_category.php, include/functions_reports.php, include/db/postgresql.php, include/functions_gis.php, include/functions_treeview.php, include/functions_network_components.php: improved the code style. * include/javascript/pandora.js: in function "agent_changed_by_multiple_agents" added hook for to call any function when loaded the module list. (now used in the wizzard of reports in enterprise). git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7540 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
fb065bb5be
commit
c30473da10
|
@ -1,3 +1,16 @@
|
|||
2013-01-29 Miguel de Dios <miguel.dedios@artica.es>
|
||||
|
||||
* general/shortcut_bar.php, godmode/alerts/alert_actions.php,
|
||||
godmode/category/edit_category.php, include/functions_reports.php,
|
||||
include/db/postgresql.php, include/functions_gis.php,
|
||||
include/functions_treeview.php,
|
||||
include/functions_network_components.php: improved the code style.
|
||||
|
||||
* include/javascript/pandora.js: in function
|
||||
"agent_changed_by_multiple_agents" added hook for to call any
|
||||
function when loaded the module list. (now used in the wizzard
|
||||
of reports in enterprise).
|
||||
|
||||
2013-01-29 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_treeview.php
|
||||
|
|
|
@ -82,7 +82,7 @@ if (is_ajax()){
|
|||
}
|
||||
|
||||
// Select only opened incidents
|
||||
if ($get_opened_incidents) {
|
||||
if ($get_opened_incidents) {
|
||||
$own_info = get_user_info ($config['id_user']);
|
||||
|
||||
if ($own_info['is_admin'] || check_acl ($config['id_user'], 0, "PM"))
|
||||
|
@ -95,20 +95,20 @@ if (is_ajax()){
|
|||
ORDER BY actualizacion";
|
||||
|
||||
|
||||
if (!empty($own_groups)) {
|
||||
if (!empty($own_groups)) {
|
||||
$result_incidents_update = db_get_all_rows_sql ($sql);
|
||||
}
|
||||
else {
|
||||
$result_incidents_update = false;
|
||||
}
|
||||
|
||||
|
||||
if ($result_incidents_update === false)
|
||||
$shortcut_incidents = 0;
|
||||
else
|
||||
$shortcut_incidents = $result_incidents_update[0]['total_incidents'];
|
||||
|
||||
echo $shortcut_incidents;
|
||||
}
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -193,21 +193,22 @@ if ($update_action) {
|
|||
exit;
|
||||
}
|
||||
else {
|
||||
// Header
|
||||
// Header
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header ();
|
||||
}
|
||||
else {
|
||||
else {
|
||||
ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "alert_action", true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Header
|
||||
}
|
||||
else {
|
||||
// Header
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header ();
|
||||
}
|
||||
else {
|
||||
else {
|
||||
ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "alert_action", true);
|
||||
}
|
||||
}
|
||||
|
@ -220,7 +221,7 @@ if ($update_action) {
|
|||
|
||||
$info_fields = '';
|
||||
$values = array();
|
||||
|
||||
|
||||
for($i=1;$i<=10;$i++) {
|
||||
$values['field'.$i] = (string) get_parameter ('field'.$i.'_value');
|
||||
$info_fields .= ' Field1: ' . $values['field'.$i];
|
||||
|
@ -230,7 +231,7 @@ if ($update_action) {
|
|||
$values['id_alert_command'] = $id_alert_command;
|
||||
$values['id_group'] = $group;
|
||||
$values['action_threshold'] = $action_threshold;
|
||||
|
||||
|
||||
if (!$name) {
|
||||
$result = '';
|
||||
}
|
||||
|
@ -270,11 +271,11 @@ if ($delete_action) {
|
|||
exit;
|
||||
}
|
||||
else {
|
||||
// Header
|
||||
// Header
|
||||
if (defined('METACONSOLE')) {
|
||||
alerts_meta_print_header ();
|
||||
}
|
||||
else {
|
||||
else {
|
||||
ui_print_page_header (__('Alerts').' » '.__('Alert actions'), "images/god2.png", false, "alert_action", true);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ $buttons = array(
|
|||
$buttons[$tab]['active'] = false;
|
||||
|
||||
// Header
|
||||
if(defined('METACONSOLE')) {
|
||||
if (defined('METACONSOLE')) {
|
||||
ui_meta_print_header(__('Categories configuration'), __('Editor'), $buttons);
|
||||
}
|
||||
else {
|
||||
|
@ -52,7 +52,7 @@ else {
|
|||
|
||||
// Two actions can performed in this page: update and create categories
|
||||
// Update category: update an existing category
|
||||
if ($update_category && $id_category != 0) {
|
||||
if ($update_category && $id_category != 0) {
|
||||
$values = array();
|
||||
$values['name'] = $name_category;
|
||||
|
||||
|
@ -113,7 +113,7 @@ echo '<form method="post" action="index.php?sec=gmodules&sec2=godmode/category/e
|
|||
echo '<div align=left style="width: 98%" class="pandora_form">';
|
||||
|
||||
echo "<table border=0 cellpadding=4 cellspacing=4 class=databox width=98%>";
|
||||
echo "<tr>";
|
||||
echo "<tr>";
|
||||
echo "<td align=center>";
|
||||
html_print_label (__("Name"),'name');
|
||||
echo "</td>";
|
||||
|
|
|
@ -285,7 +285,7 @@ function postgresql_db_get_all_rows_in_table($table, $order_field = "", $order =
|
|||
if ($order_field != "") {
|
||||
return db_get_all_rows_sql ('SELECT * FROM "'.$table.'" ORDER BY '.$order_field . ' ' . $order);
|
||||
}
|
||||
else {
|
||||
else {
|
||||
return db_get_all_rows_sql ('SELECT * FROM "'.$table.'"');
|
||||
}
|
||||
}
|
||||
|
@ -609,13 +609,13 @@ function postgresql_db_format_array_where_clause_sql ($values, $join = 'AND', $p
|
|||
* @return the first value of the first row of a table result from query.
|
||||
*
|
||||
*/
|
||||
function postgresql_db_get_value_sql($sql, $dbconnection = false) {
|
||||
function postgresql_db_get_value_sql($sql, $dbconnection = false) {
|
||||
$sql .= " LIMIT 1";
|
||||
$result = postgresql_db_get_all_rows_sql ($sql, false, true, $dbconnection);
|
||||
|
||||
|
||||
if($result === false)
|
||||
return false;
|
||||
|
||||
|
||||
foreach ($result[0] as $f)
|
||||
return $f;
|
||||
}
|
||||
|
@ -630,10 +630,10 @@ function postgresql_db_get_value_sql($sql, $dbconnection = false) {
|
|||
function postgresql_db_get_row_sql ($sql, $search_history_db = false) {
|
||||
$sql .= " LIMIT 1";
|
||||
$result = postgresql_db_get_all_rows_sql($sql, $search_history_db);
|
||||
|
||||
|
||||
if($result === false)
|
||||
return false;
|
||||
|
||||
|
||||
return $result[0];
|
||||
}
|
||||
|
||||
|
|
|
@ -194,14 +194,14 @@ function gis_make_layer($name, $visible = true, $dot = null, $idLayer = null) {
|
|||
function () { popup.destroy(); });
|
||||
feature.popup = popup;
|
||||
map.addPopup(popup);
|
||||
|
||||
|
||||
jQuery.ajax ({
|
||||
data: "page=operation/gis_maps/ajax&opt="+featureData.type+"&id=" + featureData.id,
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
url: "ajax.php",
|
||||
timeout: 10000,
|
||||
success: function (data) {
|
||||
success: function (data) {
|
||||
if (data.correct) {
|
||||
$('.cloudContent' + featureData.id).css('text-align', 'left');
|
||||
$('.cloudContent' + featureData.id).html(data.content);
|
||||
|
|
|
@ -108,6 +108,7 @@ function network_components_get_group_name ($id_network_component_group) {
|
|||
function network_components_get_group ($id_network_component_group, $filter = false, $fields = false) {
|
||||
if (empty ($id_network_component_group))
|
||||
return false;
|
||||
|
||||
if (! is_array ($filter))
|
||||
$filter = array ();
|
||||
$filter['id_sg'] = (int) $id_network_component_group;
|
||||
|
@ -218,6 +219,7 @@ function network_components_get_groups ($id_module_components = 0, $localCompone
|
|||
function network_components_get_network_component ($id_network_component, $filter = false, $fields = false) {
|
||||
if (empty ($id_network_component))
|
||||
return false;
|
||||
|
||||
if (! is_array ($filter))
|
||||
$filter = array ();
|
||||
$filter['id_nc'] = (int) $id_network_component;
|
||||
|
@ -227,7 +229,7 @@ function network_components_get_network_component ($id_network_component, $filte
|
|||
if(!empty($network_component) && $network_component['id_category'] != 0) {
|
||||
$network_component['category_name'] = (string) db_get_value('name','tcategory','id',$network_component['id_category']);
|
||||
}
|
||||
|
||||
|
||||
return $network_component;
|
||||
}
|
||||
|
||||
|
@ -254,10 +256,13 @@ function network_components_create_network_component ($name, $type, $id_group, $
|
|||
|
||||
if (empty ($name))
|
||||
return false;
|
||||
|
||||
if (empty ($type))
|
||||
return false;
|
||||
|
||||
if (! is_array ($values))
|
||||
$values = array ();
|
||||
|
||||
$values['name'] = $name;
|
||||
$values['type'] = (int) $type;
|
||||
$values['id_group'] = (int) $id_group;
|
||||
|
@ -277,9 +282,11 @@ function network_components_create_network_component ($name, $type, $id_group, $
|
|||
function network_components_update_network_component ($id_network_component, $values = false) {
|
||||
if (empty ($id_network_component))
|
||||
return false;
|
||||
|
||||
$component = network_components_get_network_component ($id_network_component);
|
||||
if (empty ($component))
|
||||
return false;
|
||||
|
||||
if (! is_array ($values))
|
||||
return false;
|
||||
|
||||
|
@ -299,6 +306,7 @@ function network_components_update_network_component ($id_network_component, $va
|
|||
function network_components_delete_network_component ($id_network_component) {
|
||||
if (empty ($id_network_component))
|
||||
return false;
|
||||
|
||||
$filter = array ();
|
||||
$filter['id_nc'] = $id_network_component;
|
||||
|
||||
|
@ -319,6 +327,7 @@ function network_components_delete_network_component ($id_network_component) {
|
|||
function network_components_create_module_from_network_component ($id_network_component, $id_agent) {
|
||||
if (! users_access_to_agent ($id_agent, 'AW'))
|
||||
return false;
|
||||
|
||||
$component = network_components_get_network_component ($id_network_component,
|
||||
false,
|
||||
array ('name',
|
||||
|
@ -375,6 +384,7 @@ function network_components_create_module_from_network_component ($id_network_co
|
|||
function network_components_get_name ($id_network_component) {
|
||||
if (empty ($id_network_component))
|
||||
return false;
|
||||
|
||||
return @db_get_value ('name', 'tnetwork_component', 'id', $id_network_component);
|
||||
}
|
||||
|
||||
|
@ -382,7 +392,7 @@ function network_components_get_name ($id_network_component) {
|
|||
* Duplicate local compoment.
|
||||
* @param integer id_local_component Id of localc component for duplicate.
|
||||
*/
|
||||
function network_components_duplicate_network_component ($id_local_component) {
|
||||
function network_components_duplicate_network_component ($id_local_component) {
|
||||
$network = network_components_get_network_component ($id_local_component);
|
||||
|
||||
if ($network === false)
|
||||
|
|
|
@ -604,7 +604,7 @@ function reports_get_report_types ($template = false, $not_editor = false) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!$template) {
|
||||
if (!$template) {
|
||||
$types['agent_configuration'] = array('optgroup' => __('Configuration'),
|
||||
'name' => __('Agent configuration'));
|
||||
$types['group_configuration'] = array('optgroup' => __('Configuration'),
|
||||
|
|
|
@ -178,7 +178,7 @@ function treeview_printAlertsTable($id_module, $server_data = array()) {
|
|||
|
||||
function treeview_printTable($id_agente, $server_data = array()) {
|
||||
global $config;
|
||||
|
||||
|
||||
if(empty($server_data)) {
|
||||
$server_name = '';
|
||||
$server_id = '';
|
||||
|
@ -404,7 +404,7 @@ function treeview_printTree($type) {
|
|||
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
|
||||
|
||||
if ($list === false) {
|
||||
echo '<h3 class="error">'.__('There aren\'t agents in this agrupation').'</h3>';
|
||||
echo '</td></tr>';
|
||||
|
@ -414,7 +414,7 @@ function treeview_printTree($type) {
|
|||
echo "<ul style='margin: 0; margin-top: 20px; padding: 0;'>\n";
|
||||
|
||||
$first = true;
|
||||
foreach ($list as $item) {
|
||||
foreach ($list as $item) {
|
||||
$lessBranchs = 0;
|
||||
if ($first) {
|
||||
if ($item != end($list)) {
|
||||
|
@ -437,12 +437,13 @@ function treeview_printTree($type) {
|
|||
}
|
||||
|
||||
echo "<li style='margin: 0px 0px 0px 0px;'>";
|
||||
|
||||
|
||||
// Convert the id to hexadecimal, since it will be used as a div id
|
||||
if (defined ('METACONSOLE')) {
|
||||
$id = unpack ('H*', $item['_id_']);
|
||||
$id = $id[1];
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
$id = $item['_id_'];
|
||||
}
|
||||
echo "<a onfocus='JavaScript: this.blur()' href='javascript: loadSubTree(\"" . $type . "\",\"" . $id . "\", " . $lessBranchs . ", \"\", \"\")'>";
|
||||
|
|
|
@ -179,6 +179,7 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
|
|||
$('#module').empty ();
|
||||
$('#module').append ($('<option></option>').html ("Loading...").attr ("value", 0));
|
||||
|
||||
|
||||
// Check if homedir was received like a JSON
|
||||
homedir = '';
|
||||
id_server = 0;
|
||||
|
@ -251,6 +252,10 @@ function agent_changed_by_multiple_agents (event, id_agent, selected) {
|
|||
|
||||
|
||||
$('#module').removeAttr('disabled');
|
||||
|
||||
if (typeof(function_hook_loaded_module_list) == 'function') {
|
||||
function_hook_loaded_module_list();
|
||||
}
|
||||
},
|
||||
"json"
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue