mirror of
https://github.com/pandorafms/pandorafms.git
synced 2025-07-31 01:35:36 +02:00
fixed errors in policies metaconsole
This commit is contained in:
parent
fb73a0b8b2
commit
3985316a9b
@ -832,19 +832,36 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
||||
|
||||
$data = array ();
|
||||
|
||||
if (!defined('METACONSOLE')) {
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
||||
if ($policyInfo === false)
|
||||
$data[$index['policy']] = '';
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
if(is_metaconsole()){
|
||||
$node = metaconsole_get_connection_by_id($alert['server_data']['id']);
|
||||
if (metaconsole_load_external_db($node) !== NOERR) {
|
||||
// Restore the default connection.
|
||||
metaconsole_restore_db();
|
||||
$errors++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$policyInfo = policies_is_alert_in_policy2($alert['id'], false);
|
||||
if ($policyInfo === false)
|
||||
$data[$index['policy']] = '';
|
||||
else {
|
||||
$img = 'images/policies.png';
|
||||
if(!is_metaconsole()){
|
||||
$data[$index['policy']] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id'] . '">' .
|
||||
html_print_image($img,true, array('title' => $policyInfo['name'])) .
|
||||
'</a>';
|
||||
}else{
|
||||
$data[$index['policy']] = '<a href="?sec=gmodules&sec2=advanced/policymanager&id=' . $policyInfo['id'] . '">' .
|
||||
html_print_image($img,true, array('title' => $policyInfo['name'])) .
|
||||
'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if(is_metaconsole()){
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
// Standby
|
||||
@ -882,7 +899,7 @@ function ui_format_alert_row ($alert, $agent = true, $url = '', $agent_style = f
|
||||
$id_agent = modules_get_agentmodule_agent ($alert["id_agent_module"]);
|
||||
}
|
||||
|
||||
if (defined('METACONSOLE') && !can_user_access_node ()) {
|
||||
if (defined('METACONSOLE') || !can_user_access_node ()) {
|
||||
$data[$index['agent_name']] = ui_print_truncate_text($agent_name, 'agent_small', false, true, false, '[…]', 'font-size:7.5pt;');
|
||||
}
|
||||
else {
|
||||
|
@ -449,10 +449,8 @@ $table->align = array ();
|
||||
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
if ($print_agent) {
|
||||
if (!is_metaconsole()) {
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" .
|
||||
__('P.') . "</span>";
|
||||
}
|
||||
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
|
||||
$table->head[1] = "<span title='" . __('Standby') . "'>" .
|
||||
__('S.') . "</span>";
|
||||
@ -496,9 +494,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (!is_metaconsole()) {
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
}
|
||||
$table->head[0] = "<span title='" . __('Policy') . "'>" . __('P.') . "</span>";
|
||||
|
||||
$table->head[1] = "<span title='" . __('Standby') . "'>" . __('S.') . "</span>";
|
||||
|
||||
|
@ -984,7 +984,7 @@ if (!empty($result)) {
|
||||
$table->head[3] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=module_name&sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' .
|
||||
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=module_name&sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>';
|
||||
|
||||
$table->head[4] = __('Server type');
|
||||
$table->head[4] = __('Server type');
|
||||
$table->head[4] .= ' <a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=moduletype&sort=up">' . html_print_image('images/sort_up.png', true, array('style' => $selectModuleNameUp, 'alt' => 'up')) . '</a>' .
|
||||
'<a href="index.php?sec=view&sec2=operation/agentes/status_monitor&datatype='.$datatype . '&moduletype='.$moduletype . '&refr=' . $refr . '&modulegroup='.$modulegroup . '&offset=' . $offset . '&ag_group=' . $ag_group . '&ag_freestring=' . $ag_freestring . '&ag_modulename=' . $ag_modulename . '&status=' . $status . $ag_custom_fields_params . '&sort_field=moduletype&sort=down">' . html_print_image('images/sort_down.png', true, array('style' => $selectModuleNameDown, 'alt' => 'down')) . '</a>';
|
||||
|
||||
@ -1043,7 +1043,18 @@ if (!empty($result)) {
|
||||
|
||||
$data = array ();
|
||||
if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) {
|
||||
if(is_metaconsole()){
|
||||
$node = metaconsole_get_connection_by_id($row['server_id']);
|
||||
if (metaconsole_load_external_db($node) !== NOERR) {
|
||||
// Restore the default connection.
|
||||
metaconsole_restore_db();
|
||||
$errors++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$policyInfo = policies_info_module_policy($row['id_agente_modulo']);
|
||||
|
||||
if ($policyInfo === false)
|
||||
$data[0] = '';
|
||||
else {
|
||||
@ -1074,10 +1085,20 @@ if (!empty($result)) {
|
||||
$title = __('(Unlinked) ') . $policyInfo['name_policy'];
|
||||
}
|
||||
}
|
||||
if(is_metaconsole()){
|
||||
$data[0] = '<a href="?sec=gmodules&sec2=advanced/policymanager&id=' . $policyInfo['id_policy'] . '">' .
|
||||
html_print_image($img,true, array('title' => $title)) .
|
||||
'</a>';
|
||||
}
|
||||
else{
|
||||
$data[0] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
html_print_image($img,true, array('title' => $title)) .
|
||||
'</a>';
|
||||
}
|
||||
}
|
||||
|
||||
$data[0] = '<a href="?sec=gmodules&sec2=enterprise/godmode/policies/policies&id=' . $policyInfo['id_policy'] . '">' .
|
||||
html_print_image($img,true, array('title' => $title)) .
|
||||
'</a>';
|
||||
if(is_metaconsole()){
|
||||
metaconsole_restore_db();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user