From eaacf461316d3da7bcf0425b67789afd99546a7e Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Wed, 11 Jan 2017 13:12:46 +0100 Subject: [PATCH 01/38] Change visual of data in tree view, now show more data. --- .../include/functions_treeview.php | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index a186f40940..c0db1f33bb 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -198,16 +198,18 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = $data = "" . remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . ""; else - $data = "" . - substr(io_safe_output($last_data['datos']),0,12) . ""; + $data = ui_print_truncate_text(io_safe_output($last_data['datos']), + GENERIC_SIZE_TEXT, true, true, + true, '...', 'white-space: nowrap;'); break; default: if (is_numeric($last_data["datos"])) $data = "" . remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . ""; else - $data = "" . - substr(io_safe_output($last_data['datos']),0,12) . ""; + $data = ui_print_truncate_text(io_safe_output($last_data['datos']), + GENERIC_SIZE_TEXT, true, true, + true, '...', 'white-space: nowrap;'); break; } break; @@ -225,17 +227,20 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = $data = "" . remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . ""; else - $data = "" . - substr(io_safe_output($last_data['datos']),0,12) . ""; + $data = ui_print_truncate_text(io_safe_output($last_data['datos']), + GENERIC_SIZE_TEXT, true, true, true, + '...', 'white-space: nowrap;'); break; default: if (is_numeric($last_data["datos"])) $data = "" . remove_right_zeros(number_format($last_data["datos"], $config['graph_precision'])) . ""; else - $data = "" . - substr(io_safe_output($last_data['datos']),0,12) . ""; + $data = ui_print_truncate_text(io_safe_output($last_data['datos']), + GENERIC_SIZE_TEXT, true, true, true, + '...', 'white-space: nowrap;'); break; + } } if (!empty($last_data['utimestamp'])) { $last_data_str = $data; From 8b4eedd630ec73898ab7b1b06c95edc99e29ffe8 Mon Sep 17 00:00:00 2001 From: m-lopez-f Date: Wed, 11 Jan 2017 16:51:16 +0100 Subject: [PATCH 02/38] add lost option in call function in alert view in metaconsole. --- pandora_console/operation/agentes/alerts_status.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index 5a40e588da..08e3032006 100755 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -386,7 +386,7 @@ if ($print_agent) { if(is_metaconsole()) { ui_toggle( printFormFilterAlert($id_group, $filter, $free_search, - $url, $filter_standby, $tag_filter, true, $strict_user), + $url, $filter_standby, $tag_filter, false, true, $strict_user), __('Show Options'));; } else { From 2ccb1685a428150a29d607d27bb13de4f7a038f5 Mon Sep 17 00:00:00 2001 From: cesar991 Date: Wed, 11 Jan 2017 17:29:40 +0100 Subject: [PATCH 03/38] Add create log file in Services.py Policies.py Views.py and User.py tests files --- tests/console/Policies.py | 14 +++++++++++--- tests/console/Services.py | 22 ++++++++++++++++++++-- tests/console/Users.py | 6 +++++- tests/console/Views.py | 7 +++++++ 4 files changed, 43 insertions(+), 6 deletions(-) diff --git a/tests/console/Policies.py b/tests/console/Policies.py index 049017e413..87ce05cf48 100644 --- a/tests/console/Policies.py +++ b/tests/console/Policies.py @@ -11,7 +11,9 @@ from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException from selenium.webdriver.remote.webelement import WebElement + import unittest2, time, re +import logging class Policies(PandoraWebDriverTestCase): @@ -22,6 +24,7 @@ class Policies(PandoraWebDriverTestCase): policy_name = gen_random_string(6) network_server_module_name = gen_random_string(6) + logging.basicConfig(filename="Policies.log", level=logging.INFO, filemode='w') @is_enterprise def test_A_create_policy(self): @@ -40,7 +43,8 @@ class Policies(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//a[contains(.,"'+self.policy_name+'")]') self.assertIsInstance(element,WebElement) - + logging.info("test_A_create_policy is correct") + @is_enterprise def test_B_add_network_server_module_to_policy(self): @@ -54,7 +58,8 @@ class Policies(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td[contains(.,"uccessfully")]') self.assertIsInstance(element,WebElement) - + logging.info("test_B_add_network_server_module_to_policy is correct") + @is_enterprise def test_C_add_collection_to_policy(self): @@ -77,7 +82,7 @@ class Policies(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td[contains(.,"Correct: add the collection in the policy")]') self.assertIsInstance(element,WebElement) - + logging.info("test_C_add_collection_to_policy is correct") @is_enterprise def test_D_Apply_policy_to_agents(self): @@ -128,6 +133,8 @@ class Policies(PandoraWebDriverTestCase): module = driver.find_element_by_xpath('//td[contains(.,"'+module_name_2+'")]') self.assertIsInstance(module,WebElement) + logging.info("test_D_Apply_policy_to_agents is correct") + @is_enterprise def test_E_Apply_policy_to_agents_with_spaces(self): @@ -181,6 +188,7 @@ class Policies(PandoraWebDriverTestCase): module = driver.find_element_by_xpath('//td[contains(.,"'+module_name+'")]') self.assertIsInstance(module,WebElement) + logging.info("test_E_Apply_policy_to_agents_with_spaces is correct") if __name__ == "__main__": unittest2.main() diff --git a/tests/console/Services.py b/tests/console/Services.py index ad90a003e1..e948c4ba12 100644 --- a/tests/console/Services.py +++ b/tests/console/Services.py @@ -15,6 +15,7 @@ from selenium.common.exceptions import NoAlertPresentException from selenium.webdriver.remote.webelement import WebElement import unittest2, time, re +import logging class SimpleService(PandoraWebDriverTestCase): @@ -31,6 +32,7 @@ class SimpleService(PandoraWebDriverTestCase): module_normal_2_name = gen_random_string(6) module_warning_1_name = gen_random_string(6) + logging.basicConfig(filename="Service.log", level=logging.INFO, filemode='w') @is_enterprise def test_A_simple_service(self): @@ -106,6 +108,8 @@ class SimpleService(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td/img[@data-title="Warning"]') self.assertIsInstance(element,WebElement) + logging.info("test_A_simple_service is correct") + @is_enterprise def test_B_simple_service(self): @@ -136,6 +140,8 @@ class SimpleService(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]') self.assertIsInstance(element,WebElement) + logging.info("test_B_simple_service is correct") + @is_enterprise def test_C_simple_service(self): @@ -166,7 +172,8 @@ class SimpleService(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]') self.assertIsInstance(element,WebElement) - + logging.info("test_C_simple_service is correct") + class ManualService(PandoraWebDriverTestCase): test_name = u'Auto service tests' @@ -224,6 +231,9 @@ class ManualService(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]') self.assertIsInstance(element,WebElement) + + logging.info("test_A_manual_service_ok is correct") + @is_enterprise def test_B_auto_service_critical(self): @@ -249,6 +259,8 @@ class ManualService(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]') self.assertIsInstance(element,WebElement) + logging.info("test_B_auto_service_critical is correct") + @is_enterprise def test_C_auto_service_warning(self): @@ -273,6 +285,8 @@ class ManualService(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td/img[@data-title="Warning"]') self.assertIsInstance(element,WebElement) + logging.info("test_C_auto_service_warning is correct") + class serviceInsideService(PandoraWebDriverTestCase): test_name = u'Auto service tests' @@ -341,6 +355,8 @@ class serviceInsideService(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td/img[@data-title="Ok"]') self.assertIsInstance(element,WebElement) + logging.info("test_A_service_ok is correct") + @is_enterprise def test_B_service_critical(self): @@ -372,6 +388,8 @@ class serviceInsideService(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]') self.assertIsInstance(element,WebElement) + logging.info("test_B_service_critical is correct") + @is_enterprise def test_C_service_warning(self): @@ -404,6 +422,6 @@ class serviceInsideService(PandoraWebDriverTestCase): element = driver.find_element_by_xpath('//td/img[@data-title="Critical"]') self.assertIsInstance(element,WebElement) - + logging.info("test_C_service_warning is correct") if __name__ == "__main__": unittest2.main() diff --git a/tests/console/Users.py b/tests/console/Users.py index 392c278d50..2682d603af 100644 --- a/tests/console/Users.py +++ b/tests/console/Users.py @@ -10,6 +10,7 @@ from selenium.common.exceptions import NoAlertPresentException from selenium.webdriver.remote.webelement import WebElement import unittest2, time, re +import logging class Users(PandoraWebDriverTestCase): @@ -23,6 +24,8 @@ class Users(PandoraWebDriverTestCase): Modify home screen, and check that change is correct. Return this change """ + logging.basicConfig(filename="Users.log", level=logging.INFO, filemode='w') + driver = self.driver self.login() detect_and_pass_all_wizards(driver) @@ -39,7 +42,8 @@ class Users(PandoraWebDriverTestCase): activate_home_screen(driver,"Default") - + logging.info("test_A_home_screen is correct") + if __name__ == "__main__": unittest2.main() diff --git a/tests/console/Views.py b/tests/console/Views.py index 8caa173201..b4ad48134e 100644 --- a/tests/console/Views.py +++ b/tests/console/Views.py @@ -8,7 +8,9 @@ from selenium.webdriver.support.ui import Select from selenium.common.exceptions import NoSuchElementException from selenium.common.exceptions import NoAlertPresentException from selenium.webdriver.remote.webelement import WebElement + import unittest2, time, re +import logging class viewAppear(PandoraWebDriverTestCase): @@ -23,6 +25,9 @@ class viewAppear(PandoraWebDriverTestCase): """ """ + + logging.basicConfig(filename="Views.log", level=logging.INFO, filemode='w') + driver = self.driver self.login() detect_and_pass_all_wizards(driver) @@ -312,6 +317,8 @@ class viewAppear(PandoraWebDriverTestCase): self.assertEqual("The last version of package installed is:" in driver.page_source,True) click_menu_element(driver,"Update Manager options") + logging.info("test_views_appear is correct") + """ if __name__ == "__main__": From 21a133977cbcdde6fed243ed48f07d865278c1ff Mon Sep 17 00:00:00 2001 From: daniel Date: Wed, 11 Jan 2017 17:31:11 +0100 Subject: [PATCH 04/38] fixed visual error visual console --- .../godmode/reporting/visual_console_builder.editor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.php b/pandora_console/godmode/reporting/visual_console_builder.editor.php index 2468cef5cf..1f86475a36 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.php +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.php @@ -75,7 +75,7 @@ if (!defined('METACONSOLE')) { echo '
'; } else { - echo '
'; + echo '
'; } echo '
'; From c0446bfde04e311c0c0c903439efb8510a22a5de Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 12 Jan 2017 00:01:15 +0100 Subject: [PATCH 05/38] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb.data.oracle.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 3295f22871..33940b22d9 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0dev-170111 +Version: 7.0dev-170112 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 2a4ee1e31e..56be746d5a 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0dev-170111" +pandora_version="7.0dev-170112" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index ef25bef7ba..49f103b1df 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0dev'; -use constant AGENT_BUILD => '170111'; +use constant AGENT_BUILD => '170112'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index aa373cdfd6..371eb27491 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0dev -%define release 170111 +%define release 170112 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 4e858b3b0f..a8cae506d5 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0dev -%define release 170111 +%define release 170112 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index a4ef3ebb26..eabd29f2e5 100644 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0dev" -PI_BUILD="170111" +PI_BUILD="170112" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 11c10089c8..c67cb480cd 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170111} +{170112} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 09ca2f5d17..c784e1640b 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0dev(Build 170111)") +#define PANDORA_VERSION ("7.0dev(Build 170112)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 0b6bd40d91..6774596507 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0dev(Build 170111))" + VALUE "ProductVersion", "(7.0dev(Build 170112))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 69042a7152..07041c46e1 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0dev-170111 +Version: 7.0dev-170112 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index c37eb80e22..6255704165 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0dev-170111" +pandora_version="7.0dev-170112" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b70db19ae8..431b47a792 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170111'; +$build_version = 'PC170112'; $pandora_version = 'v7.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 73b3c3ce5a..28916390d2 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Thu, 12 Jan 2017 10:53:08 +0100 Subject: [PATCH 06/38] fixed visual errors in metaconsole --- pandora_console/include/functions_visual_map.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index b27154c6c6..90c5c86089 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -2137,7 +2137,7 @@ function visual_map_print_visual_map ($id_layout, $show_links = true, } if (defined('METACONSOLE')) { - echo "
"; + echo "
"; } echo '
Date: Thu, 12 Jan 2017 15:51:59 +0100 Subject: [PATCH 07/38] Add selection modules in bulk operations: Add action alerts. --- .../massive/massive_add_action_alerts.php | 96 ++++++++++----- .../massive/massive_delete_action_alerts.php | 113 +++++++++++------- pandora_console/include/javascript/pandora.js | 72 +++++++++++ .../operation/agentes/ver_agente.php | 41 +++++++ 4 files changed, 244 insertions(+), 78 deletions(-) diff --git a/pandora_console/godmode/massive/massive_add_action_alerts.php b/pandora_console/godmode/massive/massive_add_action_alerts.php index 8154dbaec7..ca4c33e262 100755 --- a/pandora_console/godmode/massive/massive_add_action_alerts.php +++ b/pandora_console/godmode/massive/massive_add_action_alerts.php @@ -52,7 +52,6 @@ $id_group = (int) get_parameter ('id_group'); $id_agents = get_parameter ('id_agents'); $id_alert_templates = (array) get_parameter ('id_alert_templates'); $recursion = get_parameter ('recursion'); - $add = (bool) get_parameter_post ('add'); if ($add) { @@ -64,45 +63,61 @@ if ($add) { $fires_max = (int) get_parameter ('fires_max'); if (!empty($actions)) { - $agent_alerts = agents_get_alerts($id_agents); - $cont = 0; - $agent_alerts_id = array(); - foreach ($agent_alerts['simple'] as $agent_alert) { - if (in_array($agent_alert['id_alert_template'], $id_alert_templates)) { - $agent_alerts_id[$cont] = $agent_alert['id']; - $cont = $cont + 1; - } - } - - $options = array(); - - if ($fires_min > 0) - $options['fires_min'] = $fires_min; - if ($fires_max > 0) - $options['fires_max'] = $fires_max; - - if (empty($agent_alerts_id)) { - ui_print_result_message (false, '', __('Could not be added').". ".__('No alerts selected')); - } - else { - $results = true; - foreach ($agent_alerts_id as $agent_alert_id) { - foreach ($actions as $action) { - $result = alerts_add_alert_agent_module_action($agent_alert_id, $action, $options); - if ($result === false) - $results = false; + $modules = get_parameter ('module'); + $modules_id = array(); + if (!empty($modules)) { + foreach ($modules as $module) { + foreach ($id_agents as $id_agent) { + $module_id = modules_get_agentmodule_id($module, $id_agent); + $modules_id[] = $module_id['id_agente_modulo']; } } - db_pandora_audit("Massive management", "Add alert action " . json_encode($id_agents), false, false, 'Agents: ' . - json_encode($id_agents) . ' Alerts : ' . json_encode($agent_alerts) . - ' Fires Min: ' . $fires_min . ' Fires Max: ' . $fires_max . ' Actions: ' . implode(',',$actions)); + $agent_alerts = agents_get_alerts($id_agents); + $cont = 0; + $agent_alerts_id = array(); - ui_print_result_message ($results, __('Successfully added'), __('Could not be added')); + foreach ($agent_alerts['simple'] as $agent_alert) { + + if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) { + $agent_alerts_id[$cont] = $agent_alert['id']; + $cont += 1; + } + } + + $options = array(); + + if ($fires_min > 0) + $options['fires_min'] = $fires_min; + if ($fires_max > 0) + $options['fires_max'] = $fires_max; + + if (empty($agent_alerts_id)) { + ui_print_result_message (false, '', __('Could not be added').". ".__('No alerts selected')); + } + else { + $results = true; + foreach ($agent_alerts_id as $agent_alert_id) { + foreach ($actions as $action) { + $result = alerts_add_alert_agent_module_action($agent_alert_id, $action, $options); + if ($result === false) + $results = false; + } + } + + db_pandora_audit("Massive management", "Add alert action " . json_encode($id_agents), false, false, 'Agents: ' . + json_encode($id_agents) . ' Alerts : ' . json_encode($agent_alerts) . + ' Fires Min: ' . $fires_min . ' Fires Max: ' . $fires_max . ' Actions: ' . implode(',',$actions)); + + ui_print_result_message ($results, __('Successfully added'), __('Could not be added')); + } + } + else { + ui_print_result_message (false, '', __('Could not be added').". ".__('No modules selected')); } } else { - ui_print_result_message (false, '', __('Could not be added').". ".__('No action selected')); + ui_print_result_message (false, '', __('Could not be added').". ".__('No actions selected')); } } @@ -150,6 +165,15 @@ $table->data[2][0] .= ''; $table->data[2][1] = html_print_select (array(), 'id_alert_templates[]', '', '', '', '', true, true, true, '', $alert_templates == 0); +$table->data[2][2] = __('When select agents'); +$table->data[2][2] .= '
'; +$table->data[2][2] .= html_print_select ( + array('common' => __('Show common modules'), + 'all' => __('Show all modules'),'unknown' => __('Show unknown and not init modules')), + 'modules_selection_mode', + 'common', false, '', '', true); +$table->data[2][3] = html_print_select (array(), 'module[]', + $modules_select, false, '', '', true, true, false); $actions = alerts_get_alert_actions (); $table->data[3][0] = __('Action'); @@ -233,6 +257,12 @@ $(document).ready (function () { update_alerts(); }); + $("#id_alert_templates").change(alert_templates_changed_by_multiple_agents_with_alerts); + + $("#modules_selection_mode").click(function () { + $("#id_alert_templates").trigger("change"); + }); + function update_alerts() { var idAgents = Array(); jQuery.each ($("#id_agents option:selected"), function (i, val) { diff --git a/pandora_console/godmode/massive/massive_delete_action_alerts.php b/pandora_console/godmode/massive/massive_delete_action_alerts.php index b41642ecf8..a36363d19f 100644 --- a/pandora_console/godmode/massive/massive_delete_action_alerts.php +++ b/pandora_console/godmode/massive/massive_delete_action_alerts.php @@ -58,52 +58,65 @@ if ($delete) { $actions = get_parameter ('action'); if (!empty($actions)) { - $agent_alerts = agents_get_alerts($id_agents); - - $alerts_agent_modules = array(); - foreach ($agent_alerts['simple'] as $agent_alert) { - if (in_array($agent_alert['id_alert_template'], $id_alert_templates)) { - $alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id')); + $modules = (array) get_parameter ('module'); + $modules_id = array(); + if (!empty($modules)) { + foreach ($modules as $module) { + foreach ($id_agents as $id_agent) { + $module_id = modules_get_agentmodule_id($module, $id_agent); + $modules_id[] = $module_id['id_agente_modulo']; + } } - } - - if (empty($alerts_agent_modules)) { - ui_print_result_message (false, '', - __('Could not be deleted. No alerts selected')); - } - else { - $results = true; - $agent_module_actions = array(); - - foreach ($alerts_agent_modules as $alert_agent_module) { - $agent_module_actions = alerts_get_alert_agent_module_actions ($alert_agent_module['id'], array('id','id_alert_action')); - - foreach ($agent_module_actions as $agent_module_action) { - foreach ($actions as $action) { - if ($agent_module_action['id_alert_action'] == $action) { - $result = alerts_delete_alert_agent_module_action ($agent_module_action['id']); - - if ($result === false) - $results = false; - } - } + + $agent_alerts = agents_get_alerts($id_agents); + $alerts_agent_modules = array(); + foreach ($agent_alerts['simple'] as $agent_alert) { + if ((in_array($agent_alert['id_alert_template'], $id_alert_templates)) && (in_array($agent_alert['id_agent_module'], $modules_id))) { + $alerts_agent_modules = array_merge($alerts_agent_modules, alerts_get_alerts_agent_module ($agent_alert['id_agent_module'], true, false, 'id')); } } - if ($results) { - db_pandora_audit("Massive management", "Delete alert action", false, false, - 'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) . - ' Actions: ' . implode(',',$actions)); + if (empty($alerts_agent_modules)) { + ui_print_result_message (false, '', + __('Could not be deleted. No alerts selected')); } else { - db_pandora_audit("Massive management", "Fail try to delete alert action", false, false, - 'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) . - ' Actions: ' . implode(',',$actions)); + $results = true; + $agent_module_actions = array(); + + foreach ($alerts_agent_modules as $alert_agent_module) { + $agent_module_actions = alerts_get_alert_agent_module_actions ($alert_agent_module['id'], array('id','id_alert_action')); + + foreach ($agent_module_actions as $agent_module_action) { + foreach ($actions as $action) { + if ($agent_module_action['id_alert_action'] == $action) { + $result = alerts_delete_alert_agent_module_action ($agent_module_action['id']); + + if ($result === false) + $results = false; + } + } + } + } + + if ($results) { + db_pandora_audit("Massive management", "Delete alert action", false, false, + 'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) . + ' Actions: ' . implode(',',$actions)); + } + else { + db_pandora_audit("Massive management", "Fail try to delete alert action", false, false, + 'Agent: ' . json_encode($id_agents) . ' Alert templates: ' . json_encode($id_alert_templates) . + ' Actions: ' . implode(',',$actions)); + } + + ui_print_result_message ($results, + __('Successfully deleted'), + __('Could not be deleted')); } - - ui_print_result_message ($results, - __('Successfully deleted'), - __('Could not be deleted')); + } + else { + ui_print_result_message (false, '', __('Could not be added').". ".__('No modules selected')); } } else { @@ -143,9 +156,6 @@ $table->data[0][3] = html_print_checkbox ("recursion", 1, $recursion, true, false); $table->data[1][0] = __('Agents with templates'); -$table->data[1][0] .= ''; $table->data[1][1] = html_print_select (array(),'id_agents[]', 0, false, '', '', true, true); if (empty($id_agents)) { @@ -155,10 +165,17 @@ else { $alert_templates = agents_get_alerts_simple ($id_agents); } $table->data[2][0] = __('Alert templates'); -$table->data[2][0] .= ''; $table->data[2][1] = html_print_select (index_array ($alert_templates, 'id_alert_template', 'template_name'), 'id_alert_templates[]', '', '', '', '', true, true, true, '', $alert_templates == 0); +$table->data[2][2] = __('When select agents'); +$table->data[2][2] .= '
'; +$table->data[2][2] .= html_print_select ( + array('common' => __('Show common modules'), + 'all' => __('Show all modules'),'unknown' => __('Show unknown and not init modules')), + 'modules_selection_mode', + 'common', false, '', '', true); +$table->data[2][3] = html_print_select (array(), 'module[]', + $modules_select, false, '', '', true, true, false); + $actions = alerts_get_alert_actions (); $table->data[3][0] = __('Action'); @@ -221,6 +238,12 @@ $(document).ready (function () { update_alerts(); }); + $("#id_alert_templates").change(alert_templates_changed_by_multiple_agents_with_alerts); + + $("#modules_selection_mode").click(function () { + $("#id_alert_templates").trigger("change"); + }); + function update_alerts() { var idAgents = Array(); jQuery.each ($("#id_agents option:selected"), function (i, val) { diff --git a/pandora_console/include/javascript/pandora.js b/pandora_console/include/javascript/pandora.js index c83d7062a1..3c38c43a87 100644 --- a/pandora_console/include/javascript/pandora.js +++ b/pandora_console/include/javascript/pandora.js @@ -373,6 +373,78 @@ function agent_changed_by_multiple_agents_with_alerts (event, id_agent, selected ); } +/** + * Fill up select box with id "module" with modules with alerts of one or more templates + * before agent has been selected, but this not empty the select box.s + * + * @param event that has been triggered + * @param id_agent Agent ID that has been selected + * @param selected Which module(s) have to be selected + */ +function alert_templates_changed_by_multiple_agents_with_alerts (event, id_agent, selected) { + var idAgents = Array(); + + jQuery.each ($("#id_agents option:selected"), function (i, val) { + //val() because the var is same + idAgents.push($(val).val()); + }); + + var selection_mode = $('#modules_selection_mode').val(); + if(selection_mode == undefined) { + selection_mode = 'common'; + } + + templates = Array(); + jQuery.each ($("#id_alert_templates option:selected"), function (i, val) { + //val() because the var is same + templates.push($(val).val()); + }); + + console.log(templates); + + $('#module').attr ('disabled', 1); + $('#module').empty (); + $('#module').append ($('').html ("Loading...").attr ("value", 0)); + jQuery.post ('ajax.php', + {"page": "operation/agentes/ver_agente", + "get_agent_modules_alerts_json_for_multiple_agents": 1, + "templates[]": templates, + "id_agent[]": idAgents, + "selection_mode": selection_mode + }, + function (data) { + $('#module').empty (); + + if (typeof($(document).data('text_for_module')) != 'undefined') { + $('#module').append ($('').html ($(document).data('text_for_module')).attr("value", 0).prop('selected', true)); + } + else { + if (typeof(data['any_text']) != 'undefined') { + $('#module').append ($('').html (data['any_text']).attr ("value", 0).prop('selected', true)); + } + else { + var anyText = $("#any_text").html(); //Trick for catch the translate text. + + if (anyText == null) { + anyText = 'Any'; + } + + $('#module').append ($('').html (anyText).attr ("value", 0).prop('selected', true)); + } + } + jQuery.each (data, function (i, val) { + s = js_html_entity_decode(val); + $('#module').append ($('').html (s).attr ("value", val)); + $('#module').fadeIn ('normal'); + }); + if (selected != undefined) + $('#module').attr ('value', selected); + $('#module').removeAttr('disabled'); + }, + "json" + ); +} + /** * Fill up select box with id "agent" with agents after module has been selected, but this not empty the select box.s * diff --git a/pandora_console/operation/agentes/ver_agente.php b/pandora_console/operation/agentes/ver_agente.php index 90cb6544dc..da23b601dd 100644 --- a/pandora_console/operation/agentes/ver_agente.php +++ b/pandora_console/operation/agentes/ver_agente.php @@ -38,6 +38,7 @@ if (is_ajax ()) { $get_modules_group_json = (bool) get_parameter ("get_modules_group_json"); $get_agent_modules_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_json_for_multiple_agents"); $get_agent_modules_alerts_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_alerts_json_for_multiple_agents"); + $get_agent_modules_multiple_alerts_json_for_multiple_agents = (bool) get_parameter("get_agent_modules_multiple_alerts_json_for_multiple_agents"); $get_agents_json_for_multiple_modules = (bool) get_parameter("get_agents_json_for_multiple_modules"); $get_agent_modules_json_for_multiple_agents_id = (bool) get_parameter("get_agent_modules_json_for_multiple_agents_id"); $get_agentmodule_status_tooltip = (bool) get_parameter ("get_agentmodule_status_tooltip"); @@ -273,6 +274,46 @@ if (is_ajax ()) { } if ($get_agent_modules_alerts_json_for_multiple_agents) { + $idAgents = (array) get_parameter('id_agent'); + $templates = (array) get_parameter('templates'); + + $selection_mode = get_parameter('selection_mode','common'); + + $sql = 'SELECT DISTINCT(nombre) + FROM tagente_modulo t1, talert_template_modules t2 + WHERE t2.id_agent_module = t1.id_agente_modulo + AND delete_pending = 0 + AND id_alert_template IN (' . implode(',', $templates) . ') + AND id_agente IN (' . implode(',', $idAgents) . ')'; + + if ($selection_mode == 'common') { + $sql .= ' AND ( + SELECT count(nombre) + FROM tagente_modulo t3, talert_template_modules t4 + WHERE t4.id_agent_module = t3.id_agente_modulo + AND delete_pending = 0 AND t1.nombre = t3.nombre + AND id_agente IN (' . implode(',', $idAgents) . ') + AND id_alert_template IN (' . implode(',', $templates) . ')) = (' . count($idAgents) . ')'; + } + + $sql .= ' ORDER BY t1.nombre'; + + $nameModules = db_get_all_rows_sql($sql); + + if ($nameModules == false) { + $nameModules = array(); + } + + $result = array(); + foreach($nameModules as $nameModule) { + $result[] = io_safe_output($nameModule['nombre']); + } + + echo json_encode($result); + return; + } + + if ($get_agent_modules_multiple_alerts_json_for_multiple_agents) { $idAgents = get_parameter('id_agent'); $id_template = get_parameter('template'); From 2773b3f2f902ede87e6815cbdb6bf8c690d4dfdc Mon Sep 17 00:00:00 2001 From: artica Date: Fri, 13 Jan 2017 00:01:15 +0100 Subject: [PATCH 08/38] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb.data.oracle.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 33940b22d9..bc5e6ef80b 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0dev-170112 +Version: 7.0dev-170113 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 56be746d5a..f6d87dd3bc 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0dev-170112" +pandora_version="7.0dev-170113" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 49f103b1df..582a174de9 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0dev'; -use constant AGENT_BUILD => '170112'; +use constant AGENT_BUILD => '170113'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 371eb27491..79321a8ddf 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0dev -%define release 170112 +%define release 170113 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index a8cae506d5..76e2c5b435 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0dev -%define release 170112 +%define release 170113 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index eabd29f2e5..006252eb2b 100644 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0dev" -PI_BUILD="170112" +PI_BUILD="170113" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index c67cb480cd..134383b88a 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170112} +{170113} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index c784e1640b..63e5db2f6c 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0dev(Build 170112)") +#define PANDORA_VERSION ("7.0dev(Build 170113)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 6774596507..b95eeafe45 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0dev(Build 170112))" + VALUE "ProductVersion", "(7.0dev(Build 170113))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 07041c46e1..c4ecfc2675 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0dev-170112 +Version: 7.0dev-170113 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 6255704165..847040d535 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0dev-170112" +pandora_version="7.0dev-170113" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 431b47a792..22012b927a 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170112'; +$build_version = 'PC170113'; $pandora_version = 'v7.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 28916390d2..e133012ad6 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Fri, 13 Jan 2017 10:46:09 +0100 Subject: [PATCH 09/38] Fixed problems with access a node with user in metaconsole. --- pandora_console/include/ajax/tree.ajax.php | 9 +- .../include/functions_treeview.php | 112 +++++++++++------- 2 files changed, 71 insertions(+), 50 deletions(-) diff --git a/pandora_console/include/ajax/tree.ajax.php b/pandora_console/include/ajax/tree.ajax.php index 698ae48eb6..89f2cf3bf7 100644 --- a/pandora_console/include/ajax/tree.ajax.php +++ b/pandora_console/include/ajax/tree.ajax.php @@ -73,9 +73,6 @@ if (is_ajax ()) { if (is_metaconsole()) { $server_id = (int) get_parameter('serverID'); $server = metaconsole_get_servers($server_id); - - if (metaconsole_connect($server) != NOERR) - return; } ob_clean(); @@ -98,11 +95,7 @@ if (is_ajax ()) { } } echo '
'; - - if (!empty($server) && is_metaconsole()) { - metaconsole_restore_db(); - } - + return; } diff --git a/pandora_console/include/functions_treeview.php b/pandora_console/include/functions_treeview.php index c0db1f33bb..d18d625a00 100755 --- a/pandora_console/include/functions_treeview.php +++ b/pandora_console/include/functions_treeview.php @@ -38,7 +38,14 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = enterprise_include_once ('meta/include/functions_modules_meta.php'); enterprise_include_once ('meta/include/functions_ui_meta.php'); enterprise_include_once ('meta/include/functions_metaconsole.php'); - + + $user_access_node = can_user_access_node (); + + if (is_metaconsole()) { + if (metaconsole_connect($server_data) != NOERR) + return; + } + $filter["id_agente_modulo"] = $id_module; $module = db_get_row_filter ("tagente_modulo", $filter); @@ -47,14 +54,7 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = ui_print_error_message(__('There was a problem loading module')); return; } - - /*if (! check_acl ($config["id_user"], $module["id_grupo"], "AR")) { - db_pandora_audit("ACL Violation", - "Trying to access Module Information"); - require_once ("general/noaccess.php"); - return; - }*/ - + $table = new StdClass(); $table->width = "100%"; $table->class = "databox data"; @@ -68,24 +68,24 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = $table->head_colspan[] = 2; $table->data = array(); - + //Module name if ($module["disabled"]) $cellName = "" . ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;") . ui_print_help_tip(__('Disabled'), true) . ""; else $cellName = ui_print_truncate_text ($module["nombre"], GENERIC_SIZE_TEXT, true, true, true, '[…]',"text-transform: uppercase;"); - + $row = array(); $row['title'] = __('Name'); $row['data'] = "".$cellName.""; $table->data['name'] = $row; - + // Interval $row = array(); $row['title'] = __('Interval'); $row['data'] = human_time_description_raw (modules_get_interval($module['id_agente_modulo']), true); $table->data['interval'] = $row; - + // Warning Min/Max if (modules_is_string_type($module['id_tipo_modulo'])) { $warning_status_str = __('Str.') . ': ' . $module['str_warning']; @@ -93,12 +93,12 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = else { $warning_status_str = __('Min.') . ': ' . (float)$module['min_warning'] . '
' . __('Max.') . ': ' . (float)$module['max_warning']; } - + $row = array(); $row['title'] = __('Warning status'); $row['data'] = $warning_status_str; $table->data['watning_status'] = $row; - + // Critical Min/Max if (modules_is_string_type($module['id_tipo_modulo'])) { $critical_status_str = __('Str.') . ': ' . $module['str_warning']; @@ -110,7 +110,7 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = $row['title'] = __('Critical status'); $row['data'] = $critical_status_str; $table->data['critical_status'] = $row; - + // Module group $module_group = modules_get_modulegroup_name($module['id_module_group']); @@ -118,31 +118,32 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = $module_group = __('Not assigned'); else $module_group = __("$module_group"); - + $row = array(); $row['title'] = __('Module group'); $row['data'] = $module_group; $table->data['module_group'] = $row; - + // Description $row = array(); $row['title'] = __('Description'); $row['data'] = ui_print_truncate_text ($module['descripcion'], 'description', true, true, true, '[…]'); $table->data['description'] = $row; - + // Tags $tags = tags_get_module_tags($module['id_agente_modulo']); if (empty($tags)) { $tags = array(); } - + $user_tags = tags_get_user_tags($config["id_user"]); - + foreach ($tags as $k => $v) { if (!array_key_exists($v, $user_tags)) { //only show user's tags. unset($tags[$k]); - } else { + } + else { $tag_name = tags_get_name($v); if (empty($tag_name)) { unset($tags[$k]); @@ -152,19 +153,19 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = } } } - + if (empty($tags)) { $tags = '' . __('N/A') . ''; } else { $tags = implode(', ' , $tags); } - + $row = array(); $row['title'] = __('Tags'); $row['data'] = $tags; $table->data['tags'] = $row; - + // Data $last_data = db_get_row_filter ('tagente_estado', array('id_agente_modulo' => $module['id_agente_modulo'], 'order' => array('field' => 'id_agente_estado', 'order' => 'DESC'))); if ($config["render_proc"]) { @@ -292,20 +293,20 @@ function treeview_printModuleTable($id_module, $server_data = false, $no_head = else { $last_data_str = '' . __('No data') . ''; } - + $row = array(); $row['title'] = __('Last data'); $row['data'] = $last_data_str; $table->data['last_data'] = $row; - + //End of table html_print_table($table); - + $id_group = agents_get_agent_group($module['id_agente']); $group_name = db_get_value('nombre', 'tgrupo', 'id_grupo', $id_group); $agent_name = db_get_value('nombre', 'tagente', 'id_agente', $module['id_agente']); - - if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'AW')) { + + if ($user_access_node && check_acl ($config["id_user"], $id_group, 'AW')) { // Actions table echo ''; } - + //id_module and id_agent hidden echo ''; - + + if (!empty($server_data) && is_metaconsole()) { + metaconsole_restore_db(); + } + return; } @@ -340,7 +345,14 @@ function treeview_printAlertsTable($id_module, $server_data = array(), $no_head $console_url = $server_data['server_url'] . '/'; $url_hash = metaconsole_get_servers_url_hash($server_data); } - + + $user_access_node = can_user_access_node (); + + if (is_metaconsole()) { + if (metaconsole_connect($server_data) != NOERR) + return; + } + $module_alerts = alerts_get_alerts_agent_module($id_module); $module_name = db_get_value('nombre', 'tagente_modulo', 'id_agente_modulo', $id_module); $agent_id = db_get_value('id_agente', 'tagente_modulo', 'id_agente_modulo', $id_module); @@ -427,7 +439,7 @@ function treeview_printAlertsTable($id_module, $server_data = array(), $no_head } html_print_table($table2); - if (can_user_access_node () && check_acl ($config["id_user"], $id_group, 'LW')) { + if ($user_access_node && check_acl ($config["id_user"], $id_group, 'LW')) { // Actions table echo ''; } + + if (!empty($server_data) && is_metaconsole()) { + metaconsole_restore_db(); + } + + return; } function treeview_printTable($id_agente, $server_data = array(), $no_head = false) { @@ -467,16 +485,23 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals if ($is_extra === ENTERPRISE_NOT_HOOK) { $is_extra = false; } + + $user_access_node = can_user_access_node (); + + if (is_metaconsole()) { + if (metaconsole_connect($server_data) != NOERR) + return; + } + $agent = db_get_row ("tagente", "id_agente", $id_agente); + if (! check_acl ($config["id_user"], $agent["id_grupo"], "AR") && ! check_acl ($config["id_user"], $agent["id_grupo"], "AW") && !$is_extra) { db_pandora_audit("ACL Violation", "Trying to access Agent General Information"); require_once ("general/noaccess.php"); return; } - - $agent = db_get_row ("tagente", "id_agente", $id_agente); - + if ($agent === false) { ui_print_error_message(__('There was a problem loading agent')); return; @@ -498,7 +523,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals $cellName = ''; } - $cellName .= ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true, $console_url, $url_hash, false, can_user_access_node ()); + $cellName .= ui_print_agent_name ($agent["id_agente"], true, 500, "text-transform: uppercase;", true, $console_url, $url_hash, false, $user_access_node); if ($agent['disabled']) { $cellName .= ui_print_help_tip(__('Disabled'), true) . "
"; @@ -567,7 +592,7 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals //End of table $agent_table = html_print_table($table, true); - if (can_user_access_node () && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { + if ( $user_access_node && check_acl ($config["id_user"], $agent["id_grupo"], "AW")) { $go_to_agent = '
'; $go_to_agent .= ''; $go_to_agent .= html_print_submit_button (__('Go to agent edition'), 'upd_button', false, 'class="sub config"', true); @@ -748,8 +773,11 @@ function treeview_printTable($id_agente, $server_data = array(), $no_head = fals ui_toggle($table_interfaces, __('Interface information') . ' (SNMP)'); } - + + if (!empty($server_data) && is_metaconsole()) { + metaconsole_restore_db(); + } + return; } - -?> +?> \ No newline at end of file From 21c2b93637b349360f241b7aae277444899ab8a8 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Fri, 13 Jan 2017 11:01:08 +0100 Subject: [PATCH 10/38] Case insensitive in tree view filter search #9 --- pandora_console/include/class/Tree.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/class/Tree.class.php b/pandora_console/include/class/Tree.class.php index a1467e6992..8d2fc0c0e5 100644 --- a/pandora_console/include/class/Tree.class.php +++ b/pandora_console/include/class/Tree.class.php @@ -234,7 +234,7 @@ class Tree { // Agent name filter $agent_search_filter = ""; if (!empty($this->filter['searchAgent'])) { - $agent_search_filter = " AND ta.nombre LIKE '%".$this->filter['searchAgent']."%' "; + $agent_search_filter = " AND LOWER(ta.nombre) LIKE LOWER('%".$this->filter['searchAgent']."%')"; } // Agent status filter From 233fe5e83994b49833d9691e5b838d1484d88a86 Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 14 Jan 2017 00:01:17 +0100 Subject: [PATCH 11/38] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb.data.oracle.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index bc5e6ef80b..16628d6463 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0dev-170113 +Version: 7.0dev-170114 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index f6d87dd3bc..4a720274c4 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0dev-170113" +pandora_version="7.0dev-170114" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index 582a174de9..e474792e68 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0dev'; -use constant AGENT_BUILD => '170113'; +use constant AGENT_BUILD => '170114'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 79321a8ddf..a560c48771 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0dev -%define release 170113 +%define release 170114 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 76e2c5b435..3b4bb092da 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0dev -%define release 170113 +%define release 170114 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 006252eb2b..4877168130 100644 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0dev" -PI_BUILD="170113" +PI_BUILD="170114" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 134383b88a..817b398a88 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170113} +{170114} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 63e5db2f6c..1f6978aa7b 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0dev(Build 170113)") +#define PANDORA_VERSION ("7.0dev(Build 170114)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index b95eeafe45..b302995c3f 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0dev(Build 170113))" + VALUE "ProductVersion", "(7.0dev(Build 170114))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index c4ecfc2675..28f0015fd7 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0dev-170113 +Version: 7.0dev-170114 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 847040d535..bdbfbfc0e1 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0dev-170113" +pandora_version="7.0dev-170114" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 22012b927a..58a5e1f75f 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170113'; +$build_version = 'PC170114'; $pandora_version = 'v7.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index e133012ad6..0484a5bd8d 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Sun, 15 Jan 2017 00:01:12 +0100 Subject: [PATCH 12/38] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb.data.oracle.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 16628d6463..d972d2ee44 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0dev-170114 +Version: 7.0dev-170115 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index 4a720274c4..e89fab5d2a 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0dev-170114" +pandora_version="7.0dev-170115" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index e474792e68..fa4134107f 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0dev'; -use constant AGENT_BUILD => '170114'; +use constant AGENT_BUILD => '170115'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index a560c48771..47d93391b6 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0dev -%define release 170114 +%define release 170115 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 3b4bb092da..81ea43b5ff 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0dev -%define release 170114 +%define release 170115 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 4877168130..132bb5eae8 100644 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0dev" -PI_BUILD="170114" +PI_BUILD="170115" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 817b398a88..f933dad4d1 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170114} +{170115} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 1f6978aa7b..7ac11b9068 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0dev(Build 170114)") +#define PANDORA_VERSION ("7.0dev(Build 170115)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index b302995c3f..d1ef5c4798 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0dev(Build 170114))" + VALUE "ProductVersion", "(7.0dev(Build 170115))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 28f0015fd7..7e3242aab1 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0dev-170114 +Version: 7.0dev-170115 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index bdbfbfc0e1..73d666239c 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0dev-170114" +pandora_version="7.0dev-170115" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 58a5e1f75f..87810dd09f 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170114'; +$build_version = 'PC170115'; $pandora_version = 'v7.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 0484a5bd8d..b024ed167a 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Mon, 16 Jan 2017 00:01:12 +0100 Subject: [PATCH 13/38] Auto-updated build strings. --- pandora_agents/unix/DEBIAN/control | 2 +- pandora_agents/unix/DEBIAN/make_deb_package.sh | 2 +- pandora_agents/unix/pandora_agent | 2 +- pandora_agents/unix/pandora_agent.redhat.spec | 2 +- pandora_agents/unix/pandora_agent.spec | 2 +- pandora_agents/unix/pandora_agent_installer | 2 +- pandora_agents/win32/installer/pandora.mpi | 2 +- pandora_agents/win32/pandora.cc | 2 +- pandora_agents/win32/versioninfo.rc | 2 +- pandora_console/DEBIAN/control | 2 +- pandora_console/DEBIAN/make_deb_package.sh | 2 +- pandora_console/include/config_process.php | 2 +- pandora_console/install.php | 2 +- pandora_console/pandora_console.redhat.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_console/pandoradb.data.oracle.sql | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/pandora_server.redhat.spec | 2 +- pandora_server/pandora_server.spec | 2 +- pandora_server/pandora_server_installer | 2 +- pandora_server/util/pandora_db.pl | 2 +- pandora_server/util/pandora_manage.pl | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index d972d2ee44..206d16a77e 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0dev-170115 +Version: 7.0dev-170116 Architecture: all Priority: optional Section: admin diff --git a/pandora_agents/unix/DEBIAN/make_deb_package.sh b/pandora_agents/unix/DEBIAN/make_deb_package.sh index e89fab5d2a..1365d93641 100644 --- a/pandora_agents/unix/DEBIAN/make_deb_package.sh +++ b/pandora_agents/unix/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0dev-170115" +pandora_version="7.0dev-170116" echo "Test if you has the tools for to make the packages." whereis dpkg-deb | cut -d":" -f2 | grep dpkg-deb > /dev/null diff --git a/pandora_agents/unix/pandora_agent b/pandora_agents/unix/pandora_agent index fa4134107f..0576c823ee 100644 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -41,7 +41,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0dev'; -use constant AGENT_BUILD => '170115'; +use constant AGENT_BUILD => '170116'; # Agent log default file size maximum and instances use constant DEFAULT_MAX_LOG_SIZE => 600000; diff --git a/pandora_agents/unix/pandora_agent.redhat.spec b/pandora_agents/unix/pandora_agent.redhat.spec index 47d93391b6..109a0bdad7 100644 --- a/pandora_agents/unix/pandora_agent.redhat.spec +++ b/pandora_agents/unix/pandora_agent.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0dev -%define release 170115 +%define release 170116 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent.spec b/pandora_agents/unix/pandora_agent.spec index 81ea43b5ff..6dfb89814e 100644 --- a/pandora_agents/unix/pandora_agent.spec +++ b/pandora_agents/unix/pandora_agent.spec @@ -3,7 +3,7 @@ # %define name pandorafms_agent_unix %define version 7.0dev -%define release 170115 +%define release 170116 Summary: Pandora FMS Linux agent, PERL version Name: %{name} diff --git a/pandora_agents/unix/pandora_agent_installer b/pandora_agents/unix/pandora_agent_installer index 132bb5eae8..704fc22ed7 100644 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0dev" -PI_BUILD="170115" +PI_BUILD="170116" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index f933dad4d1..0bcd5ad6da 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{170115} +{170116} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 7ac11b9068..a234461d14 100644 --- a/pandora_agents/win32/pandora.cc +++ b/pandora_agents/win32/pandora.cc @@ -30,7 +30,7 @@ using namespace Pandora; using namespace Pandora_Strutils; #define PATH_SIZE _MAX_PATH+1 -#define PANDORA_VERSION ("7.0dev(Build 170115)") +#define PANDORA_VERSION ("7.0dev(Build 170116)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index d1ef5c4798..93baf4ef91 100644 --- a/pandora_agents/win32/versioninfo.rc +++ b/pandora_agents/win32/versioninfo.rc @@ -11,7 +11,7 @@ BEGIN VALUE "LegalCopyright", "Artica ST" VALUE "OriginalFilename", "PandoraAgent.exe" VALUE "ProductName", "Pandora FMS Windows Agent" - VALUE "ProductVersion", "(7.0dev(Build 170115))" + VALUE "ProductVersion", "(7.0dev(Build 170116))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 7e3242aab1..8206b32b8f 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0dev-170115 +Version: 7.0dev-170116 Architecture: all Priority: optional Section: admin diff --git a/pandora_console/DEBIAN/make_deb_package.sh b/pandora_console/DEBIAN/make_deb_package.sh index 73d666239c..8903015dd5 100644 --- a/pandora_console/DEBIAN/make_deb_package.sh +++ b/pandora_console/DEBIAN/make_deb_package.sh @@ -14,7 +14,7 @@ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. -pandora_version="7.0dev-170115" +pandora_version="7.0dev-170116" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 87810dd09f..8a5ffdfb5a 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -22,7 +22,7 @@ /** * Pandora build version and version */ -$build_version = 'PC170115'; +$build_version = 'PC170116'; $pandora_version = 'v7.0dev'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index b024ed167a..9eb3cde130 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -71,7 +71,7 @@
Date: Mon, 16 Jan 2017 08:37:45 +0100 Subject: [PATCH 14/38] fixed minor error extensions --- pandora_console/extensions/net_tools.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/extensions/net_tools.php b/pandora_console/extensions/net_tools.php index 1049bc5e81..f3fc3a9a74 100644 --- a/pandora_console/extensions/net_tools.php +++ b/pandora_console/extensions/net_tools.php @@ -256,7 +256,7 @@ function main_net_tools () { function godmode_net_tools() { global $config; - check_config (); + check_login(); if (! check_acl ($config['id_user'], 0, "PM")) { db_pandora_audit("ACL Violation", From 2dcc6db3420d5513478778df8581ff19d2783769 Mon Sep 17 00:00:00 2001 From: vgilc Date: Fri, 13 Jan 2017 10:01:20 +0100 Subject: [PATCH 15/38] Merge branch '7-cambiar_color_de_grafica_de_acceso' into 'pandora_6.0' Change agent details graph color #7 See merge request !14 --- pandora_console/include/graphs/flot/pandora.flot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 1e3f0fb245..1680949950 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -945,7 +945,7 @@ function pandoraFlotArea(graph_id, values, labels, labels_long, legend, serie_color = colors[i]; } else { - serie_color = null; + serie_color = '#8c2'; } var normalw = '#efe'; From 66ae3460cec25c52548019362df3f1d986cf4147 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Mon, 16 Jan 2017 11:29:23 +0100 Subject: [PATCH 16/38] Add the token group_password to agent configuration files. --- pandora_agents/unix/AIX/pandora_agent.conf | 3 +++ pandora_agents/unix/Darwin/pandora_agent.conf | 3 +++ pandora_agents/unix/FreeBSD/pandora_agent.conf | 3 +++ pandora_agents/unix/HP-UX/pandora_agent.conf | 3 +++ pandora_agents/unix/Linux/pandora_agent.conf | 3 +++ pandora_agents/unix/NT4/pandora_agent.conf | 3 +++ pandora_agents/unix/NetBSD/pandora_agent.conf | 3 +++ pandora_agents/unix/SunOS/pandora_agent.conf | 3 +++ 8 files changed, 24 insertions(+) diff --git a/pandora_agents/unix/AIX/pandora_agent.conf b/pandora_agents/unix/AIX/pandora_agent.conf index a594a75db6..8699987b8d 100644 --- a/pandora_agents/unix/AIX/pandora_agent.conf +++ b/pandora_agents/unix/AIX/pandora_agent.conf @@ -28,6 +28,9 @@ debug 0 # Group assigned for this agent (descriptive, p.e: Servers) #group Servers +# Group password (if defined). +#group_password + # Autotime: Enforce to server to ignore timestamp coming from this # agent, used when agents has no timer or it's inestable. 1 to enable # this feature diff --git a/pandora_agents/unix/Darwin/pandora_agent.conf b/pandora_agents/unix/Darwin/pandora_agent.conf index e0fb18b645..d97102bd83 100644 --- a/pandora_agents/unix/Darwin/pandora_agent.conf +++ b/pandora_agents/unix/Darwin/pandora_agent.conf @@ -42,6 +42,9 @@ udp_server_auth_address 0.0.0.0 # Group assigned for this agent (descriptive, p.e: Servers) #group Servers +# Group password (if defined). +#group_password + # address: Enforce to server a ip address to this agent # You can also try to detect the first IP using "auto", for example #address auto diff --git a/pandora_agents/unix/FreeBSD/pandora_agent.conf b/pandora_agents/unix/FreeBSD/pandora_agent.conf index 37d24cedd7..4ea1e428eb 100644 --- a/pandora_agents/unix/FreeBSD/pandora_agent.conf +++ b/pandora_agents/unix/FreeBSD/pandora_agent.conf @@ -50,6 +50,9 @@ udp_server_auth_address 0.0.0.0 # Group assigned for this agent (descriptive, p.e: Servers) group Servers +# Group password (if defined). +#group_password + # address: Enforce to server a ip address to this agent # You can also try to detect the first IP using "auto", for example address auto diff --git a/pandora_agents/unix/HP-UX/pandora_agent.conf b/pandora_agents/unix/HP-UX/pandora_agent.conf index 11cfd76443..6e3e07ff96 100644 --- a/pandora_agents/unix/HP-UX/pandora_agent.conf +++ b/pandora_agents/unix/HP-UX/pandora_agent.conf @@ -30,6 +30,9 @@ debug 0 # Group assigned for this agent (descriptive, p.e: Servers) #group Servers +# Group password (if defined). +#group_password + # Autotime: Enforce to server to ignore timestamp coming from this # agent, used when agents has no timer or it's inestable. 1 to enable # this feature diff --git a/pandora_agents/unix/Linux/pandora_agent.conf b/pandora_agents/unix/Linux/pandora_agent.conf index fca976f40a..a4e2a62a2c 100644 --- a/pandora_agents/unix/Linux/pandora_agent.conf +++ b/pandora_agents/unix/Linux/pandora_agent.conf @@ -50,6 +50,9 @@ udp_server_auth_address 0.0.0.0 # Group assigned for this agent (descriptive, p.e: Servers) group Servers +# Group password (if defined). +#group_password + # address: Enforce to server a ip address to this agent # You can also try to detect the first IP using "auto", for example address auto diff --git a/pandora_agents/unix/NT4/pandora_agent.conf b/pandora_agents/unix/NT4/pandora_agent.conf index 11a84591fa..e853695923 100644 --- a/pandora_agents/unix/NT4/pandora_agent.conf +++ b/pandora_agents/unix/NT4/pandora_agent.conf @@ -41,6 +41,9 @@ udp_server_auth_address 0.0.0.0 # Group assigned for this agent (descriptive, p.e: Servers) #group Servers + +# Group password (if defined). +#group_password # Autotime: Enforce to server to ignore timestamp coming from this # agent, used when agents has no timer or it's inestable. 1 to enable diff --git a/pandora_agents/unix/NetBSD/pandora_agent.conf b/pandora_agents/unix/NetBSD/pandora_agent.conf index 12f185d3b8..bcb27d825f 100644 --- a/pandora_agents/unix/NetBSD/pandora_agent.conf +++ b/pandora_agents/unix/NetBSD/pandora_agent.conf @@ -33,6 +33,9 @@ debug 0 # Group assigned for this agent (descriptive, p.e: Servers) group Servers +# Group password (if defined). +#group_password + # Autotime: Enforce to server to ignore timestamp coming from this # agent, used when agents has no timer or it's inestable. 1 to enable # this feature diff --git a/pandora_agents/unix/SunOS/pandora_agent.conf b/pandora_agents/unix/SunOS/pandora_agent.conf index a55ee944af..29acf4ec60 100644 --- a/pandora_agents/unix/SunOS/pandora_agent.conf +++ b/pandora_agents/unix/SunOS/pandora_agent.conf @@ -30,6 +30,9 @@ debug 0 # Group assigned for this agent (descriptive, p.e: Servers) #group Servers +# Group password (if defined). +#group_password + # Autotime: Enforce to server to ignore timestamp coming from this # agent, used when agents has no timer or it's inestable. 1 to enable # this feature From d51225f86ccd0b9adeda84198f05d37004298916 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Mon, 16 Jan 2017 11:34:55 +0100 Subject: [PATCH 17/38] Added pass field to groups in console. Ticket #153 --- .../godmode/groups/configure_group.php | 39 +++++++++++++------ pandora_console/godmode/groups/group_list.php | 9 +++-- 2 files changed, 33 insertions(+), 15 deletions(-) diff --git a/pandora_console/godmode/groups/configure_group.php b/pandora_console/godmode/groups/configure_group.php index 8e3bca5800..5dc9b539b7 100644 --- a/pandora_console/godmode/groups/configure_group.php +++ b/pandora_console/godmode/groups/configure_group.php @@ -34,6 +34,7 @@ enterprise_include_once ('meta/include/functions_agents_meta.php'); $icon = ""; $name = ""; $id_parent = 0; +$group_pass = ""; $alerts_disabled = 0; $custom_id = ""; $propagate = 0; @@ -55,6 +56,7 @@ if ($id_group) { else { $icon = $group["icon"].'.png'; } + $group_pass = io_safe_output($group['password']); $alerts_disabled = $group["disabled"]; $id_parent = $group["parent"]; $custom_id = $group["custom_id"]; @@ -158,23 +160,36 @@ if ($acl_parent) { $table->data[2][1] .= ''; } -$table->data[3][0] = __('Alerts'); -$table->data[3][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true); +$i = 3; +if ($config['enterprise_installed']) { + $i = 4; + $table->data[3][0] = __('Group Password'); + $table->data[3][1] = html_print_input_password ('group_pass', $group_pass, '', 16, 255, true); +} -$table->data[4][0] = __('Propagate ACL') . ui_print_help_tip (__("Propagate the same ACL security into the child subgroups."), true); -$table->data[4][1] = html_print_checkbox('propagate', 1, $propagate, true).ui_print_help_icon ("propagate_acl", true); +$table->data[$i][0] = __('Alerts'); +$table->data[$i][1] = html_print_checkbox ('alerts_enabled', 1, ! $alerts_disabled, true); +$i++; -$table->data[5][0] = __('Custom ID'); -$table->data[5][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true); +$table->data[$i][0] = __('Propagate ACL') . ui_print_help_tip (__("Propagate the same ACL security into the child subgroups."), true); +$table->data[$i][1] = html_print_checkbox('propagate', 1, $propagate, true).ui_print_help_icon ("propagate_acl", true); +$i++; -$table->data[6][0] = __('Description'); -$table->data[6][1] = html_print_input_text ('description', $description, '', 60, 255, true); +$table->data[$i][0] = __('Custom ID'); +$table->data[$i][1] = html_print_input_text ('custom_id', $custom_id, '', 16, 255, true); +$i++; -$table->data[7][0] = __('Contact') . ui_print_help_tip (__("Contact information accessible through the _groupcontact_ macro"), true); -$table->data[7][1] = html_print_textarea ('contact', 4, 40, $contact, "style='min-height: 0px;'", true); +$table->data[$i][0] = __('Description'); +$table->data[$i][1] = html_print_input_text ('description', $description, '', 60, 255, true); +$i++; -$table->data[8][0] = __('Other') . ui_print_help_tip (__("Information accessible through the _group_other_ macro"), true); -$table->data[8][1] = html_print_textarea ('other', 4, 40, $other, "style='min-height: 0px;'", true); +$table->data[$i][0] = __('Contact') . ui_print_help_tip (__("Contact information accessible through the _groupcontact_ macro"), true); +$table->data[$i][1] = html_print_textarea ('contact', 4, 40, $contact, "style='min-height: 0px;'", true); +$i++; + +$table->data[$i][0] = __('Other') . ui_print_help_tip (__("Information accessible through the _group_other_ macro"), true); +$table->data[$i][1] = html_print_textarea ('other', 4, 40, $other, "style='min-height: 0px;'", true); +$i++; $isFunctionSkins = enterprise_include_once ('include/functions_skins.php'); if ($isFunctionSkins !== ENTERPRISE_NOT_HOOK && !defined('METACONSOLE')) { diff --git a/pandora_console/godmode/groups/group_list.php b/pandora_console/godmode/groups/group_list.php index 87bff77a0e..023ed6e84c 100644 --- a/pandora_console/godmode/groups/group_list.php +++ b/pandora_console/godmode/groups/group_list.php @@ -178,6 +178,7 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) { $name = (string) get_parameter ('name'); $icon = (string) get_parameter ('icon'); $id_parent = (int) get_parameter ('id_parent'); + $group_pass = (string)get_parameter('group_pass'); $alerts_disabled = (bool) get_parameter ('alerts_disabled'); $custom_id = (string) get_parameter ('custom_id'); $skin = (string) get_parameter ('skin'); @@ -200,7 +201,8 @@ if (($create_group) && (check_acl($config['id_user'], 0, "PM"))) { 'description' => $description, 'contact' => $contact, 'propagate' => $propagate, - 'other' => $other + 'other' => $other, + 'password' => io_safe_input($group_pass) ); $result = db_process_sql_insert('tgrupo', $values); @@ -228,6 +230,7 @@ if ($update_group) { $icon = (string) get_parameter ('icon'); $id_parent = (int) get_parameter ('id_parent'); $description = (string) get_parameter ('description'); + $group_pass = (string)get_parameter('group_pass'); $alerts_enabled = (bool) get_parameter ('alerts_enabled'); $custom_id = (string) get_parameter ('custom_id'); $propagate = (bool) get_parameter('propagate'); @@ -241,9 +244,9 @@ if ($update_group) { switch ($config["dbtype"]) { case "mysql": $sql = sprintf ('UPDATE tgrupo SET nombre = "%s", - icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s" + icon = "%s", disabled = %d, parent = %d, custom_id = "%s", propagate = %d, id_skin = %d, description = "%s", contact = "%s", other = "%s", password = "%s" WHERE id_grupo = %d', - $name, empty($icon) ? '' : substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $description, $contact, $other, $id_group); + $name, empty($icon) ? '' : substr ($icon, 0, -4), !$alerts_enabled, $id_parent, $custom_id, $propagate, $skin, $description, $contact, $other, $group_pass, $id_group); break; case "postgresql": case "oracle": From 32b0e504aac92717d661a69408902f5eeb73f319 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 16 Jan 2017 12:05:36 +0100 Subject: [PATCH 18/38] Change hover text in vconsole, full text in bbdd but show truncate - #13 --- .../include/functions_visual_map.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pandora_console/include/functions_visual_map.php b/pandora_console/include/functions_visual_map.php index 90c5c86089..fb6680965c 100755 --- a/pandora_console/include/functions_visual_map.php +++ b/pandora_console/include/functions_visual_map.php @@ -121,8 +121,9 @@ function visual_map_print_item($mode = "read", $layoutData, $left = $left * $proportion['proportion_width']; } - - $text = '' . $label . ''; + $agentname = agents_get_name(agents_get_module_id ($id_module)); + $label = str_replace($agentname,ui_print_truncate_text($agentname, 'agent_small', false, true, false, '…', false),$label); + $text = '' . $label .''; if (!isset($layoutData['status_calculated'])) { $layoutData['status_calculated'] = @@ -1434,16 +1435,16 @@ function visual_map_process_wizard_add_modules ($id_modules, $image, switch ($label_type) { case 'agent_module': default: - $agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 'agent_small', false, true, false, '…', false); - $module_label = ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_small', false, true, false, '…', false); + $agent_label = agents_get_name ($id_agent); + $module_label = modules_get_agentmodule_name($id_module); $label = '

'.$agent_label . " - " . $module_label.'

'; break; case 'module': - $module_label = ui_print_truncate_text(modules_get_agentmodule_name($id_module), 'module_small', false, true, false, '…', false); + $module_label = modules_get_agentmodule_name($id_module); $label = '

'.$module_label.'

'; break; case 'agent': - $agent_label = ui_print_truncate_text(agents_get_name ($id_agent), 'agent_small', false, true, false, '…', false); + $agent_label = agents_get_name ($id_agent); $label = '

'.$agent_label.'

'; break; case 'none': @@ -1635,9 +1636,8 @@ function visual_map_process_wizard_add_agents ($id_agents, $image, switch ($label_type) { case 'agent': - $agent_label = ui_print_truncate_text( - agents_get_name($id_agent), - 'agent_small', false, true, false, '…', false); + $agent_label = + agents_get_name($id_agent); $label = $agent_label; break; case 'none': From 64471896060c3b501d37378c426e28428d3cb180 Mon Sep 17 00:00:00 2001 From: enriquecd Date: Mon, 16 Jan 2017 13:31:56 +0100 Subject: [PATCH 19/38] Improve visual console - #110 --- .../pandoradb_migrate_6.0_to_6.1.mysql.sql | 1 + .../pandoradb_migrate_6.0_to_6.1.oracle.sql | 1 + ...andoradb_migrate_6.0_to_6.1.postgreSQL.sql | 6 +- .../reporting/visual_console_builder.data.php | 66 +- .../visual_console_builder.editor.js | 735 +++++++++++++++--- .../visual_console_builder.editor.php | 33 +- .../visual_console_builder.elements.php | 2 + .../visual_console_builder.wizard.php | 49 +- .../images/console/signes/custom_graph.png | Bin 7473 -> 7960 bytes .../images/console/signes/module_graph.png | Bin 8998 -> 9400 bytes .../images/console/signes/percentil.png | Bin 4628 -> 5056 bytes .../console/signes/percentil_bubble.png | Bin 13107 -> 14093 bytes .../images/console/signes/service.png | Bin 6231 -> 6200 bytes .../ajax/visual_console_builder.ajax.php | 24 + .../include/functions_visual_map.php | 526 ++++++++++--- .../include/functions_visual_map_editor.php | 28 +- .../include/graphs/flot/pandora.flot.js | 10 +- pandora_console/include/styles/pandora.css | 152 +++- .../include/styles/pandora_black.css | 131 +++- .../include/styles/pandora_green_old.css | 137 +++- .../operation/visual_console/render_view.php | 99 ++- pandora_console/pandoradb.oracle.sql | 1 + pandora_console/pandoradb.postgreSQL.sql | 1 + pandora_console/pandoradb.sql | 1 + 24 files changed, 1595 insertions(+), 408 deletions(-) diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql index cf24f0e238..ff16959e39 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.mysql.sql @@ -124,6 +124,7 @@ ALTER TABLE tlayout ADD `background_color` varchar(50) NOT NULL default '#FFF'; -- Table `tlayout_data` -- --------------------------------------------------------------------- ALTER TABLE tlayout_data ADD `type_graph` varchar(50) NOT NULL default 'area'; +ALTER TABLE tlayout_data ADD `label_position` varchar(50) NOT NULL default 'down'; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql index 37ff6d3e3d..e47e1174a9 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.oracle.sql @@ -102,6 +102,7 @@ ALTER TABLE tlayout ADD COLUMN background_color varchar(50) NOT NULL default '#F -- Table `tlayout_data` -- --------------------------------------------------------------------- ALTER TABLE tlayout_data ADD COLUMN type_graph varchar(50) NOT NULL default 'area'; +ALTER TABLE tlayout_data ADD COLUMN label_position varchar(50) NOT NULL default 'down'; -- --------------------------------------------------------------------- -- Table `tagent_custom_fields` diff --git a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql index 245c193bb3..26e62d16b5 100644 --- a/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_6.0_to_6.1.postgreSQL.sql @@ -38,8 +38,4 @@ ALTER TABLE tlayout ADD COLUMN background_color varchar(50) NOT NULL default '#F -- Table `tlayout_data` -- --------------------------------------------------------------------- ALTER TABLE tlayout_data ADD COLUMN type_graph varchar(50) NOT NULL default 'area'; - --- --------------------------------------------------------------------- --- Table `tgraph` --- --------------------------------------------------------------------- -ALTER TABLE tgraph ADD COLUMN percentil int(4) unsigned default 0; +ALTER TABLE tlayout_data ADD COLUMN label_position varchar(50) NOT NULL default 'down'; diff --git a/pandora_console/godmode/reporting/visual_console_builder.data.php b/pandora_console/godmode/reporting/visual_console_builder.data.php index 4ade7b5975..6507f3d02a 100644 --- a/pandora_console/godmode/reporting/visual_console_builder.data.php +++ b/pandora_console/godmode/reporting/visual_console_builder.data.php @@ -134,24 +134,23 @@ else{ $table->data[5][0] = __('Size - (Width x Height)'); -$table->data[5][1] = html_print_input_text('width', 1024, '', 10, 10, true , true) . + +if($action == 'new'){ +$table->data[5][1] = ''; +} +else{ +$table->data[5][1] = ''; +} + +$table->data[5][1] .= ''; if($action == 'new'){ -$table->data[5][1] .= ''; +$table->data[5][1] .= ''; } else{ -$table->data[5][1] .= ''; -} - -$table->data[5][1] .= ui_print_help_tip(__("You must define size"), true); - -if($action == 'new'){ -$table->data[5][1] .= 'Disabled'; -} -else{ -$table->data[5][1] .= 'Disabled'; +$table->data[5][1] .= ''; } $table->data[5][2] = ''; @@ -191,46 +190,39 @@ $(document).ready (function () { $("#modsize").click(function(event){ event.preventDefault(); - - if($('input[name=width]').attr('readonly')){ - $('input[name=width]').attr('readonly',false); - $('input[name=height]').attr('readonly',false); - $('#modsizetext').html('Enabled'); - $('input[name=update_layout]').attr('disabled',false); - } - else{ - $('input[name=width]').attr('readonly',true); - $('input[name=height]').attr('readonly',true); - $('#modsizetext').html('Disabled'); - $('input[name=update_layout]').attr('enabled',false); - } + if($('.opt').css('visibility') == 'hidden'){ + $('.opt').css('visibility','visible'); + } + $('input[name=width]').val($('#imagen').width()); $('input[name=height]').val($('#imagen').height()); - - - - + }); $("#getsize").click(function(event){ event.preventDefault(); - -$('input[name=update_layout]').attr('disabled',false); + $('input[name=width]').val($('#imagen').width()); $('input[name=height]').val($('#imagen').height()); - }); - $("#background").click(function(event){ $('#imagen').attr('src','images/console/background/'+$('#background').val()); - $('input[name=update_layout]').attr('disabled',true); - $("#getsize").attr('disabled',false); - $("#modsize").attr('disabled',false); }); +$( "input[type=submit]" ).click(function( event ) { + + if($( "#getsize" ).css('visibility')=='hidden'){ + $('input[name=width]').val($('#imagen').width()); + $('input[name=height]').val($('#imagen').height()); + } + + +}); + + $("#file-background_image").change(function(event){ $('#back').submit(); }); diff --git a/pandora_console/godmode/reporting/visual_console_builder.editor.js b/pandora_console/godmode/reporting/visual_console_builder.editor.js index 7a79bbc768..d40e20d9c0 100755 --- a/pandora_console/godmode/reporting/visual_console_builder.editor.js +++ b/pandora_console/godmode/reporting/visual_console_builder.editor.js @@ -83,6 +83,22 @@ function visual_map_main() { //Fixed to wait the load of images. $(window).load(function() { + + $('#radiobtn0001').click(function(){ + $("#custom_graph option[value=0]").prop("selected", true); + }); + + $('.labelpos').click(function(event){ + $("#labelposup img").attr('src','/pandora_console/images/label_up.png'); + $("#labelposdown img").attr('src','/pandora_console/images/label_down.png'); + $("#labelposleft img").attr('src','/pandora_console/images/label_left.png'); + $("#labelposright img").attr('src','/pandora_console/images/label_right.png'); + $('.labelpos').attr('sel','no'); + $("#"+$(this).attr('id')+" img").attr('src','/pandora_console/images/label_'+$(this).attr('id').replace('labelpos','')+'_2.png'); + $("#"+$(this).attr('id')).attr('sel','yes'); + + }); + draw_lines(lines, 'background', true); draw_user_lines("", 0, 0, 0 , 0, 0, true); @@ -151,7 +167,6 @@ function is_metaconsole() { function update_button_palette_callback() { - var values = {}; values = readFields(); @@ -176,33 +191,79 @@ function update_button_palette_callback() { idElement = 0; break; case 'box_item': + + if($('input[name=width_box]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height_box]').val() == ''){ + alert('Undefined height'); + return false; + } + $("#" + idItem + " div").css('background-color', values['fill_color']); $("#" + idItem + " div").css('border-color', values['border_color']); $("#" + idItem + " div").css('border-width', values['border_width'] + "px"); - $("#" + idItem + " div").css('height', values['height_box'] + "px"); - $("#" + idItem + " div").css('width', values['width_box'] + "px"); + + if(values['height_box']==0 || values['width_box']==0){ + $("#" + idItem + " div").css('width', "300px"); + $("#" + idItem + " div").css('height', "180px"); + } + else{ + $("#" + idItem + " div").css('height', values['height_box'] + "px"); + $("#" + idItem + " div").css('width', values['width_box'] + "px"); + } break; case 'group_item': case 'static_graph': + + if($('input[name=width]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height]').val() == ''){ + alert('Undefined height'); + return false; + } + $("#text_" + idItem).html(values['label']); - - if ((values['width'] != 0) && (values['height'] != 0)) { - $("#image_" + idItem).attr('width', values['width']); - $("#image_" + idItem).attr('height', values['height']); - $("#" + idItem).css('width', values['width'] + 'px'); - $("#" + idItem).css('height', values['height'] + 'px'); + + + + if ((values['width'] == 0) || (values['height'] == 0)) { + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 70); + $("#image_" + idItem).attr('height', 70); + $("#image_" + idItem).css('width', '70px'); + $("#image_" + idItem).css('height', '70px'); + } else { $("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('height'); - $("#" + idItem +" img").css('width', '70px'); - $("#" + idItem +" img").css('height', '70px'); - $("#" + idItem).css('width', '70px'); - $("#" + idItem).css('height', '70px'); + $("#image_" + idItem).attr('width', values['width']); + $("#image_" + idItem).attr('height', values['height']); + $("#image_" + idItem).css('width', values['width'] + 'px'); + $("#image_" + idItem).css('height', values['height'] + 'px'); } + + + break; case 'percentile_bar': case 'percentile_item': + + if($('input[name=width_percentile]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height_percentile]').val() == ''){ + alert('Undefined height'); + return false; + } + + $("#text_" + idItem).html(values['label']); $("#image_" + idItem).attr("src", "images/spinner.gif"); if (values['type_percentile'] == 'bubble') { @@ -211,9 +272,27 @@ function update_button_palette_callback() { else { setPercentileBar(idItem, values); } + + break; case 'module_graph': + + if($('input[name=width_module_graph]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height_module_graph]').val() == ''){ + alert('Undefined height'); + return false; + } + if($('#custom_graph_row').css('display') != 'none' && $("#custom_graph option:selected").html() == 'None'){ + alert('Undefined graph'); + return false; + } + + + $("#text_" + idItem).html(values['label']); $("#image_" + idItem).attr("src", "images/spinner.gif"); setModuleGraph(idItem); @@ -228,49 +307,130 @@ function update_button_palette_callback() { $("#text_" + idItem).html(values['label']); break; case 'icon': + + if($('input[name=width]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height]').val() == ''){ + alert('Undefined height'); + return false; + } + + $("#image_" + idItem).attr('src', "images/spinner.gif"); - if ((values['width'] != 0) && (values['height'] != 0)) { - $("#image_" + idItem).attr('width', values['width']); - $("#image_" + idItem).attr('height', values['height']); - $("#" + idItem).css('width', values['width'] + 'px'); - $("#" + idItem).css('height', values['height'] + 'px'); + if ((values['width'] == 0) || (values['height'] == 0)) { + $("#image_" + idItem).removeAttr('width'); + $("#image_" + idItem).removeAttr('height'); + $("#image_" + idItem).attr('width', 70); + $("#image_" + idItem).attr('height', 70); + $("#image_" + idItem).css('width', '70px'); + $("#image_" + idItem).css('height', '70px'); + } else { $("#image_" + idItem).removeAttr('width'); $("#image_" + idItem).removeAttr('height'); - $("#" + idItem).css('width', '70px'); - $("#" + idItem).css('height', '70px'); - - $("#" + idItem +" img").css('width', '70px'); - $("#" + idItem +" img").css('height', '70px'); + $("#image_" + idItem).attr('width', values['width']); + $("#image_" + idItem).attr('height', values['height']); + $("#image_" + idItem).css('width', values['width'] + 'px'); + $("#image_" + idItem).css('height', values['height'] + 'px'); } var image = values['image'] + ".png"; set_image("image", idItem, image); break; default: + if($('input[name=width]').val() == ''){ + alert('Undefined width'); + return false; + } + if($('input[name=height]').val() == ''){ + alert('Undefined height'); + return false; + } //Maybe save in any Enterprise item. if (typeof(enterprise_update_button_palette_callback) == 'function') { enterprise_update_button_palette_callback(values); } - break; + + break; + } updateDB(selectedItem, idItem , values); toggle_item_palette(); + + if(values['label_position']=='left'){ + $("#" + idItem + ' table').css('float','left'); + $("#" + idItem + ' img').css('float','right'); + $("#" + idItem + ' img').css('margin-left',''); + $("#" + idItem + ' table').css('height',$("#" + idItem+ ' img').css('height')); + $("#" + idItem + ' table').css('width',''); + $("#" + idItem + ' img').css('margin-top',(parseInt($("#" + idItem).css('height'))/2)-(parseInt($("#" + idItem + " img").css('height'))/2)+'px'); + $("#" + idItem + ' > p').remove(); + } + else if(values['label_position']=='right'){ + $("#" + idItem + ' table').css('float','right'); + $("#" + idItem + ' img').css('float','left'); + $("#" + idItem + ' img').css('margin-left',''); + $("#" + idItem + ' table').css('height',$("#" + idItem+ ' img').css('height')); + $("#" + idItem + ' table').css('width',''); + $("#" + idItem + ' img').css('margin-top',(parseInt($("#" + idItem).css('height'))/2)-(parseInt($("#" + idItem + " img").css('height'))/2)+'px'); + $("#" + idItem + ' > p').remove(); + } + + else if(values['label_position']=='down'){ + $("#" + idItem + ' table').css('float',''); + $("#" + idItem + ' img').css('float',''); + var tempoimg = $('#' + idItem + ' table').clone(); + $('#' + idItem + ' table').remove(); + $('#' + idItem).append(tempoimg); + $("#" + idItem + ' table').css('height',''); + $("#" + idItem + ' table').css('width','100%'); + $("#" + idItem + ' span').css('width','100%'); + $("#" + idItem + ' img').css('margin-top',''); + //if(parseInt($("#" + idItem).css('width'))-parseInt($("#" + idItem + " img").css('width'))/2 == 0 || values['height'] == 0 || values['width'] == 0){ + $("#" + idItem + ' img').css('margin-left',(parseInt($("#" + idItem).css('width'))/2)-(parseInt($("#" + idItem + " img").css('width'))/2)+'px'); + //} + //else{ + //$("#" + idItem + ' img').css('margin-left',''); + //} + + $("#" + idItem + ' > p').remove(); + } + else if(values['label_position']=='up'){ + $("#" + idItem + ' table').css('float',''); + $("#" + idItem + ' img').css('float',''); + var tempoimg = $('#' + idItem + ' img').clone(); + $('#' + idItem + ' img').remove(); + $('#' + idItem).append(tempoimg); + $("#" + idItem + ' table').css('height',''); + $("#" + idItem + ' table').css('width','100%'); + $("#" + idItem + ' span').css('width','100%'); + $("#" + idItem + ' img').css('margin-top',''); + //if(parseInt($("#" + idItem).css('width'))-parseInt($("#" + idItem + " img").css('width'))/2 == 0 || values['height'] == 0 || values['width'] == 0){ + //$("#" + idItem + ' img').css('margin-left',''); + + //} + //else{ + $("#" + idItem + ' img').css('margin-left',(parseInt($("#" + idItem).css('width'))/2)-(parseInt($("#" + idItem + " img").css('width'))/2)+'px'); + //} + $("#" + idItem + ' > p').remove(); + } + } function readFields() { + + $("#text-label_ifr").contents().find("p").css('overflow','hidden'); metaconsole = $("input[name='metaconsole']").val(); - var values = {}; - values['label'] = $("input[name=label]").val(); - - var text = tinymce.get('text-label').getContent(); values['label'] = text; + values['line-height'] = $("#text-label_ifr").contents().find("p").css('line-height'); values['type_graph'] = $("select[name=type_graph]").val(); values['image'] = $("select[name=image]").val(); values['background_color'] = $("select[name=background_color]").val(); @@ -306,7 +466,8 @@ function readFields() { values['line_width'] = parseInt( $("input[name='line_width']").val()); values['line_color'] = $("input[name='line_color']").val(); - + values['label_position'] = $(".labelpos[sel=yes]").attr('position'); + if (is_metaconsole()) { values['metaconsole'] = 1; values['id_agent'] = $("#hidden-agent").val(); @@ -333,9 +494,25 @@ function create_button_palette_callback() { var validate = true; switch (creationItem) { case 'box_item': + if (($("input[name='width_box']").val() == '')) { + alert('Undefined width'); + validate = false; + } + if (($("input[name='height_box']").val() == '')) { + alert('Undefined height'); + validate = false; + } break; case 'group_item': case 'static_graph': + if ((values['width'] == '')) { + alert('Undefined width'); + validate = false; + } + if ((values['height'] == '')) { + alert('Undefined height'); + validate = false; + } if ((values['label'] == '') && (values['image'] == '')) { alert($("#message_alert_no_label_no_image").html()); validate = false; @@ -348,6 +525,14 @@ function create_button_palette_callback() { } break; case 'icon': + if ((values['width'] == '')) { + alert('Undefined width'); + validate = false; + } + if ((values['height'] == '')) { + alert('Undefined height'); + validate = false; + } if ((values['image'] == '')) { alert($("#message_alert_no_image").html()); validate = false; @@ -355,6 +540,10 @@ function create_button_palette_callback() { break; case 'percentile_bar': case 'percentile_item': + if ((values['width'] == '')) { + alert('Undefined width'); + validate = false; + } if ((values['agent'] == '')) { alert($("#message_alert_no_agent").html()); validate = false; @@ -372,7 +561,15 @@ function create_button_palette_callback() { validate = false; } break; - case 'module_graph': + case 'module_graph': + if (values['width_module_graph'] == '') { + alert('Undefined width'); + validate = false; + } + if (values['height_module_graph'] == '') { + alert('Undefined height'); + validate = false; + } if (values['id_custom_graph'] == 0) { if ((values['agent'] == '')) { alert($("#message_alert_no_agent").html()); @@ -631,9 +828,6 @@ function toggle_item_palette() { enterprise_activeToolboxButton(false); } - - - if (creationItem != null) { //Create a item @@ -670,9 +864,27 @@ function toggle_item_palette() { hiddenFields(item); - - $("#properties_panel").show("fast"); + + $( ".lineheighttd").remove(); + //$('.mceToolbarEndButton').before( + // '' + //); + $('.mceToolbarEndButton').before( + '' + ); + + $('.lineheight').click(function(){ + $( "#text-label_ifr" ).contents().find( "p" ).attr( "data-mce-style","line-height:"+$(this).val()+";"); + $( "#text-label_ifr" ).contents().find( "p" ).css("line-height",$(this).val()); + $( "#text-label_ifr" ).contents().find( "span" ).attr( "data-mce-style","line-height:"+$(this).val()+";"); + $( "#text-label_ifr" ).contents().find( "span" ).css("line-height",$(this).val()); + + }); + + $( "#text-label_ifr" ).contents().find( "p" ).css("line-height",$('#lineheight').val()); + $( "#text-label_ifr" ).contents().find( "span" ).css("line-height",$('#lineheight').val()); + } } @@ -744,6 +956,8 @@ function loadFieldsFromDB(item) { tinymce.get('text-label').setContent(val); $("input[name=label]").val(val); } + + $('#lineheight').val($("#text-label_ifr").contents().find("p").css('line-height')); if (key == 'enable_link') { if (val == "1") { @@ -757,14 +971,19 @@ function loadFieldsFromDB(item) { } if (key == 'type_graph') { - if (val == "area") { $("select[name=type_graph]").val(val); } - else { - $("select[name=type_graph]").val(val); + + if (key == 'label_position') { + $('#labelposup'+" img").attr('src','/pandora_console/images/label_up.png'); + $('#labelposdown'+" img").attr('src','/pandora_console/images/label_down.png'); + $('#labelposleft'+" img").attr('src','/pandora_console/images/label_left.png'); + $('#labelposright'+" img").attr('src','/pandora_console/images/label_right.png'); + $('.labelpos').attr('sel','no'); + $('#labelpos'+val+" img").attr('src','/pandora_console/images/label_'+$('#labelpos'+val).attr('id').replace('labelpos','')+'_2.png'); + $('#labelpos'+val).attr('sel','yes'); } - } - + if (key == 'image') { //Load image preview $("select[name=image]").val(val); @@ -890,31 +1109,47 @@ function loadFieldsFromDB(item) { } }); + if (data.type == 6 || data.type == 7 || data.type == 8) { + + $("#period_row").css('display', ''); + $("#period_row." + item).css('display', ''); + } + else if (data.type == 2) { + $("#period_row").css('display', 'none'); + $("#period_row." + item).css('display', 'none'); + } + if (data.type == 1) { - if (data.id_custom_graph > 0) { - $("input[name='radio_choice'][value='custom_graph']") - .prop('checked', true); - $("input[name='radio_choice']").trigger('change'); - // $("#custom_graph option[value=" + data.id_custom_graph + "]") - // .prop("selected", true); - } - else { + if (data.id_custom_graph == 0) { $("input[name='radio_choice'][value='module_graph']") .prop('checked', true); $("input[name='radio_choice']").trigger('change'); + + + } + else { + + $("input[name='radio_choice'][value='custom_graph']") + .prop('checked', true); + $("input[name='radio_choice']").trigger('change'); + + $("#custom_graph option[value=" + data.id_custom_graph + "]").prop("selected", true); + } } if (typeof(enterprise_loadFieldsFromDB) == 'function') { enterprise_loadFieldsFromDB(data); } - + $("#loading_in_progress_dialog").dialog("close"); } }); } + + function setAspectRatioBackground(side) { toggle_item_palette(); @@ -1077,10 +1312,6 @@ function hiddenFields(item) { $("#line_case").css('display', 'none'); $("#line_case." + item).css('display', ''); - - - - $("input[name='radio_choice']").trigger('change'); if (typeof(enterprise_hiddenFields) == 'function') { @@ -1181,6 +1412,15 @@ function set_static_graph_status(idElement, image, status) { data: parameter, success: function (data) { set_static_graph_status(idElement, image, data); + + if($('#'+idElement+' table').css('float') == 'right' || $('#'+idElement+ ' table').css('float') == 'left'){ + $('#'+idElement+ ' img').css('margin-top', parseInt($('#'+idElement).css('height'))/2 - parseInt($('#'+idElement+ ' img').css('height'))/2); + } + else{ + $('#'+idElement+ ' img').css('margin-left',parseInt($('#'+idElement).css('width'))/2 - parseInt($('#'+idElement+ ' img').css('width'))/2); + } + + } }); @@ -1298,14 +1538,34 @@ function setModuleGraph(id_data) { else { if($("#module_row").css('display')!='none'){ $("#" + id_data + " img").attr('src', 'images/console/signes/module_graph.png'); - $("#" + id_data + " img").css('width', $('#text-width_module_graph').val()+'px'); - $("#" + id_data + " img").css('height', $('#text-height_module_graph').val()+'px'); + if($('#text-width_module_graph').val() == 0 || $('#text-height_module_graph').val() == 0){ + $("#" + id_data + " img").css('width', '300px'); + $("#" + id_data + " img").css('height', '180px'); + } + else{ + $("#" + id_data + " img").css('width', $('#text-width_module_graph').val()+'px'); + $("#" + id_data + " img").css('height', $('#text-height_module_graph').val()+'px'); + } }else{ $("#" + id_data + " img").attr('src', 'images/console/signes/custom_graph.png'); - $("#" + id_data + " img").css('width', $('#text-width_module_graph').val()+'px'); - $("#" + id_data + " img").css('height', $('#text-height_module_graph').val()+'px'); + if($('#text-width_module_graph').val() == 0 || $('#text-height_module_graph').val() == 0){ + $("#" + id_data + " img").css('width', '300px'); + $("#" + id_data + " img").css('height', '180px'); + } + else{ + $("#" + id_data + " img").css('width', $('#text-width_module_graph').val()+'px'); + $("#" + id_data + " img").css('height', $('#text-height_module_graph').val()+'px'); + } } } + + if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){ + $('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2); + } + else{ + $('#'+id_data+ ' img').css('margin-left',parseInt($('#'+id_data).css('width'))/2 - parseInt($('#'+id_data+ ' img').css('width'))/2); + } + } }); } @@ -1332,8 +1592,9 @@ function setModuleValue(id_data, process_simple_value, period) { dataType: 'json', success: function (data) { var currentValue = $("#text_" + id_data).html(); - currentValue = currentValue.replace(/_VALUE_/gi, data.value); - $("#text_" + id_data).html('Data value'); + //currentValue = currentValue.replace(/_VALUE_/gi, data.value); + $("#text_" + id_data).html(currentValue); + //$("#text_" + id_data).html('Data value'); } }); } @@ -1364,8 +1625,8 @@ function setPercentileBar(id_data, values) { dataType: 'json', success: function (data) { module_value = data['value']; - //max_percentile = data['max_percentile']; - //width_percentile = data['width_percentile']; + max_percentile = data['max_percentile']; + width_percentile = data['width_percentile']; unit_text = false; if ((data['unit_text'] != false) || typeof(data['unit_text']) != 'boolean') { @@ -1393,8 +1654,24 @@ function setPercentileBar(id_data, values) { $("#"+ id_data).attr('src', img); $("#" + id_data + " img").attr('src', 'images/console/signes/percentil.png'); + if($('#text-width_percentile').val() == 0){ + $("#" + id_data + " img").css('width', '130px'); + } + else{ $("#" + id_data + " img").css('width', $('#text-width_percentile').val()+'px'); + } + $("#" + id_data + " img").css('height', '30px'); + + + if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){ + $('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2); + } + else{ + $('#'+id_data+ ' img').css('margin-left',parseInt($('#'+id_data).css('width'))/2 - parseInt($('#'+id_data+ ' img').css('width'))/2); + } + + } }); } @@ -1425,8 +1702,8 @@ function setPercentileBubble(id_data, values) { dataType: 'json', success: function (data) { module_value = data['value']; - //max_percentile = data['max_percentile']; - //width_percentile = data['width_percentile']; + max_percentile = data['max_percentile']; + width_percentile = data['width_percentile']; unit_text = false if ((data['unit_text'] != false) || typeof(data['unit_text']) != 'boolean') unit_text = data['unit_text']; @@ -1451,8 +1728,23 @@ function setPercentileBubble(id_data, values) { $("#image_" + id_data).attr('src', img); $("#" + id_data + " img").attr('src', 'images/console/signes/percentil_bubble.png'); + + + if($('#text-width_percentile').val() == 0){ + $("#" + id_data + " img").css('width', '130px'); + $("#" + id_data + " img").css('height', '130px'); + } + else{ $("#" + id_data + " img").css('width', $('#text-width_percentile').val()+'px'); $("#" + id_data + " img").css('height', $('#text-width_percentile').val()+'px'); + } + + if($('#'+id_data+' table').css('float') == 'right' || $('#'+id_data+ ' table').css('float') == 'left'){ + $('#'+id_data+ ' img').css('margin-top', parseInt($('#'+id_data).css('height'))/2 - parseInt($('#'+id_data+ ' img').css('height'))/2); + } + else{ + $('#'+id_data+ ' img').css('margin-left',parseInt($('#'+id_data).css('width'))/2 - parseInt($('#'+id_data+ ' img').css('width'))/2); + } } }); @@ -1522,29 +1814,59 @@ function createItem(type, values, id_data) { switch (type) { case 'box_item': - item = $('
' - + '
' + + if(values['width_box'] == 0 || values['height_box'] == 0){ + item = $('
' + + '
' + + '
' + '
' - + '
' - + '' - ); + + '' + ); + } + else{ + item = $('
' + + '
' + + '
' + + '
' + + '' + ); + } + + break; case 'group_item': case 'static_graph': @@ -1562,24 +1884,42 @@ function createItem(type, values, id_data) { item = $('
') .attr('id', id_data) .attr('class', 'item ' + class_type) - .css('text-align', 'center') + .css('text-align', 'left') .css('position', 'absolute') .css('display', 'inline-block') .css('top', values['top'] + 'px') .css('left', values['left'] + 'px'); - if ((values['width'] == 0) && (values['height'] == 0)) { - // Do none + + + + if(values['label_position'] == 'left'){ + + var $image = $('') + .attr('id', 'image_' + id_data) + .attr('class', 'image') + .attr('src', img_src) + .attr('style','float:right;'); + } - else { - item.css('width','70' + 'px') - .css('height', '70' + 'px'); + else if(values['label_position'] == 'right'){ + + var $image = $('') + .attr('id', 'image_' + id_data) + .attr('class', 'image') + .attr('src', img_src) + .attr('style','float:left;'); + } - - var $image = $('') - .attr('id', 'image_' + id_data) - .attr('class', 'image') - .attr('src', img_src); - if ((values['width'] == 0) && (values['height'] == 0)) { + else{ + + var $image = $('') + .attr('id', 'image_' + id_data) + .attr('class', 'image') + .attr('src', img_src); + + } + + if ((values['width'] == 0) || (values['height'] == 0)) { // Do none $image.attr('width', '70') .attr('height', '70'); @@ -1588,23 +1928,63 @@ function createItem(type, values, id_data) { $image.attr('width', values['width']) .attr('height', values['height']); } - +/* var $span = $('') .attr('id', 'text_' + id_data) .attr('class', 'text') .append(values['label']); - + +*/ var $input = $('') .attr('id', 'hidden-status_' + id_data) .attr('type', 'hidden') .attr('value', -1) .attr('name', 'status_' + id_data); + if(values['label_position'] == 'up'){ item + .append('
'+values['label']+'
') .append($image) .append($image) - .append($span) .append($input); + + } + else if(values['label_position'] == 'down'){ + item + .append($image) + .append($image) + .append('
'+values['label']+'
') + .append($input); + } + else if(values['label_position'] == 'left'){ + + if(values['height'] == 0){ + item + .append('
'+values['label']+'
'); + } + else{ + item + .append('
'+values['label']+'
') + } + item + .append($image) + .append($image) + .append($input); + } + else if(values['label_position'] == 'right'){ + if(values['height'] == 0){ + item + .append('
'+values['label']+'
'); + } + else{ + item + .append('
'+values['label']+'
') + } + item + .append($image) + .append($image) + .append($input); + } set_static_graph_status(id_data, values['image']); @@ -1615,21 +1995,72 @@ function createItem(type, values, id_data) { var imageSize = ''; if (values['type_percentile'] == 'percentile') { - item = $('
' + - '' + values['label'] + '
' + - '' + - '
' - ); - + + if(values['label_position'] == 'up'){ + item = $('
' + + '
' + values['label'] + '
' + + '' + + '
' + ); + } + else if(values['label_position'] == 'down'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + + } + else if(values['label_position'] == 'right'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + + } + else if(values['label_position'] == 'left'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + + } + setPercentileBar(id_data, values); } else { - item = $('
' + - '' + values['label'] + '
' + - '' + - '
' - ); - + + + if(values['label_position'] == 'up'){ + item = $('
' + + '
' + values['label'] + '
' + + '' + + '
' + ); + } + else if(values['label_position'] == 'down'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + } + else if(values['label_position'] == 'left'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + } + else if(values['label_position'] == 'right'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + } setPercentileBubble(id_data, values); } break; @@ -1637,11 +2068,36 @@ function createItem(type, values, id_data) { sizeStyle = ''; imageSize = ''; - item = $('
' + - '' + values['label'] + '
' + - '' + - '
' - ); + if(values['label_position'] == 'up'){ + item = $('
' + + '
' + values['label'] + '
' + + '' + + '
' + ); + } + else if(values['label_position'] == 'down'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + } + else if(values['label_position'] == 'left'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + } + else if(values['label_position'] == 'right'){ + item = $('
' + + '' + + '
' + values['label'] + '
' + + '
' + ); + } + + setModuleGraph(id_data); break; case 'simple_value': @@ -1664,7 +2120,7 @@ function createItem(type, values, id_data) { ); break; case 'icon': - if ((values['width'] == 0) && (values['height'] == 0)) { + if ((values['width'] == 0) || (values['height'] == 0)) { sizeStyle = 'width: ' + '70' + 'px; height: ' + '70' + 'px;'; imageSize = 'width="' + '70' + '" height="' + '70' + '"'; } @@ -1673,7 +2129,7 @@ function createItem(type, values, id_data) { imageSize = 'width="' + values['width'] + '" height="' + values['height'] + '"'; } - item = $('
' + + item = $('
' + '
' + '
' ); @@ -1688,6 +2144,7 @@ function createItem(type, values, id_data) { if (temp_item != false) { item = temp_item; } + $('#'+id_data).css({'width':'','height':''}); } break; } @@ -1708,6 +2165,15 @@ function createItem(type, values, id_data) { refresh_lines(lines, 'background', true); } + + + if(values['label_position'] == 'right'){ + $('#text_'+id_data).css({'display':'block','float':'right'}); + } + else if(values['label_position'] == 'left'){ + $('#text_'+id_data).css({'display':'block','float':'left'}); + } + } function addItemSelectParents(id_data, text) { @@ -1774,7 +2240,7 @@ function insertDB(type, values) { // Draw handler start item = $('
'; } else { - echo '
'; + echo '
'; } -echo '
'; +echo '
'; echo "