diff --git a/pandora_console/extras/mr/53.sql b/pandora_console/extras/mr/53.sql index 2393c4cb85..ba62943ce9 100644 --- a/pandora_console/extras/mr/53.sql +++ b/pandora_console/extras/mr/53.sql @@ -19,5 +19,8 @@ CREATE TABLE IF NOT EXISTS `tbackup` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4; - +ALTER TABLE `treport_content` ADD COLUMN `macros_definition` TEXT; +ALTER TABLE `treport_content` ADD COLUMN `render_definition` TEXT; +ALTER TABLE `treport_content_template` ADD COLUMN `macros_definition` TEXT; +ALTER TABLE `treport_content_template` ADD COLUMN `render_definition` TEXT; COMMIT; diff --git a/pandora_console/godmode/reporting/reporting_builder.item_editor.php b/pandora_console/godmode/reporting/reporting_builder.item_editor.php index 901549b253..75e3b306d3 100755 --- a/pandora_console/godmode/reporting/reporting_builder.item_editor.php +++ b/pandora_console/godmode/reporting/reporting_builder.item_editor.php @@ -176,6 +176,8 @@ $unknown_checks = true; $agent_max_value = true; $agent_min_value = true; $uncompressed_module = true; +$macros_definition = ''; +$render_definition = ''; $only_data = false; @@ -724,6 +726,12 @@ switch ($action) { $graph_render = $item['graph_render']; break; + case 'custom_render': + $description = $item['description']; + $macros_definition = $item['macros_definition']; + $render_definition = $item['render_definition']; + break; + case 'top_n': $description = $item['description']; $period = $item['period']; @@ -2441,6 +2449,35 @@ $class = 'databox filters'; + + + + + + + + + + + + + + + + + + option:selected").val(); - if(serviceId != '' && serviceId.split('|').length > 1 ) { + if(serviceId != undefined && serviceId != '' && serviceId.split('|').length > 1 ) { var ids = serviceId.split('|'); serverId = ids[0]; serviceId = ids[1]; @@ -5895,6 +5932,8 @@ function chooseType() { $("#row_max_min_avg").hide(); $("#row_fullscale").hide(); $("#row_graph_render").hide(); + $("#row_macros_definition").hide(); + $("#row_render_definition").hide(); $("#row_time_compare_overlapped").hide(); $("#row_quantity").hide(); $("#row_exception_condition_value").hide(); @@ -6441,6 +6480,13 @@ function chooseType() { } break; + case 'custom_render': + $("#row_description").show(); + $("#row_period").show(); + $("#row_macros_definition").show(); + $("#row_render_definition").show(); + break; + case 'top_n': $("#row_description").show(); $("#row_period").show(); @@ -6767,6 +6813,81 @@ function chooseType() { } } +function addCustomFieldRow() { + var clone = $("#table-macros-definition #table-macros-definition-0") + .clone() + .prop("id", "table-macros-definition-" + $("tr.tr-macros-definition").length); + + clone + .find("#macro_custom_name") + .prop("id", "macro_custom_name_" + $("tr.tr-macros-definition").length) + .val(""); + + clone + .find("#macro_custom_type") + .prop("id", "macro_custom_type" + $("tr.tr-macros-definition").length) + .attr("onchange", "change_custom_fields_macros_report(" + $("tr.tr-macros-definition").length + ")"); + + clone + .find("#table-macros-definition-0-value") + .prop("id", "table-macros-definition-"+$("tr.tr-macros-definition").length+"-value"); + + clone + .find("#macro_custom_value") + .prop("id", "macro_custom_value_" + $("tr.tr-macros-definition").length) + .val(''); + + clone + .find(".icon-clean-custom-macro") + .attr("onclick", "cleanCustomFieldRow(" + $("tr.tr-macros-definition").length + ")"); + + clone + .find(".icon-delete-custom-macro") + .attr("onclick", "removeCustomFieldRow(" + $("tr.tr-macros-definition").length + ")") + .css("display", "inline-block"); + + clone + .appendTo("#table-macros-definition"); +} + +function cleanCustomFieldRow(row) { + if(row === 0) { + // Default value. + $("#macro_custom_name").val(''); + $("#macro_custom_value").val(''); + } else { + $("#macro_custom_name_"+row).val(''); + $("#macro_custom_value_"+row).val(''); + $("#macro_custom_width_"+row).val(''); + $("#macro_custom_height_"+row).val(''); + } +} + +function removeCustomFieldRow(row) { + if(row !== 0) { + $("tr#table-macros-definition-"+row).remove(); + } +} + +function change_custom_fields_macros_report(id) { + var new_type = this.event.target.value; + jQuery.post ( + "ajax.php", + { + "page" : "include/ajax/reporting.ajax", + "change_custom_fields_macros_report" : 1, + "macro_type": new_type, + "macro_id": id + }, + function (data, status) { + console.log(id); + $("td#table-macros-definition-"+id+"-value").empty(); + $("td#table-macros-definition-"+id+"-value").append(data); + }, + "html" + ); +} + function event_change_id_agent_inventory() { agent_changed_by_multiple_agents_inventory( {"data" : { diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 7fc89b6267..9ca004fd3e 100755 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -1852,6 +1852,36 @@ switch ($action) { $good_format = true; break; + case 'custom_render': + $macro_custom_name = get_parameter('macro_custom_name', []); + $macro_custom_type = get_parameter('macro_custom_type', []); + $macro_custom_value = get_parameter('macro_custom_value', []); + $macro_custom_width = get_parameter('macro_custom_width', []); + $macro_custom_height = get_parameter('macro_custom_height', []); + $macros_definition = []; + + foreach ($macro_custom_name as $key_macro => $value_macro) { + $macros_definition[$key_macro]['name'] = $value_macro; + $macros_definition[$key_macro]['type'] = $macro_custom_type[$key_macro]; + + if (isset($macro_custom_value[$key_macro]) === true) { + $macros_definition[$key_macro]['value'] = $macro_custom_value[$key_macro]; + } + + if (isset($macro_custom_width[$key_macro]) === true) { + $macros_definition[$key_macro]['width'] = $macro_custom_width[$key_macro]; + } + + if (isset($macro_custom_height[$key_macro]) === true) { + $macros_definition[$key_macro]['height'] = $macro_custom_height[$key_macro]; + } + } + + $values['macros_definition'] = json_encode($macros_definition); + $values['render_definition'] = get_parameter('render_definition', ''); + $good_format = true; + break; + case 'min_value': case 'max_value': case 'avg_value': @@ -2602,6 +2632,36 @@ switch ($action) { $good_format = true; break; + case 'custom_render': + $macro_custom_name = get_parameter('macro_custom_name', []); + $macro_custom_type = get_parameter('macro_custom_type', []); + $macro_custom_value = get_parameter('macro_custom_value', []); + $macro_custom_width = get_parameter('macro_custom_width', []); + $macro_custom_height = get_parameter('macro_custom_height', []); + $macros_definition = []; + + foreach ($macro_custom_name as $key_macro => $value_macro) { + $macros_definition[$key_macro]['name'] = $value_macro; + $macros_definition[$key_macro]['type'] = $macro_custom_type[$key_macro]; + + if (isset($macro_custom_value[$key_macro]) === true) { + $macros_definition[$key_macro]['value'] = $macro_custom_value[$key_macro]; + } + + if (isset($macro_custom_width[$key_macro]) === true) { + $macros_definition[$key_macro]['width'] = $macro_custom_width[$key_macro]; + } + + if (isset($macro_custom_height[$key_macro]) === true) { + $macros_definition[$key_macro]['height'] = $macro_custom_height[$key_macro]; + } + } + + $values['macros_definition'] = json_encode($macros_definition); + $values['render_definition'] = get_parameter('render_definition', ''); + $good_format = true; + break; + case 'min_value': case 'max_value': case 'avg_value': diff --git a/pandora_console/include/ajax/reporting.ajax.php b/pandora_console/include/ajax/reporting.ajax.php index 89d5b715fb..bafe01307d 100755 --- a/pandora_console/include/ajax/reporting.ajax.php +++ b/pandora_console/include/ajax/reporting.ajax.php @@ -34,6 +34,10 @@ $id = get_parameter('id', 0); $truncate_text = get_parameter('truncate_text', 0); $get_metaconsole_hash_data = get_parameter('get_metaconsole_hash_data', 0); $get_metaconsole_server_url = get_parameter('get_metaconsole_server_url', 0); +$change_custom_fields_macros_report = (bool) get_parameter( + 'change_custom_fields_macros_report', + 0 +); if ($delete_sla_item) { $result = db_process_sql_delete('treport_content_sla_combined', ['id' => (int) $id]); @@ -218,3 +222,25 @@ if ($get_metaconsole_server_url) { echo $server['server_url']; return; } + +if ($change_custom_fields_macros_report === true) { + include_once $config['homedir'].'/include/functions_reports.php'; + $macro_type = get_parameter('macro_type', ''); + $macro_id = get_parameter('macro_id', 0); + + $macro = [ + 'name' => '', + 'type' => $macro_type, + 'value' => '', + ]; + $custom_fields = custom_fields_macros_report($macro, $macro_id); + $custom_field_draw = ''; + if (empty($custom_fields) === false) { + foreach ($custom_fields as $key => $value) { + $custom_field_draw .= $value; + } + } + + echo $custom_field_draw; + return; +} diff --git a/pandora_console/include/functions.php b/pandora_console/include/functions.php index 82f5ea6cca..ca0c9dad7d 100644 --- a/pandora_console/include/functions.php +++ b/pandora_console/include/functions.php @@ -4194,7 +4194,7 @@ function generator_chart_to_pdf( ) { $width_img = 650; $height_img = ($params['height'] + 50); - } else if ($type_graph_pdf === 'hbar') { + } else if ($type_graph_pdf === 'hbar' || $type_graph_pdf === 'pie_chart') { $width_img = ($params['width'] ?? 550); $height_img = $params['height']; } else { diff --git a/pandora_console/include/functions_html.php b/pandora_console/include/functions_html.php index 944733ffd0..a6f76f667f 100644 --- a/pandora_console/include/functions_html.php +++ b/pandora_console/include/functions_html.php @@ -808,7 +808,7 @@ function html_print_select( $output .= '
'; } - $output .= ''; if ($nothing !== false) { if ($nothing != '' || empty($fields)) { @@ -4766,10 +4766,15 @@ function html_print_input($data, $wrapper='div', $input_only=false) enterprise_include_once('include/functions_metaconsole.php'); + $style = ''; if ($config['style'] === 'pandora_black' && !is_metaconsole()) { $style = 'style="color: white"'; } + if (isset($data['label_class']) === false) { + $data['label_class'] = ''; + } + $output = ''; if (($data['label'] ?? false) && $input_only === false) { diff --git a/pandora_console/include/functions_reporting.php b/pandora_console/include/functions_reporting.php index 5eb016c3b0..2904c4f681 100755 --- a/pandora_console/include/functions_reporting.php +++ b/pandora_console/include/functions_reporting.php @@ -688,6 +688,15 @@ function reporting_make_reporting_data( ); break; + case 'custom_render': + $report['contents'][] = reporting_custom_render( + $report, + $content, + $type, + $pdf + ); + break; + case 'group_configuration': $report['contents'][] = reporting_group_configuration( $report, @@ -4675,6 +4684,224 @@ function reporting_network_interfaces_report($report, $content, $type='dinamic', } +function reporting_custom_render($report, $content, $type='dinamic', $pdf=0) +{ + global $config; + + $return['type'] = 'custom_render'; + + if (empty($content['name'])) { + $content['name'] = __('Custom render report'); + } + + $return['title'] = $content['name']; + $return['landscape'] = $content['landscape']; + $return['pagebreak'] = $content['pagebreak']; + $return['subtitle'] = ''; + $return['description'] = $content['description']; + $return['date'] = reporting_get_date_text($report, $content); + $return['failed'] = null; + + $macros = []; + $patterns = []; + $substitutions = []; + if (isset($content['macros_definition']) === true + && empty($content['macros_definition']) === false + ) { + $macros = json_decode( + io_safe_output($content['macros_definition']), + true + ); + if (empty($macros) === false && is_array($macros) === true) { + foreach ($macros as $key_macro => $data_macro) { + switch ($data_macro['type']) { + case 0: + // Type: String. + $patterns[] = addslashes( + '/_'.$data_macro['name'].'_/' + ); + $substitutions[] = $data_macro['value']; + break; + + case 1: + // Type Sql value. + $patterns[] = addslashes( + '/_'.$data_macro['name'].'_/' + ); + + $regex = '/(UPDATE|INSERT INTO|DELETE FROM|TRUNCATE|DROP|ALTER|CREATE|GRANT|REVOKE)\s+(.*?)\s+/i'; + if (preg_match($regex, $data_macro['value']) > 0) { + $value_query = __('This query is insecure, it could apply unwanted modiffications on the schema'); + } else { + $error_reporting = error_reporting(); + error_reporting(0); + $value_query = db_get_value_sql( + trim($data_macro['value'], ';') + ); + + if ($value_query === false) { + $value_query = __('Error: %s', $config['dbconnection']->error); + } + + error_reporting($error_reporting); + } + + $substitutions[] = $value_query; + break; + + case 2: + // Type: SQL graph. + $patterns[] = addslashes( + '/_'.$data_macro['name'].'_/' + ); + + $regex = '/(UPDATE|INSERT INTO|DELETE FROM|TRUNCATE|DROP|ALTER|CREATE|GRANT|REVOKE)\s+(.*?)\s+/i'; + if (preg_match($regex, $data_macro['value']) > 0) { + $value_query = __('This query is insecure, it could apply unwanted modiffications on the schema'); + } else { + $error_reporting = error_reporting(); + error_reporting(0); + $data_query = db_get_all_rows_sql( + trim($data_macro['value'], ';') + ); + + error_reporting($error_reporting); + + if ($data_query === false) { + $value_query = __('Error: %s', $config['dbconnection']->error); + } else { + $width = (isset($data_macro['width']) === true) ? $data_macro['width'] : 210; + $height = (isset($data_macro['height']) === true) ? $data_macro['height'] : 210; + + // TODO: Allow to paint horizontal and vertical bar graphs for the moment only pie graphs. + $type = 'sql_graph_pie'; + + $SQL_GRAPH_MAX_LABEL_SIZE = 5; + + $count = 0; + $flagOther = false; + foreach ($data_query as $data_item) { + $count++; + $value = 0; + if (empty($data_item['value']) === false) { + $value = $data_item['value']; + } + + if ($count <= 5) { + $label = __('Data'); + if (empty($data_item['label']) === false) { + $label = io_safe_output($data_item['label']); + if (strlen($label) > $SQL_GRAPH_MAX_LABEL_SIZE) { + $first_label = $label; + $label = substr( + $first_label, + 0, + floor($SQL_GRAPH_MAX_LABEL_SIZE / 2) + ); + $label .= '...
'; + $label .= substr( + $first_label, + floor(-$SQL_GRAPH_MAX_LABEL_SIZE / 2) + ); + } + } + + switch ($type) { + case 'sql_graph_vbar': + default: + // Vertical bar. + $data[] = [ + 'tick' => $label.'_'.$count, + 'data' => $value, + ]; + break; + + case 'sql_graph_hbar': + // Horizontal bar. + $data[$label.'_'.$count]['g'] = $value; + break; + + case 'sql_graph_pie': + // Pie. + $data[$label.'_'.$count] = $value; + break; + } + } else { + switch ($type) { + case 'sql_graph_vbar': + default: + // Vertical bar. + if ($flagOther === false) { + $data[] = [ + 'tick' => __('Other'), + 'data' => $value, + ]; + + $flagOther = true; + } + + $data[(count($data) - 1)]['data'] += $value; + break; + + case 'sql_graph_hbar': + // Horizontal bar. + if (isset($data[__('Other')]['g']) === false) { + $data[__('Other')]['g'] = 0; + } + + $data[__('Other')]['g'] += $value; + break; + + case 'sql_graph_pie': + // Pie. + if (isset($data[__('Other')]) === false) { + $data[__('Other')] = 0; + } + + $data[__('Other')] += $value; + break; + } + } + } + + $value_query = pie_graph( + $data, + $width, + $height, + __('other'), + ui_get_full_url(false, false, false, false), + '', + $config['fontpath'], + $config['font_size'], + 2, + 'hidden', + '', + true + ); + } + } + + $substitutions[] = $value_query; + break; + + default: + // Not possible. + break; + } + } + } + } + + $return['data'] = preg_replace( + $patterns, + $substitutions, + $content['render_definition'] + ); + + return reporting_check_structure_content($return); +} + + function agents_get_network_interfaces_array( $network_interfaces_by_agents, $return, @@ -9961,10 +10188,12 @@ function reporting_get_date_text($report=null, $content=null) if (!empty($report) && !empty($content)) { if ($content['period'] == 0) { $es = json_decode($content['external_source'], true); - if ($es['date'] == 0) { - $return['period'] = 0; - } else { - $return['date'] = $es['date']; + if (empty($es) === false) { + if ($es['date'] == 0) { + $return['period'] = 0; + } else { + $return['date'] = $es['date']; + } } } else { $return['period'] = $content['period']; diff --git a/pandora_console/include/functions_reporting_html.php b/pandora_console/include/functions_reporting_html.php index 9973e9df55..cd6af07794 100644 --- a/pandora_console/include/functions_reporting_html.php +++ b/pandora_console/include/functions_reporting_html.php @@ -350,6 +350,10 @@ function reporting_html_print_report($report, $mini=false, $report_info=1) reporting_html_network_interfaces_report($table, $item); break; + case 'custom_render': + reporting_html_custom_render($table, $item); + break; + case 'group_configuration': reporting_html_group_configuration($table, $item); break; @@ -3060,6 +3064,47 @@ function reporting_html_network_interfaces_report($table, $item, $pdf=0) } +/** + * This type of report element will generate the interface graphs + * of all those devices that belong to the selected group. + * + * @param object $table Head table or false if it comes from pdf. + * @param array $item Items data. + * @param boolean $pdf If it comes from pdf. + * + * @return string HTML code. + */ +function reporting_html_custom_render($table, $item, $pdf=0) +{ + $return_pdf = ''; + if (empty($item['failed']) === false) { + if ($pdf === 0) { + $table->colspan['interfaces']['cell'] = 3; + $table->cellstyle['interfaces']['cell'] = 'text-align: left;'; + $table->data['interfaces']['cell'] = $item['failed']; + } else { + $return_pdf .= $item['failed']; + } + } else { + $output = '
'; + $output .= $item['data']; + $output .= '
'; + + if ($pdf === 1) { + $return_pdf .= $output; + } else { + $id = uniqid(); + $table->colspan[$id][0] = 3; + $table->data[$id] = $output; + } + } + + if ($pdf !== 0) { + return $return_pdf; + } +} + + /** * Unified alert report HTML */ diff --git a/pandora_console/include/functions_reports.php b/pandora_console/include/functions_reports.php index f8fa28a0e7..03cd82742b 100755 --- a/pandora_console/include/functions_reports.php +++ b/pandora_console/include/functions_reports.php @@ -818,6 +818,10 @@ function reports_get_report_types($template=false, $not_editor=false) 'optgroup' => __('Grouped'), 'name' => __('Network interfaces'), ]; + $types['custom_render'] = [ + 'optgroup' => __('Grouped'), + 'name' => __('Custom Render'), + ]; $types['availability'] = [ 'optgroup' => __('Grouped'), 'name' => __('Availability'), @@ -1031,3 +1035,226 @@ function reports_copy_report($id_report) return true; } + + +function get_table_custom_macros_report($data) +{ + $table = new StdClass(); + $table->data = []; + $table->width = '100%'; + $table->class = 'databox data fullwidth'; + $table->id = 'table-macros-definition'; + $table->rowclass = []; + + $table->size = []; + $table->size['name'] = '20%'; + $table->size['type'] = '20%'; + $table->size['value'] = '50%'; + $table->size['op'] = '10%'; + + $table->head = []; + $table->head['name'] = __('Macro'); + $table->head['type'] = __('Type'); + $table->head['value'] = __('Value'); + $table->head['op'] = html_print_image( + 'images/add.png', + true, + [ + 'class' => 'invert_filter btn_debugModule', + 'style' => 'cursor: pointer; filter: invert(100%);', + 'onclick' => 'addCustomFieldRow();', + ] + ); + + $list_macro_custom_type = [ + 0 => __('String'), + 1 => __('Sql'), + 2 => __('Graph Sql'), + 3 => __('Simple graph'), + ]; + + $data = json_decode($data, true); + if (is_array($data) === false || empty($data) === true) { + $data = []; + $data[0] = [ + 'name' => '', + 'type' => 0, + 'value' => '', + ]; + } + + $table->data = []; + foreach ($data as $key_macro => $value_data_macro) { + $table->rowclass[$key_macro] = 'tr-macros-definition'; + $table->data[$key_macro]['name'] = html_print_input_text_extended( + 'macro_custom_name[]', + $value_data_macro['name'], + ($key_macro === 0) ? 'macro_custom_name' : 'macro_custom_name_'.$key_macro, + '', + 15, + 255, + false, + '', + 'class="fullwidth"', + true + ); + + $table->data[$key_macro]['type'] = html_print_select( + $list_macro_custom_type, + 'macro_custom_type[]', + $value_data_macro['type'], + 'change_custom_fields_macros_report('.$key_macro.')', + '', + 0, + true, + false, + false, + 'fullwidth', + false, + 'height: 32px;', + false, + false, + false, + '', + false, + false, + false, + false, + false + ); + + $custom_fields = custom_fields_macros_report( + $value_data_macro, + $key_macro + ); + + $custom_field_draw = ''; + if (empty($custom_fields) === false) { + foreach ($custom_fields as $key => $value) { + $custom_field_draw .= $value; + } + } + + $table->data[$key_macro]['value'] = $custom_field_draw; + + $table->data[$key_macro]['op'] = html_print_image( + 'images/clean.png', + true, + [ + 'class' => 'invert_filter icon-clean-custom-macro', + 'style' => 'cursor: pointer;', + 'onclick' => 'cleanCustomFieldRow('.$key_macro.')', + ] + ); + + $styles_remove = 'cursor: pointer; margin-right:10px;'; + if ($key_macro === 0) { + $styles_remove .= 'display:none'; + } + + $table->data[$key_macro]['op'] .= html_print_image( + 'images/delete.png', + true, + [ + 'class' => 'invert_filter icon-delete-custom-macro', + 'style' => $styles_remove, + 'onclick' => 'removeCustomFieldRow('.$key_macro.')', + ] + ); + } + + return html_print_table( + $table, + true + ); + +} + + +function custom_fields_macros_report($macro, $key_macro) +{ + $result = []; + + switch ($macro['type']) { + case 0: + case 1: + $result['value'] = '
'; + $result['value'] .= ''; + $result['value'] .= html_print_input_text_extended( + 'macro_custom_value['.$key_macro.']', + $macro['value'], + ($key_macro === 0) ? 'macro_custom_value' : 'macro_custom_value_'.$key_macro, + '', + 15, + 255, + false, + '', + '', + true + ); + $result['value'] .= '
'; + break; + + case 2: + $result['value'] = '
'; + $result['value'] .= ''; + $result['value'] .= html_print_input_text_extended( + 'macro_custom_value['.$key_macro.']', + $macro['value'], + ($key_macro === 0) ? 'macro_custom_value' : 'macro_custom_value_'.$key_macro, + '', + 15, + 255, + false, + '', + 'class="fullwidth"', + true + ); + $result['value'] .= '
'; + + $result['size'] = '
'; + $result['size'] .= ''; + $result['size'] .= html_print_input_text_extended( + 'macro_custom_width['.$key_macro.']', + $macro['width'], + ($key_macro === 0) ? 'macro_custom_width' : 'macro_custom_width_'.$key_macro, + '', + 5, + 255, + false, + '', + '', + true + ); + + $result['size'] .= ''; + $result['size'] .= html_print_input_text_extended( + 'macro_custom_height['.$key_macro.']', + $macro['height'], + ($key_macro === 0) ? 'macro_custom_height' : 'macro_custom_height_'.$key_macro, + '', + 5, + 255, + false, + '', + '', + true + ); + $result['size'] .= '
'; + break; + + default: + // code... + break; + } + + return $result; +} diff --git a/pandora_console/include/graphs/flot/pandora.flot.js b/pandora_console/include/graphs/flot/pandora.flot.js index 13e72bdaca..01b53136ee 100644 --- a/pandora_console/include/graphs/flot/pandora.flot.js +++ b/pandora_console/include/graphs/flot/pandora.flot.js @@ -104,7 +104,7 @@ function pandoraFlotPie( '
' + + 'text-align:center;padding:2px;color:#4a4a4a;">' + label + "
" + series.percent.toFixed(2) + diff --git a/pandora_console/include/styles/pandora.css b/pandora_console/include/styles/pandora.css index 743568eb46..85f7d16aec 100644 --- a/pandora_console/include/styles/pandora.css +++ b/pandora_console/include/styles/pandora.css @@ -8572,3 +8572,446 @@ div#err_msg_centralised { width: 90%; margin: 0 auto; } + +.custom-field-macro-report { + display: flex; + flex-direction: row; + justify-content: center; + align-items: center; + align-content: center; +} + +.custom-field-macro-report label { + flex: 0; + margin-right: 10px; + margin-left: 10px; +} + +.custom-field-macro-report input { + flex: 2; +} +.mb10 { + margin-bottom: 10px; +} + +#reset-styles { + font-size: 9pt; + line-height: 16pt; + padding: 0px; + box-sizing: border-box; + page-break-after: always; +} + +#reset-styles a:link { + text-decoration: underline; + cursor: auto; +} +#reset-styles a:visited { + text-decoration: underline; + cursor: auto; +} +#reset-styles address { + display: block; + font-style: italic; +} +#reset-styles area { + display: none; +} +#reset-styles article { + display: block; +} +#reset-styles aside { + display: block; +} +#reset-styles b { + font-weight: bold; +} +#reset-styles bdo { + unicode-bidi: bidi-override; +} +#reset-styles blockquote { + display: block; + margin-top: 1em; + margin-bottom: 1em; + margin-left: 40px; + margin-right: 40px; +} +#reset-styles body { + display: block; + margin: 8px; +} +#reset-styles body:focus { + outline: none; +} +#reset-styles caption { + display: table-caption; + text-align: center; +} +#reset-styles cite { + font-style: italic; +} +#reset-styles code { + font-family: monospace; +} +#reset-styles col { + display: table-column; +} +#reset-styles colgroup { + display: table-column-group; +} +#reset-styles datalist { + display: none; +} +#reset-styles dd { + display: block; + margin-left: 40px; +} +#reset-styles del { + text-decoration: line-through; +} +#reset-styles details { + display: block; +} +#reset-styles dfn { + font-style: italic; +} +#reset-styles div { + display: block; +} +#reset-styles dl { + display: block; + margin-top: 1em; + margin-bottom: 1em; + margin-left: 0; + margin-right: 0; +} +#reset-styles dt { + display: block; +} +#reset-styles em { + font-style: italic; +} +#reset-styles embed:focus { + outline: none; +} +#reset-styles fieldset { + display: block; + margin-left: 2px; + margin-right: 2px; + padding-top: 0.35em; + padding-bottom: 0.625em; + padding-left: 0.75em; + padding-right: 0.75em; + border: 2px groove; +} +#reset-styles figcaption { + display: block; +} +#reset-styles figure { + display: block; + margin-top: 1em; + margin-bottom: 1em; + margin-left: 40px; + margin-right: 40px; +} +#reset-styles footer { + display: block; +} +#reset-styles form { + display: block; + margin-top: 0em; +} +#reset-styles h1 { + display: inline-block; + font-size: 2em; + margin-top: 0.67em; + margin-bottom: 0.67em; + margin-left: 0; + margin-right: 0; + margin-block-start: 0.67em; + margin-block-end: 0.67em; + margin-inline-start: 0px; + margin-inline-end: 0px; + font-weight: bold; + text-transform: uppercase; + padding: 0; +} +#reset-styles h2 { + display: inline-block; + font-size: 1.5em; + margin-top: 0.83em; + margin-bottom: 0.83em; + margin-left: 0; + margin-right: 0; + margin-block-start: 0.83em; + margin-block-end: 0.83em; + margin-inline-start: 0px; + margin-inline-end: 0px; + font-weight: bold; + text-transform: uppercase; + padding: 0; +} +#reset-styles h3 { + display: inline-block; + font-size: 1.17em; + margin-top: 1em; + margin-bottom: 1em; + margin-left: 0; + margin-right: 0; + margin-block-start: 1em; + margin-block-end: 1em; + margin-inline-start: 0px; + margin-inline-end: 0px; + font-weight: bold; + text-transform: uppercase; + padding: 0; +} +#reset-styles h4 { + display: inline-block; + margin-top: 1.33em; + margin-bottom: 1.33em; + margin-left: 0; + margin-right: 0; + margin-block-start: 1.33em; + margin-block-end: 1.33em; + margin-inline-start: 0px; + margin-inline-end: 0px; + font-weight: bold; + text-transform: uppercase; + padding: 0; +} +#reset-styles h5 { + display: inline-block; + font-size: 0.83em; + margin-top: 1.67em; + margin-bottom: 1.67em; + margin-block-start: 1.67em; + margin-block-end: 1.67em; + margin-inline-start: 0px; + margin-inline-end: 0px; + margin-left: 0; + margin-right: 0; + font-weight: bold; + text-transform: uppercase; + padding: 0; +} +#reset-styles h6 { + display: inline-block; + font-size: 0.67em; + margin-top: 2.33em; + margin-bottom: 2.33em; + margin-left: 0; + margin-right: 0; + font-weight: bold; + text-transform: uppercase; + padding: 0; +} +#reset-styles head { + display: none; +} +#reset-styles header { + display: block; +} +#reset-styles hr { + display: block; + margin-top: 0.5em; + margin-bottom: 0.5em; + margin-left: auto; + margin-right: auto; + border-style: inset; + border-width: 1px; +} +#reset-styles html { + display: block; +} +#reset-styles html:focus { + outline: none; +} +#reset-styles i { + font-style: italic; +} +#reset-styles iframe:focus { + outline: none; +} +#reset-styles iframe[seamless] { + display: block; +} +#reset-styles img { + display: inline-block; +} +#reset-styles ins { + text-decoration: underline; +} +#reset-styles kbd { + font-family: monospace; +} +#reset-styles label { + cursor: default; +} +#reset-styles legend { + display: block; + padding-left: 2px; + padding-right: 2px; + border: none; +} +#reset-styles li { + display: list-item; +} +#reset-styles link { + display: none; +} +#reset-styles map { + display: inline; +} +#reset-styles mark { + background-color: yellow; + color: black; +} +#reset-styles menu { + display: block; + list-style-type: disc; + margin-top: 1em; + margin-bottom: 1em; + margin-left: 0; + margin-right: 0; + padding-left: 40px; +} +#reset-styles nav { + display: block; +} +#reset-styles object:focus { + outline: none; +} +#reset-styles ol { + display: block; + list-style-type: decimal; + margin-top: 1em; + margin-bottom: 1em; + margin-left: 0; + margin-right: 0; + padding-left: 40px; +} +#reset-styles output { + display: inline; +} +#reset-styles p { + display: block; + margin-top: 1em; + margin-bottom: 1em; + margin-left: 0; + margin-right: 0; +} +#reset-styles param { + display: none; +} +#reset-styles pre { + display: block; + font-family: monospace; + white-space: pre; + margin: 1em 0; +} +#reset-styles q { + display: inline; +} +#reset-styles q::before { + content: open-quote; +} +#reset-styles q::after { + content: close-quote; +} +#reset-styles rt { + line-height: normal; +} +#reset-styles s { + text-decoration: line-through; +} +#reset-styles samp { + font-family: monospace; +} +#reset-styles script { + display: none; +} +#reset-styles section { + display: block; +} +#reset-styles small { + font-size: smaller; +} +#reset-styles strike { + text-decoration: line-through; +} +#reset-styles strong { + font-weight: bold; +} +#reset-styles style { + display: none; +} +#reset-styles sub { + vertical-align: sub; + font-size: smaller; +} +#reset-styles summary { + display: block; +} +#reset-styles sup { + vertical-align: super; + font-size: smaller; +} +#reset-styles table { + display: table; + border-collapse: separate; + border-spacing: 2px; + border-color: gray; +} +#reset-styles tbody { + display: table-row-group; + vertical-align: middle; + border-color: inherit; +} +#reset-styles td { + display: table-cell; + vertical-align: inherit; + text-align: inherit; +} + +#reset-styles tfoot { + display: table-footer-group; + vertical-align: middle; + border-color: inherit; +} +#reset-styles thead tr th { + display: table-cell; + vertical-align: inherit; + font-weight: bold; + text-align: center; + background-color: initial; + color: initial; +} +#reset-styles thead { + display: table-header-group; + vertical-align: middle; + border-color: inherit; +} +#reset-styles title { + display: none; +} +#reset-styles tr { + display: table-row; + vertical-align: inherit; + border-color: inherit; +} +#reset-styles u { + text-decoration: underline; +} +#reset-styles ul { + display: block; + list-style-type: disc; + margin-top: 1em; + margin-bottom: 1em; + margin-left: 0; + margin-right: 0; + padding-left: 40px; +} +#reset-styles var { + font-style: italic; +} diff --git a/pandora_console/pandoradb.sql b/pandora_console/pandoradb.sql index fe1b9d6752..5724c02b93 100644 --- a/pandora_console/pandoradb.sql +++ b/pandora_console/pandoradb.sql @@ -1608,6 +1608,8 @@ CREATE TABLE IF NOT EXISTS `treport_content` ( `ipam_network_filter` INT UNSIGNED DEFAULT 0, `ipam_alive_ips` TINYINT UNSIGNED NOT NULL DEFAULT 0, `ipam_ip_not_assigned_to_agent` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `macros_definition` TEXT, + `render_definition` TEXT, PRIMARY KEY(`id_rc`), FOREIGN KEY (`id_report`) REFERENCES treport(`id_report`) ON UPDATE CASCADE ON DELETE CASCADE @@ -3242,6 +3244,8 @@ CREATE TABLE IF NOT EXISTS `treport_content_template` ( `ipam_network_filter` INT UNSIGNED DEFAULT 0, `ipam_alive_ips` TINYINT UNSIGNED NOT NULL DEFAULT 0, `ipam_ip_not_assigned_to_agent` TINYINT UNSIGNED NOT NULL DEFAULT 0, + `macros_definition` TEXT, + `render_definition` TEXT, PRIMARY KEY(`id_rc`) ) ENGINE=InnoDB DEFAULT CHARSET=UTF8MB4;