From aba2ef509a2da8a16862a7f6bb1530ca06170131 Mon Sep 17 00:00:00 2001 From: samucarc Date: Wed, 13 Mar 2019 11:58:21 +0100 Subject: [PATCH 001/123] Fixed messages count Former-commit-id: df7b230fe009e6f73d836cf2290f33deb8a743d9 --- pandora_console/include/functions_messages.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_messages.php b/pandora_console/include/functions_messages.php index 5374fb7b1e..63c12d019d 100644 --- a/pandora_console/include/functions_messages.php +++ b/pandora_console/include/functions_messages.php @@ -383,7 +383,7 @@ function messages_get_count( } $sql = sprintf( - 'SELECT count(*) as "n" FROM ( + 'SELECT count(distinct id_mensaje) as "n" FROM ( SELECT tm.*, utimestamp_read > 0 as "read" From 1a01c311d6e0d208a98177371d3fb65a8a7fd88e Mon Sep 17 00:00:00 2001 From: samucarc Date: Wed, 20 Mar 2019 18:30:52 +0100 Subject: [PATCH 002/123] Fixed down paginations in manage agents Former-commit-id: 28f7546b2d0cc8f4e1d13763e9c92ac99c2de2f9 --- pandora_console/godmode/agentes/modificar_agente.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/agentes/modificar_agente.php b/pandora_console/godmode/agentes/modificar_agente.php index 4673bf2f46..82078fc109 100644 --- a/pandora_console/godmode/agentes/modificar_agente.php +++ b/pandora_console/godmode/agentes/modificar_agente.php @@ -670,7 +670,7 @@ if ($agents !== false) { } echo ''; - ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset); + ui_pagination($total_agents, "index.php?sec=gagente&sec2=godmode/agentes/modificar_agente&group_id=$ag_group&recursion=$recursion&search=$search&sort_field=$sortField&sort=$sort&disabled=$disabled&os=$os", $offset); echo "
"; } else { ui_print_info_message(['no_close' => true, 'message' => __('There are no defined agents') ]); From 8d8b856864d5291bef6421dbc7eae37e06ac5725 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Fri, 22 Mar 2019 14:03:38 +0100 Subject: [PATCH 003/123] Fixed create from bug: added action with refresh url Former-commit-id: b63f6e6f9169a35d9dcb9cfd078c35fd4deafdac --- pandora_console/godmode/modules/manage_nc_groups.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/modules/manage_nc_groups.php b/pandora_console/godmode/modules/manage_nc_groups.php index 5fddce35f4..6ef4eb0cd9 100644 --- a/pandora_console/godmode/modules/manage_nc_groups.php +++ b/pandora_console/godmode/modules/manage_nc_groups.php @@ -265,7 +265,7 @@ if (isset($data)) { } -echo '
'; +echo ''; echo '
'; html_print_input_hidden('new', 1); html_print_submit_button(__('Create'), 'crt', false, 'class="sub next"'); From 9c3d26f12030f683f8e7e32a13fe3aafd819ec22 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Wed, 3 Apr 2019 11:22:20 +0200 Subject: [PATCH 004/123] Deleted Servers menu option for operator(read) Former-commit-id: 89723d23cb2199152cfc9f3d72997ddcd7b31796 --- pandora_console/godmode/menu.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/menu.php b/pandora_console/godmode/menu.php index ac3154b657..6224d361c9 100644 --- a/pandora_console/godmode/menu.php +++ b/pandora_console/godmode/menu.php @@ -208,7 +208,7 @@ if (!empty($sub)) { } -if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM') || check_acl($config['id_user'], 0, 'RR')) { +if (check_acl($config['id_user'], 0, 'AW') || check_acl($config['id_user'], 0, 'PM')) { // Servers $menu_godmode['gservers']['text'] = __('Servers'); $menu_godmode['gservers']['sec2'] = 'godmode/servers/modificar_server'; From 9df4cb86dc496c8aecd56be96f785695da16b25d Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Thu, 4 Apr 2019 09:45:29 +0200 Subject: [PATCH 005/123] Added inline-block and fixed size to label Former-commit-id: 40c1ca6d5c06fb771eb7e8d1ac81dde6e7012cfb --- pandora_console/include/styles/login.css | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pandora_console/include/styles/login.css b/pandora_console/include/styles/login.css index bffcda19d5..648eadb503 100644 --- a/pandora_console/include/styles/login.css +++ b/pandora_console/include/styles/login.css @@ -407,6 +407,8 @@ div.form_message_alert ul li input { } div.form_message_alert ul li label { + display: inline-block; + width: 145px; font-size: 10pt; padding-right: 20px; } From 1b6a01cfd5ac0f97266abd35471788ef32cca8fb Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Thu, 4 Apr 2019 14:11:44 +0200 Subject: [PATCH 006/123] Changed modal size to fit err. msg Former-commit-id: 2676ac1d217cc5245ce09277b8b76d1d562cdf5f --- .../include/javascript/jquery.pandora.js | 697 +++++++++--------- 1 file changed, 358 insertions(+), 339 deletions(-) diff --git a/pandora_console/include/javascript/jquery.pandora.js b/pandora_console/include/javascript/jquery.pandora.js index 9e0b3447af..ed75400386 100644 --- a/pandora_console/include/javascript/jquery.pandora.js +++ b/pandora_console/include/javascript/jquery.pandora.js @@ -1,386 +1,405 @@ (function($) { - $.fn.check = function () { - return this.each (function () { - this.checked = true; - });}; + $.fn.check = function() { + return this.each(function() { + this.checked = true; + }); + }; - $.fn.uncheck = function () { - return this.each (function () { - this.checked = false; - });}; + $.fn.uncheck = function() { + return this.each(function() { + this.checked = false; + }); + }; - $.fn.enable = function () { - return $(this).removeAttr ("disabled"); - }; + $.fn.enable = function() { + return $(this).removeAttr("disabled"); + }; - $.fn.disable = function () { - return $(this).attr ("disabled", "disabled"); - }; + $.fn.disable = function() { + return $(this).attr("disabled", "disabled"); + }; - $.fn.pulsate = function () { - var i = 0; - for (i = 0; i <= 2; i++) { - $(this).fadeOut ("slow").fadeIn ("slow"); - } - }; + $.fn.pulsate = function() { + var i = 0; + for (i = 0; i <= 2; i++) { + $(this) + .fadeOut("slow") + .fadeIn("slow"); + } + }; - $.fn.showMessage = function (msg) { - return $(this).hide ().empty () - // here, previously .text (msg) - .html (msg) - .slideDown (); - }; -}) (jQuery); + $.fn.showMessage = function(msg) { + return ( + $(this) + .hide() + .empty() + // here, previously .text (msg) + .html(msg) + .slideDown() + ); + }; +})(jQuery); -$(document).ready (function () { - $("a#show_messages_dialog").click (function () { - jQuery.post ("ajax.php", - { - "page": "operation/messages/message_list" - }, - function (data, status) { - $("#dialog_messages").hide () - .empty () - .append (data) - .dialog ({ - title: $("a#show_messages_dialog").attr ("title"), - resizable: false, - modal: true, - overlay: { - opacity: 0.5, - background: "black" - }, - width: 700, - height: 300 - }).show (); - }, - "html" - ); +$(document).ready(function() { + $("a#show_messages_dialog").click(function() { + jQuery.post( + "ajax.php", + { + page: "operation/messages/message_list" + }, + function(data, status) { + $("#dialog_messages") + .hide() + .empty() + .append(data) + .dialog({ + title: $("a#show_messages_dialog").attr("title"), + resizable: false, + modal: true, + overlay: { + opacity: 0.5, + background: "black" + }, + width: 700, + height: 300 + }) + .show(); + }, + "html" + ); - return false; - }); + return false; + }); - $("a.show_systemalert_dialog").click (function () { - $('body').append( "
" ); - $("#opacidad").css('opacity', 0.5); + $("a.show_systemalert_dialog").click(function() { + $("body").append( + "
" + ); + $("#opacidad").css("opacity", 0.5); - jQuery.post ("ajax.php", - { - "page": "operation/system_alert"}, - function (data, status) { - $("#alert_messages").show(); - $("#alert_messages").empty ().append (data); - $("#alert_messages").css('opacity', 1); + jQuery.post( + "ajax.php", + { + page: "operation/system_alert" + }, + function(data, status) { + $("#alert_messages").show(); + $("#alert_messages") + .empty() + .append(data); + $("#alert_messages").css("opacity", 1); + }, + "html" + ); + }); - }, - "html" - ); - }); - - $("a.modalpopup").click (function () { - var elem = $(this).attr("id"); - $('body').append( "
" ); - $("#opacidad").css('opacity', 0.5); + $("a.modalpopup").click(function() { + var elem = $(this).attr("id"); + $("body").append( + "
" + ); + $("#opacidad").css("opacity", 0.5); - jQuery.post ("ajax.php", - { - "page": "general/alert_enterprise", - "message": elem - }, - function (data, status) { - $("#alert_messages").show(); - $("#alert_messages").empty ().append (data); - $("#alert_messages").css('opacity', 1); - }, - "html" - ); - return false; - }); + jQuery.post( + "ajax.php", + { + page: "general/alert_enterprise", + message: elem + }, + function(data, status) { + $("#alert_messages").show(); + $("#alert_messages") + .empty() + .append(data); + $("#alert_messages").css("opacity", 1); + }, + "html" + ); + return false; + }); - // Creacion de ventana modal y botones - $(".publienterprise").click (function () { - var elem = $(this).attr("id"); - $('body').append( "
" ); - $("#opacidad").css('opacity', 0.5); + // Creacion de ventana modal y botones + $(".publienterprise").click(function() { + var elem = $(this).attr("id"); + $("body").append( + "
" + ); + $("#opacidad").css("opacity", 0.5); - jQuery.post ("ajax.php", - { - "page": "general/alert_enterprise", - "message": elem - }, - function (data, status) { - $("#alert_messages").show(); - $("#alert_messages").empty ().append (data); - $("#alert_messages").css('opacity', 1); - }, - "html" - ); - return false; - }); - - - $(".publienterprisehide").click (function () { - var elem = $(this).attr("id"); - $('body').append( "
" ); - $("#opacidad").css('opacity', 0.5); + jQuery.post( + "ajax.php", + { + page: "general/alert_enterprise", + message: elem + }, + function(data, status) { + $("#alert_messages").show(); + $("#alert_messages") + .empty() + .append(data); + $("#alert_messages").css("opacity", 1); + }, + "html" + ); + return false; + }); - jQuery.post ("ajax.php", - { - "page": "general/alert_enterprise", - "message": elem - }, - function (data, status) { - $("#alert_messages").show(); - $("#alert_messages").empty ().append (data); - $("#alert_messages").css('opacity', 1); - }, - "html" - ); - return false; - }); + $(".publienterprisehide").click(function() { + var elem = $(this).attr("id"); + $("body").append( + "
" + ); + $("#opacidad").css("opacity", 0.5); + jQuery.post( + "ajax.php", + { + page: "general/alert_enterprise", + message: elem + }, + function(data, status) { + $("#alert_messages").show(); + $("#alert_messages") + .empty() + .append(data); + $("#alert_messages").css("opacity", 1); + }, + "html" + ); + return false; + }); + if ($("#license_error_msg_dialog").length) { + if (typeof process_login_ok == "undefined") process_login_ok = 0; - if ($('#license_error_msg_dialog').length) { - if (typeof(process_login_ok) == "undefined") - process_login_ok = 0; + if (typeof show_error_license == "undefined") show_error_license = 0; - if (typeof(show_error_license) == "undefined") - show_error_license = 0; + if (process_login_ok || show_error_license) { + $("#license_error_msg_dialog").dialog({ + dialogClass: "no-close", + closeOnEscape: false, + resizable: false, + draggable: true, + modal: true, + height: 470, + width: 850, + overlay: { + opacity: 0.5, + background: "black" + }, + open: function() { + var remaining = 30; - if (process_login_ok || show_error_license) { + // Timeout counter. + var count = function() { + if (remaining > 0) { + $("#license_error_remaining").text(remaining); + remaining -= 1; + } else { + $("#license_error_remaining").hide(); + $("#ok_buttom").show(); + clearInterval(count); + } + }; - $( "#license_error_msg_dialog" ).dialog({ - dialogClass: "no-close", - closeOnEscape: false, - resizable: false, - draggable: true, - modal: true, - height: 450, - width: 850, - overlay: { - opacity: 0.5, - background: "black" - }, - open: function() { - var remaining = 30; + setInterval(count, 1000); + } + }); - // Timeout counter. - var count = function() { - if (remaining > 0) { - $("#license_error_remaining").text(remaining); - remaining -= 1; - } else { - $("#license_error_remaining").hide(); - $("#ok_buttom").show(); - clearInterval(count); - } - } + $("#submit-hide-license-error-msg").click(function() { + $("#license_error_msg_dialog").dialog("close"); + }); + } + } - setInterval(count, 1000); - } - }); + if ($("#msg_change_password").length) { + $("#msg_change_password").dialog({ + resizable: false, + draggable: true, + modal: true, + height: 450, + width: 620, + overlay: { + opacity: 0.5, + background: "black" + } + }); + } - $("#submit-hide-license-error-msg").click (function () { - $("#license_error_msg_dialog" ).dialog('close') - }); + if ($("#login_blocked").length) { + $("#login_blocked").dialog({ + resizable: true, + draggable: true, + modal: true, + height: 200, + width: 520, + overlay: { + opacity: 0.5, + background: "black" + } + }); + } - } - } + if ($("#login_correct_pass").length) { + $("#login_correct_pass").dialog({ + resizable: true, + draggable: true, + modal: true, + height: 200, + width: 520, + overlay: { + opacity: 0.5, + background: "black" + } + }); + } + forced_title_callback(); - if ($('#msg_change_password').length) { + $(document).on("scroll", function() { + if ( + document.documentElement.scrollTop != 0 || + document.body.scrollTop != 0 + ) { + if ($("#head").css("position") == "fixed") { + if ($("#menu").css("position") == "fixed") { + $("#menu").css("top", "80px"); + } else { + $("#menu").css("top", "60px"); + } + } else { + if ($("#menu").css("position") == "fixed") { + $("#menu").css("top", "20px"); + } else { + $("#menu").css("top", "80px"); + } + } + } else { + if ($("#head").css("position") == "fixed") { + if ($("#menu").css("position") == "fixed") { + $("#menu").css("top", "80px"); + } else { + $("#menu").css("top", "60px"); + } + } else { + if ($("#menu").css("position") == "fixed") { + $("#menu").css("top", "80px"); + } else { + $("#menu").css("top", "80px"); + } + } + } - $( "#msg_change_password" ).dialog({ - resizable: false, - draggable: true, - modal: true, - height: 350, - width: 620, - overlay: { - opacity: 0.5, - background: "black" - } - }); + // if((document.documentElement.scrollTop != 0 || document.body.scrollTop != 0) && $('#menu').css('position') =='fixed'){ + // if($('#head').css('position') =='fixed'){ + // $('#menu').css('top','80px'); + // } + // else{ + // $('#menu').css('top','20px'); + // } + // } + // else{ + // if($('#head').css('position') =='fixed'){ + // if(document.documentElement.scrollTop != 0 || document.body.scrollTop != 0){ + // $('#menu').css('top','60px'); + // }else{ + // $('#menu').css('top','80px'); + // } + // + // } + // else{ + // $('#menu').css('top','60px'); + // } + // } + }); - } - - if ($('#login_blocked').length) { - - $( "#login_blocked" ).dialog({ - resizable: true, - draggable: true, - modal: true, - height: 200, - width: 520, - overlay: { - opacity: 0.5, - background: "black" - } - }); - - } - - if ($('#login_correct_pass').length) { - - $( "#login_correct_pass" ).dialog({ - resizable: true, - draggable: true, - modal: true, - height: 200, - width: 520, - overlay: { - opacity: 0.5, - background: "black" - } - }); - - } - - forced_title_callback(); - - - $(document).on("scroll", function(){ - - if(document.documentElement.scrollTop != 0 || document.body.scrollTop != 0){ - if($('#head').css('position') =='fixed'){ - if($('#menu').css('position') =='fixed'){ - $('#menu').css('top','80px'); - } else { - $('#menu').css('top','60px'); - } - } else { - if($('#menu').css('position') =='fixed'){ - $('#menu').css('top','20px'); - } else { - $('#menu').css('top','80px'); - } - } - } else { - if($('#head').css('position') =='fixed'){ - if($('#menu').css('position') =='fixed'){ - $('#menu').css('top','80px'); - } else { - $('#menu').css('top','60px'); - } - } else { - if($('#menu').css('position') =='fixed'){ - $('#menu').css('top','80px'); - } else { - $('#menu').css('top','80px'); - } - } - } - - // if((document.documentElement.scrollTop != 0 || document.body.scrollTop != 0) && $('#menu').css('position') =='fixed'){ - // if($('#head').css('position') =='fixed'){ - // $('#menu').css('top','80px'); - // } - // else{ - // $('#menu').css('top','20px'); - // } - // } - // else{ - // if($('#head').css('position') =='fixed'){ - // if(document.documentElement.scrollTop != 0 || document.body.scrollTop != 0){ - // $('#menu').css('top','60px'); - // }else{ - // $('#menu').css('top','80px'); - // } - // - // } - // else{ - // $('#menu').css('top','60px'); - // } - // } - }); - - $("#alert_messages").draggable(); - $("#alert_messages").css({'left':+parseInt(screen.width/2)-parseInt($("#alert_messages").css('width'))/2+'px'}); - + $("#alert_messages").draggable(); + $("#alert_messages").css({ + left: + +parseInt(screen.width / 2) - + parseInt($("#alert_messages").css("width")) / 2 + + "px" + }); }); - - - function forced_title_callback() { - // Forced title code - $('body').on('mouseenter', '.forced_title', function() { - /////////////////////////////////////////// - // Put the layer in the left-top corner to fill it - /////////////////////////////////////////// - $('#forced_title_layer').css('left', 0); - $('#forced_title_layer').css('top', 0); + // Forced title code + $("body").on("mouseenter", ".forced_title", function() { + /////////////////////////////////////////// + // Put the layer in the left-top corner to fill it + /////////////////////////////////////////// + $("#forced_title_layer").css("left", 0); + $("#forced_title_layer").css("top", 0); - /////////////////////////////////////////// - // Get info of the image - /////////////////////////////////////////// + /////////////////////////////////////////// + // Get info of the image + /////////////////////////////////////////// - var img_top = $(this).offset().top; - var img_width = $(this).width(); - var img_height = $(this).height(); - var img_id = $(this).attr('id'); - var img_left_mid = $(this).offset().left + (img_width / 2); + var img_top = $(this).offset().top; + var img_width = $(this).width(); + var img_height = $(this).height(); + var img_id = $(this).attr("id"); + var img_left_mid = $(this).offset().left + img_width / 2; - /////////////////////////////////////////// - // Put title in the layer - /////////////////////////////////////////// + /////////////////////////////////////////// + // Put title in the layer + /////////////////////////////////////////// - // If the '.forced_title' element has 'use_title_for_force_title' = 1 - // into their 'data' prop, the element title will be used for the - // content. - if ($(this).data("use_title_for_force_title")) { - var title = $(this).data("title"); - } - else { - var title = $('#forced_title_'+img_id).html(); - } + // If the '.forced_title' element has 'use_title_for_force_title' = 1 + // into their 'data' prop, the element title will be used for the + // content. + if ($(this).data("use_title_for_force_title")) { + var title = $(this).data("title"); + } else { + var title = $("#forced_title_" + img_id).html(); + } - $('#forced_title_layer').html(title); + $("#forced_title_layer").html(title); - /////////////////////////////////////////// - // Get info of the layer - /////////////////////////////////////////// + /////////////////////////////////////////// + // Get info of the layer + /////////////////////////////////////////// - var layer_width = $('#forced_title_layer').width(); - var layer_height = $('#forced_title_layer').height(); + var layer_width = $("#forced_title_layer").width(); + var layer_height = $("#forced_title_layer").height(); - /////////////////////////////////////////// - // Obtain the new position of the layer - /////////////////////////////////////////// + /////////////////////////////////////////// + // Obtain the new position of the layer + /////////////////////////////////////////// - // Jquery doesnt know the padding of the layer - var layer_padding = 4; + // Jquery doesnt know the padding of the layer + var layer_padding = 4; - // Deduct padding of both sides - var layer_top = img_top - layer_height - (layer_padding * 2) - 5; - if (layer_top < 0) { - layer_top = img_top + img_height + (layer_padding * 2); - } + // Deduct padding of both sides + var layer_top = img_top - layer_height - layer_padding * 2 - 5; + if (layer_top < 0) { + layer_top = img_top + img_height + layer_padding * 2; + } - // Deduct padding of one side - var layer_left = img_left_mid - (layer_width / 2) - layer_padding; - if (layer_left < 0) { - layer_left = 0; - } + // Deduct padding of one side + var layer_left = img_left_mid - layer_width / 2 - layer_padding; + if (layer_left < 0) { + layer_left = 0; + } - var real_layer_width = layer_width + (layer_padding * 2) + 5; - var layer_right = layer_left + real_layer_width; - var screen_width = $(window).width(); - if (screen_width < layer_right) { - layer_left = screen_width - real_layer_width; - } + var real_layer_width = layer_width + layer_padding * 2 + 5; + var layer_right = layer_left + real_layer_width; + var screen_width = $(window).width(); + if (screen_width < layer_right) { + layer_left = screen_width - real_layer_width; + } - /////////////////////////////////////////// - // Set the layer position and show - /////////////////////////////////////////// + /////////////////////////////////////////// + // Set the layer position and show + /////////////////////////////////////////// - $('#forced_title_layer').css('left', layer_left); - $('#forced_title_layer').css('top', layer_top); - $('#forced_title_layer').show(); - }); - $('body').on('mouseout', '.forced_title', function () { - $('#forced_title_layer').hide().empty(); - }); + $("#forced_title_layer").css("left", layer_left); + $("#forced_title_layer").css("top", layer_top); + $("#forced_title_layer").show(); + }); + $("body").on("mouseout", ".forced_title", function() { + $("#forced_title_layer") + .hide() + .empty(); + }); } - From 5998b30a161d95cac697f43084e17f405ea2d7b3 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Wed, 10 Apr 2019 17:30:35 +0200 Subject: [PATCH 007/123] Added css hint to discovery tasks when task list is empty Former-commit-id: 1da71cda1b1ed376bb6bae0281b0dd882dbfbeff --- pandora_console/general/firts_task/recon_view.php | 1 + pandora_console/godmode/servers/discovery.php | 5 +++++ pandora_console/include/styles/discovery-hint.css | 10 ++++++++++ 3 files changed, 16 insertions(+) create mode 100644 pandora_console/include/styles/discovery-hint.css diff --git a/pandora_console/general/firts_task/recon_view.php b/pandora_console/general/firts_task/recon_view.php index 282a6b75be..8c59b23f64 100755 --- a/pandora_console/general/firts_task/recon_view.php +++ b/pandora_console/general/firts_task/recon_view.php @@ -35,6 +35,7 @@ ui_require_css_file('firts_task');

+
diff --git a/pandora_console/godmode/servers/discovery.php b/pandora_console/godmode/servers/discovery.php index d9e19abdff..e20588b97d 100755 --- a/pandora_console/godmode/servers/discovery.php +++ b/pandora_console/godmode/servers/discovery.php @@ -130,5 +130,10 @@ if ($classname_selected === null) { } } + // Show hints if there is no task + if (get_parameter('discovery_hint', 0)) { + ui_require_css_file('discovery-hint'); + } + Wizard::printBigButtonsList($wiz_data); } diff --git a/pandora_console/include/styles/discovery-hint.css b/pandora_console/include/styles/discovery-hint.css new file mode 100644 index 0000000000..8247b26c96 --- /dev/null +++ b/pandora_console/include/styles/discovery-hint.css @@ -0,0 +1,10 @@ +/* + * Discovery show help css + */ +li.discovery:not(:first-child) > a:hover { + color: #000; +} + +li.discovery:not(:first-child) div.data_container:not(:hover) { + box-shadow: 2px 2px 10px #80ba27; +} From 6276936e1d30fffe29cb4e2e0fa1122e0d7d247e Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Wed, 10 Apr 2019 17:51:50 +0200 Subject: [PATCH 008/123] Added info message Former-commit-id: 11f4c9c8b52f6ef3bed2236534010f2caa3bb8e0 --- pandora_console/godmode/servers/discovery.php | 1 + 1 file changed, 1 insertion(+) diff --git a/pandora_console/godmode/servers/discovery.php b/pandora_console/godmode/servers/discovery.php index e20588b97d..a2c0abd5d6 100755 --- a/pandora_console/godmode/servers/discovery.php +++ b/pandora_console/godmode/servers/discovery.php @@ -133,6 +133,7 @@ if ($classname_selected === null) { // Show hints if there is no task if (get_parameter('discovery_hint', 0)) { ui_require_css_file('discovery-hint'); + ui_print_info_message(__('You must create a task first')); } Wizard::printBigButtonsList($wiz_data); From 553ec48f5451a331f33e292ee37ff14bbe88bc57 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Mon, 15 Apr 2019 15:21:07 +0200 Subject: [PATCH 009/123] changed title plugin creation to plugin registration Former-commit-id: bd5ee299d91c52d3064eafa85b092b525b70381a --- pandora_console/godmode/servers/plugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/godmode/servers/plugin.php b/pandora_console/godmode/servers/plugin.php index b04643e1c3..5ff8022afa 100644 --- a/pandora_console/godmode/servers/plugin.php +++ b/pandora_console/godmode/servers/plugin.php @@ -281,7 +281,7 @@ if (($create != '') || ($view != '')) { } else { if ($create != '') { ui_print_page_header( - __('Plugin creation'), + __('Plugin registration'), 'images/gm_servers.png', false, 'plugin_definition', From d5ac57064bf3deceef1c99cdcc229afe7029c480 Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Wed, 29 May 2019 11:34:23 +0200 Subject: [PATCH 010/123] Condition is added to keep the selection color in the main menu --- pandora_console/include/functions_menu.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandora_console/include/functions_menu.php b/pandora_console/include/functions_menu.php index 0dbe1049bc..e26acd5cac 100644 --- a/pandora_console/include/functions_menu.php +++ b/pandora_console/include/functions_menu.php @@ -50,6 +50,12 @@ function menu_print_menu(&$menu) $sec = (string) get_parameter('sec'); $sec2 = (string) get_parameter('sec2'); + if ($sec2 == 'operation/agentes/ver_agente') { + $sec2 = 'godmode/agentes/configurar_agente'; + } else { + $sec2 = (string) get_parameter('sec2'); + } + $menu_selected = false; $allsec2 = explode('sec2=', $_SERVER['REQUEST_URI']); From 78e01d9c7dfde80a2416bfdc836824fa9d768202 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Mon, 10 Jun 2019 13:04:52 +0200 Subject: [PATCH 011/123] Added encode --- .../rest-api/models/VisualConsole/Item.php | 471 +++++++++++++++++- 1 file changed, 464 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/rest-api/models/VisualConsole/Item.php b/pandora_console/include/rest-api/models/VisualConsole/Item.php index 617b48e517..ebb6fd10f0 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Item.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Item.php @@ -240,7 +240,7 @@ class Item extends CachedModel private static function extractX(array $data): int { return static::parseIntOr( - static::issetInArray($data, ['x', 'pos_x']), + static::issetInArray($data, ['x', 'pos_x', 'posX']), 0 ); } @@ -256,7 +256,7 @@ class Item extends CachedModel private static function extractY(array $data): int { return static::parseIntOr( - static::issetInArray($data, ['y', 'pos_y']), + static::issetInArray($data, ['y', 'pos_y', 'posY']), 0 ); } @@ -272,7 +272,7 @@ class Item extends CachedModel private static function extractAclGroupId(array $data) { return static::parseIntOr( - static::issetInArray($data, ['id_group', 'aclGroupId']), + static::issetInArray($data, ['id_group', 'aclGroupId', 'idGroup']), null ); } @@ -288,7 +288,7 @@ class Item extends CachedModel private static function extractParentId(array $data) { return static::parseIntOr( - static::issetInArray($data, ['parentId', 'parent_item']), + static::issetInArray($data, ['parentId', 'parent_item', 'parentItem']), null ); } @@ -304,7 +304,7 @@ class Item extends CachedModel private static function extractIsOnTop(array $data): bool { return static::parseBool( - static::issetInArray($data, ['isOnTop', 'show_on_top']) + static::issetInArray($data, ['isOnTop', 'show_on_top', 'showOnTop']) ); } @@ -319,7 +319,7 @@ class Item extends CachedModel private static function extractIsLinkEnabled(array $data): bool { return static::parseBool( - static::issetInArray($data, ['isLinkEnabled', 'enable_link']) + static::issetInArray($data, ['isLinkEnabled', 'enable_link', 'enableLink']) ); } @@ -376,7 +376,23 @@ class Item extends CachedModel private static function extractAgentId(array $data) { return static::parseIntOr( - static::issetInArray($data, ['agentId', 'id_agent', 'id_agente']), + static::issetInArray($data, ['agentId', 'id_agent', 'id_agente', 'idAgent', 'idAgente']), + null + ); + } + + + /** + * Extract a custom id graph value. + * + * @param array $data Unknown input data structure. + * + * @return integer Valid identifier of an agent. + */ + private static function extractIdCustomGraph(array $data) + { + return static::parseIntOr( + static::issetInArray($data, ['id_custom_graph', 'idCustomGraph', 'customGraphId']), null ); } @@ -398,6 +414,9 @@ class Item extends CachedModel 'moduleId', 'id_agente_modulo', 'id_modulo', + 'idModulo', + 'idAgenteModulo', + 'idAgentModule', ] ), null @@ -1187,4 +1206,442 @@ class Item extends CachedModel } + /** + * Return a valid representation of a record in database. + * + * @param array $data Input data. + * + * @return array Data structure representing a record in database. + */ + protected function encode(array $data): array + { + $result = []; + + $id = static::extractId($data); + if ($id) { + $result['id'] = $id; + } + + $id_layout = static::extractIdLayout($data); + if ($id_layout) { + $result['id_layout'] = $id_layout; + } + + $pos_x = static::parseIntOr( + static::issetInArray($data, ['x', 'pos_x', 'posX']), + null + ); + if ($pos_x !== null) { + $result['pos_x'] = $pos_x; + } + + $pos_y = static::parseIntOr( + static::issetInArray($data, ['y', 'pos_y', 'posY']), + null + ); + if ($pos_y !== null) { + $result['pos_y'] = $pos_y; + } + + $height = static::extractHeight($data); + if ($height !== null) { + $result['height'] = $height; + } + + $width = static::extractWidth($data); + if ($width !== null) { + $result['width'] = $width; + } + + $label = static::extractLabel($data); + if ($label !== null) { + $result['label'] = $label; + } + + $image = static::extractImageSrc($data); + if ($image !== null) { + $result['image'] = $image; + } + + $type = static::parseIntOr( + static::issetInArray($data, ['type']), + null + ); + if ($type !== null) { + $result['type'] = $type; + } + + $period = static::parseIntOr( + static::issetInArray($data, ['period']), + null + ); + if ($period !== null) { + $result['period'] = $period; + } + + $id_agente_modulo = static::extractModuleId($data); + if ($id_agente_modulo !== null) { + $result['id_agente_modulo'] = $id_agente_modulo; + } + + $id_agent = static::extractAgentId($data); + if ($id_agent !== null) { + $result['id_agent'] = $id_agent; + } + + $id_layout_linked = static::parseIntOr( + static::issetInArray($data, ['linkedLayoutId', 'id_layout_linked', 'idLayoutLinked']), + null + ); + if ($id_layout_linked !== null) { + $result['id_layout_linked'] = $id_layout_linked; + } + + $parent_item = static::extractParentId($data); + if ($parent_item !== null) { + $result['parent_item'] = $parent_item; + } + + $enable_link = static::issetInArray($data, ['isLinkEnabled', 'enable_link', 'enableLink']); + if ($enable_link !== null) { + $result['enable_link'] = static::parseBool($enable_link); + } + + $id_metaconsole = static::extractMetaconsoleId($data); + if ($id_metaconsole !== null) { + $result['id_metaconsole'] = $id_metaconsole; + } + + $id_group = static::extractAclGroupId($data); + if ($id_group !== null) { + $result['id_group'] = $id_group; + } + + $id_custom_graph = static::extractIdCustomGraph($data); + if ($id_custom_graph !== null) { + $result['id_custom_graph'] = $id_custom_graph; + } + + $border_width = static::extractBorderWidth($data); + if ($border_width !== null) { + $result['border_width'] = $border_width; + } + + $type_graph = static::extractTypeGraph($data); + if ($type_graph !== null) { + $result['type_graph'] = $type_graph; + } + + $label_position = static::notEmptyStringOr( + static::issetInArray($data, ['labelPosition', 'label_position']), + null + ); + if ($label_position !== null) { + $result['label_position'] = $label_position; + } + + $border_color = static::extractBorderColor($data); + if ($border_color !== null) { + $result['border_color'] = $border_color; + } + + $fill_color = static::extractFillColor($data); + if ($fill_color !== null) { + $result['fill_color'] = $fill_color; + } + + $show_statistics = static::issetInArray($data, ['showStatistics', 'show_statistics']); + if ($show_statistics !== null) { + $result['show_statistics'] = static::parseBool($show_statistics); + } + + $linked_layout_node_id = static::parseIntOr( + static::issetInArray( + $data, + [ + 'linkedLayoutAgentId', + 'linked_layout_node_id', + ] + ), + null + ); + if ($linked_layout_node_id !== null) { + $result['linked_layout_node_id'] = $linked_layout_node_id; + } + + $linked_layout_status_type = static::notEmptyStringOr( + static::issetInArray($data, ['linkedLayoutStatusType', 'linked_layout_status_type']), + null + ); + if ($linked_layout_status_type !== null) { + $result['linked_layout_status_type'] = $linked_layout_status_type; + } + + $id_layout_linked_weight = static::parseIntOr( + static::issetInArray($data, ['linkedLayoutStatusTypeWeight', 'id_layout_linked_weight']), + null + ); + if ($id_layout_linked_weight !== null) { + $result['id_layout_linked_weight'] = $id_layout_linked_weight; + } + + $linked_layout_status_as_service_warning = static::parseIntOr( + static::issetInArray( + $data, + [ + 'linkedLayoutStatusTypeWarningThreshold', + 'linked_layout_status_as_service_warning', + ] + ), + null + ); + if ($linked_layout_status_as_service_warning !== null) { + $result['linked_layout_status_as_service_warning'] = $linked_layout_status_as_service_warning; + } + + $linked_layout_status_as_service_critical = static::parseIntOr( + static::issetInArray( + $data, + [ + 'linkedLayoutStatusTypeCriticalThreshold', + 'linked_layout_status_as_service_critical', + ] + ), + null + ); + if ($linked_layout_status_as_service_critical !== null) { + $result['linked_layout_status_as_service_critical'] = $linked_layout_status_as_service_critical; + } + + $element_group = static::parseIntOr( + static::issetInArray($data, ['elementGroup', 'element_group']), + null + ); + if ($element_group !== null) { + $result['element_group'] = $element_group; + } + + $show_on_top = static::issetInArray($data, ['isOnTop', 'show_on_top', 'showOnTop']); + if ($show_on_top !== null) { + $result['show_on_top'] = static::parseBool($show_on_top); + } + + $clock_animation = static::notEmptyStringOr( + static::issetInArray($data, ['clockType', 'clock_animation', 'clockAnimation']), + null + ); + if ($clock_animation !== null) { + $result['clock_animation'] = $clock_animation; + } + + $time_format = static::notEmptyStringOr( + static::issetInArray($data, ['clockFormat', 'time_format', 'timeFormat']), + null + ); + if ($time_format !== null) { + $result['time_format'] = $time_format; + } + + $timezone = static::notEmptyStringOr( + static::issetInArray($data, ['timezone', 'timeZone', 'time_zone']), + null + ); + if ($timezone !== null) { + $result['timezone'] = $timezone; + } + + $show_last_value = static::parseIntOr( + static::issetInArray($data, ['show_last_value', 'showLastValue']), + null + ); + if ($show_last_value !== null) { + $result['show_last_value'] = $show_last_value; + } + + $cache_expiration = static::parseIntOr( + static::issetInArray($data, ['cache_expiration', 'cacheExpiration']), + null + ); + if ($cache_expiration !== null) { + $result['cache_expiration'] = $cache_expiration; + } + + return $result; + } + + + /** + * Extract item id. + * + * @param array $data Unknown input data structure. + * + * @return integer Item id. 0 by default. + */ + private static function extractId(array $data): integer + { + return static::parseIntOr( + static::issetInArray($data, ['id', 'itemId']), + 0 + ); + } + + + /** + * Extract layout id. + * + * @param array $data Unknown input data structure. + * + * @return integer Item id. 0 by default. + */ + private static function extractIdLayout(array $data): integer + { + return static::parseIntOr( + static::issetInArray($data, ['id_layout', 'idLayout', 'layoutId']), + 0 + ); + } + + + /** + * Extract item width. + * + * @param array $data Unknown input data structure. + * + * @return integer Item width. 0 by default. + */ + private static function extractWidth(array $data): integer + { + return static::parseIntOr( + static::issetInArray($data, ['width']), + null + ); + } + + + /** + * Extract item height. + * + * @param array $data Unknown input data structure. + * + * @return integer Item height. 0 by default. + */ + private static function extractHeight(array $data): integer + { + return static::parseIntOr( + static::issetInArray($data, ['height']), + null + ); + } + + + /** + * Extract a image src value. + * + * @param array $data Unknown input data structure. + * + * @return mixed String representing the image url (not empty) or null. + */ + private static function extractImageSrc(array $data): string + { + $imageSrc = static::notEmptyStringOr( + static::issetInArray($data, ['imageSrc', 'image']), + null + ); + + return $imageSrc; + } + + + /** + * Extract a border width value. + * + * @param array $data Unknown input data structure. + * + * @return integer Valid border width. + */ + private static function extractBorderWidth(array $data) + { + return static::parseIntOr( + static::issetInArray($data, ['border_width', 'borderWidth']), + null + ); + } + + + /** + * Extract a type graph value. + * + * @param array $data Unknown input data structure. + * + * @return string One of 'vertical' or 'horizontal'. 'vertical' by default. + */ + private static function extractTypeGraph(array $data): string + { + return static::notEmptyStringOr( + static::issetInArray($data, ['typeGraph', 'type_graph']), + null + ); + } + + + /** + * Extract a border color value. + * + * @param array $data Unknown input data structure. + * + * @return mixed String representing the border color (not empty) or null. + */ + private function extractBorderColor(array $data) + { + return static::notEmptyStringOr( + static::issetInArray($data, ['borderColor', 'border_color']), + null + ); + } + + + /** + * Extract a fill color value. + * + * @param array $data Unknown input data structure. + * + * @return mixed String representing the fill color (not empty) or null. + */ + private function extractFillColor(array $data) + { + return static::notEmptyStringOr( + static::issetInArray($data, ['fillColor', 'fill_color']), + null + ); + } + + + /** + * . + * + * @param array $data Unknown input data structure. + * + * @return boolean The modeled element data structure stored into the DB. + */ + public function save(array $data=[]): boolean + { + $mergedData = \array_merge(static::data, $data); + + $save = static::encode($mergedData); + + if (empty($save['id'])) { + // Insert. + $result = db_process_sql_insert('tlayout_data', $save); + } else { + // Update. + $result = db_process_sql_update('tlayout_data', $save, ['id' => $save['id']]); + } + + if ($result) { + } + + return $result; + } + + } From 2b17953e419ae3deed604c510eaf25185ed628ab Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 11 Jun 2019 15:08:10 +0200 Subject: [PATCH 012/123] Added a move cursor to the editing state style --- visual_console_client/src/main.css | 1 + 1 file changed, 1 insertion(+) diff --git a/visual_console_client/src/main.css b/visual_console_client/src/main.css index 95217070c2..b737d1768a 100644 --- a/visual_console_client/src/main.css +++ b/visual_console_client/src/main.css @@ -18,4 +18,5 @@ .visual-console-item.is-editing { border: 2px dashed #33ccff; transform: translateX(-2px) translateY(-2px); + cursor: move; } From 8868c64f3dd3f349c933366c3ffdd8384bcd65b9 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 11 Jun 2019 15:19:27 +0200 Subject: [PATCH 013/123] Minor change --- visual_console_client/src/VisualConsole.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/visual_console_client/src/VisualConsole.ts b/visual_console_client/src/VisualConsole.ts index 091cc08f92..63e46771c0 100644 --- a/visual_console_client/src/VisualConsole.ts +++ b/visual_console_client/src/VisualConsole.ts @@ -571,6 +571,7 @@ export default class VisualConsole { this.elements.forEach(item => { item.meta = { ...item.meta, editMode: true }; }); + this.containerRef.classList.add("is-editing"); } /** @@ -580,5 +581,6 @@ export default class VisualConsole { this.elements.forEach(item => { item.meta = { ...item.meta, editMode: false }; }); + this.containerRef.classList.remove("is-editing"); } } From f1ed4bddb292f31328496d0dbdf67e688e89a1c8 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 11 Jun 2019 15:25:04 +0200 Subject: [PATCH 014/123] Added a throttle and debounce utils. Added a function to move an element --- visual_console_client/src/lib/index.ts | 184 +++++++++++++++++++++++++ 1 file changed, 184 insertions(+) diff --git a/visual_console_client/src/lib/index.ts b/visual_console_client/src/lib/index.ts index 65f0a1ab86..6a7bf89909 100644 --- a/visual_console_client/src/lib/index.ts +++ b/visual_console_client/src/lib/index.ts @@ -374,3 +374,187 @@ export function replaceMacros(macros: Macro[], text: string): string { text ); } + +/** + * Create a function which will limit the rate of execution of + * the selected function to one time for the selected interval. + * @param delay Interval. + * @param fn Function to be executed at a limited rate. + */ +export function throttle(delay: number, fn: (...args: T[]) => R) { + let last = 0; + return (...args: T[]) => { + const now = Date.now(); + if (now - last < delay) return; + last = now; + return fn(...args); + }; +} + +/** + * Create a function which will call the selected function only + * after the interval time has passed after its last execution. + * @param delay Interval. + * @param fn Function to be executed after the last call. + */ +export function debounce(delay: number, fn: (...args: T[]) => void) { + let timerRef: number | null = null; + return (...args: T[]) => { + if (timerRef !== null) window.clearTimeout(timerRef); + timerRef = window.setTimeout(() => { + fn(...args); + timerRef = null; + }, delay); + }; +} + +/** + * Retrieve the offset of an element relative to the page. + * @param el Node used to calculate the offset. + */ +function getOffset(el: HTMLElement | null) { + let x = 0; + let y = 0; + while (el && !Number.isNaN(el.offsetLeft) && !Number.isNaN(el.offsetTop)) { + x += el.offsetLeft - el.scrollLeft; + y += el.offsetTop - el.scrollTop; + el = el.offsetParent as HTMLElement | null; + } + return { top: y, left: x }; +} + +/** + * Add the grab & move functionality to a certain element inside it's container. + * + * @param element Element to move. + * @param onMoved Function to execute when the element moves. + * + * @return A function which will clean the event handlers when executed. + */ +export function addMovementListener( + element: HTMLElement, + onMoved: (x: Position["x"], y: Position["y"]) => void +): Function { + const container = element.parentElement as HTMLElement; + // Store the initial draggable state. + const isDraggable = element.draggable; + // Init the coordinates. + let lastX: Position["x"] = 0; + let lastY: Position["y"] = 0; + let lastMouseX: Position["x"] = 0; + let lastMouseY: Position["y"] = 0; + let mouseElementOffsetX: Position["x"] = 0; + let mouseElementOffsetY: Position["y"] = 0; + // Bounds. + let containerBounds = container.getBoundingClientRect(); + let containerTop = getOffset(container).top; + let containerBottom = containerTop + containerBounds.height; + let containerLeft = getOffset(container).left; + let containerRight = containerLeft + containerBounds.width; + let elementBounds = element.getBoundingClientRect(); + let borderWidth = window.getComputedStyle(element).borderWidth || "0"; + let borderFix = Number.parseInt(borderWidth) * 2; + + // Will run onMoved 32ms after its last execution. + const debouncedMovement = debounce(32, (x: Position["x"], y: Position["y"]) => + onMoved(x, y) + ); + // Will run onMoved one time max every 16ms. + const throttledMovement = throttle(16, (x: Position["x"], y: Position["y"]) => + onMoved(x, y) + ); + + const handleMove = (e: MouseEvent) => { + // Calculate the new element coordinates. + let x = 0; + let y = 0; + + // TODO: Document. + + if (e.pageX < containerLeft) x = 0; + else if (e.pageX > containerRight) x = containerBounds.width; + else x = e.pageX - lastMouseX + lastX; + + if (e.pageY < containerTop) y = 0; + else if (e.pageY > containerBottom) + y = containerBounds.height - elementBounds.height + borderFix; + else y = e.pageY - lastMouseY + lastY; + + if (x < 0) x = 0; + else if (x + elementBounds.width - borderFix > containerBounds.width) + x = containerBounds.width - elementBounds.width + borderFix; + + if (y < 0) y = 0; + else if (y + elementBounds.height - borderFix > containerBounds.height) + y = containerBounds.height - elementBounds.height + borderFix; + + // Run the movement events. + throttledMovement(x, y); + debouncedMovement(x, y); + + // Store the coordinates of the element. + lastX = x; + lastY = y; + // Store the last mouse coordinates. + lastMouseX = e.pageX; + lastMouseY = e.pageY; + }; + const handleEnd = () => { + // Reset the positions. + lastX = 0; + lastY = 0; + lastMouseX = 0; + lastMouseY = 0; + // Remove the move event. + document.removeEventListener("mousemove", handleMove); + // Clean itself. + document.removeEventListener("mouseup", handleEnd); + // Reset the draggable property to its initial state. + element.draggable = isDraggable; + // Reset the body selection property to a default state. + document.body.style.userSelect = "auto"; + }; + const handleStart = (e: MouseEvent) => { + e.stopPropagation(); + + // Disable the drag temporarily. + element.draggable = false; + + // Store the difference between the cursor and + // the initial coordinates of the element. + lastX = element.offsetLeft; + lastY = element.offsetTop; + // Store the mouse position. + lastMouseX = e.pageX; + lastMouseY = e.pageY; + // Store the relative position between the mouse and the element. + mouseElementOffsetX = e.offsetX; + mouseElementOffsetY = e.offsetY; + + // Initialize the bounds. + containerBounds = container.getBoundingClientRect(); + containerTop = getOffset(container).top; + containerBottom = containerTop + containerBounds.height; + containerLeft = getOffset(container).left; + containerRight = containerLeft + containerBounds.width; + elementBounds = element.getBoundingClientRect(); + borderWidth = window.getComputedStyle(element).borderWidth || "0"; + borderFix = Number.parseInt(borderWidth) * 2; + + // Listen to the mouse movement. + document.addEventListener("mousemove", handleMove); + // Listen to the moment when the mouse click is not pressed anymore. + document.addEventListener("mouseup", handleEnd); + // Limit the mouse selection of the body. + document.body.style.userSelect = "none"; + }; + + // Event to listen the init of the movement. + element.addEventListener("mousedown", handleStart); + + // Returns a function to clean the event listeners. + return () => { + element.removeEventListener("mousedown", handleStart); + handleEnd(); + }; +} From 4815d73149a555374ebc8774cfc0deff210100ee Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 11 Jun 2019 15:26:10 +0200 Subject: [PATCH 015/123] Update --- .../rest-api/models/VisualConsole/Item.php | 35 +++++++++---------- 1 file changed, 16 insertions(+), 19 deletions(-) diff --git a/pandora_console/include/rest-api/models/VisualConsole/Item.php b/pandora_console/include/rest-api/models/VisualConsole/Item.php index ebb6fd10f0..373afe5f37 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Item.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Item.php @@ -240,7 +240,7 @@ class Item extends CachedModel private static function extractX(array $data): int { return static::parseIntOr( - static::issetInArray($data, ['x', 'pos_x', 'posX']), + static::issetInArray($data, ['x', 'pos_x', 'posX', 'startX']), 0 ); } @@ -256,7 +256,7 @@ class Item extends CachedModel private static function extractY(array $data): int { return static::parseIntOr( - static::issetInArray($data, ['y', 'pos_y', 'posY']), + static::issetInArray($data, ['y', 'pos_y', 'posY', 'startY']), 0 ); } @@ -1272,7 +1272,7 @@ class Item extends CachedModel } $period = static::parseIntOr( - static::issetInArray($data, ['period']), + static::issetInArray($data, ['period', 'maxTime']), null ); if ($period !== null) { @@ -1443,7 +1443,7 @@ class Item extends CachedModel } $timezone = static::notEmptyStringOr( - static::issetInArray($data, ['timezone', 'timeZone', 'time_zone']), + static::issetInArray($data, ['timezone', 'timeZone', 'time_zone', 'clockTimezone']), null ); if ($timezone !== null) { @@ -1512,7 +1512,7 @@ class Item extends CachedModel private static function extractWidth(array $data): integer { return static::parseIntOr( - static::issetInArray($data, ['width']), + static::issetInArray($data, ['width', 'endX']), null ); } @@ -1528,7 +1528,7 @@ class Item extends CachedModel private static function extractHeight(array $data): integer { return static::parseIntOr( - static::issetInArray($data, ['height']), + static::issetInArray($data, ['height', 'endY']), null ); } @@ -1544,7 +1544,7 @@ class Item extends CachedModel private static function extractImageSrc(array $data): string { $imageSrc = static::notEmptyStringOr( - static::issetInArray($data, ['imageSrc', 'image']), + static::issetInArray($data, ['imageSrc', 'image', 'backgroundColor', 'backgroundType', 'valueType']), null ); @@ -1578,7 +1578,7 @@ class Item extends CachedModel private static function extractTypeGraph(array $data): string { return static::notEmptyStringOr( - static::issetInArray($data, ['typeGraph', 'type_graph']), + static::issetInArray($data, ['typeGraph', 'type_graph', 'graphType']), null ); } @@ -1594,7 +1594,7 @@ class Item extends CachedModel private function extractBorderColor(array $data) { return static::notEmptyStringOr( - static::issetInArray($data, ['borderColor', 'border_color']), + static::issetInArray($data, ['borderColor', 'border_color', 'gridColor', 'color', 'legendBackgroundColor']), null ); } @@ -1610,14 +1610,14 @@ class Item extends CachedModel private function extractFillColor(array $data) { return static::notEmptyStringOr( - static::issetInArray($data, ['fillColor', 'fill_color']), + static::issetInArray($data, ['fillColor', 'fill_color', 'labelColor']), null ); } /** - * . + * Insert or update an item in the database * * @param array $data Unknown input data structure. * @@ -1625,19 +1625,16 @@ class Item extends CachedModel */ public function save(array $data=[]): boolean { - $mergedData = \array_merge(static::data, $data); - - $save = static::encode($mergedData); + $save = static::encode($data); if (empty($save['id'])) { // Insert. - $result = db_process_sql_insert('tlayout_data', $save); + $result = \db_process_sql_insert('tlayout_data', $save); + // static = static::fromDB(['id' => $result]); } else { // Update. - $result = db_process_sql_update('tlayout_data', $save, ['id' => $save['id']]); - } - - if ($result) { + $result = \db_process_sql_update('tlayout_data', $save, ['id' => $save['id']]); + // static = static::fromDB(['id' => $save['id']]); } return $result; From aaa1917fce5dbd14ed61230f4b179b3d5969cd7c Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 11 Jun 2019 15:27:06 +0200 Subject: [PATCH 016/123] Added movement to the visual console items --- visual_console_client/src/Item.ts | 66 ++++++++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 5 deletions(-) diff --git a/visual_console_client/src/Item.ts b/visual_console_client/src/Item.ts index b7c44f8c12..a21a8db6ce 100644 --- a/visual_console_client/src/Item.ts +++ b/visual_console_client/src/Item.ts @@ -13,7 +13,9 @@ import { notEmptyStringOr, replaceMacros, humanDate, - humanTime + humanTime, + addMovementListener, + debounce } from "./lib"; import TypedEvent, { Listener, Disposable } from "./lib/TypedEvent"; @@ -140,6 +142,46 @@ abstract class VisualConsoleItem { // List of references to clean the event listeners. private readonly disposables: Disposable[] = []; + // This function will only run the 2nd arg function after the time + // of the first arg have passed after its last execution. + private debouncedMovementSave = debounce( + 500, // ms. + (x: Position["x"], y: Position["y"]) => { + // Save the new position to the props. + this.move(x, y); + // TODO: start an async task to persist the change. + console.log("SAVED", x, y); + } + ); + // This property will store the function + // to clean the movement listener. + private removeMovement: Function | null = null; + + /** + * Start the movement funtionality. + * @param element Element to move inside its container. + */ + private initMovementListener(element: HTMLElement): void { + this.removeMovement = addMovementListener( + element, + (x: Position["x"], y: Position["y"]) => { + // Move the DOM element. + this.moveElement(x, y); + // Run the save function. + this.debouncedMovementSave(x, y); + } + ); + } + /** + * Stop the movement fun + */ + private stopMovementListener(): void { + if (this.removeMovement) { + this.removeMovement(); + this.removeMovement = null; + } + } + /** * To create a new element which will be inside the item box. * @return Item. @@ -182,18 +224,17 @@ abstract class VisualConsoleItem { private createContainerDomElement(): HTMLElement { let box; if (this.props.isLinkEnabled) { - box = document.createElement("a"); - box as HTMLAnchorElement; + box = document.createElement("a") as HTMLAnchorElement; if (this.props.link) box.href = this.props.link; } else { - box = document.createElement("div"); - box as HTMLDivElement; + box = document.createElement("div") as HTMLDivElement; } box.className = "visual-console-item"; box.style.zIndex = this.props.isOnTop ? "2" : "1"; box.style.left = `${this.props.x}px`; box.style.top = `${this.props.y}px`; + // Init the click listener. box.addEventListener("click", e => { if (this.meta.editMode) { e.preventDefault(); @@ -203,6 +244,19 @@ abstract class VisualConsoleItem { } }); + // Metadata state. + if (this.meta.editMode) { + box.classList.add("is-editing"); + // Init the movement listener. + this.initMovementListener(box); + } + if (this.meta.isFetching) { + box.classList.add("is-fetching"); + } + if (this.meta.isUpdating) { + box.classList.add("is-updating"); + } + return box; } @@ -428,8 +482,10 @@ abstract class VisualConsoleItem { if (!prevMeta || prevMeta.editMode !== this.meta.editMode) { if (this.meta.editMode) { this.elementRef.classList.add("is-editing"); + this.initMovementListener(this.elementRef); } else { this.elementRef.classList.remove("is-editing"); + this.stopMovementListener(); } } if (!prevMeta || prevMeta.isFetching !== this.meta.isFetching) { From 9d15ece41a07bc7bad3bc21a5d183686fe98ea7d Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 11 Jun 2019 16:44:19 +0200 Subject: [PATCH 017/123] Added an event handler for move events of the visual console items --- .../javascript/pandora_visual_console.js | 10 +++++- visual_console_client/src/Item.ts | 26 ++++++++++++-- visual_console_client/src/VisualConsole.ts | 35 +++++++++++++++++-- 3 files changed, 66 insertions(+), 5 deletions(-) diff --git a/pandora_console/include/javascript/pandora_visual_console.js b/pandora_console/include/javascript/pandora_visual_console.js index bedc6538f4..d2e197a69d 100755 --- a/pandora_console/include/javascript/pandora_visual_console.js +++ b/pandora_console/include/javascript/pandora_visual_console.js @@ -123,7 +123,7 @@ function createVisualConsole( try { visualConsole = new VisualConsole(container, props, items); // VC Item clicked. - visualConsole.onClick(function(e) { + visualConsole.onItemClick(function(e) { // Override the link to another VC if it isn't on remote console. if ( e.data && @@ -139,6 +139,14 @@ function createVisualConsole( updateVisualConsole(e.data.linkedLayoutId, updateInterval); } }); + // VC Item moved. + visualConsole.onItemMoved(function(e) { + // TODO: Run an async task to update the position here. + // TODO: Recover the previous position if the update task fails. + console.log( + "Moved item #" + e.item.props.id + " (x: " + e.x + ", y: " + e.y + ")" + ); + }); if (updateInterval != null && updateInterval > 0) { // Start an interval to update the Visual Console. diff --git a/visual_console_client/src/Item.ts b/visual_console_client/src/Item.ts index a21a8db6ce..0ce681ae23 100644 --- a/visual_console_client/src/Item.ts +++ b/visual_console_client/src/Item.ts @@ -70,6 +70,10 @@ export interface ItemRemoveEvent { data: AnyObject; } +export interface ItemMovedEvent extends Position { + item: VisualConsoleItem; +} + /** * Extract a valid enum value from a raw label positi9on value. * @param labelPosition Raw value. @@ -135,6 +139,8 @@ abstract class VisualConsoleItem { protected readonly childElementRef: HTMLElement; // Event manager for click events. private readonly clickEventManager = new TypedEvent>(); + // Event manager for moved events. + private readonly movedEventManager = new TypedEvent(); // Event manager for remove events. private readonly removeEventManager = new TypedEvent< ItemRemoveEvent @@ -149,8 +155,8 @@ abstract class VisualConsoleItem { (x: Position["x"], y: Position["y"]) => { // Save the new position to the props. this.move(x, y); - // TODO: start an async task to persist the change. - console.log("SAVED", x, y); + // Emit the movement event. + this.movedEventManager.emit({ item: this, x, y }); } ); // This property will store the function @@ -657,6 +663,22 @@ abstract class VisualConsoleItem { return disposable; } + /** + * To add an event handler to the movement of visual console elements. + * @param listener Function which is going to be executed when a linked console is moved. + */ + public onMoved(listener: Listener): Disposable { + /* + * The '.on' function returns a function which will clean the event + * listener when executed. We store all the 'dispose' functions to + * call them when the item should be cleared. + */ + const disposable = this.movedEventManager.on(listener); + this.disposables.push(disposable); + + return disposable; + } + /** * To add an event handler to the removal of the item. * @param listener Function which is going to be executed when a item is removed. diff --git a/visual_console_client/src/VisualConsole.ts b/visual_console_client/src/VisualConsole.ts index 63e46771c0..868342b44b 100644 --- a/visual_console_client/src/VisualConsole.ts +++ b/visual_console_client/src/VisualConsole.ts @@ -10,7 +10,8 @@ import Item, { ItemType, ItemProps, ItemClickEvent, - ItemRemoveEvent + ItemRemoveEvent, + ItemMovedEvent } from "./Item"; import StaticGraph, { staticGraphPropsDecoder } from "./items/StaticGraph"; import Icon, { iconPropsDecoder } from "./items/Icon"; @@ -204,6 +205,8 @@ export default class VisualConsole { private readonly clickEventManager = new TypedEvent< ItemClickEvent >(); + // Event manager for move events. + private readonly movedEventManager = new TypedEvent(); // List of references to clean the event listeners. private readonly disposables: Disposable[] = []; @@ -216,6 +219,15 @@ export default class VisualConsole { // console.log(`Clicked element #${e.data.id}`, e); }; + /** + * React to a movement on an element. + * @param e Event object. + */ + private handleElementMovement: (e: ItemMovedEvent) => void = e => { + this.movedEventManager.emit(e); + // console.log(`Moved element #${e.item.props.id}`, e); + }; + /** * Clear some element references. * @param e Event object. @@ -264,6 +276,7 @@ export default class VisualConsole { this.elementIds.push(itemInstance.props.id); // Item event handlers. itemInstance.onClick(this.handleElementClick); + itemInstance.onMoved(this.handleElementMovement); itemInstance.onRemove(this.handleElementRemove); // Add the item to the DOM. this.containerRef.append(itemInstance.elementRef); @@ -552,7 +565,9 @@ export default class VisualConsole { * Add an event handler to the click of the linked visual console elements. * @param listener Function which is going to be executed when a linked console is clicked. */ - public onClick(listener: Listener>): Disposable { + public onItemClick( + listener: Listener> + ): Disposable { /* * The '.on' function returns a function which will clean the event * listener when executed. We store all the 'dispose' functions to @@ -564,6 +579,22 @@ export default class VisualConsole { return disposable; } + /** + * Add an event handler to the movement of the visual console elements. + * @param listener Function which is going to be executed when a linked console is moved. + */ + public onItemMoved(listener: Listener): Disposable { + /* + * The '.on' function returns a function which will clean the event + * listener when executed. We store all the 'dispose' functions to + * call them when the item should be cleared. + */ + const disposable = this.movedEventManager.on(listener); + this.disposables.push(disposable); + + return disposable; + } + /** * Enable the edition mode. */ From 5735326430f7ad577f993c41001d6309132d9c4d Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 11 Jun 2019 17:27:22 +0200 Subject: [PATCH 018/123] Added an async task to persist the visual console item movement to the database --- .../javascript/pandora_visual_console.js | 113 +++++++++++++++++- visual_console_client/src/Item.ts | 18 ++- 2 files changed, 124 insertions(+), 7 deletions(-) diff --git a/pandora_console/include/javascript/pandora_visual_console.js b/pandora_console/include/javascript/pandora_visual_console.js index d2e197a69d..7337bae8bf 100755 --- a/pandora_console/include/javascript/pandora_visual_console.js +++ b/pandora_console/include/javascript/pandora_visual_console.js @@ -141,11 +141,45 @@ function createVisualConsole( }); // VC Item moved. visualConsole.onItemMoved(function(e) { - // TODO: Run an async task to update the position here. - // TODO: Recover the previous position if the update task fails. - console.log( - "Moved item #" + e.item.props.id + " (x: " + e.x + ", y: " + e.y + ")" - ); + var id = e.item.props.id; + var data = { + x: e.newPosition.x, + y: e.newPosition.y + }; + var taskId = "visual-console-item-move-" + id; + + asyncTaskManager + .add(taskId, function(done) { + var abortable = updateVisualConsoleItem( + baseUrl, + visualConsole.props.id, + id, + data, + function(error, data) { + if (error && error.request.statusText === "abort") return; + if (error || !data) { + console.log( + "[ERROR]", + "[VISUAL-CONSOLE-CLIENT]", + "[API]", + error ? error.message : "Invalid response" + ); + + // Move the element to its initial position. + e.item.move(e.prevPosition.x, e.prevPosition.y); + } + + done(); + } + ); + + return { + cancel: function() { + abortable.abort(); + } + }; + }) + .init(); }); if (updateInterval != null && updateInterval > 0) { @@ -274,6 +308,75 @@ function loadVisualConsoleData(baseUrl, vcId, callback) { }; } +/** + * Fetch a Visual Console's structure and its items. + * @param {string} baseUrl Base URL to build the API path. + * @param {number} vcId Identifier of the Visual Console. + * @param {number} vcItemId Identifier of the Visual Console's item. + * @param {Object} data Data we want to save. + * @param {function} callback Function to be executed on request success or fail. + * @return {Object} Cancellable. Object which include and .abort([statusText]) function. + */ +// eslint-disable-next-line no-unused-vars +function updateVisualConsoleItem(baseUrl, vcId, vcItemId, data, callback) { + // var apiPath = baseUrl + "/include/rest-api"; + var apiPath = baseUrl + "/ajax.php"; + var jqXHR = null; + + // Cancel the ajax requests. + var abort = function(textStatus) { + if (textStatus == null) textStatus = "abort"; + + // -- XMLHttpRequest.readyState -- + // Value State Description + // 0 UNSENT Client has been created. open() not called yet. + // 4 DONE The operation is complete. + + if (jqXHR.readyState !== 0 && jqXHR.readyState !== 4) + jqXHR.abort(textStatus); + }; + + // Failed request handler. + var handleFail = function(jqXHR, textStatus, errorThrown) { + abort(); + // Manually aborted or not. + if (textStatus === "abort") { + callback(); + } else { + var error = new Error(errorThrown); + error.request = jqXHR; + callback(error); + } + }; + + // Function which handle success case. + var handleSuccess = function(data) { + callback(null, data); + }; + + // Visual Console container request. + jqXHR = jQuery + // .get(apiPath + "/visual-consoles/" + vcId, null, "json") + .get( + apiPath, + { + page: "include/rest-api/index", + updateVisualConsoleItem: 1, + visualConsoleId: vcId, + visualConsoleItemId: vcItemId, + data: data + }, + "json" + ) + .done(handleSuccess) + .fail(handleFail); + + // Abortable. + return { + abort: abort + }; +} + // TODO: Delete the functions below when you can. /************************************** These functions require jQuery library diff --git a/visual_console_client/src/Item.ts b/visual_console_client/src/Item.ts index 0ce681ae23..aa60913796 100644 --- a/visual_console_client/src/Item.ts +++ b/visual_console_client/src/Item.ts @@ -70,8 +70,10 @@ export interface ItemRemoveEvent { data: AnyObject; } -export interface ItemMovedEvent extends Position { +export interface ItemMovedEvent { item: VisualConsoleItem; + prevPosition: Position; + newPosition: Position; } /** @@ -153,10 +155,22 @@ abstract class VisualConsoleItem { private debouncedMovementSave = debounce( 500, // ms. (x: Position["x"], y: Position["y"]) => { + const prevPosition = { + x: this.props.x, + y: this.props.y + }; + const newPosition = { + x: x, + y: y + }; // Save the new position to the props. this.move(x, y); // Emit the movement event. - this.movedEventManager.emit({ item: this, x, y }); + this.movedEventManager.emit({ + item: this, + prevPosition: prevPosition, + newPosition: newPosition + }); } ); // This property will store the function From 7307d34c7518aa4a06850bddd1cf43184664954d Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 11 Jun 2019 17:39:46 +0200 Subject: [PATCH 019/123] Minor fix --- pandora_console/include/javascript/pandora_visual_console.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandora_console/include/javascript/pandora_visual_console.js b/pandora_console/include/javascript/pandora_visual_console.js index 7337bae8bf..ca1fed6e79 100755 --- a/pandora_console/include/javascript/pandora_visual_console.js +++ b/pandora_console/include/javascript/pandora_visual_console.js @@ -156,8 +156,8 @@ function createVisualConsole( id, data, function(error, data) { - if (error && error.request.statusText === "abort") return; - if (error || !data) { + if (!error && !data) return; + if (error) { console.log( "[ERROR]", "[VISUAL-CONSOLE-CLIENT]", From e4139874dd7eb71007476656a5b7278e6b61d788 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Tue, 11 Jun 2019 18:00:41 +0200 Subject: [PATCH 020/123] Removed option to show qr code in header - #4196 --- pandora_console/godmode/setup/setup_visuals.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index bcaff54d95..8b0b2d5486 100755 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -1113,15 +1113,6 @@ $row++; - $table_other->data[$row][0] = __('Show QR Code icon in the header'); - $table_other->data[$row][1] = html_print_checkbox_switch( - 'show_qr_code_header', - 1, - $config['show_qr_code_header'], - true - ); - $row++; - $table_other->data[$row][0] = __('Custom graphviz directory').ui_print_help_tip(__('Custom directory where the graphviz binaries are stored.'), true); $table_other->data[$row][1] = html_print_input_text( 'graphviz_bin_dir', From f1787c7920a54bd04b2cf4235184d11868291ddd Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Thu, 13 Jun 2019 10:11:03 +0200 Subject: [PATCH 021/123] Removed empty help in unknown modules - #4208 --- pandora_console/include/help/clippy/module_unknow.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/help/clippy/module_unknow.php b/pandora_console/include/help/clippy/module_unknow.php index 28656c9ba2..d3a6245032 100644 --- a/pandora_console/include/help/clippy/module_unknow.php +++ b/pandora_console/include/help/clippy/module_unknow.php @@ -32,7 +32,7 @@ function clippy_module_unknow() $return_tours['tours']['module_unknow']['steps'] = []; $return_tours['tours']['module_unknow']['steps'][] = [ 'init_step_context' => true, - 'intro' => ''.''.''.''.''.''.''.'
'.__('You have unknown modules in this agent.').'
'.__('Unknown modules are modules which receive data normally at least in one occassion, but at this time are not receving data. Please check our troubleshoot help page to help you determine why you have unknown modules.').ui_print_help_icon('context_module_unknow', true, '', 'images/help.png').'
', + 'intro' => ''.''.''.''.''.''.''.'
'.__('You have unknown modules in this agent.').'
'.__('Unknown modules are modules which receive data normally at least in one occassion, but at this time are not receving data. Please check our troubleshoot help page to help you determine why you have unknown modules.').'
', ]; $return_tours['tours']['module_unknow']['conf'] = []; $return_tours['tours']['module_unknow']['conf']['autostart'] = false; From e9b4dea6c59f387e08547a8d5858c15abb6aebc7 Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Thu, 13 Jun 2019 14:51:27 +0200 Subject: [PATCH 022/123] update --- .../include/rest-api/models/Model.php | 24 ++++++++++++ .../models/VisualConsole/Container.php | 32 ++++++++++++++++ .../rest-api/models/VisualConsole/Item.php | 37 +++++++++++-------- .../models/VisualConsole/Items/Line.php | 31 ++++++++++++++++ 4 files changed, 109 insertions(+), 15 deletions(-) diff --git a/pandora_console/include/rest-api/models/Model.php b/pandora_console/include/rest-api/models/Model.php index 78ef90468e..44e4f8b3e8 100644 --- a/pandora_console/include/rest-api/models/Model.php +++ b/pandora_console/include/rest-api/models/Model.php @@ -47,6 +47,30 @@ abstract class Model abstract protected function decode(array $data): array; + /** + * Return a valid representation of a record in database. + * + * @param array $data Input data. + * + * @return array Data structure representing a record in database. + * + * @abstract + */ + abstract protected function encode(array $data): array; + + + /** + * Insert or update an item in the database + * + * @param array $data Unknown input data structure. + * + * @return boolean The modeled element data structure stored into the DB. + * + * @abstract + */ + abstract public function save(array $data=[]): bool; + + /** * Constructor of the model. It won't be public. The instances * will be created through factories which start with from*. diff --git a/pandora_console/include/rest-api/models/VisualConsole/Container.php b/pandora_console/include/rest-api/models/VisualConsole/Container.php index ad1f34a2ff..653b33d5c4 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Container.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Container.php @@ -92,6 +92,37 @@ final class Container extends Model } + /** + * Return a valid representation of a record in database. + * + * @param array $data Input data. + * + * @return array Data structure representing a record in database. + * + * @overrides Model::encode. + */ + protected function encode(array $data): array + { + $result = []; + return $result; + } + + + /** + * Insert or update an item in the database + * + * @param array $data Unknown input data structure. + * + * @return boolean The modeled element data structure stored into the DB. + * + * @overrides Model::save. + */ + public function save(array $data=[]): bool + { + return true; + } + + /** * Extract a group Id value. * @@ -365,6 +396,7 @@ final class Container extends Model try { array_push($items, $class::fromDB($data)); + hd($class::save($data), true); } catch (\Throwable $e) { // TODO: Log this? } diff --git a/pandora_console/include/rest-api/models/VisualConsole/Item.php b/pandora_console/include/rest-api/models/VisualConsole/Item.php index 373afe5f37..c368e855cb 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Item.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Item.php @@ -1212,17 +1212,19 @@ class Item extends CachedModel * @param array $data Input data. * * @return array Data structure representing a record in database. + * + * @overrides Model::encode. */ protected function encode(array $data): array { $result = []; - $id = static::extractId($data); + $id = static::getId($data); if ($id) { $result['id'] = $id; } - $id_layout = static::extractIdLayout($data); + $id_layout = static::getIdLayout($data); if ($id_layout) { $result['id_layout'] = $id_layout; } @@ -1243,12 +1245,12 @@ class Item extends CachedModel $result['pos_y'] = $pos_y; } - $height = static::extractHeight($data); + $height = static::getHeight($data); if ($height !== null) { $result['height'] = $height; } - $width = static::extractWidth($data); + $width = static::getWidth($data); if ($width !== null) { $result['width'] = $width; } @@ -1258,7 +1260,7 @@ class Item extends CachedModel $result['label'] = $label; } - $image = static::extractImageSrc($data); + $image = static::getImageSrc($data); if ($image !== null) { $result['image'] = $image; } @@ -1322,12 +1324,12 @@ class Item extends CachedModel $result['id_custom_graph'] = $id_custom_graph; } - $border_width = static::extractBorderWidth($data); + $border_width = static::getBorderWidth($data); if ($border_width !== null) { $result['border_width'] = $border_width; } - $type_graph = static::extractTypeGraph($data); + $type_graph = static::getTypeGraph($data); if ($type_graph !== null) { $result['type_graph'] = $type_graph; } @@ -1477,7 +1479,7 @@ class Item extends CachedModel * * @return integer Item id. 0 by default. */ - private static function extractId(array $data): integer + private static function getId(array $data): int { return static::parseIntOr( static::issetInArray($data, ['id', 'itemId']), @@ -1493,7 +1495,7 @@ class Item extends CachedModel * * @return integer Item id. 0 by default. */ - private static function extractIdLayout(array $data): integer + private static function getIdLayout(array $data): int { return static::parseIntOr( static::issetInArray($data, ['id_layout', 'idLayout', 'layoutId']), @@ -1509,7 +1511,7 @@ class Item extends CachedModel * * @return integer Item width. 0 by default. */ - private static function extractWidth(array $data): integer + private static function getWidth(array $data) { return static::parseIntOr( static::issetInArray($data, ['width', 'endX']), @@ -1525,7 +1527,7 @@ class Item extends CachedModel * * @return integer Item height. 0 by default. */ - private static function extractHeight(array $data): integer + private static function getHeight(array $data) { return static::parseIntOr( static::issetInArray($data, ['height', 'endY']), @@ -1541,7 +1543,7 @@ class Item extends CachedModel * * @return mixed String representing the image url (not empty) or null. */ - private static function extractImageSrc(array $data): string + protected static function getImageSrc(array $data) { $imageSrc = static::notEmptyStringOr( static::issetInArray($data, ['imageSrc', 'image', 'backgroundColor', 'backgroundType', 'valueType']), @@ -1559,7 +1561,7 @@ class Item extends CachedModel * * @return integer Valid border width. */ - private static function extractBorderWidth(array $data) + private static function getBorderWidth(array $data) { return static::parseIntOr( static::issetInArray($data, ['border_width', 'borderWidth']), @@ -1575,7 +1577,7 @@ class Item extends CachedModel * * @return string One of 'vertical' or 'horizontal'. 'vertical' by default. */ - private static function extractTypeGraph(array $data): string + private static function getTypeGraph(array $data) { return static::notEmptyStringOr( static::issetInArray($data, ['typeGraph', 'type_graph', 'graphType']), @@ -1622,8 +1624,10 @@ class Item extends CachedModel * @param array $data Unknown input data structure. * * @return boolean The modeled element data structure stored into the DB. + * + * @overrides Model::save. */ - public function save(array $data=[]): boolean + public function save(array $data=[]): bool { $save = static::encode($data); @@ -1637,6 +1641,9 @@ class Item extends CachedModel // static = static::fromDB(['id' => $save['id']]); } + if ($result) { + } + return $result; } diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php index fd6f64b4cb..73887827d5 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php @@ -206,4 +206,35 @@ final class Line extends Model } + /** + * Return a valid representation of a record in database. + * + * @param array $data Input data. + * + * @return array Data structure representing a record in database. + * + * @overrides Model::encode. + */ + protected function encode(array $data): array + { + $result = []; + return $result; + } + + + /** + * Insert or update an item in the database + * + * @param array $data Unknown input data structure. + * + * @return boolean The modeled element data structure stored into the DB. + * + * @overrides Model::save. + */ + public function save(array $data=[]): bool + { + return true; + } + + } From 018c942ecb0e84f94f5e90008a5ac6c100ad3978 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Thu, 13 Jun 2019 15:04:39 +0200 Subject: [PATCH 023/123] Added meta option in function ui_print_os_icon - #3999 --- pandora_console/include/functions_ui.php | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index c81148b9c9..f9a8e784e3 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -760,6 +760,12 @@ function ui_print_os_icon( $subfolder .= '/so_big_icons'; } + if (is_metaconsole()) { + $no_in_meta = true; + } else { + $no_in_meta = false; + } + $icon = (string) db_get_value('icon_name', 'tconfig_os', 'id_os', (int) $id_os); $os_name = get_os_name($id_os); if (empty($icon)) { @@ -770,7 +776,7 @@ function ui_print_os_icon( $options, true, $relative, - false, + $no_in_meta, true ); } else { @@ -778,13 +784,13 @@ function ui_print_os_icon( } } else if ($apply_skin) { if ($only_src) { - $output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, true, $relative, false, true); + $output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, true, $relative, $no_in_meta, true); } else { if (!isset($options['title'])) { $options['title'] = $os_name; } - $output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, false, $relative, false, true); + $output = html_print_image('images/'.$subfolder.'/'.$icon, true, $options, false, $relative, $no_in_meta, true); } } else { // $output = "" . $os_name . ""; From 3c1336d298347bbf20b6a81d8fad7925bf3a35fd Mon Sep 17 00:00:00 2001 From: "marcos.alconada" Date: Thu, 13 Jun 2019 18:27:51 +0200 Subject: [PATCH 024/123] Fixed problem to edit custom graphs on search --- pandora_console/include/functions_custom_graphs.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandora_console/include/functions_custom_graphs.php b/pandora_console/include/functions_custom_graphs.php index f98084f808..4a1c5df11c 100644 --- a/pandora_console/include/functions_custom_graphs.php +++ b/pandora_console/include/functions_custom_graphs.php @@ -184,7 +184,7 @@ function custom_graphs_search($id_group, $search) FROM tgraph_source WHERE id_graph = '.$graph['id_graph'].'' ); - + $graphs[$graph['id_graph']]['id_graph'] = $graph['id_graph']; $graphs[$graph['id_graph']]['graphs_count'] = $graphsCount; $graphs[$graph['id_graph']]['name'] = $graph['name']; $graphs[$graph['id_graph']]['description'] = $graph['description']; From bdeb456a448278fd0ffea40d870c01e0dc912db2 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Fri, 14 Jun 2019 12:54:03 +0200 Subject: [PATCH 025/123] Added sorting in last fired column - #3965 --- .../operation/agentes/alerts_status.php | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/pandora_console/operation/agentes/alerts_status.php b/pandora_console/operation/agentes/alerts_status.php index e231266667..908a903834 100755 --- a/pandora_console/operation/agentes/alerts_status.php +++ b/pandora_console/operation/agentes/alerts_status.php @@ -229,6 +229,9 @@ $selectModuleUp = false; $selectModuleDown = false; $selectTemplateUp = false; $selectTemplateDown = false; +$selectLastFiredUp = false; +$selectLastFiredDown = false; + switch ($sortField) { case 'agent': switch ($sort) { @@ -290,6 +293,26 @@ switch ($sortField) { } break; + case 'last_fired': + switch ($sort) { + case 'up': + $selectLastFiredUp = $selected; + $order = [ + 'field' => 'last_fired', + 'order' => 'ASC', + ]; + break; + + case 'down': + $selectLastFiredDown = $selected; + $order = [ + 'field' => 'last_fired', + 'order' => 'DESC', + ]; + break; + } + break; + default: if ($print_agent) { $selectDisabledUp = ''; @@ -300,6 +323,8 @@ switch ($sortField) { $selectModuleDown = false; $selectTemplateUp = false; $selectTemplateDown = false; + $selectLastFiredUp = false; + $selectLastFiredDown = false; $order = [ 'field' => 'agent_module_name', 'order' => 'ASC', @@ -313,6 +338,8 @@ switch ($sortField) { $selectModuleDown = false; $selectTemplateUp = false; $selectTemplateDown = false; + $selectLastFiredUp = false; + $selectLastFiredDown = false; $order = [ 'field' => 'agent_module_name', 'order' => 'ASC', @@ -449,6 +476,8 @@ $url_up_module = $url.'&sort_field=module&sort=up'; $url_down_module = $url.'&sort_field=module&sort=down'; $url_up_template = $url.'&sort_field=template&sort=up'; $url_down_template = $url.'&sort_field=template&sort=down'; +$url_up_lastfired = $url.'&sort_field=last_fired&sort=up'; +$url_down_lastfired = $url.'&sort_field=last_fired&sort=down'; $table = new stdClass(); $table->width = '100%'; @@ -494,6 +523,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { $table->head[3] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown); $table->head[4] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown); $table->head[5] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown); + $table->head[7] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown); } } else { if (!is_metaconsole()) { @@ -528,6 +558,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if (!is_metaconsole()) { $table->head[3] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown); $table->head[4] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown); + $table->head[6] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown); } } } else { @@ -562,6 +593,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { $table->head[3] .= ui_get_sorting_arrows($url_up_agente, $url_down_agente, $selectAgentUp, $selectAgentDown); $table->head[4] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown); $table->head[5] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown); + $table->head[6] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown); } } else { if (!is_metaconsole()) { @@ -592,6 +624,7 @@ if ($isFunctionPolicies !== ENTERPRISE_NOT_HOOK) { if (!is_metaconsole()) { $table->head[2] .= ui_get_sorting_arrows($url_up_module, $url_down_module, $selectModuleUp, $selectModuleDown); $table->head[3] .= ui_get_sorting_arrows($url_up_template, $url_down_template, $selectTemplateUp, $selectTemplateDown); + $table->head[5] .= ui_get_sorting_arrows($url_up_lastfired, $url_down_lastfired, $selectLastFiredUp, $selectLastFiredDown); } } } From 92dc7d4e8c48d68941f5c037529770db9162d6ae Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Fri, 14 Jun 2019 13:48:35 +0200 Subject: [PATCH 026/123] Truncate long title in modal dialogs - #4112 --- pandora_console/include/styles/js/jquery-ui_custom.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pandora_console/include/styles/js/jquery-ui_custom.css b/pandora_console/include/styles/js/jquery-ui_custom.css index f5bd560d69..94240f4bea 100644 --- a/pandora_console/include/styles/js/jquery-ui_custom.css +++ b/pandora_console/include/styles/js/jquery-ui_custom.css @@ -3,6 +3,9 @@ /* --- JQUERY-UI --- */ .ui-dialog .ui-dialog-titlebar { background-color: #82b92e !important; + overflow: hidden; + text-overflow: ellipsis; + padding-right: 33px !important; } /*center ui dialog center*/ @@ -40,6 +43,7 @@ position: relative; top: 5px; float: none !important; + vertical-align: bottom; } .ui-dialog .ui-dialog-titlebar-close { position: absolute !important; From dbf15a759f074d230c4531963e4372b440f0e1f8 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 17 Jun 2019 12:22:55 +0200 Subject: [PATCH 027/123] Added a functionality to allows the live vc item resizement --- .../javascript/pandora_visual_console.js | 48 +++++++- visual_console_client/src/Item.ts | 89 +++++++++++++- visual_console_client/src/VisualConsole.ts | 31 ++++- visual_console_client/src/lib/index.ts | 112 ++++++++++++++++++ visual_console_client/src/main.css | 13 +- visual_console_client/src/resize-handle.svg | 24 ++++ 6 files changed, 312 insertions(+), 5 deletions(-) create mode 100644 visual_console_client/src/resize-handle.svg diff --git a/pandora_console/include/javascript/pandora_visual_console.js b/pandora_console/include/javascript/pandora_visual_console.js index ca1fed6e79..13d7f899e4 100755 --- a/pandora_console/include/javascript/pandora_visual_console.js +++ b/pandora_console/include/javascript/pandora_visual_console.js @@ -148,6 +148,7 @@ function createVisualConsole( }; var taskId = "visual-console-item-move-" + id; + // Persist the new position. asyncTaskManager .add(taskId, function(done) { var abortable = updateVisualConsoleItem( @@ -156,8 +157,8 @@ function createVisualConsole( id, data, function(error, data) { - if (!error && !data) return; - if (error) { + // if (!error && !data) return; + if (error || !data) { console.log( "[ERROR]", "[VISUAL-CONSOLE-CLIENT]", @@ -181,6 +182,49 @@ function createVisualConsole( }) .init(); }); + // VC Item resized. + visualConsole.onItemResized(function(e) { + var id = e.item.props.id; + var data = { + width: e.newSize.width, + height: e.newSize.height + }; + var taskId = "visual-console-item-resize-" + id; + + // Persist the new size. + asyncTaskManager + .add(taskId, function(done) { + var abortable = updateVisualConsoleItem( + baseUrl, + visualConsole.props.id, + id, + data, + function(error, data) { + // if (!error && !data) return; + if (error || !data) { + console.log( + "[ERROR]", + "[VISUAL-CONSOLE-CLIENT]", + "[API]", + error ? error.message : "Invalid response" + ); + + // Resize the element to its initial Size. + e.item.resize(e.prevSize.width, e.prevSize.height); + } + + done(); + } + ); + + return { + cancel: function() { + abortable.abort(); + } + }; + }) + .init(); + }); if (updateInterval != null && updateInterval > 0) { // Start an interval to update the Visual Console. diff --git a/visual_console_client/src/Item.ts b/visual_console_client/src/Item.ts index aa60913796..8d8bd08027 100644 --- a/visual_console_client/src/Item.ts +++ b/visual_console_client/src/Item.ts @@ -15,7 +15,8 @@ import { humanDate, humanTime, addMovementListener, - debounce + debounce, + addResizementListener } from "./lib"; import TypedEvent, { Listener, Disposable } from "./lib/TypedEvent"; @@ -76,6 +77,12 @@ export interface ItemMovedEvent { newPosition: Position; } +export interface ItemResizedEvent { + item: VisualConsoleItem; + prevSize: Size; + newSize: Size; +} + /** * Extract a valid enum value from a raw label positi9on value. * @param labelPosition Raw value. @@ -143,6 +150,8 @@ abstract class VisualConsoleItem { private readonly clickEventManager = new TypedEvent>(); // Event manager for moved events. private readonly movedEventManager = new TypedEvent(); + // Event manager for resized events. + private readonly resizedEventManager = new TypedEvent(); // Event manager for remove events. private readonly removeEventManager = new TypedEvent< ItemRemoveEvent @@ -163,6 +172,9 @@ abstract class VisualConsoleItem { x: x, y: y }; + + if (!this.positionChanged(prevPosition, newPosition)) return; + // Save the new position to the props. this.move(x, y); // Emit the movement event. @@ -202,6 +214,61 @@ abstract class VisualConsoleItem { } } + // This function will only run the 2nd arg function after the time + // of the first arg have passed after its last execution. + private debouncedResizementSave = debounce( + 500, // ms. + (width: Size["width"], height: Size["height"]) => { + const prevSize = { + width: this.props.width, + height: this.props.height + }; + const newSize = { + width: width, + height: height + }; + + if (!this.sizeChanged(prevSize, newSize)) return; + + // Save the new position to the props. + this.resize(width, height); + // Emit the resizement event. + this.resizedEventManager.emit({ + item: this, + prevSize: prevSize, + newSize: newSize + }); + } + ); + // This property will store the function + // to clean the resizement listener. + private removeResizement: Function | null = null; + + /** + * Start the resizement funtionality. + * @param element Element to move inside its container. + */ + private initResizementListener(element: HTMLElement): void { + this.removeResizement = addResizementListener( + element, + (width: Size["width"], height: Size["height"]) => { + // Move the DOM element. + this.resizeElement(width, height); + // Run the save function. + this.debouncedResizementSave(width, height); + } + ); + } + /** + * Stop the resizement functionality. + */ + private stopResizementListener(): void { + if (this.removeResizement) { + this.removeResizement(); + this.removeResizement = null; + } + } + /** * To create a new element which will be inside the item box. * @return Item. @@ -269,6 +336,8 @@ abstract class VisualConsoleItem { box.classList.add("is-editing"); // Init the movement listener. this.initMovementListener(box); + // Init the resizement listener. + this.initResizementListener(box); } if (this.meta.isFetching) { box.classList.add("is-fetching"); @@ -503,9 +572,11 @@ abstract class VisualConsoleItem { if (this.meta.editMode) { this.elementRef.classList.add("is-editing"); this.initMovementListener(this.elementRef); + this.initResizementListener(this.elementRef); } else { this.elementRef.classList.remove("is-editing"); this.stopMovementListener(); + this.stopResizementListener(); } } if (!prevMeta || prevMeta.isFetching !== this.meta.isFetching) { @@ -693,6 +764,22 @@ abstract class VisualConsoleItem { return disposable; } + /** + * To add an event handler to the resizement of visual console elements. + * @param listener Function which is going to be executed when a linked console is moved. + */ + public onResized(listener: Listener): Disposable { + /* + * The '.on' function returns a function which will clean the event + * listener when executed. We store all the 'dispose' functions to + * call them when the item should be cleared. + */ + const disposable = this.resizedEventManager.on(listener); + this.disposables.push(disposable); + + return disposable; + } + /** * To add an event handler to the removal of the item. * @param listener Function which is going to be executed when a item is removed. diff --git a/visual_console_client/src/VisualConsole.ts b/visual_console_client/src/VisualConsole.ts index 868342b44b..2dbdcd3a09 100644 --- a/visual_console_client/src/VisualConsole.ts +++ b/visual_console_client/src/VisualConsole.ts @@ -11,7 +11,8 @@ import Item, { ItemProps, ItemClickEvent, ItemRemoveEvent, - ItemMovedEvent + ItemMovedEvent, + ItemResizedEvent } from "./Item"; import StaticGraph, { staticGraphPropsDecoder } from "./items/StaticGraph"; import Icon, { iconPropsDecoder } from "./items/Icon"; @@ -207,6 +208,8 @@ export default class VisualConsole { >(); // Event manager for move events. private readonly movedEventManager = new TypedEvent(); + // Event manager for resize events. + private readonly resizedEventManager = new TypedEvent(); // List of references to clean the event listeners. private readonly disposables: Disposable[] = []; @@ -228,6 +231,15 @@ export default class VisualConsole { // console.log(`Moved element #${e.item.props.id}`, e); }; + /** + * React to a resizement on an element. + * @param e Event object. + */ + private handleElementResizement: (e: ItemResizedEvent) => void = e => { + this.resizedEventManager.emit(e); + // console.log(`Resized element #${e.item.props.id}`, e); + }; + /** * Clear some element references. * @param e Event object. @@ -277,6 +289,7 @@ export default class VisualConsole { // Item event handlers. itemInstance.onClick(this.handleElementClick); itemInstance.onMoved(this.handleElementMovement); + itemInstance.onResized(this.handleElementResizement); itemInstance.onRemove(this.handleElementRemove); // Add the item to the DOM. this.containerRef.append(itemInstance.elementRef); @@ -595,6 +608,22 @@ export default class VisualConsole { return disposable; } + /** + * Add an event handler to the resizement of the visual console elements. + * @param listener Function which is going to be executed when a linked console is moved. + */ + public onItemResized(listener: Listener): Disposable { + /* + * The '.on' function returns a function which will clean the event + * listener when executed. We store all the 'dispose' functions to + * call them when the item should be cleared. + */ + const disposable = this.resizedEventManager.on(listener); + this.disposables.push(disposable); + + return disposable; + } + /** * Enable the edition mode. */ diff --git a/visual_console_client/src/lib/index.ts b/visual_console_client/src/lib/index.ts index 6a7bf89909..eaad5bbab6 100644 --- a/visual_console_client/src/lib/index.ts +++ b/visual_console_client/src/lib/index.ts @@ -558,3 +558,115 @@ export function addMovementListener( handleEnd(); }; } + +/** + * Add the grab & resize functionality to a certain element. + * + * @param element Element to move. + * @param onResized Function to execute when the element is resized. + * + * @return A function which will clean the event handlers when executed. + */ +export function addResizementListener( + element: HTMLElement, + onResized: (x: Position["x"], y: Position["y"]) => void +): Function { + const resizeDraggable = document.createElement("div"); + resizeDraggable.className = "resize-draggable"; + element.appendChild(resizeDraggable); + + // Store the initial draggable state. + const isDraggable = element.draggable; + // Init the coordinates. + let lastWidth: Size["width"] = 0; + let lastHeight: Size["height"] = 0; + let lastMouseX: Position["x"] = 0; + let lastMouseY: Position["y"] = 0; + let mouseElementOffsetX: Position["x"] = 0; + let mouseElementOffsetY: Position["y"] = 0; + + // Will run onResized 32ms after its last execution. + const debouncedResizement = debounce( + 32, + (width: Size["width"], height: Size["height"]) => onResized(width, height) + ); + // Will run onResized one time max every 16ms. + const throttledResizement = throttle( + 16, + (width: Size["width"], height: Size["height"]) => onResized(width, height) + ); + + const handleResize = (e: MouseEvent) => { + // Calculate the new element coordinates. + let width = lastWidth + (e.pageX - lastMouseX); + let height = lastHeight + (e.pageY - lastMouseY); + + // TODO: Document. + + // Minimum value. + if (width <= 0) width = 10; + if (height <= 0) height = 10; + + // Run the movement events. + throttledResizement(width, height); + debouncedResizement(width, height); + + // Store the coordinates of the element. + lastWidth = width; + lastHeight = height; + // Store the last mouse coordinates. + lastMouseX = e.pageX; + lastMouseY = e.pageY; + }; + const handleEnd = () => { + // Reset the positions. + lastWidth = 0; + lastHeight = 0; + lastMouseX = 0; + lastMouseY = 0; + mouseElementOffsetX = 0; + mouseElementOffsetY = 0; + // Remove the move event. + document.removeEventListener("mousemove", handleResize); + // Clean itself. + document.removeEventListener("mouseup", handleEnd); + // Reset the draggable property to its initial state. + element.draggable = isDraggable; + // Reset the body selection property to a default state. + document.body.style.userSelect = "auto"; + }; + const handleStart = (e: MouseEvent) => { + e.stopPropagation(); + + // Disable the drag temporarily. + element.draggable = false; + + // Store the difference between the cursor and + // the initial coordinates of the element. + const { width, height } = element.getBoundingClientRect(); + lastWidth = width; + lastHeight = height; + // Store the mouse position. + lastMouseX = e.pageX; + lastMouseY = e.pageY; + // Store the relative position between the mouse and the element. + mouseElementOffsetX = e.offsetX; + mouseElementOffsetY = e.offsetY; + + // Listen to the mouse movement. + document.addEventListener("mousemove", handleResize); + // Listen to the moment when the mouse click is not pressed anymore. + document.addEventListener("mouseup", handleEnd); + // Limit the mouse selection of the body. + document.body.style.userSelect = "none"; + }; + + // Event to listen the init of the movement. + resizeDraggable.addEventListener("mousedown", handleStart); + + // Returns a function to clean the event listeners. + return () => { + resizeDraggable.remove(); + handleEnd(); + }; +} diff --git a/visual_console_client/src/main.css b/visual_console_client/src/main.css index b737d1768a..99df3bb925 100644 --- a/visual_console_client/src/main.css +++ b/visual_console_client/src/main.css @@ -16,7 +16,18 @@ } .visual-console-item.is-editing { - border: 2px dashed #33ccff; + border: 2px dashed #b2b2b2; transform: translateX(-2px) translateY(-2px); cursor: move; } + +.visual-console-item.is-editing > .resize-draggable { + float: right; + position: absolute; + right: 0; + bottom: 0; + width: 15px; + height: 15px; + background: url(./resize-handle.svg); + cursor: se-resize; +} diff --git a/visual_console_client/src/resize-handle.svg b/visual_console_client/src/resize-handle.svg new file mode 100644 index 0000000000..b851b85377 --- /dev/null +++ b/visual_console_client/src/resize-handle.svg @@ -0,0 +1,24 @@ + + + + + + + + + + + + + From 4d287a6f36458fbf7f565ac43d485c3fe05f4683 Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Mon, 17 Jun 2019 12:31:20 +0200 Subject: [PATCH 028/123] Fixed bug showing total events in tactical view on dashboard - #4075 --- .../include/functions_reporting.php | 42 +++++++++++++------ 1 file changed, 29 insertions(+), 13 deletions(-) diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index eb215340c3..df8e98202c 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -11105,22 +11105,38 @@ function reporting_get_stats_servers() $output = '
'.__('Server performance').''.html_print_table($table_srv, true).'
'; + $public_hash = get_parameter('hash', false); + if ($public_hash === false) { + $output .= ''; + $output .= ''; + } else { + // This is for public link on the dashboard + $sql_count_event = 'SELECT SQL_NO_CACHE COUNT(id_evento) FROM tevento '; + if ($config['event_view_hr']) { + $sql_count_event .= 'WHERE utimestamp > (UNIX_TIMESTAMP(NOW()) - '.($config['event_view_hr'] * SECONDS_1HOUR).')'; + } - return $output; + $system_events = db_get_value_sql($sql_count_event); + + $output .= ''; + } + + return $output; } From a75acb75fc9597897452c2616a26135dca2932ba Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Mon, 17 Jun 2019 12:46:35 +0200 Subject: [PATCH 029/123] Minor fix --- visual_console_client/src/main.css | 1 + 1 file changed, 1 insertion(+) diff --git a/visual_console_client/src/main.css b/visual_console_client/src/main.css index 99df3bb925..c69a486c8f 100644 --- a/visual_console_client/src/main.css +++ b/visual_console_client/src/main.css @@ -19,6 +19,7 @@ border: 2px dashed #b2b2b2; transform: translateX(-2px) translateY(-2px); cursor: move; + user-select: none; } .visual-console-item.is-editing > .resize-draggable { From 08c035a61292b5db2ecd36989518adb4c5bc9919 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 17 Jun 2019 16:33:57 +0200 Subject: [PATCH 030/123] Refactorf SNMPBrowserWndow in one unique function --- .../realtime_graphs/realtime_graphs.js | 46 ++---------------- .../javascript/pandora_snmp_browser.js | 47 +++++++++++++++++++ 2 files changed, 51 insertions(+), 42 deletions(-) diff --git a/pandora_console/extensions/realtime_graphs/realtime_graphs.js b/pandora_console/extensions/realtime_graphs/realtime_graphs.js index 7140d245d4..b5d6c1eaa8 100644 --- a/pandora_console/extensions/realtime_graphs/realtime_graphs.js +++ b/pandora_console/extensions/realtime_graphs/realtime_graphs.js @@ -10,7 +10,9 @@ var plot; var plotOptions = { - legend: { container: $("#chartLegend") }, + legend: { + container: $("#chartLegend") + }, xaxis: { tickFormatter: function(timestamp, axis) { var date = new Date(timestamp * 1000); @@ -131,47 +133,6 @@ resetDataPooling(); } - // Set the form OID to the value selected in the SNMP browser - function setOID() { - if ($("#snmp_browser_version").val() == "3") { - $("#text-snmp_oid").val($("#table1-0-1").text()); - } else { - $("#text-snmp_oid").val($("#snmp_selected_oid").text()); - } - - // Close the SNMP browser - $(".ui-dialog-titlebar-close").trigger("click"); - } - - // Show the SNMP browser window - function snmpBrowserWindow() { - // Keep elements in the form and the SNMP browser synced - $("#text-target_ip").val($("#text-ip_target").val()); - $("#text-community").val($("#text-snmp_community").val()); - $("#snmp_browser_version").val($("#snmp_version").val()); - $("#snmp3_browser_auth_user").val($("#snmp3_auth_user").val()); - $("#snmp3_browser_security_level").val($("#snmp3_security_level").val()); - $("#snmp3_browser_auth_method").val($("#snmp3_auth_method").val()); - $("#snmp3_browser_auth_pass").val($("#snmp3_auth_pass").val()); - $("#snmp3_browser_privacy_method").val($("#snmp3_privacy_method").val()); - $("#snmp3_browser_privacy_pass").val($("#snmp3_privacy_pass").val()); - - $("#snmp_browser_container") - .show() - .dialog({ - title: "", - resizable: true, - draggable: true, - modal: true, - overlay: { - opacity: 0.5, - background: "black" - }, - width: 920, - height: 500 - }); - } - function shortNumber(number) { if (Math.round(number) != number) return number; number = Number.parseInt(number); @@ -187,6 +148,7 @@ return number + " " + shorts[pos]; } + function roundToTwo(num) { return +(Math.round(num + "e+2") + "e-2"); } diff --git a/pandora_console/include/javascript/pandora_snmp_browser.js b/pandora_console/include/javascript/pandora_snmp_browser.js index ee75eac71f..dbe8121a64 100644 --- a/pandora_console/include/javascript/pandora_snmp_browser.js +++ b/pandora_console/include/javascript/pandora_snmp_browser.js @@ -417,3 +417,50 @@ function checkSNMPVersion() { $("#snmp3_browser_options").css("display", "none"); } } + +// Show the SNMP browser window +function snmpBrowserWindow() { + // Keep elements in the form and the SNMP browser synced + $("#text-target_ip").val($("#text-ip_target").val()); + $("#text-community").val($("#text-snmp_community").val()); + $("#snmp_browser_version").val($("#snmp_version").val()); + $("#text-snmp3_browser_auth_user").val($("#text-snmp3_auth_user").val()); + $("#snmp3_browser_security_level").val($("#snmp3_security_level").val()); + $("#snmp3_browser_auth_method").val($("#snmp3_auth_method").val()); + $("#password-snmp3_browser_auth_pass").val( + $("#password-snmp3_auth_pass").val() + ); + $("#snmp3_browser_privacy_method").val($("#snmp3_privacy_method").val()); + $("#password-snmp3_browser_privacy_pass").val( + $("#password-snmp3_privacy_pass").val() + ); + + checkSNMPVersion(); + + $("#snmp_browser_container") + .show() + .dialog({ + title: "", + resizable: true, + draggable: true, + modal: true, + overlay: { + opacity: 0.5, + background: "black" + }, + width: 920, + height: 500 + }); +} + +// Set the form OID to the value selected in the SNMP browser +function setOID() { + if ($("#snmp_browser_version").val() == "3") { + $("#text-snmp_oid").val($("#table1-0-1").text()); + } else { + $("#text-snmp_oid").val($("#snmp_selected_oid").text()); + } + + // Close the SNMP browser + $(".ui-dialog-titlebar-close").trigger("click"); +} From 9bdf048fae2219b4121e50530906ede03b8174b2 Mon Sep 17 00:00:00 2001 From: Luis Calvo Date: Mon, 17 Jun 2019 16:35:58 +0200 Subject: [PATCH 031/123] Fixed and refactored duplicated functions SNMP Browser not showing v3 paramethers --- .../extensions/realtime_graphs.php | 2 +- .../agentes/module_manager_editor_network.php | 40 ------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/pandora_console/extensions/realtime_graphs.php b/pandora_console/extensions/realtime_graphs.php index cea09fe4d5..e487d49ee5 100644 --- a/pandora_console/extensions/realtime_graphs.php +++ b/pandora_console/extensions/realtime_graphs.php @@ -173,7 +173,7 @@ function pandora_realtime_graphs() $table->colspan[2]['snmp_oid'] = 2; $data['snmp_ver'] = __('Version').'  '.html_print_select($snmp_versions, 'snmp_version', $snmp_ver, '', '', 0, true); - $data['snmp_ver'] .= '  '.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:realtimeGraphs.snmpBrowserWindow();', 'class="sub next"', true); + $data['snmp_ver'] .= '  '.html_print_button(__('SNMP walk'), 'snmp_walk', false, 'javascript:snmpBrowserWindow();', 'class="sub next"', true); $table->colspan[2]['snmp_ver'] = 2; $table->data[] = $data; diff --git a/pandora_console/godmode/agentes/module_manager_editor_network.php b/pandora_console/godmode/agentes/module_manager_editor_network.php index 306e5f9804..c0a6181a8e 100644 --- a/pandora_console/godmode/agentes/module_manager_editor_network.php +++ b/pandora_console/godmode/agentes/module_manager_editor_network.php @@ -506,45 +506,5 @@ $(document).ready (function () { }); }); -// Show the SNMP browser window -function snmpBrowserWindow () { - - // Keep elements in the form and the SNMP browser synced - $('#text-target_ip').val($('#text-ip_target').val()); - $('#text-community').val($('#text-snmp_community').val()); - $('#snmp_browser_version').val($('#snmp_version').val()); - $('#text-snmp3_browser_auth_user').val($('#text-snmp3_auth_user').val()); - $('#snmp3_browser_security_level').val($('#snmp3_security_level').val()); - $('#snmp3_browser_auth_method').val($('#snmp3_auth_method').val()); - $('#password-snmp3_browser_auth_pass').val($('#password-snmp3_auth_pass').val()); - $('#snmp3_browser_privacy_method').val($('#snmp3_privacy_method').val()); - $('#password-snmp3_browser_privacy_pass').val($('#password-snmp3_privacy_pass').val()); - - $("#snmp_browser_container").show().dialog ({ - title: '', - resizable: true, - draggable: true, - modal: true, - overlay: { - opacity: 0.5, - background: "black" - }, - width: 920, - height: 500 - }); -} - -// Set the form OID to the value selected in the SNMP browser -function setOID () { - - if($('#snmp_browser_version').val() == '3'){ - $('#text-snmp_oid').val($('#table1-0-1').text()); - } else { - $('#text-snmp_oid').val($('#snmp_selected_oid').text()); - } - - // Close the SNMP browser - $('.ui-dialog-titlebar-close').trigger('click'); -} From 589000fb6cc9c3cc014f4a5cfdc256758292e8fe Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 18 Jun 2019 10:13:56 +0200 Subject: [PATCH 032/123] Added save in onItemMoved --- .../javascript/pandora_visual_console.js | 3 +- pandora_console/include/rest-api/index.php | 16 ++++++++++ .../include/rest-api/models/Model.php | 4 +-- .../models/VisualConsole/Container.php | 3 +- .../rest-api/models/VisualConsole/Item.php | 31 ++++++++++++------- .../models/VisualConsole/Items/Line.php | 2 +- 6 files changed, 42 insertions(+), 17 deletions(-) diff --git a/pandora_console/include/javascript/pandora_visual_console.js b/pandora_console/include/javascript/pandora_visual_console.js index ca1fed6e79..6958fdae7f 100755 --- a/pandora_console/include/javascript/pandora_visual_console.js +++ b/pandora_console/include/javascript/pandora_visual_console.js @@ -144,7 +144,8 @@ function createVisualConsole( var id = e.item.props.id; var data = { x: e.newPosition.x, - y: e.newPosition.y + y: e.newPosition.y, + type: e.item.props.type }; var taskId = "visual-console-item-move-" + id; diff --git a/pandora_console/include/rest-api/index.php b/pandora_console/include/rest-api/index.php index 10f87488c7..a49667670b 100644 --- a/pandora_console/include/rest-api/index.php +++ b/pandora_console/include/rest-api/index.php @@ -13,6 +13,7 @@ use Models\VisualConsole\Container as VisualConsole; $visualConsoleId = (int) get_parameter('visualConsoleId'); $getVisualConsole = (bool) get_parameter('getVisualConsole'); $getVisualConsoleItems = (bool) get_parameter('getVisualConsoleItems'); +$updateVisualConsoleItem = (bool) get_parameter('updateVisualConsoleItem'); // Check groups can access user. $aclUserGroups = []; @@ -44,6 +45,21 @@ if ($getVisualConsole === true) { } else if ($getVisualConsoleItems === true) { $vcItems = VisualConsole::getItemsFromDB($visualConsoleId, $aclUserGroups); echo '['.implode($vcItems, ',').']'; +} else if ($updateVisualConsoleItem === true) { + $visualConsoleId = (integer) get_parameter('visualConsoleId'); + $visualConsoleItemId = (integer) get_parameter('visualConsoleItemId'); + $data = get_parameter('data'); + + $class = VisualConsole::getItemClass($data['type']); + + $item_data = []; + $item_data['id'] = $visualConsoleItemId; + $item_data['id_layout'] = $visualConsoleId; + $item_data['type'] = $data['type']; + + $item = $class::fromDB($item_data); + + $item->save($item->toArray(), $data); } exit; diff --git a/pandora_console/include/rest-api/models/Model.php b/pandora_console/include/rest-api/models/Model.php index 44e4f8b3e8..1cc8564603 100644 --- a/pandora_console/include/rest-api/models/Model.php +++ b/pandora_console/include/rest-api/models/Model.php @@ -68,7 +68,7 @@ abstract class Model * * @abstract */ - abstract public function save(array $data=[]): bool; + abstract public function save(array $data=[], array $newdata=[]); /** @@ -93,7 +93,7 @@ abstract class Model * * @return self Instance of the model. */ - public static function fromArray(array $data) + public static function fromArray(array $data): self { // The reserved word static refers to the invoked class at runtime. return new static($data); diff --git a/pandora_console/include/rest-api/models/VisualConsole/Container.php b/pandora_console/include/rest-api/models/VisualConsole/Container.php index 653b33d5c4..1f013cc28f 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Container.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Container.php @@ -117,7 +117,7 @@ final class Container extends Model * * @overrides Model::save. */ - public function save(array $data=[]): bool + public function save(array $data=[], array $newdata=[]): bool { return true; } @@ -396,7 +396,6 @@ final class Container extends Model try { array_push($items, $class::fromDB($data)); - hd($class::save($data), true); } catch (\Throwable $e) { // TODO: Log this? } diff --git a/pandora_console/include/rest-api/models/VisualConsole/Item.php b/pandora_console/include/rest-api/models/VisualConsole/Item.php index c368e855cb..56b349db54 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Item.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Item.php @@ -1627,24 +1627,33 @@ class Item extends CachedModel * * @overrides Model::save. */ - public function save(array $data=[]): bool + public function save(array $data=[], array $newdata=[]) { - $save = static::encode($data); + $save = self::encode($data); + $newSave = self::encode($newdata); - if (empty($save['id'])) { - // Insert. - $result = \db_process_sql_insert('tlayout_data', $save); - // static = static::fromDB(['id' => $result]); - } else { - // Update. - $result = \db_process_sql_update('tlayout_data', $save, ['id' => $save['id']]); - // static = static::fromDB(['id' => $save['id']]); + $save = \array_merge($save, $newSave); + + if (!empty($save)) { + if (empty($save['id'])) { + // Insert. + $result = \db_process_sql_insert('tlayout_data', $save); + } else { + // Update. + $result = \db_process_sql_update('tlayout_data', $save, ['id' => $save['id']]); + } } + // Update the model. if ($result) { + if (empty($save['id'])) { + $item = static::fromDB(['id' => $result]); + } else { + $item = static::fromDB(['id' => $save['id']]); + } } - return $result; + return $item; } diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php index 73887827d5..465a264459 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php @@ -231,7 +231,7 @@ final class Line extends Model * * @overrides Model::save. */ - public function save(array $data=[]): bool + public function save(array $data=[], array $newdata=[]): bool { return true; } From 649689b1a19326e0a7ddd00e186c60a329b6500c Mon Sep 17 00:00:00 2001 From: Daniel Maya Date: Tue, 18 Jun 2019 17:28:36 +0200 Subject: [PATCH 033/123] Update --- pandora_console/include/rest-api/index.php | 4 +- .../include/rest-api/models/Model.php | 8 +- .../models/VisualConsole/Container.php | 2 +- .../rest-api/models/VisualConsole/Item.php | 33 ++-- .../models/VisualConsole/Items/Line.php | 172 +++++++++++++++++- 5 files changed, 198 insertions(+), 21 deletions(-) diff --git a/pandora_console/include/rest-api/index.php b/pandora_console/include/rest-api/index.php index a49667670b..46cc756545 100644 --- a/pandora_console/include/rest-api/index.php +++ b/pandora_console/include/rest-api/index.php @@ -55,11 +55,9 @@ if ($getVisualConsole === true) { $item_data = []; $item_data['id'] = $visualConsoleItemId; $item_data['id_layout'] = $visualConsoleId; - $item_data['type'] = $data['type']; $item = $class::fromDB($item_data); - - $item->save($item->toArray(), $data); + $item->save($data); } exit; diff --git a/pandora_console/include/rest-api/models/Model.php b/pandora_console/include/rest-api/models/Model.php index 1cc8564603..cebdb3d0d7 100644 --- a/pandora_console/include/rest-api/models/Model.php +++ b/pandora_console/include/rest-api/models/Model.php @@ -68,7 +68,7 @@ abstract class Model * * @abstract */ - abstract public function save(array $data=[], array $newdata=[]); + abstract public function save(array $data=[]); /** @@ -86,6 +86,12 @@ abstract class Model } + public function setData(array $data) + { + $this->data = $data; + } + + /** * Instance the class with the unknown input data. * diff --git a/pandora_console/include/rest-api/models/VisualConsole/Container.php b/pandora_console/include/rest-api/models/VisualConsole/Container.php index 1f013cc28f..0353b8c44a 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Container.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Container.php @@ -117,7 +117,7 @@ final class Container extends Model * * @overrides Model::save. */ - public function save(array $data=[], array $newdata=[]): bool + public function save(array $data=[]): bool { return true; } diff --git a/pandora_console/include/rest-api/models/VisualConsole/Item.php b/pandora_console/include/rest-api/models/VisualConsole/Item.php index 56b349db54..da9290bade 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Item.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Item.php @@ -1627,33 +1627,38 @@ class Item extends CachedModel * * @overrides Model::save. */ - public function save(array $data=[], array $newdata=[]) + public function save(array $data=[]): bool { - $save = self::encode($data); - $newSave = self::encode($newdata); + if (empty($data)) { + return false; + } - $save = \array_merge($save, $newSave); + $dataModelEncode = $this->encode($this->toArray()); + $dataEncode = $this->encode($data); + hd(self::toArray(), true); + $save = \array_merge($dataModelEncode, $dataEncode); if (!empty($save)) { if (empty($save['id'])) { // Insert. $result = \db_process_sql_insert('tlayout_data', $save); + if ($result) { + $item = static::fromDB(['id' => $result]); + } } else { // Update. $result = \db_process_sql_update('tlayout_data', $save, ['id' => $save['id']]); + if ($result) { + $item = static::fromDB(['id' => $save['id']]); + // Update the model. + if (!empty($item)) { + $this->setData($item->toArray()); + } + } } } - // Update the model. - if ($result) { - if (empty($save['id'])) { - $item = static::fromDB(['id' => $result]); - } else { - $item = static::fromDB(['id' => $save['id']]); - } - } - - return $item; + return (bool) $result; } diff --git a/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php b/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php index 465a264459..4b177c30b2 100644 --- a/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php +++ b/pandora_console/include/rest-api/models/VisualConsole/Items/Line.php @@ -218,10 +218,150 @@ final class Line extends Model protected function encode(array $data): array { $result = []; + + $id = static::getId($data); + if ($id) { + $result['id'] = $id; + } + + $id_layout = static::getIdLayout($data); + if ($id_layout) { + $result['id_layout'] = $id_layout; + } + + $pos_x = static::parseIntOr( + static::issetInArray($data, ['x', 'pos_x', 'posX']), + null + ); + if ($pos_x !== null) { + $result['pos_x'] = $pos_x; + } + + $pos_y = static::parseIntOr( + static::issetInArray($data, ['y', 'pos_y', 'posY']), + null + ); + if ($pos_y !== null) { + $result['pos_y'] = $pos_y; + } + + $height = static::getHeight($data); + if ($height !== null) { + $result['height'] = $height; + } + + $width = static::getWidth($data); + if ($width !== null) { + $result['width'] = $width; + } + + $type = static::parseIntOr( + static::issetInArray($data, ['type']), + null + ); + if ($type !== null) { + $result['type'] = $type; + } + + $border_width = static::getBorderWidth($data); + if ($border_width !== null) { + $result['border_width'] = $border_width; + } + + $border_color = static::extractBorderColor($data); + if ($border_color !== null) { + $result['border_color'] = $border_color; + } + + $show_on_top = static::issetInArray($data, ['isOnTop', 'show_on_top', 'showOnTop']); + if ($show_on_top !== null) { + $result['show_on_top'] = static::parseBool($show_on_top); + } + return $result; } + /** + * Extract item id. + * + * @param array $data Unknown input data structure. + * + * @return integer Item id. 0 by default. + */ + private static function getId(array $data): int + { + return static::parseIntOr( + static::issetInArray($data, ['id', 'itemId']), + 0 + ); + } + + + /** + * Extract layout id. + * + * @param array $data Unknown input data structure. + * + * @return integer Item id. 0 by default. + */ + private static function getIdLayout(array $data): int + { + return static::parseIntOr( + static::issetInArray($data, ['id_layout', 'idLayout', 'layoutId']), + 0 + ); + } + + + /** + * Extract item width. + * + * @param array $data Unknown input data structure. + * + * @return integer Item width. 0 by default. + */ + private static function getWidth(array $data) + { + return static::parseIntOr( + static::issetInArray($data, ['width', 'endX']), + null + ); + } + + + /** + * Extract item height. + * + * @param array $data Unknown input data structure. + * + * @return integer Item height. 0 by default. + */ + private static function getHeight(array $data) + { + return static::parseIntOr( + static::issetInArray($data, ['height', 'endY']), + null + ); + } + + + /** + * Extract a border width value. + * + * @param array $data Unknown input data structure. + * + * @return integer Valid border width. + */ + private static function getBorderWidth(array $data) + { + return static::parseIntOr( + static::issetInArray($data, ['border_width', 'borderWidth']), + null + ); + } + + /** * Insert or update an item in the database * @@ -231,9 +371,37 @@ final class Line extends Model * * @overrides Model::save. */ - public function save(array $data=[], array $newdata=[]): bool + public function save(array $data=[]): bool { - return true; + $data_model = $this->encode($this->toArray()); + $newData = $this->encode($data); + + $save = \array_merge($data_model, $newData); + + if (!empty($save)) { + if (empty($save['id'])) { + // Insert. + $result = \db_process_sql_insert('tlayout_data', $save); + } else { + // Update. + $result = \db_process_sql_update('tlayout_data', $save, ['id' => $save['id']]); + } + } + + // Update the model. + if ($result) { + if (empty($save['id'])) { + $item = static::fromDB(['id' => $result]); + } else { + $item = static::fromDB(['id' => $save['id']]); + } + + if (!empty($item)) { + $this->setData($item->toArray()); + } + } + + return (bool) $result; } From 50b05728b7bd4bc4b4c4a2dc654736e8ea8a0196 Mon Sep 17 00:00:00 2001 From: Alejandro Gallardo Escobar Date: Tue, 18 Jun 2019 18:08:52 +0200 Subject: [PATCH 034/123] Limited the vc item resizement to its container --- visual_console_client/src/lib/index.ts | 47 +++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 5 deletions(-) diff --git a/visual_console_client/src/lib/index.ts b/visual_console_client/src/lib/index.ts index eaad5bbab6..69b58d3732 100644 --- a/visual_console_client/src/lib/index.ts +++ b/visual_console_client/src/lib/index.ts @@ -571,10 +571,15 @@ export function addResizementListener( element: HTMLElement, onResized: (x: Position["x"], y: Position["y"]) => void ): Function { + const minWidth = 15; + const minHeight = 15; + const resizeDraggable = document.createElement("div"); resizeDraggable.className = "resize-draggable"; element.appendChild(resizeDraggable); + // Container of the resizable element. + const container = element.parentElement as HTMLElement; // Store the initial draggable state. const isDraggable = element.draggable; // Init the coordinates. @@ -584,6 +589,18 @@ export function addResizementListener( let lastMouseY: Position["y"] = 0; let mouseElementOffsetX: Position["x"] = 0; let mouseElementOffsetY: Position["y"] = 0; + // Init the bounds. + let containerBounds = container.getBoundingClientRect(); + let containerOffset = getOffset(container); + let containerTop = containerOffset.top; + let containerBottom = containerTop + containerBounds.height; + let containerLeft = containerOffset.left; + let containerRight = containerLeft + containerBounds.width; + let elementOffset = getOffset(element); + let elementTop = elementOffset.top; + let elementLeft = elementOffset.left; + let borderWidth = window.getComputedStyle(element).borderWidth || "0"; + let borderFix = Number.parseInt(borderWidth); // Will run onResized 32ms after its last execution. const debouncedResizement = debounce( @@ -601,11 +618,20 @@ export function addResizementListener( let width = lastWidth + (e.pageX - lastMouseX); let height = lastHeight + (e.pageY - lastMouseY); - // TODO: Document. - - // Minimum value. - if (width <= 0) width = 10; - if (height <= 0) height = 10; + if (width < minWidth) { + // Minimum value. + width = minWidth; + } else if (width + elementLeft - borderFix / 2 >= containerRight) { + // Limit the size to the container. + width = containerRight - elementLeft; + } + if (height < minHeight) { + // Minimum value. + height = minHeight; + } else if (height + elementTop - borderFix / 2 >= containerBottom) { + // Limit the size to the container. + height = containerBottom - elementTop; + } // Run the movement events. throttledResizement(width, height); @@ -653,6 +679,17 @@ export function addResizementListener( mouseElementOffsetX = e.offsetX; mouseElementOffsetY = e.offsetY; + // Initialize the bounds. + containerBounds = container.getBoundingClientRect(); + containerOffset = getOffset(container); + containerTop = containerOffset.top; + containerBottom = containerTop + containerBounds.height; + containerLeft = containerOffset.left; + containerRight = containerLeft + containerBounds.width; + elementOffset = getOffset(element); + elementTop = elementOffset.top; + elementLeft = elementOffset.left; + // Listen to the mouse movement. document.addEventListener("mousemove", handleResize); // Listen to the moment when the mouse click is not pressed anymore. From 524575171a8360968cf28fdca5ea1b8a6917aef8 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 19 Jun 2019 12:56:16 +0200 Subject: [PATCH 035/123] event history viewer --- pandora_console/include/functions_ui.php | 6 +- pandora_console/operation/events/events.php | 73 ++++++++++++--------- 2 files changed, 45 insertions(+), 34 deletions(-) diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index ea07c20d6a..c18ef5a52b 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -2936,15 +2936,15 @@ function ui_print_datatable(array $parameters) } if (!isset($parameters['order']['field'])) { - $order = 1; + $order = 0; } else { $order = array_search( $parameters['order']['field'], $parameters['columns'] ); - if (empty($order)) { - $order = 1; + if ($order === false) { + $order = 0; } } diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 7e8ce16ec3..88621b7711 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -109,6 +109,8 @@ $date_to = get_parameter('filter[date_to]'); $source = get_parameter('filter[source]'); $id_extra = get_parameter('filter[id_extra]'); $user_comment = get_parameter('filter[user_comment]'); +$history = get_parameter('history', false); +$section = get_parameter('section', false); // Ajax responses. if (is_ajax()) { @@ -155,7 +157,9 @@ if (is_ajax()) { } $events = events_get_all( + // Fields. $fields, + // Filter. $filter, // Offset. $start, @@ -164,7 +168,9 @@ if (is_ajax()) { // Order. $order['direction'], // Sort field. - $order['field'] + $order['field'], + // History. + $history ); $count = events_get_all( 'count', @@ -1227,7 +1233,10 @@ try { 'class' => 'info_table events', 'style' => 'width: 100%;', 'ajax_url' => 'operation/events/events', - 'ajax_data' => ['get_events' => 1], + 'ajax_data' => [ + 'get_events' => 1, + 'history' => (int) $history, + ], 'form' => [ 'id' => 'events_form', 'class' => 'flex-row', @@ -1280,39 +1289,41 @@ try { $sql_event_resp = "SELECT id, name FROM tevent_response WHERE type LIKE 'command'"; $event_responses = db_get_all_rows_sql($sql_event_resp); -if (check_acl($config['id_user'], 0, 'EW') == 1 && !$readonly) { - $array_events_actions['in_progress_selected'] = __('In progress selected'); - $array_events_actions['validate_selected'] = __('Validate selected'); -} +if ($config['event_replication'] != 1) { + if (check_acl($config['id_user'], 0, 'EW') == 1 && !$readonly) { + $array_events_actions['in_progress_selected'] = __('In progress selected'); + $array_events_actions['validate_selected'] = __('Validate selected'); + } -if (check_acl($config['id_user'], 0, 'EM') == 1 && !$readonly) { - $array_events_actions['delete_selected'] = __('Delete selected'); + if (check_acl($config['id_user'], 0, 'EM') == 1 && !$readonly) { + $array_events_actions['delete_selected'] = __('Delete selected'); + } } foreach ($event_responses as $val) { $array_events_actions[$val['id']] = $val['name']; } -if ($config['event_replication'] != 1) { - echo '
'; - echo '
'; - echo ''; - html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false); - echo '  '; - html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"'); - echo "'; - echo '
'; - echo ''; - echo ''; - echo '
'; -} + +echo '
'; +echo '
'; +echo ''; +html_print_select($array_events_actions, 'response_id', '', '', '', 0, false, false, false); +echo '  '; +html_print_button(__('Execute event response'), 'submit_event_response', false, 'execute_event_response(true);', 'class="sub next"'); +echo "'; +echo '
'; +echo ''; +echo ''; +echo '
'; + // Close viewer. enterprise_hook('close_meta_frame'); @@ -1658,6 +1669,9 @@ function process_datatables_item(item) { item.options += ' __('Delete event')]); ?>'; } } + // Multi select. item.m = ' /* Status */ img = ' __('Unknown'), 'class' => 'forced-title']); ?>'; From 44d8b977cbc8948867eb1573ea57a6d1d178a2a8 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 19 Jun 2019 16:52:14 +0200 Subject: [PATCH 036/123] event advanced filter fixes --- pandora_console/include/ajax/events.php | 24 +++++--- pandora_console/include/functions_events.php | 56 +++++++++++------ pandora_console/include/functions_groups.php | 47 ++++++++++++++ pandora_console/operation/events/events.php | 64 ++++++++++---------- 4 files changed, 131 insertions(+), 60 deletions(-) diff --git a/pandora_console/include/ajax/events.php b/pandora_console/include/ajax/events.php index ce173898b2..12f86c4852 100644 --- a/pandora_console/include/ajax/events.php +++ b/pandora_console/include/ajax/events.php @@ -1079,29 +1079,37 @@ if ($get_extended_event) { } // Check ACLs. + $access = false; if (is_user_admin($config['id_user'])) { // Do nothing if you're admin, you get full access. - $__ignored_line = 0; + $access = true; } else if ($config['id_user'] == $event['owner_user']) { // Do nothing if you're the owner user, you get access. - $__ignored_line = 0; + $access = true; } else if ($event['id_grupo'] == 0) { // If the event has access to all groups, you get access. - $__ignored_line = 0; + $access = true; } else { // Get your groups. $groups = users_get_groups($config['id_user'], 'ER'); if (in_array($event['id_grupo'], array_keys($groups))) { // If event group is among the groups of the user, you get access. - $__ignored_line = 0; - } else { - // If all the access types fail, abort. - echo 'Access denied'; - return false; + $access = true; + } else if ($event['id_agente'] + && agents_check_access_agent($event['id_agente'], 'ER') + ) { + // Secondary group, indirect access. + $access = true; } } + if (!$access) { + // If all the access types fail, abort. + echo 'Access denied'; + return false; + } + // Print group_rep in a hidden field to recover it from javascript. html_print_input_hidden('group_rep', (int) $group_rep); diff --git a/pandora_console/include/functions_events.php b/pandora_console/include/functions_events.php index 9339322a7d..da2efa1bd1 100644 --- a/pandora_console/include/functions_events.php +++ b/pandora_console/include/functions_events.php @@ -641,32 +641,37 @@ function events_get_all( } } - if (isset($filter['id_group_filter']) && $filter['id_group_filter'] > 0) { + $groups = $filter['id_group_filter']; + if (isset($groups) && $groups > 0) { $propagate = db_get_value( 'propagate', 'tgrupo', 'id_grupo', - $filter['id_group_filter'] + $groups ); if (!$propagate) { $sql_filters[] = sprintf( - ' AND te.id_grupo = %d ', - $filter['id_group_filter'] + ' AND (te.id_grupo = %d OR tasg.id_group = %d)', + $groups ); } else { - $groups = [ $filter['id_group_filter'] ]; - $childrens = groups_get_childrens($id_group, null, true); - if (!empty($childrens)) { - foreach ($childrens as $child) { - $groups[] = (int) $child['id_grupo']; + $children = groups_get_children($groups); + $_groups = []; + if (!empty($children)) { + foreach ($children as $child) { + $_groups[] = (int) $child['id_grupo']; } + + $groups = $_groups; + } else { + $groups = [ $groups ]; } - $filter['id_group_filter'] = $groups; $sql_filters[] = sprintf( - ' AND id_group IN (%s) ', - join(',', $filter['id_group_filter']) + ' AND (te.id_grupo IN (%s) OR tasg.id_group IN (%s)', + join(',', array_keys($groups)), + join(',', array_keys($groups)) ); } } @@ -702,8 +707,6 @@ function events_get_all( } } - $sg_active = enterprise_hook('agents_is_using_secondary_groups'); - if (!$user_is_admin) { $ER_groups = users_get_groups($config['id_user'], 'ER', false); $EM_groups = users_get_groups($config['id_user'], 'EM', false, true); @@ -713,7 +716,8 @@ function events_get_all( if (!$user_is_admin && !users_can_manage_group_all('ER')) { // Get groups where user have ER grants. $sql_filters[] = sprintf( - ' AND te.id_grupo IN ( %s )', + ' AND (te.id_grupo IN ( %s ) OR tasg.id_group IN (%s))', + join(', ', array_keys($ER_groups)), join(', ', array_keys($ER_groups)) ); } @@ -1036,12 +1040,24 @@ function events_get_all( $tgrupo_join = 'LEFT'; $tgrupo_join_filters = []; - if (isset($filter['id_group_filter']) && $filter['id_group_filter'] > 0) { + if (isset($groups) + && (is_array($groups) + || $groups > 0) + ) { $tgrupo_join = 'INNER'; - $tgrupo_join_filters[] = sprintf( - ' AND tg.id_grupo = %s', - $filter['id_group_filter'] - ); + if (is_array($groups)) { + $tgrupo_join_filters[] = sprintf( + ' AND (tg.id_grupo IN (%s) OR tasg.id_group IN (%s))', + join(', ', array_keys($groups)), + join(', ', array_keys($groups)) + ); + } else { + $tgrupo_join_filters[] = sprintf( + ' AND (tg.id_grupo = %s OR tasg.id_group = %s)', + $groups, + $groups + ); + } } // Secondary groups. diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 8fe37c0e48..0e88d86004 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -298,6 +298,53 @@ function groups_get_childrens_ids($parent, $groups=null) /** + * Return a array of id_group of children of given parent. + * + * @param integer $parent The id_grupo parent to search its children. + * @param array $ignorePropagate Ignore propagate. + */ +function groups_get_children($parent, $ignorePropagate=false) +{ + static $groups; + + if (empty($groups)) { + $groups = db_get_all_rows_in_table('tgrupo'); + $groups = array_reduce( + $groups, + function ($carry, $item) { + $carry[$item['id_grupo']] = $item; + return $carry; + } + ); + } + + $return = []; + foreach ($groups as $key => $g) { + if ($g['id_grupo'] == 0) { + continue; + } + + if ($ignorePropagate || $parent == 0 || $groups[$parent]['propagate']) { + if ($g['parent'] == $parent) { + $return += [$g['id_grupo'] => $g]; + if ($g['propagate'] || $ignorePropagate) { + $return += groups_get_children( + $g['id_grupo'], + $ignorePropagate + ) + ); + } + } + } + } + + return $return; +} + + +/** + * XXX: This is not working. Expects 'propagate' on CHILD not on PARENT!!! + * * Return a array of id_group of childrens (to branches down) * * @param integer $parent The id_group parent to search the childrens. diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 88621b7711..95ac221164 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -1591,38 +1591,6 @@ function process_datatables_item(item) { module_status = '
' + text + "
"; - - /* Agent name link */ - if (item.id_agente > 0) { - item.agent_name = '' + item.agent_name + ''; - } else { - item.agent_name = ''; - } - - /* Agent ID link */ - if (item.id_agente > 0) { - - item.id_agente = '' + item.id_agente + ''; - - item.id_agente = '' + item.agent_name + ''; - - } else { - item.id_agente = ''; - } - - /* Group name */ - if (item.id_grupo == "0") { - item.id_grupo = ""; - } else { - item.id_grupo = item.group_name; - } - /* Options */ // Show more. item.options = '' +item.id_agente+'">' + item.agent_name + ''; + } else { + item.agent_name = ''; + } + + /* Agent ID link */ + if (item.id_agente > 0) { + + item.id_agente = '' + item.id_agente + ''; + + item.id_agente = '' + item.agent_name + ''; + + } else { + item.id_agente = ''; + } + item.estado = '
'; item.estado += img; item.estado += '
'; @@ -1719,6 +1712,13 @@ function process_datatables_item(item) { // Add event severity format to itself. item.evento = evn; + /* Group name */ + if (item.id_grupo == "0") { + item.id_grupo = ""; + } else { + item.id_grupo = item.group_name; + } + } /* Datatables auxiliary functions ends */ From 6b944ead9735241fa50e550f816f0691708fe9c6 Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 19 Jun 2019 17:08:18 +0200 Subject: [PATCH 037/123] minor fix --- pandora_console/include/functions_groups.php | 1 - 1 file changed, 1 deletion(-) diff --git a/pandora_console/include/functions_groups.php b/pandora_console/include/functions_groups.php index 0e88d86004..a1448e37f2 100644 --- a/pandora_console/include/functions_groups.php +++ b/pandora_console/include/functions_groups.php @@ -331,7 +331,6 @@ function groups_get_children($parent, $ignorePropagate=false) $return += groups_get_children( $g['id_grupo'], $ignorePropagate - ) ); } } From 275261e6b3ce2777f7c19eea5419de706dffd3be Mon Sep 17 00:00:00 2001 From: fbsanchez Date: Wed, 19 Jun 2019 17:30:32 +0200 Subject: [PATCH 038/123] wip csv export events --- pandora_console/operation/events/events.php | 26 ++++++++++++++----- .../operation/events/export_csv.php | 15 +++++++++++ 2 files changed, 34 insertions(+), 7 deletions(-) diff --git a/pandora_console/operation/events/events.php b/pandora_console/operation/events/events.php index 95ac221164..400f3e9d6d 100644 --- a/pandora_console/operation/events/events.php +++ b/pandora_console/operation/events/events.php @@ -111,11 +111,11 @@ $id_extra = get_parameter('filter[id_extra]'); $user_comment = get_parameter('filter[user_comment]'); $history = get_parameter('history', false); $section = get_parameter('section', false); +$filter = get_parameter('filter', []); // Ajax responses. if (is_ajax()) { $get_events = get_parameter('get_events', 0); - $filter = get_parameter('filter', []); // Datatables offset, limit. $start = get_parameter('start', 0); $length = get_parameter('length', $config['block_size']); @@ -493,27 +493,27 @@ if ($pure) { // Fullscreen. $fullscreen['active'] = false; - $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).''; + $fullscreen['text'] = ''.html_print_image('images/full_screen.png', true, ['title' => __('Full screen')]).''; // Event list. $list['active'] = false; - $list['text'] = ''.html_print_image('images/events_list.png', true, ['title' => __('Event list')]).''; + $list['text'] = ''.html_print_image('images/events_list.png', true, ['title' => __('Event list')]).''; // History event list. $history_list['active'] = false; - $history_list['text'] = ''.html_print_image('images/books.png', true, ['title' => __('History event list')]).''; + $history_list['text'] = ''.html_print_image('images/books.png', true, ['title' => __('History event list')]).''; // RSS. $rss['active'] = false; - $rss['text'] = ''.html_print_image('images/rss.png', true, ['title' => __('RSS Events')]).''; + $rss['text'] = ''.html_print_image('images/rss.png', true, ['title' => __('RSS Events')]).''; // Marquee. $marquee['active'] = false; - $marquee['text'] = ''.html_print_image('images/heart.png', true, ['title' => __('Marquee display')]).''; + $marquee['text'] = ''.html_print_image('images/heart.png', true, ['title' => __('Marquee display')]).''; // CSV. $csv['active'] = false; - $csv['text'] = ''.html_print_image('images/csv_mc.png', true, ['title' => __('Export to CSV file')]).''; + $csv['text'] = ''.html_print_image('images/csv_mc.png', true, ['title' => __('Export to CSV file')]).''; // Sound events. $sound_event['active'] = false; @@ -1969,6 +1969,18 @@ function reorder_tags_inputs() { /* Tag management ends */ $(document).ready( function() { + /* Filter to a href */ + $('.events_link').on('click', function(e) { + e.preventDefault(); + + console.log(e.currentTarget); + + + + + + }); + /* Multi select handler */ $('#checkbox-all_validate_box').on('change', function() { if($('#checkbox-all_validate_box').is(":checked")) { diff --git a/pandora_console/operation/events/export_csv.php b/pandora_console/operation/events/export_csv.php index dbc20abb6a..be0bb52b71 100644 --- a/pandora_console/operation/events/export_csv.php +++ b/pandora_console/operation/events/export_csv.php @@ -27,6 +27,21 @@ if (! check_acl($config['id_user'], 0, 'ER') && ! check_acl($config['id_user'], exit; } +hd($_REQUEST); + +$fb64 = get_parameter('fb64', ''); + + +try { + $filter = json_decode(base64_decode($fb64), true); +} catch (Exception $e) { + echo $e; + exit; +} + +hd($filter); + +die(); global $config; // loading l10n tables, because of being invoked not through index.php. From 988eb2e257fdc7e3e2e0e937d475a2561f56762f Mon Sep 17 00:00:00 2001 From: Tatiana Llorente Date: Wed, 19 Jun 2019 17:36:55 +0200 Subject: [PATCH 039/123] Add module filter by text -#2094 --- .../godmode/massive/massive_edit_modules.php | 8 ++++ .../include/javascript/pandora_modules.js | 39 +++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/pandora_console/godmode/massive/massive_edit_modules.php b/pandora_console/godmode/massive/massive_edit_modules.php index a803fa4725..1a18b410d5 100755 --- a/pandora_console/godmode/massive/massive_edit_modules.php +++ b/pandora_console/godmode/massive/massive_edit_modules.php @@ -388,6 +388,11 @@ $table->data['form_modules_4'][1] = html_print_select( true ); +$table->rowstyle['form_modules_filter'] = 'vertical-align: top;'; +$table->rowclass['form_modules_filter'] = 'select_modules_row select_modules_row_2'; +$table->data['form_modules_filter'][0] = __('Filter Modules'); +$table->data['form_modules_filter'][1] = html_print_input_text('filter_modules', '', '', 20, 255, true); + $table->rowstyle['form_modules_2'] = 'vertical-align: top;'; $table->rowclass['form_modules_2'] = 'select_modules_row select_modules_row_2'; $table->data['form_modules_2'][0] = __('Modules'); @@ -1247,6 +1252,9 @@ $(document).ready (function () { }); $("#module_loading").hide (); $("#module_name").removeAttr ("disabled"); + //Filter modules. Call the function when the select is fully loaded. + var textNoData = ""; + filterByText($('#module_name'), $("#text-filter_modules"), textNoData); }, "json" ); diff --git a/pandora_console/include/javascript/pandora_modules.js b/pandora_console/include/javascript/pandora_modules.js index 0487923b38..049bb9e96b 100644 --- a/pandora_console/include/javascript/pandora_modules.js +++ b/pandora_console/include/javascript/pandora_modules.js @@ -1223,3 +1223,42 @@ function get_explanation_recon_script(id, id_rt, url) { taskManager.addTask(xhr); } + +// Filter modules in a select (bulk operations) +function filterByText(selectbox, textbox, textNoData) { + return selectbox.each(function() { + var select = selectbox; + var options = []; + $(select) + .find("option") + .each(function() { + options.push({ value: $(this).val(), text: $(this).text() }); + }); + $(select).data("options", options); + $(textbox).bind("change keyup", function() { + var options = $(select) + .empty() + .scrollTop(0) + .data("options"); + var search = $(this).val(); + var regex = new RegExp(search, "gi"); + $.each(options, function(i) { + var option = options[i]; + if (option.text.match(regex) !== null) { + $(select).append( + $("
'; echo __('Group').' '; $own_info = get_user_info($config['id_user']); -if (!$own_info['is_admin'] && check_acl($config['id_user'], 0, 'AW')) { +if (!$own_info['is_admin'] && !check_acl($config['id_user'], 0, 'AR') && !check_acl($config['id_user'], 0, 'AW')) { $return_all_group = false; } else { $return_all_group = true; diff --git a/pandora_console/include/functions_users.php b/pandora_console/include/functions_users.php index 3b4af210d0..d461ca9754 100755 --- a/pandora_console/include/functions_users.php +++ b/pandora_console/include/functions_users.php @@ -293,7 +293,7 @@ function users_get_groups( } // Per-group permissions. else { - $query = 'SELECT * FROM tgrupo ORDER BY parent,id_grupo DESC'; + $query = 'SELECT * FROM tgrupo ORDER BY nombre'; $raw_groups = db_get_all_rows_sql($query); $query = sprintf( From eeffe40b6ba47e6b19d3bf0caaac0f134ec6ab69 Mon Sep 17 00:00:00 2001 From: artica Date: Sat, 29 Jun 2019 00:01:07 +0200 Subject: [PATCH 118/123] 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.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index b6e8eee877..d28b2ec146 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.736-190628 +Version: 7.0NG.736-190629 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 5b33962912..cc1476eb23 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.0NG.736-190628" +pandora_version="7.0NG.736-190629" 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 e547e26c9d..d9ad04d838 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.736'; -use constant AGENT_BUILD => '190628'; +use constant AGENT_BUILD => '190629'; # 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 dae9afb803..0dcdd21e04 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.0NG.736 -%define release 190628 +%define release 190629 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 d195943bad..524fb0f673 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.0NG.736 -%define release 190628 +%define release 190629 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 8df338265a..5f942b61bb 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190628" +PI_BUILD="190629" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 12e927b377..c4ae668ac0 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190628} +{190629} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index df44b628ce..a84a4711c5 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.0NG.736(Build 190628)") +#define PANDORA_VERSION ("7.0NG.736(Build 190629)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 6e5b9873bf..a0e4514803 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.0NG.736(Build 190628))" + VALUE "ProductVersion", "(7.0NG.736(Build 190629))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index ccfbbb3ace..40b942e9d7 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.736-190628 +Version: 7.0NG.736-190629 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 270ec1354b..8fa22dadd4 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.0NG.736-190628" +pandora_version="7.0NG.736-190629" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 213036374f..bbbb059b49 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190628'; +$build_version = 'PC190629'; $pandora_version = 'v7.0NG.736'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 4e708966e3..2c3b33186d 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 58de3c6e8d..434cd4dc60 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190628 +%define release 190629 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index c79285db3f..d90eca0c08 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190628 +%define release 190629 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 3b3d487c43..98c0857109 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190628" +PI_BUILD="190629" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 4addd4b6f8..bcb02960c1 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.736 PS190628"; +my $version = "7.0NG.736 PS190629"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 7e638ace81..2d5beeb20c 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.736 PS190628"; +my $version = "7.0NG.736 PS190629"; # save program name for logging my $progname = basename($0); From c9f101eda68670de7ddd03365dcfb3526fe97885 Mon Sep 17 00:00:00 2001 From: artica Date: Sun, 30 Jun 2019 00:01:05 +0200 Subject: [PATCH 119/123] 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.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index d28b2ec146..7af0f4d36c 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.736-190629 +Version: 7.0NG.736-190630 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 cc1476eb23..9699c3aaf3 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.0NG.736-190629" +pandora_version="7.0NG.736-190630" 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 d9ad04d838..3870c287a2 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.736'; -use constant AGENT_BUILD => '190629'; +use constant AGENT_BUILD => '190630'; # 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 0dcdd21e04..1399996932 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.0NG.736 -%define release 190629 +%define release 190630 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 524fb0f673..e962c38618 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.0NG.736 -%define release 190629 +%define release 190630 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 5f942b61bb..0a57d81e27 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190629" +PI_BUILD="190630" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index c4ae668ac0..0a645c12c0 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190629} +{190630} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index a84a4711c5..b2542ed82d 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.0NG.736(Build 190629)") +#define PANDORA_VERSION ("7.0NG.736(Build 190630)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index a0e4514803..89c933cc26 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.0NG.736(Build 190629))" + VALUE "ProductVersion", "(7.0NG.736(Build 190630))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 40b942e9d7..271b698ec9 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.736-190629 +Version: 7.0NG.736-190630 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 8fa22dadd4..3bba8bd8cd 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.0NG.736-190629" +pandora_version="7.0NG.736-190630" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index bbbb059b49..160b432514 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190629'; +$build_version = 'PC190630'; $pandora_version = 'v7.0NG.736'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 2c3b33186d..4869f70136 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index 434cd4dc60..c8d1b4f325 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190629 +%define release 190630 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index d90eca0c08..defdeba862 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190629 +%define release 190630 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 98c0857109..abf486fafa 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190629" +PI_BUILD="190630" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index bcb02960c1..838fd5b529 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.736 PS190629"; +my $version = "7.0NG.736 PS190630"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 2d5beeb20c..4602a8190f 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.736 PS190629"; +my $version = "7.0NG.736 PS190630"; # save program name for logging my $progname = basename($0); From dd75aa6a42645a231a14f38cfd97866bdc0dcdfc Mon Sep 17 00:00:00 2001 From: artica Date: Mon, 1 Jul 2019 00:01:07 +0200 Subject: [PATCH 120/123] 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.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 7af0f4d36c..72471bf73d 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.736-190630 +Version: 7.0NG.736-190701 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 9699c3aaf3..1d0950a6c2 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.0NG.736-190630" +pandora_version="7.0NG.736-190701" 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 3870c287a2..c75bac002b 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.736'; -use constant AGENT_BUILD => '190630'; +use constant AGENT_BUILD => '190701'; # 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 1399996932..75b1232417 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.0NG.736 -%define release 190630 +%define release 190701 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 e962c38618..a7b3d24163 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.0NG.736 -%define release 190630 +%define release 190701 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 0a57d81e27..14b4bd5092 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190630" +PI_BUILD="190701" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 0a645c12c0..ecfd905763 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190630} +{190701} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index b2542ed82d..138daf143a 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.0NG.736(Build 190630)") +#define PANDORA_VERSION ("7.0NG.736(Build 190701)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 89c933cc26..2a4e9a924d 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.0NG.736(Build 190630))" + VALUE "ProductVersion", "(7.0NG.736(Build 190701))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index 271b698ec9..c0f73ed08b 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.736-190630 +Version: 7.0NG.736-190701 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 3bba8bd8cd..a557249535 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.0NG.736-190630" +pandora_version="7.0NG.736-190701" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index 160b432514..e2e2bd6c63 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190630'; +$build_version = 'PC190701'; $pandora_version = 'v7.0NG.736'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 4869f70136..c48f32de4b 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index c8d1b4f325..c44e40570a 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190630 +%define release 190701 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index defdeba862..3613e6b0ae 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190630 +%define release 190701 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index abf486fafa..1d140cba64 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190630" +PI_BUILD="190701" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 838fd5b529..8c89121a0f 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.736 PS190630"; +my $version = "7.0NG.736 PS190701"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 4602a8190f..b59d7f7076 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.736 PS190630"; +my $version = "7.0NG.736 PS190701"; # save program name for logging my $progname = basename($0); From 78bcf83856c4a15eafeceb82b7e86c556f705500 Mon Sep 17 00:00:00 2001 From: artica Date: Tue, 2 Jul 2019 00:01:09 +0200 Subject: [PATCH 121/123] 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.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 72471bf73d..460dd6b7f9 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.736-190701 +Version: 7.0NG.736-190702 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 1d0950a6c2..90ce64b6d8 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.0NG.736-190701" +pandora_version="7.0NG.736-190702" 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 c75bac002b..8e46849482 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.736'; -use constant AGENT_BUILD => '190701'; +use constant AGENT_BUILD => '190702'; # 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 75b1232417..62c86be6c3 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.0NG.736 -%define release 190701 +%define release 190702 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 a7b3d24163..5c6cebed00 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.0NG.736 -%define release 190701 +%define release 190702 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 14b4bd5092..30e9725bda 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190701" +PI_BUILD="190702" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index ecfd905763..d202a71b65 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190701} +{190702} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 138daf143a..658a85c414 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.0NG.736(Build 190701)") +#define PANDORA_VERSION ("7.0NG.736(Build 190702)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 2a4e9a924d..a572727e12 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.0NG.736(Build 190701))" + VALUE "ProductVersion", "(7.0NG.736(Build 190702))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index c0f73ed08b..a3e4c8a1ba 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.736-190701 +Version: 7.0NG.736-190702 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 a557249535..110cc566c1 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.0NG.736-190701" +pandora_version="7.0NG.736-190702" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index e2e2bd6c63..f8ea00a12d 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190701'; +$build_version = 'PC190702'; $pandora_version = 'v7.0NG.736'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index c48f32de4b..7d57a69f04 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index c44e40570a..b0bb8af72a 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190701 +%define release 190702 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 3613e6b0ae..4f438c4752 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190701 +%define release 190702 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 1d140cba64..748bd88761 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190701" +PI_BUILD="190702" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 8c89121a0f..25dc343eb2 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.736 PS190701"; +my $version = "7.0NG.736 PS190702"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index b59d7f7076..3357cf0837 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.736 PS190701"; +my $version = "7.0NG.736 PS190702"; # save program name for logging my $progname = basename($0); From 3b68964f27a37de0137f95358a8fa17c6f2a1b76 Mon Sep 17 00:00:00 2001 From: artica Date: Wed, 3 Jul 2019 00:01:12 +0200 Subject: [PATCH 122/123] 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.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 460dd6b7f9..109bc572a4 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.736-190702 +Version: 7.0NG.736-190703 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 90ce64b6d8..5f46072be1 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.0NG.736-190702" +pandora_version="7.0NG.736-190703" 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 8e46849482..fd04540106 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.736'; -use constant AGENT_BUILD => '190702'; +use constant AGENT_BUILD => '190703'; # 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 62c86be6c3..f9c083395b 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.0NG.736 -%define release 190702 +%define release 190703 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 5c6cebed00..22d9a60423 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.0NG.736 -%define release 190702 +%define release 190703 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 30e9725bda..d1d92af45b 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190702" +PI_BUILD="190703" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index d202a71b65..072442eca6 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190702} +{190703} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index 658a85c414..b9a8154b96 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.0NG.736(Build 190702)") +#define PANDORA_VERSION ("7.0NG.736(Build 190703)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index a572727e12..4e27f4fd19 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.0NG.736(Build 190702))" + VALUE "ProductVersion", "(7.0NG.736(Build 190703))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a3e4c8a1ba..a1f366f752 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.736-190702 +Version: 7.0NG.736-190703 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 110cc566c1..2e12856839 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.0NG.736-190702" +pandora_version="7.0NG.736-190703" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index f8ea00a12d..b738586dd4 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190702'; +$build_version = 'PC190703'; $pandora_version = 'v7.0NG.736'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index 7d57a69f04..e38e5e42e3 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index b0bb8af72a..f6c06186e1 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190702 +%define release 190703 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 4f438c4752..6e1d85582a 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190702 +%define release 190703 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 748bd88761..1957c78f86 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190702" +PI_BUILD="190703" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 25dc343eb2..8e415f4a52 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.736 PS190702"; +my $version = "7.0NG.736 PS190703"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 3357cf0837..07d06cc368 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.736 PS190702"; +my $version = "7.0NG.736 PS190703"; # save program name for logging my $progname = basename($0); From f4b8b39704dc85744197773f3e963704b23a4912 Mon Sep 17 00:00:00 2001 From: artica Date: Thu, 4 Jul 2019 00:01:09 +0200 Subject: [PATCH 123/123] 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.rhel7.spec | 2 +- pandora_console/pandora_console.spec | 2 +- pandora_server/DEBIAN/control | 2 +- pandora_server/DEBIAN/make_deb_package.sh | 2 +- pandora_server/lib/PandoraFMS/Config.pm | 2 +- pandora_server/lib/PandoraFMS/PluginTools.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 +- 25 files changed, 25 insertions(+), 25 deletions(-) diff --git a/pandora_agents/unix/DEBIAN/control b/pandora_agents/unix/DEBIAN/control index 109bc572a4..4ca43080d4 100644 --- a/pandora_agents/unix/DEBIAN/control +++ b/pandora_agents/unix/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-agent-unix -Version: 7.0NG.736-190703 +Version: 7.0NG.736-190704 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 5f46072be1..4d2eb2ad36 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.0NG.736-190703" +pandora_version="7.0NG.736-190704" 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 fd04540106..c4b8c9a482 100755 --- a/pandora_agents/unix/pandora_agent +++ b/pandora_agents/unix/pandora_agent @@ -42,7 +42,7 @@ my $Sem = undef; my $ThreadSem = undef; use constant AGENT_VERSION => '7.0NG.736'; -use constant AGENT_BUILD => '190703'; +use constant AGENT_BUILD => '190704'; # 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 f9c083395b..9ee7dfac59 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.0NG.736 -%define release 190703 +%define release 190704 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 22d9a60423..0adace638a 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.0NG.736 -%define release 190703 +%define release 190704 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 d1d92af45b..1650743680 100755 --- a/pandora_agents/unix/pandora_agent_installer +++ b/pandora_agents/unix/pandora_agent_installer @@ -10,7 +10,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190703" +PI_BUILD="190704" OS_NAME=`uname -s` FORCE=0 diff --git a/pandora_agents/win32/installer/pandora.mpi b/pandora_agents/win32/installer/pandora.mpi index 072442eca6..6e9c24fdbf 100644 --- a/pandora_agents/win32/installer/pandora.mpi +++ b/pandora_agents/win32/installer/pandora.mpi @@ -186,7 +186,7 @@ UpgradeApplicationID {} Version -{190703} +{190704} ViewReadme {Yes} diff --git a/pandora_agents/win32/pandora.cc b/pandora_agents/win32/pandora.cc index b9a8154b96..61557bc15a 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.0NG.736(Build 190703)") +#define PANDORA_VERSION ("7.0NG.736(Build 190704)") string pandora_path; string pandora_dir; diff --git a/pandora_agents/win32/versioninfo.rc b/pandora_agents/win32/versioninfo.rc index 4e27f4fd19..6a19940b9b 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.0NG.736(Build 190703))" + VALUE "ProductVersion", "(7.0NG.736(Build 190704))" VALUE "FileVersion", "1.0.0.0" END END diff --git a/pandora_console/DEBIAN/control b/pandora_console/DEBIAN/control index a1f366f752..2f4cba40c0 100644 --- a/pandora_console/DEBIAN/control +++ b/pandora_console/DEBIAN/control @@ -1,5 +1,5 @@ package: pandorafms-console -Version: 7.0NG.736-190703 +Version: 7.0NG.736-190704 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 2e12856839..9e607576dc 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.0NG.736-190703" +pandora_version="7.0NG.736-190704" package_pear=0 package_pandora=1 diff --git a/pandora_console/include/config_process.php b/pandora_console/include/config_process.php index b738586dd4..4868483266 100644 --- a/pandora_console/include/config_process.php +++ b/pandora_console/include/config_process.php @@ -20,7 +20,7 @@ /** * Pandora build version and version */ -$build_version = 'PC190703'; +$build_version = 'PC190704'; $pandora_version = 'v7.0NG.736'; // Do not overwrite default timezone set if defined. diff --git a/pandora_console/install.php b/pandora_console/install.php index e38e5e42e3..56db55110d 100644 --- a/pandora_console/install.php +++ b/pandora_console/install.php @@ -129,7 +129,7 @@
[ qw() ] ); diff --git a/pandora_server/pandora_server.redhat.spec b/pandora_server/pandora_server.redhat.spec index f6c06186e1..bd2c15d77d 100644 --- a/pandora_server/pandora_server.redhat.spec +++ b/pandora_server/pandora_server.redhat.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190703 +%define release 190704 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server.spec b/pandora_server/pandora_server.spec index 6e1d85582a..ce2fc59451 100644 --- a/pandora_server/pandora_server.spec +++ b/pandora_server/pandora_server.spec @@ -3,7 +3,7 @@ # %define name pandorafms_server %define version 7.0NG.736 -%define release 190703 +%define release 190704 Summary: Pandora FMS Server Name: %{name} diff --git a/pandora_server/pandora_server_installer b/pandora_server/pandora_server_installer index 1957c78f86..1de14abf9f 100755 --- a/pandora_server/pandora_server_installer +++ b/pandora_server/pandora_server_installer @@ -9,7 +9,7 @@ # ********************************************************************** PI_VERSION="7.0NG.736" -PI_BUILD="190703" +PI_BUILD="190704" MODE=$1 if [ $# -gt 1 ]; then diff --git a/pandora_server/util/pandora_db.pl b/pandora_server/util/pandora_db.pl index 8e415f4a52..9fa9ef2dfc 100644 --- a/pandora_server/util/pandora_db.pl +++ b/pandora_server/util/pandora_db.pl @@ -34,7 +34,7 @@ use PandoraFMS::Config; use PandoraFMS::DB; # version: define current version -my $version = "7.0NG.736 PS190703"; +my $version = "7.0NG.736 PS190704"; # Pandora server configuration my %conf; diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 07d06cc368..5eae88d3e8 100644 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -36,7 +36,7 @@ use Encode::Locale; Encode::Locale::decode_argv; # version: define current version -my $version = "7.0NG.736 PS190703"; +my $version = "7.0NG.736 PS190704"; # save program name for logging my $progname = basename($0);