From 8f88287bdfd281170b78b73e2ff10b28b837f986 Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Tue, 11 Dec 2012 17:39:48 +0000 Subject: [PATCH] 2012-12-11 Juan Manuel Ramon * include/ajax/agent.php include/functions_ui.php include/javascript/pandora.js godmode/alerts/alert_list.list.php godmode/alerts/alert_list.php godmode/alerts/alert_list.builder.php godmode/users/user_list.php godmode/users/profile_list.php godmode/users/configure_user.php godmode/users/configure_profile.php: Added user and alert editor in metaconsole. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7261 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_console/ChangeLog | 14 +++++ .../godmode/alerts/alert_list.builder.php | 15 +++-- .../godmode/alerts/alert_list.list.php | 48 ++++++++++----- pandora_console/godmode/alerts/alert_list.php | 53 ++++++++++------- .../godmode/users/configure_profile.php | 40 ++++++++----- .../godmode/users/configure_user.php | 42 ++++++++----- .../godmode/users/profile_list.php | 33 +++++++---- pandora_console/godmode/users/user_list.php | 59 ++++++++++++------- pandora_console/include/ajax/agent.php | 3 +- pandora_console/include/functions_ui.php | 24 ++++++-- pandora_console/include/javascript/pandora.js | 4 +- 11 files changed, 221 insertions(+), 114 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index ddb78f5528..9b66c77eb1 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,17 @@ +2012-12-11 Juan Manuel Ramon + + * include/ajax/agent.php + include/functions_ui.php + include/javascript/pandora.js + godmode/alerts/alert_list.list.php + godmode/alerts/alert_list.php + godmode/alerts/alert_list.builder.php + godmode/users/user_list.php + godmode/users/profile_list.php + godmode/users/configure_user.php + godmode/users/configure_profile.php: Added user and alert editor + in metaconsole. + 2012-12-11 Ramon Novoa * include/functions_netflow.php: Added a new way of retrieving netflow diff --git a/pandora_console/godmode/alerts/alert_list.builder.php b/pandora_console/godmode/alerts/alert_list.builder.php index 1f9ce46b96..3af24ad407 100644 --- a/pandora_console/godmode/alerts/alert_list.builder.php +++ b/pandora_console/godmode/alerts/alert_list.builder.php @@ -28,6 +28,8 @@ if (! check_acl ($config['id_user'], 0, "LW")) { include_once($config['homedir'] . "/include/functions_agents.php"); include_once($config['homedir'] . '/include/functions_users.php'); +$pure = get_parameter('pure', 0); + $table->id = 'add_alert_table'; $table->class = 'databox'; $table->width = '98%'; @@ -52,6 +54,7 @@ if (! $id_agente) { $params['input_name'] = 'id_agent'; $params['selectbox_id'] = 'id_agent_module'; $params['javascript_is_function_select'] = true; + $params['metaconsole_enabled'] = false; $table->data['agent'][1] = ui_print_agent_autocomplete_input($params); } @@ -84,7 +87,7 @@ $table->data[1][1] .= ' '; if (check_acl ($config['id_user'], 0, "LM")) { $table->data[1][1] .= html_print_image ('images/add.png', true); - $table->data[1][1] .= ''; + $table->data[1][1] .= ''; $table->data[1][1] .= __('Create Template'); $table->data[1][1] .= ''; } @@ -114,18 +117,18 @@ $table->data[2][1] .= __('Number of alerts match from').' '; $table->data[2][1] .= html_print_input_text ('fires_min', '', '', 4, 10, true); $table->data[2][1] .= ' '.__('to').' '; $table->data[2][1] .= html_print_input_text ('fires_max', '', '', 4, 10, true); -$table->data[2][1] .= ui_print_help_icon ("alert-matches", true); +$table->data[2][1] .= ui_print_help_icon ("alert-matches", true, ui_get_full_url(false, false, false, false)); $table->data[2][1] .= ''; $table->data[2][1] .= ''; if (check_acl ($config['id_user'], 0, "LM")) { $table->data[2][1] .= html_print_image ('images/add.png', true); - $table->data[2][1] .= ''; + $table->data[2][1] .= ''; $table->data[2][1] .= __('Create Action'); $table->data[2][1] .= ''; } $table->data[3][0] = __('Threshold'); $table->data[3][1] = html_print_extended_select_for_time ('module_action_threshold', 0, '', 0, - __('None'), false, true) . ui_print_help_icon ('action_threshold', true); + __('None'), false, true) . ui_print_help_icon ('action_threshold', true, ui_get_full_url(false, false, false, false)); echo '
'; @@ -163,7 +166,7 @@ $(document).ready (function () { return; } $a.unbind () - .attr ("href", "ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template="+id) + .attr ("href", + "ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template="+id) .show () .cluetip ({ arrows: true, @@ -190,7 +193,7 @@ $(document).ready (function () { var $value = $(this).siblings ("span#latest_value").hide (); var $loading = $(this).siblings ("span#module_loading").show (); $("#value", $value).empty (); - jQuery.post ("ajax.php", + jQuery.post ( + "ajax.php", {"page" : "operation/agentes/estado_agente", "get_agent_module_last_value" : 1, "id_agent_module" : this.value diff --git a/pandora_console/godmode/alerts/alert_list.list.php b/pandora_console/godmode/alerts/alert_list.list.php index 7b4104cb41..7b600b6b44 100644 --- a/pandora_console/godmode/alerts/alert_list.list.php +++ b/pandora_console/godmode/alerts/alert_list.list.php @@ -38,8 +38,21 @@ require_once ($config['homedir'].'/include/functions_agents.php'); require_once ($config['homedir'].'/include/functions_modules.php'); require_once ($config['homedir'].'/include/functions_users.php'); +$pure = get_parameter('pure', 0); + +if (defined('METACONSOLE')) { + + $sec = 'advanced'; + +} +else { + + $sec = 'galertas'; + +} + // Table for filter controls -$form_filter = ''; +$form_filter = ''; $form_filter .= "\n"; $form_filter .= ''."\n"; $form_filter .= "\n"; @@ -65,6 +78,8 @@ $params['show_helptip'] = true; $params['input_name'] = 'agent_name'; $params['value'] = $agentName; $params['size'] = 12; +$params['metaconsole_enabled'] = false; + $form_filter .= ui_print_agent_autocomplete_input($params); @@ -295,18 +310,19 @@ if ($id_agente) { ui_pagination ($total, 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=' . $id_agente); } else { - ui_pagination ($total, 'index.php?sec=galertas&sec2=godmode/alerts/alert_list&search=1' . '&template_name=' . $templateName . '&agent_name=' . $agentName . '&module_name=' . $moduleName . '&action_id=' . $actionID . '&field_content=' . $fieldContent. '&priority=' . $priority . '&enabledisable=' . $enabledisable . '&standby=' . $standby); + ui_pagination ($total, 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&search=1' . '&template_name=' . $templateName . '&agent_name=' . $agentName . '&module_name=' . $moduleName . '&action_id=' . $actionID . '&field_content=' . $fieldContent. '&priority=' . $priority . '&enabledisable=' . $enabledisable . '&standby=' . $standby); } $simple_alerts = agents_get_alerts_simple (array_keys ($agents), false, array ('offset' => (int) get_parameter ('offset'), 'limit' => $config['block_size'], 'order' => $order), $where, false); $offset = get_parameter('offset'); + if (!$id_agente) { - $url = 'index.php?sec=galertas&sec2=godmode/alerts/alert_list&tab=list&offset=' . $offset; + $url = 'index.php?sec='.$sec.'&sec2=godmode/alerts/alert_list&tab=list&pure='.$pure.'&offset=' . $offset; } else { - $url = 'index.php?sec=gagente&sec2=godmode/agentes/configurar_agente&tab=alert&id_agente=' . $id_agente; + $url = 'index.php?sec='.$sec.'&sec2=godmode/agentes/configurar_agente&pure='.$pure.'&tab=alert&id_agente=' . $id_agente; } $table->class = 'alert_list'; @@ -324,8 +340,8 @@ if (! $id_agente) { $table->style = array (); $table->style[0] = 'font-weight: bold'; $table->head[0] = __('Agent') . '
' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectAgentUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectAgentDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectAgentUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectAgentDown)) . ''; $table->size[0] = '20%'; $table->size[1] = '15%'; $table->size[2] = '15%'; @@ -350,11 +366,11 @@ else { } $table->head[1] = __('Module') . '
' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectModuleUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectModuleUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectModuleDown)) . ''; $table->head[2] = __('Template') . '
' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectTemplateUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectTemplateUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectTemplateDown)) . ''; /*if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { $table->head[5] = "" . __('P.') . ""; }*/ @@ -407,9 +423,9 @@ foreach ($simple_alerts as $alert) { modules_get_agentmodule_name ($alert['id_agent_module']), 'module_small', false, true, true, '[…]', 'font-size: 7.2pt'); $data[2] = ' ' . + href="'.ui_get_full_url(false,false,false,false).'ajax.php?page=godmode/alerts/alert_templates&get_template_tooltip=1&id_template='.$alert['id_alert_template'].'">' . html_print_image("images/zoom.png", true, array("id" => 'template-details-'.$alert['id_alert_template'], "class" => "img_help")) . ' '; - $data[2] .= ""; + $data[2] .= ""; $data[2] .= ui_print_truncate_text( alerts_get_alert_template_name ($alert['id_alert_template']), GENERIC_SIZE_TEXT, false, true, true, '[…]', 'font-size: 7.1pt'); $data[2] .= ""; @@ -488,9 +504,9 @@ foreach ($simple_alerts as $alert) { $data[3] .= html_print_input_text ('fires_min', -1, '', 4, 10, true); $data[3] .= ' '.__('to').' '; $data[3] .= html_print_input_text ('fires_max', -1, '', 4, 10, true); - $data[3] .= ui_print_help_icon ("alert-matches", true); + $data[3] .= ui_print_help_icon ("alert-matches", true, ui_get_full_url(false, false, false, false)); $data[3] .= '
' . __('Threshold'); - $data[3] .= html_print_input_text ('module_action_threshold', '', '', 4, 10, true) . ui_print_help_icon ('action_threshold', true); + $data[3] .= html_print_input_text ('module_action_threshold', '', '', 4, 10, true) . ui_print_help_icon ('action_threshold', true, ui_get_full_url(false, false, false, false)); $data[3] .= ''; $data[3] .= '
'; $data[3] .= html_print_submit_button (__('Add'), 'add_action', false, 'class="sub next"', true); @@ -546,7 +562,7 @@ foreach ($simple_alerts as $alert) { else { $img = 'images/policies.png'; - $data[5] .= '  ' . + $data[5] .= '  ' . html_print_image($img,true, array('title' => $policyInfo['name'])) . ''; } @@ -576,7 +592,7 @@ if (isset($dont_display_alert_create_bttn)) if ($display_create){ echo '
'; - echo ''; + echo ''; html_print_submit_button (__('Create'), 'crtbtn', false, 'class="sub next"'); echo ''; echo '
'; diff --git a/pandora_console/godmode/alerts/alert_list.php b/pandora_console/godmode/alerts/alert_list.php index f0c48aff3e..0fb851fe27 100644 --- a/pandora_console/godmode/alerts/alert_list.php +++ b/pandora_console/godmode/alerts/alert_list.php @@ -25,10 +25,11 @@ if (! check_acl ($config['id_user'], 0, "LW")) { exit; } -require_once ('include/functions_agents.php'); -require_once ('include/functions_alerts.php'); -require_once ('include/functions_users.php'); +require_once ($config['homedir'] . '/include/functions_agents.php'); +require_once ($config['homedir'] . '/include/functions_alerts.php'); +require_once ($config['homedir'] . '/include/functions_users.php'); $isFunctionPolicies = enterprise_include_once ('include/functions_policies.php'); +enterprise_include_once ('meta/include/functions_alerts_meta.php'); $id_group = 0; /* Check if this page is included from a agent edition */ @@ -60,7 +61,7 @@ $priority = get_parameter('priority',''); $searchFlag = get_parameter('search',0); $enabledisable = get_parameter('enabledisable',''); $standby = get_parameter('standby',''); - +$pure = get_parameter('pure', 0); $messageAction = ''; if ($create_alert) { @@ -263,23 +264,31 @@ if ($id_agente) { return; } else { - $buttons = array( - 'list' => array( - 'active' => false, - 'text' => '' . - html_print_image ("images/god6.png", true, array ("title" => __('List alerts'))) .''), - 'builder' => array( - 'active' => false, - 'text' => '' . - html_print_image ("images/config.png", true, array ("title" => __('Builder alert'))) .'')); - - $buttons[$tab]['active'] = true; - - if ($tab == 'list') { - ui_print_page_header(__('Alerts') . ' » ' . __('Manage alerts') . ' » ' . __('List'), "images/god2.png", false, "manage_alert_list", true, $buttons); - } + if (!defined('METACONSOLE')) { + $buttons = array( + 'list' => array( + 'active' => false, + 'text' => '' . + html_print_image ("images/god6.png", true, array ("title" => __('List alerts'))) .''), + 'builder' => array( + 'active' => false, + 'text' => '' . + html_print_image ("images/config.png", true, array ("title" => __('Builder alert'))) .'')); + + $buttons[$tab]['active'] = true; + + if ($tab == 'list') { + ui_print_page_header(__('Alerts') . ' » ' . __('Manage alerts') . ' » ' . __('List'), "images/god2.png", false, "manage_alert_list", true, $buttons); + } + else { + ui_print_page_header(__('Alerts') . ' » ' . __('Manage alerts') . ' » ' . __('Create'), "images/god2.png", false, "manage_alert_list", true, $buttons); + } + + } else { - ui_print_page_header(__('Alerts') . ' » ' . __('Manage alerts') . ' » ' . __('Create'), "images/god2.png", false, "manage_alert_list", true, $buttons); + + alerts_meta_print_header(); + } echo $messageAction; @@ -294,7 +303,7 @@ else { } $agents = agents_get_group_agents (array_keys ($groups), false, "none"); - require_once('godmode/alerts/alert_list.list.php'); + require_once($config['homedir'] . '/godmode/alerts/alert_list.list.php'); return; break; @@ -306,7 +315,7 @@ else { $groups = array(0 => __('All')); } - require_once('godmode/alerts/alert_list.builder.php'); + require_once($config['homedir'] . '/godmode/alerts/alert_list.builder.php'); return; break; diff --git a/pandora_console/godmode/users/configure_profile.php b/pandora_console/godmode/users/configure_profile.php index e44124d167..e5c146cf12 100644 --- a/pandora_console/godmode/users/configure_profile.php +++ b/pandora_console/godmode/users/configure_profile.php @@ -25,22 +25,34 @@ if (! check_acl ($config['id_user'], 0, "PM")) { return; } +enterprise_include_once ('meta/include/functions_users_meta.php'); + $tab = get_parameter('tab', 'profile'); - -$buttons = array( - 'user' => array( - 'active' => false, - 'text' => '' . - html_print_image ("images/god3.png", true, array ("title" => __('User management'))) .''), - 'profile' => array( - 'active' => false, - 'text' => '' . - html_print_image ("images/profiles.png", true, array ("title" => __('Profile management'))) .'')); - -$buttons[$tab]['active'] = true; +$pure = get_parameter('pure', 0); // Header -ui_print_page_header (__('User management').' » '.__('Profiles defined in Pandora'), "images/god3.png", false, "", true, $buttons); +if (!defined('METACONSOLE')) { + $buttons = array( + 'user' => array( + 'active' => false, + 'text' => '' . + html_print_image ("images/god3.png", true, array ("title" => __('User management'))) .''), + 'profile' => array( + 'active' => false, + 'text' => '' . + html_print_image ("images/profiles.png", true, array ("title" => __('Profile management'))) .'')); + + $buttons[$tab]['active'] = true; + + ui_print_page_header (__('User management').' » '.__('Profiles defined in Pandora'), "images/god3.png", false, "", true, $buttons); + $sec2 = 'gusuarios'; +} +else { + + user_meta_print_header(); + $sec2 = 'advanced'; + +} $new_profile = (bool) get_parameter ('new_profile'); $id_profile = (int) get_parameter ('id'); @@ -136,7 +148,7 @@ if ($id_profile || $new_profile) { $table->data[10][0] = __('Pandora management'); $table->data[10][1] = html_print_checkbox ('pandora_management', 1, $pandora_management, true); - echo '
'; + echo ''; html_print_table ($table); diff --git a/pandora_console/godmode/users/configure_user.php b/pandora_console/godmode/users/configure_user.php index a463a51e58..2a1b28bcbe 100644 --- a/pandora_console/godmode/users/configure_user.php +++ b/pandora_console/godmode/users/configure_user.php @@ -30,10 +30,14 @@ if (ENTERPRISE_NOT_HOOK !== enterprise_include('include/functions_policies.php') $enterprise_include = true; } +if ($enterprise_include) + enterprise_include_once ('meta/include/functions_users_meta.php'); + // This defines the working user. Beware with this, old code get confusses // and operates with current logged user (dangerous). $id = get_parameter ('id', get_parameter ('id_user', '')); // ID given as parameter +$pure = get_parameter('pure', 0); $user_info = get_user_info ($id); @@ -56,21 +60,29 @@ if (!check_referer()) { $tab = get_parameter('tab', 'user'); -$buttons = array( - 'user' => array( - 'active' => false, - 'text' => '' . - html_print_image ("images/god3.png", true, array ("title" => __('User management'))) .''), - 'profile' => array( - 'active' => false, - 'text' => '' . - html_print_image ("images/profiles.png", true, array ("title" => __('Profile management'))) .'')); - -$buttons[$tab]['active'] = true; - // Header -ui_print_page_header (__('User detail editor'), "images/god3.png", false, "", true, $buttons); +if (defined('METACONSOLE')) { + user_meta_print_header(); + $sec = 'advanced'; + +} +else { + $buttons = array( + 'user' => array( + 'active' => false, + 'text' => '' . + html_print_image ("images/god3.png", true, array ("title" => __('User management'))) .''), + 'profile' => array( + 'active' => false, + 'text' => '' . + html_print_image ("images/profiles.png", true, array ("title" => __('Profile management'))) .'')); + + $buttons[$tab]['active'] = true; + + ui_print_page_header (__('User detail editor'), "images/god3.png", false, "", true, $buttons); + $sec = 'gusuarios'; +} if ($config['user_can_update_info']) { $view_mode = false; @@ -510,9 +522,9 @@ foreach ($result as $profile) { $data = array (); - $data[0] = ''.profile_get_name ($profile['id_perfil']).''; + $data[0] = ''.profile_get_name ($profile['id_perfil']).''; $data[1] = ui_print_group_icon($profile["id_grupo"], true) . - ' ' . + ' ' . ui_print_truncate_text(groups_get_name ($profile['id_grupo'], True), GENERIC_SIZE_TEXT).''; $data[2] = ''; $data[2] .= html_print_input_hidden ('delete_profile', 1, true); diff --git a/pandora_console/godmode/users/profile_list.php b/pandora_console/godmode/users/profile_list.php index d53d60ba2f..f5f1797d97 100644 --- a/pandora_console/godmode/users/profile_list.php +++ b/pandora_console/godmode/users/profile_list.php @@ -29,23 +29,32 @@ if (! check_acl ($config['id_user'], 0, "UM")) { exit; } -$tab = get_parameter('tab', 'profile'); +enterprise_include_once ('meta/include/functions_users_meta.php'); -$buttons = array( +$tab = get_parameter('tab', 'profile'); +$pure = get_parameter('pure', 0); + +// Header +if (!defined('METACONSOLE')) { + $buttons = array( 'user' => array( 'active' => false, - 'text' => '' . + 'text' => '' . html_print_image ("images/god3.png", true, array ("title" => __('User management'))) .''), 'profile' => array( 'active' => false, - 'text' => '' . + 'text' => '' . html_print_image ("images/profiles.png", true, array ("title" => __('Profile management'))) .'')); -$buttons[$tab]['active'] = true; + $buttons[$tab]['active'] = true; - -// Header -ui_print_page_header (__('User management').' » '.__('Profiles defined in Pandora'), "images/god3.png", false, "profile", true, $buttons); + ui_print_page_header (__('User management').' » '.__('Profiles defined in Pandora'), "images/god3.png", false, "profile", true, $buttons); + $sec = 'gusuarios'; +} +else { + user_meta_print_header(); + $sec = 'advanced'; +} $delete_profile = (bool) get_parameter ('delete_profile'); $create_profile = (bool) get_parameter ('create_profile'); @@ -209,7 +218,7 @@ if ($profiles === false) { $img = html_print_image ("images/ok.png", true, array ("border" => 0)); foreach ($profiles as $profile) { - $data[0] = ''.$profile["name"].''; + $data[0] = ''.$profile["name"].''; $data[1] = ($profile["incident_view"] ? $img : ''); $data[2] = ($profile["incident_edit"] ? $img : ''); $data[3] = ($profile["incident_management"] ? $img : ''); @@ -220,12 +229,12 @@ foreach ($profiles as $profile) { $data[8] = ($profile["db_management"] ? $img : ''); $data[9] = ($profile["alert_management"] ? $img : ''); $data[10] = ($profile["pandora_management"] ? $img : ''); - $data[11] = ''. html_print_image('images/config.png', true, array('title' => __('Edit'))) .''; - $data[11] .= '  '. html_print_image("images/cross.png", true) . ''; + $data[11] = ''. html_print_image('images/config.png', true, array('title' => __('Edit'))) .''; + $data[11] .= '  '. html_print_image("images/cross.png", true) . ''; array_push ($table->data, $data); } -echo ''; +echo ''; if (isset($data)) { html_print_table ($table); } diff --git a/pandora_console/godmode/users/user_list.php b/pandora_console/godmode/users/user_list.php index 9421d83d86..fcc967e3d7 100644 --- a/pandora_console/godmode/users/user_list.php +++ b/pandora_console/godmode/users/user_list.php @@ -21,6 +21,7 @@ check_login (); include_once($config['homedir'] . "/include/functions_profile.php"); include_once ($config['homedir'].'/include/functions_users.php'); require_once ($config['homedir'] . '/include/functions_groups.php'); +enterprise_include_once ('meta/include/functions_users_meta.php'); if (! check_acl ($config['id_user'], 0, "UM")) { db_pandora_audit("ACL Violation", @@ -32,6 +33,7 @@ if (! check_acl ($config['id_user'], 0, "UM")) { $sortField = get_parameter('sort_field'); $sort = get_parameter('sort', 'none'); $tab = get_parameter('tab', 'user'); +$pure = get_parameter('pure', 0); $selected = 'border: 1px solid black;'; $selectUserIDUp = ''; @@ -90,20 +92,33 @@ switch ($sortField) { break; } -$buttons = array( - 'user' => array( - 'active' => false, - 'text' => '' . - html_print_image ("images/god3.png", true, array ("title" => __('User management'))) .''), - 'profile' => array( - 'active' => false, - 'text' => '' . - html_print_image ("images/profiles.png", true, array ("title" => __('Profile management'))) .'')); $buttons[$tab]['active'] = true; // Header -ui_print_page_header (__('User management').' » '.__('Users defined in Pandora'), "images/god3.png", false, "", true, $buttons); +if (defined('METACONSOLE')) { + + user_meta_print_header(); + $sec = 'advanced'; + +} +else { + + $buttons = array( + 'user' => array( + 'active' => false, + 'text' => '' . + html_print_image ("images/god3.png", true, array ("title" => __('User management'))) .''), + 'profile' => array( + 'active' => false, + 'text' => '' . + html_print_image ("images/profiles.png", true, array ("title" => __('Profile management'))) .'')); + + ui_print_page_header (__('User management').' » '.__('Users defined in Pandora'), "images/god3.png", false, "", true, $buttons); + + $sec = 'gusuarios'; + +} $disable_user = get_parameter ("disable_user", false); @@ -169,14 +184,14 @@ $table->align = array (); $table->size = array (); $table->head[0] = __('User ID') . ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectUserIDUp)) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectUserIDDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectUserIDUp)) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectUserIDDown)) . ''; $table->head[1] = __('Name') . ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectFullnameUp )) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectFullnameDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectFullnameUp )) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectFullnameDown)) . ''; $table->head[2] = __('Last contact') . ' ' . - '' . html_print_image("images/sort_up.png", true, array("style" => $selectLastConnectUp )) . '' . - '' . html_print_image("images/sort_down.png", true, array("style" => $selectLastConnectDown)) . ''; + '' . html_print_image("images/sort_up.png", true, array("style" => $selectLastConnectUp )) . '' . + '' . html_print_image("images/sort_down.png", true, array("style" => $selectLastConnectDown)) . ''; $table->head[3] = __('Profile'); $table->head[4] = __('Description'); $table->head[5] = '' . __('Op.') . ''; @@ -225,7 +240,7 @@ foreach ($info as $user_id => $user_info) { } $iterator++; - $data[0] = ''.$user_id.''; + $data[0] = ''.$user_id.''; $data[1] = $user_info["fullname"] . ''; $data[1] .= __('First name') . ': ' . $user_info["firstname"].'
'; $data[1] .= __('Last name') . ': ' . $user_info["lastname"].'
'; @@ -263,14 +278,14 @@ foreach ($info as $user_id => $user_info) { $data[4] = ui_print_string_substr ($user_info["comments"], 24, true); if ($user_info['disabled'] == 0) { - $data[5] = '
'.html_print_image('images/lightbulb.png', true, array('title' => __('Disable'))).''; + $data[5] = ''.html_print_image('images/lightbulb.png', true, array('title' => __('Disable'))).''; } else { - $data[5] = ''.html_print_image('images/lightbulb_off.png', true, array('title' => __('Enable'))).''; + $data[5] = ''.html_print_image('images/lightbulb_off.png', true, array('title' => __('Enable'))).''; } - $data[5] .= ''.html_print_image('images/config.png', true, array('title' => __('Edit'))).''; + $data[5] .= ''.html_print_image('images/config.png', true, array('title' => __('Edit'))).''; if ($config["admin_can_delete_user"] && $user_info['id_user'] != $config['id_user']) { - $data[5] .= "  ".html_print_image('images/cross.png', true, array ('title' => __('Delete'), 'onclick' => "if (! confirm ('" .__('Deleting User'). " ". $user_info['id_user'] . ". " . __('Are you sure?') ."')) return false")).""; + $data[5] .= "  ".html_print_image('images/cross.png', true, array ('title' => __('Delete'), 'onclick' => "if (! confirm ('" .__('Deleting User'). " ". $user_info['id_user'] . ". " . __('Are you sure?') ."')) return false")).""; } else { $data[5] .= ''; //Delete button not in this mode @@ -283,7 +298,7 @@ html_print_table ($table); echo '
'; unset ($table); if ($config["admin_can_add_user"] !== false) { - echo ''; + echo ''; html_print_input_hidden ('new_user', 1); html_print_submit_button (__('Create user'), "crt", false, 'class="sub next"'); echo ''; diff --git a/pandora_console/include/ajax/agent.php b/pandora_console/include/ajax/agent.php index f4a3fa6bc0..ca9b680aec 100644 --- a/pandora_console/include/ajax/agent.php +++ b/pandora_console/include/ajax/agent.php @@ -28,6 +28,7 @@ enterprise_include_once ('include/functions_metaconsole.php'); $search_agents = (bool) get_parameter ('search_agents'); $search_agents_2 = (bool) get_parameter ('search_agents_2'); $get_agents_group = (bool) get_parameter('get_agents_group', false); +$force_local = (bool) get_parameter('force_local', false); if ($get_agents_group) { $id_group = (int)get_parameter('id_group', -1); @@ -163,7 +164,7 @@ elseif ($search_agents && ($config['metaconsole'] == 1)) { return; } -if ($search_agents_2 && (!defined('METACONSOLE'))) { +if ($search_agents_2 && ((!defined('METACONSOLE')) || $force_local)) { require_once ('include/functions_agents.php'); diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index 572cc5331a..6af19a4162 100644 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -939,14 +939,17 @@ function ui_print_alert_template_example ($id_alert_template, $return = false, $ * * @param string Id of the help article * @param bool Whether to return or output the result + * @param string Home url if its necessary * * @return string The help tip */ -function ui_print_help_icon ($help_id, $return = false) { +function ui_print_help_icon ($help_id, $return = false, $home_url = '') { + if (empty($home_url)) + $home_url = ""; $output = ' '.html_print_image ("images/help.png", true, array ("class" => "img_help", "title" => __('Help'), - "onclick" => "open_help ('".$help_id."')")); + "onclick" => "open_help ('".$help_id."','".$home_url."')")); if (!$return) echo $output; @@ -2427,7 +2430,7 @@ function ui_print_agent_autocomplete_input($parameters) { // Javascript configurations //------------------------------------------------------------------ - $javascript_ajax_page = 'ajax.php'; //Default value + $javascript_ajax_page = ui_get_full_url('ajax.php', false, false, false, false); //Default value if (isset($parameters['javascript_ajax_page'])) { $javascript_ajax_page = $parameters['javascript_ajax_page']; } @@ -2491,6 +2494,10 @@ function ui_print_agent_autocomplete_input($parameters) { inputs.push ("get_agent_modules_json=1"); inputs.push ("page=operation/agentes/ver_agente"); + if (' . ((int) !$metaconsole_enabled) . ') { + inputs.push ("force_local_modules=1"); + } + if (' . ((int)$metaconsole_enabled) . ') { inputs.push ("server_name=" + $("#' . $input_server_id . '").val()); } @@ -2551,6 +2558,11 @@ function ui_print_agent_autocomplete_input($parameters) { return group_id; }', 'q' => 'term'); + + if (!$metaconsole_enabled) { + $javascript_change_ajax_params_original['force_local'] = 1; + } + if (isset($parameters['javascript_change_ajax_params'])) { $javascript_change_ajax_params = array(); @@ -2815,7 +2827,11 @@ function ui_print_agent_autocomplete_input($parameters) { var data_params = {"page": "include/ajax/agent", "search_agents_2": 1, "id_group": 0, - "q": term}; + "q": term}; + + if (' . ((int) !$metaconsole_enabled) . ') { + data_params[\'force_local\'] = 1; + } jQuery.ajax ({ data: data_params, diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index 8252583fd3..8aa347faea 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -22,8 +22,8 @@ function winopeng_var (url, wid, width, height) { status = wid; } -function open_help (help_id) { - open ("general/pandora_help.php?id="+help_id, "pandorahelp", "width=650,height=500,status=0,toolbar=0,menubar=0,scrollbars=1,location=0"); +function open_help (help_id, home_url) { + open (home_url+"general/pandora_help.php?id="+help_id, "pandorahelp", "width=650,height=500,status=0,toolbar=0,menubar=0,scrollbars=1,location=0"); } /**