2012-10-25 Miguel de Dios <miguel.dedios@artica.es>

* include/functions_extensions.php, extensions/pandora_logs.php,
	extensions/update_manager.php, extensions/resource_registration.php,
	extensions/resource_exportation.php, extensions/module_groups.php,
	extensions/plugin_registration.php, extensions/snmp_explorer.php,
	extensions/system_info.php, operation/menu.php: cleaned source code
	style.
	
	* include/functions_menu.php: fixed the hidden icons the extensions
	in  menu.
	
	Fixes: #3568966




git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@7096 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
mdtrooper 2012-10-25 16:46:52 +00:00
parent 6f27f7ec28
commit e33cebbd8e
12 changed files with 88 additions and 71 deletions

View File

@ -1,3 +1,17 @@
2012-10-25 Miguel de Dios <miguel.dedios@artica.es>
* include/functions_extensions.php, extensions/pandora_logs.php,
extensions/update_manager.php, extensions/resource_registration.php,
extensions/resource_exportation.php, extensions/module_groups.php,
extensions/plugin_registration.php, extensions/snmp_explorer.php,
extensions/system_info.php, operation/menu.php: cleaned source code
style.
* include/functions_menu.php: fixed the hidden icons the extensions
in menu.
Fixes: #3568966
2012-10-25 Vanessa Gil <vanessa.gil@artica.es> 2012-10-25 Vanessa Gil <vanessa.gil@artica.es>
* include/functions_reporting.php * include/functions_reporting.php

View File

@ -83,9 +83,9 @@ if (is_ajax ()) {
/** /**
* Translate the array texts using gettext * Translate the array texts using gettext
*/ */
function translate(&$item, $key) { function translate(&$item, $key) {
$item = __($item); $item = __($item);
} }
/** /**
* The main function of module groups and the enter point to * The main function of module groups and the enter point to
@ -143,7 +143,7 @@ function mainModuleGroups() {
$agentGroups = users_get_groups ($config['id_user'], "AR", false); $agentGroups = users_get_groups ($config['id_user'], "AR", false);
$modelGroups = users_get_all_model_groups(); $modelGroups = users_get_all_model_groups();
if(!empty($agentGroups) && !empty($modelGroups)) { if (!empty($agentGroups) && !empty($modelGroups)) {
array_walk($modelGroups, 'translate'); //Translate all head titles to language is set array_walk($modelGroups, 'translate'); //Translate all head titles to language is set
foreach ($modelGroups as $i => $n) { foreach ($modelGroups as $i => $n) {
@ -217,17 +217,17 @@ function mainModuleGroups() {
if ($fired) { if ($fired) {
$color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired. $color = '#ffa300'; //Orange when the cell for this model group and agent has at least one alert fired.
} }
else if (array_key_exists(1,$states)) { else if (array_key_exists(1, $states)) {
$color = '#cc0000'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state. $color = '#cc0000'; //Red when the cell for this model group and agent has at least one module in critical state and the rest in any state.
$font_color = '#ffffff'; $font_color = '#ffffff';
} }
elseif (array_key_exists(2,$states)) { elseif (array_key_exists(2, $states)) {
$color = '#fce94f'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state. $color = '#fce94f'; //Yellow when the cell for this model group and agent has at least one in warning state and the rest in green state.
} }
elseif (array_key_exists(3,$states)) { elseif (array_key_exists(3, $states)) {
$color = '#babdb6'; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state. $color = '#babdb6'; //Grey when the cell for this model group and agent has at least one module in unknown state and the rest in any state.
} }
elseif (array_key_exists(0,$states)) { elseif (array_key_exists(0, $states)) {
$color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules. $color = '#8ae234'; //Green when the cell for this model group and agent has OK state all modules.
} }

View File

@ -116,7 +116,7 @@ function pluginreg_extension_main () {
// Build macros // Build macros
$macros = array(); $macros = array();
$n = 1; $n = 1;
while(1) { while (1) {
if(!isset($ini_array["plugin_definition"]["macro_desc_field".$n."_"])) { if(!isset($ini_array["plugin_definition"]["macro_desc_field".$n."_"])) {
break; break;
} }
@ -129,7 +129,7 @@ function pluginreg_extension_main () {
$n++; $n++;
} }
if(empty($macros)) { if (empty($macros)) {
$macros = ''; $macros = '';
} }
else { else {

View File

@ -52,13 +52,13 @@ function snmp_explorer() {
$interfaces = array(); $interfaces = array();
if($snmpwalk) { if ($snmpwalk) {
$snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user, $snmpis = get_snmpwalk($ip_target, $snmp_version, $snmp_community, $snmp3_auth_user,
$snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass, $snmp3_security_level, $snmp3_auth_method, $snmp3_auth_pass,
$snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1", $tcp_port); $snmp3_privacy_method, $snmp3_privacy_pass, 0, ".1.3.6.1.2.1", $tcp_port);
if($snmpis === false) { if ($snmpis === false) {
$snmpis = array(); $snmpis = array();
} }
@ -252,7 +252,7 @@ function snmp_explorer() {
// Create the interface list for the interface // Create the interface list for the interface
$interfaces_list = array(); $interfaces_list = array();
foreach($interfaces as $interface){ foreach ($interfaces as $interface){
// Get the interface name, removing " " characters and avoid "blank" interfaces // Get the interface name, removing " " characters and avoid "blank" interfaces
if (isset($interface['ifName']) && $interface['ifName']['value'] != ""){ if (isset($interface['ifName']) && $interface['ifName']['value'] != ""){
$ifname = $interface['ifName']['value']; $ifname = $interface['ifName']['value'];
@ -344,9 +344,6 @@ function snmp_explorer() {
echo "</form>"; echo "</form>";
//echo "</tr></table>";
//echo "</form>";
if (!empty($interfaces_list)) { if (!empty($interfaces_list)) {
echo '<span id="form_interfaces">'; echo '<span id="form_interfaces">';
echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>'; echo '<span id ="none_text" style="display: none;">' . __('None') . '</span>';

View File

@ -147,7 +147,7 @@ function getLastLinesLog($file, $numLines = 2000) {
function show_logfile($file_name, $numLines = 2000) { function show_logfile($file_name, $numLines = 2000) {
global $config; global $config;
if (!file_exists($file_name)){ if (!file_exists($file_name)) {
echo "<h2 class=error>" . __("Cannot find file") . "(" . $file_name . echo "<h2 class=error>" . __("Cannot find file") . "(" . $file_name .
")</h2>"; ")</h2>";
} }
@ -267,7 +267,8 @@ function mainSystemInfo() {
$table->align = array(); $table->align = array();
$table->align[1] = 'right'; $table->align[1] = 'right';
if ($pandora_diag) { if ($pandora_diag) {
$table->data[0][0] = '<a href="#diag_info">' . __('Pandora Diagnostic info') . "</a>"; $table->data[0][0] = '<a href="#diag_info">' .
__('Pandora Diagnostic info') . "</a>";
} }
else { else {
$table->data[0][0] = __('Pandora Diagnostic info'); $table->data[0][0] = __('Pandora Diagnostic info');
@ -291,7 +292,6 @@ function mainSystemInfo() {
$table->data[3][1] = html_print_input_text('log_num_lines', $log_num_lines, __('Number lines of log'), 5, 10, true); $table->data[3][1] = html_print_input_text('log_num_lines', $log_num_lines, __('Number lines of log'), 5, 10, true);
html_print_table($table); html_print_table($table);
echo "<div style='width: " . $table->width . "; text-align: right;'>"; echo "<div style='width: " . $table->width . "; text-align: right;'>";
//html_print_submit_button(__('Show'), 'show', false, 'class="sub next"');
html_print_submit_button(__('Generate file'), 'generate', false, 'class="sub next"'); html_print_submit_button(__('Generate file'), 'generate', false, 'class="sub next"');
echo "</div>"; echo "</div>";
echo "</form>"; echo "</form>";

View File

@ -46,7 +46,7 @@ if (is_ajax ()) {
$is_enteprise = enterprise_hook('license_show_info'); $is_enteprise = enterprise_hook('license_show_info');
// If Open show info // If Open show info
if ($is_enteprise === ENTERPRISE_NOT_HOOK){ if ($is_enteprise === ENTERPRISE_NOT_HOOK) {
$table->width = '98%'; $table->width = '98%';
$table->data = array (); $table->data = array ();
$table->style = array(); $table->style = array();

View File

@ -300,16 +300,20 @@ function extensions_add_operation_menu_option ($name, $fatherId = null, $icon =
global $config; global $config;
global $extension_file; global $extension_file;
/* $config['extension_file'] is set in extensions_load_extensions(), since that function must /*
be called before any function the extension call, we are sure it will $config['extension_file'] is set in extensions_load_extensions(),
be set. */ since that function must be called before any function the extension
call, we are sure it will be set.
*/
$option_menu['name'] = $name; $option_menu['name'] = $name;
$extension = &$config['extensions'][$extension_file]; $extension = &$config['extensions'][$extension_file];
$option_menu['sec2'] = $extension['dir'].'/'.mb_substr ($extension_file, 0, -4);
$option_menu['sec2'] = $extension['dir'] . '/' . mb_substr ($extension_file, 0, -4);
$option_menu['fatherId'] = $fatherId; $option_menu['fatherId'] = $fatherId;
$option_menu['icon'] = $icon; $option_menu['icon'] = $icon;
$option_menu['version'] = $version; $option_menu['version'] = $version;
$extension['operation_menu'] = $option_menu; $extension['operation_menu'] = $option_menu;
} }

View File

@ -34,7 +34,7 @@ function menu_print_menu (&$menu) {
$sec2 = (string) get_parameter ('sec2'); $sec2 = (string) get_parameter ('sec2');
$allsec2 = explode('sec2=', $_SERVER['REQUEST_URI']); $allsec2 = explode('sec2=', $_SERVER['REQUEST_URI']);
if(isset($allsec2[1])) { if (isset($allsec2[1])) {
$allsec2 = $allsec2[1]; $allsec2 = $allsec2[1];
} }
else { else {
@ -200,8 +200,10 @@ function menu_print_menu (&$menu) {
//Ini Add icon extension //Ini Add icon extension
$secExtension = null; $secExtension = null;
if (array_key_exists('extension',$sub)) $secExtensionBool = $sub["extension"]; if (array_key_exists('extension',$sub))
else $secExtensionBool = false; $secExtensionBool = $sub["extension"];
else
$secExtensionBool = false;
if ($secExtensionBool) { if ($secExtensionBool) {
$imageIconDefault = 'images/extensions.png'; $imageIconDefault = 'images/extensions.png';
@ -224,8 +226,8 @@ function menu_print_menu (&$menu) {
else { else {
$imageIcon = $imageIconDefault; $imageIcon = $imageIconDefault;
} }
//Delete extension Icon before the was a style with background: url('.$imageIcon.') no-repeat;
$submenu_output .= '<div style="width: 16px; height: 16px; float: left; margin: 5px 0px 0px 3px;">&nbsp;</div>'; $submenu_output .= '<div style="background: url('.$imageIcon.') no-repeat; width: 16px; height: 16px; float: left; margin: 5px 0px 0px 3px;">&nbsp;</div>';
} }
@ -404,7 +406,7 @@ function menu_add_extras(&$menu) {
* Get the sec list built in menu * Get the sec list built in menu
* *
* @param bool If true, the array returned will have the structure * @param bool If true, the array returned will have the structure
* to combo categories (optgroup) * to combo categories (optgroup)
* *
* @return array Sections list * @return array Sections list
*/ */