add new token to report
This commit is contained in:
parent
d677fedc0e
commit
40864eee6b
|
@ -25,4 +25,10 @@ ALTER TABLE talert_actions ADD COLUMN `field20_recovery` TEXT NOT NULL DEFAULT "
|
|||
ALTER TABLE `treport_content` add column `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
ALTER TABLE `treport_content_template` add column `graph_render` tinyint(1) UNSIGNED NOT NULL default 0;
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
ALTER TABLE `treport` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
|
||||
ALTER TABLE `treport_template` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
ALTER TABLE `treport_template` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
|
||||
COMMIT;
|
|
@ -770,7 +770,8 @@ CREATE TABLE IF NOT EXISTS `treport_template` (
|
|||
`custom_font` varchar(200) default NULL,
|
||||
`metaconsole` tinyint(1) DEFAULT 0,
|
||||
`agent_regex` varchar(600) NOT NULL default '',
|
||||
|
||||
`cover_page_render` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`index_render` tinyint(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY(`id_report`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -2227,13 +2228,15 @@ INSERT INTO tlog_graph_models VALUES (6, 'Pages with warnings',
|
|||
INSERT INTO tlog_graph_models VALUES (7, 'Users login',
|
||||
'Starting Session \d+\ of user (.*)',
|
||||
'user', 0);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Add column in table `treport`
|
||||
-- -----------------------------------------------------
|
||||
|
||||
ALTER TABLE `treport` ADD COLUMN `hidden` tinyint(1) NOT NULL DEFAULT 0;
|
||||
ALTER TABLE `treport` ADD COLUMN `orientation` varchar(25) NOT NULL default 'vertical';
|
||||
ALTER TABLE `treport` MODIFY COLUMN `hidden` tinyint(1) NULL DEFAULT '0' AFTER `non_interactive`;
|
||||
ALTER TABLE `treport` ADD COLUMN `cover_page_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
ALTER TABLE `treport` ADD COLUMN `index_render` tinyint(1) NOT NULL DEFAULT 1;
|
||||
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_version` varchar(5) NOT NULL default '1';
|
||||
ALTER TABLE `trecon_task` ADD COLUMN `snmp_auth_user` varchar(255) NOT NULL default '';
|
||||
|
|
|
@ -1,18 +1,28 @@
|
|||
<?php
|
||||
// Pandora FMS - http://pandorafms.com
|
||||
// ==================================================
|
||||
// Copyright (c) 2005-2010 Artica Soluciones Tecnologicas
|
||||
// Please see http://pandorafms.org for full contribution list
|
||||
// This program is free software; you can redistribute it and/or
|
||||
// modify it under the terms of the GNU General Public License
|
||||
// as published by the Free Software Foundation for version 2.
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
/**
|
||||
* Reporting builder main.
|
||||
*
|
||||
* @category Options reports.
|
||||
* @package Pandora FMS
|
||||
* @subpackage Enterprise
|
||||
* @version 1.0.0
|
||||
* @license See below
|
||||
*
|
||||
* ______ ___ _______ _______ ________
|
||||
* | __ \.-----.--.--.--| |.-----.----.-----. | ___| | | __|
|
||||
* | __/| _ | | _ || _ | _| _ | | ___| |__ |
|
||||
* |___| |___._|__|__|_____||_____|__| |___._| |___| |__|_|__|_______|
|
||||
*
|
||||
* ============================================================================
|
||||
* Copyright (c) 2007-2019 Artica Soluciones Tecnologicas, http://www.artica.es
|
||||
* This code is NOT free software. This code is NOT licenced under GPL2 licence
|
||||
* You cannnot redistribute it without written permission of copyright holder.
|
||||
* ============================================================================
|
||||
*/
|
||||
|
||||
global $config;
|
||||
|
||||
// Login check
|
||||
// Login check.
|
||||
check_login();
|
||||
|
||||
if (! check_acl($config['id_user'], 0, 'RW')) {
|
||||
|
@ -29,6 +39,7 @@ require_once $config['homedir'].'/include/functions_users.php';
|
|||
$groups = users_get_groups();
|
||||
|
||||
switch ($action) {
|
||||
default:
|
||||
case 'new':
|
||||
$actionButtonHtml = html_print_submit_button(
|
||||
__('Save'),
|
||||
|
@ -39,7 +50,6 @@ switch ($action) {
|
|||
);
|
||||
$hiddenFieldAction = 'save';
|
||||
break;
|
||||
|
||||
case 'update':
|
||||
case 'edit':
|
||||
$actionButtonHtml = html_print_submit_button(
|
||||
|
@ -59,7 +69,7 @@ $table->id = 'add_alert_table';
|
|||
$table->class = 'databox filters';
|
||||
$table->head = [];
|
||||
|
||||
if (is_metaconsole()) {
|
||||
if (is_metaconsole() === true) {
|
||||
$table->head[0] = __('Main data');
|
||||
$table->head_colspan[0] = 4;
|
||||
$table->headstyle[0] = 'text-align: center';
|
||||
|
@ -70,7 +80,7 @@ $table->size = [];
|
|||
$table->size = [];
|
||||
$table->size[0] = '15%';
|
||||
$table->size[1] = '90%';
|
||||
if (!is_metaconsole()) {
|
||||
if (is_metaconsole() === false) {
|
||||
$table->style[0] = 'font-weight: bold; vertical-align: top;';
|
||||
} else {
|
||||
$table->style[0] = 'font-weight: bold;';
|
||||
|
@ -89,14 +99,18 @@ $table->data['name'][1] = html_print_input_text(
|
|||
);
|
||||
|
||||
$table->data['group'][0] = __('Group');
|
||||
$write_groups = users_get_groups_for_select(false, 'AR', true, true, false, 'id_grupo');
|
||||
$write_groups = users_get_groups_for_select(
|
||||
false,
|
||||
'AR',
|
||||
true,
|
||||
true,
|
||||
false,
|
||||
'id_grupo'
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// If the report group is not among the RW groups (special permission) we add it
|
||||
if (!isset($write_groups[$idGroupReport]) && $idGroupReport) {
|
||||
// If the report group is not among the
|
||||
// RW groups (special permission) we add it.
|
||||
if (isset($write_groups[$idGroupReport]) === false && $idGroupReport) {
|
||||
$write_groups[$idGroupReport] = groups_get_name($idGroupReport);
|
||||
}
|
||||
|
||||
|
@ -123,7 +137,11 @@ if ($report_id_user == $config['id_user']
|
|||
'group_edit' => __('The next group can edit the report'),
|
||||
'user_edit' => __('Only the user and admin user can edit the report'),
|
||||
];
|
||||
$table->data['access'][0] = __('Write Access').ui_print_help_tip(__('For example, you want a report that the people of "All" groups can see but you want to edit only for you or your group.'), true);
|
||||
$table->data['access'][0] = __('Write Access');
|
||||
$table->data['access'][0] .= ui_print_help_tip(
|
||||
__('For example, you want a report that the people of "All" groups can see but you want to edit only for you or your group.'),
|
||||
true
|
||||
);
|
||||
$table->data['access'][1] = html_print_select(
|
||||
$type_access,
|
||||
'type_access',
|
||||
|
@ -163,14 +181,19 @@ if ($enterpriseEnable) {
|
|||
}
|
||||
|
||||
$table->data['interactive_report'][0] = __('Non interactive report');
|
||||
$table->data['interactive_report'][1] = __('Yes').' '.html_print_radio_button(
|
||||
$table->data['interactive_report'][1] = __('Yes');
|
||||
$table->data['interactive_report'][1] .= ' ';
|
||||
$table->data['interactive_report'][1] .= html_print_radio_button(
|
||||
'non_interactive',
|
||||
1,
|
||||
'',
|
||||
$non_interactive_check,
|
||||
true
|
||||
).' ';
|
||||
$table->data['interactive_report'][1] .= __('No').' '.html_print_radio_button(
|
||||
);
|
||||
$table->data['interactive_report'][1] .= ' ';
|
||||
$table->data['interactive_report'][1] .= __('No');
|
||||
$table->data['interactive_report'][1] .= ' ';
|
||||
$table->data['interactive_report'][1] .= html_print_radio_button(
|
||||
'non_interactive',
|
||||
0,
|
||||
'',
|
||||
|
@ -180,7 +203,32 @@ if ($enterpriseEnable) {
|
|||
}
|
||||
|
||||
$table->data['description'][0] = __('Description');
|
||||
$table->data['description'][1] = html_print_textarea('description', 5, 15, $description, '', true);
|
||||
$table->data['description'][1] = html_print_textarea(
|
||||
'description',
|
||||
5,
|
||||
15,
|
||||
$description,
|
||||
'',
|
||||
true
|
||||
);
|
||||
|
||||
if (enterprise_installed() === true) {
|
||||
$table->data['cover'][0] = __('Generate cover page in PDF render');
|
||||
$table->data['cover'][1] = html_print_checkbox_switch(
|
||||
'cover_page_render',
|
||||
1,
|
||||
$cover_page_render,
|
||||
true
|
||||
);
|
||||
|
||||
$table->data['index'][0] = __('Generate index in PDF render');
|
||||
$table->data['index'][1] = html_print_checkbox_switch(
|
||||
'index_render',
|
||||
1,
|
||||
$index_render,
|
||||
true
|
||||
);
|
||||
}
|
||||
|
||||
echo '<form class="" method="post">';
|
||||
html_print_table($table);
|
||||
|
|
|
@ -1180,6 +1180,8 @@ switch ($action) {
|
|||
$report_id_user = 0;
|
||||
$type_access_selected = reports_get_type_access(false);
|
||||
$id_group_edit = 0;
|
||||
$cover_page_render = true;
|
||||
$index_render = true;
|
||||
break;
|
||||
|
||||
case 'item_editor':
|
||||
|
@ -1215,6 +1217,12 @@ switch ($action) {
|
|||
$report_id_user = get_parameter('report_id_user');
|
||||
$non_interactive = get_parameter('non_interactive', 0);
|
||||
|
||||
$cover_page_render = get_parameter_switch(
|
||||
'cover_page_render',
|
||||
0
|
||||
);
|
||||
$index_render = get_parameter_switch('index_render', 0);
|
||||
|
||||
$custom_font = $config['custom_report_front_font'];
|
||||
|
||||
switch ($type_access_selected) {
|
||||
|
@ -1241,12 +1249,14 @@ switch ($action) {
|
|||
if ($action == 'update') {
|
||||
if ($reportName != '' && $idGroupReport != '') {
|
||||
$new_values = [
|
||||
'name' => $reportName,
|
||||
'id_group' => $idGroupReport,
|
||||
'description' => $description,
|
||||
'private' => $private,
|
||||
'id_group_edit' => $id_group_edit,
|
||||
'non_interactive' => $non_interactive,
|
||||
'name' => $reportName,
|
||||
'id_group' => $idGroupReport,
|
||||
'description' => $description,
|
||||
'private' => $private,
|
||||
'id_group_edit' => $id_group_edit,
|
||||
'non_interactive' => $non_interactive,
|
||||
'cover_page_render' => $cover_page_render,
|
||||
'index_render' => $index_render,
|
||||
];
|
||||
|
||||
|
||||
|
@ -1311,19 +1321,21 @@ switch ($action) {
|
|||
$idOrResult = db_process_sql_insert(
|
||||
'treport',
|
||||
[
|
||||
'name' => $reportName,
|
||||
'id_group' => $idGroupReport,
|
||||
'description' => $description,
|
||||
'first_page' => $first_page,
|
||||
'private' => $private,
|
||||
'id_group_edit' => $id_group_edit,
|
||||
'id_user' => $config['id_user'],
|
||||
'metaconsole' => $metaconsole_report,
|
||||
'non_interactive' => $non_interactive,
|
||||
'custom_font' => $custom_font,
|
||||
'custom_logo' => $logo,
|
||||
'header' => $header,
|
||||
'footer' => $footer,
|
||||
'name' => $reportName,
|
||||
'id_group' => $idGroupReport,
|
||||
'description' => $description,
|
||||
'first_page' => $first_page,
|
||||
'private' => $private,
|
||||
'id_group_edit' => $id_group_edit,
|
||||
'id_user' => $config['id_user'],
|
||||
'metaconsole' => $metaconsole_report,
|
||||
'non_interactive' => $non_interactive,
|
||||
'custom_font' => $custom_font,
|
||||
'custom_logo' => $logo,
|
||||
'header' => $header,
|
||||
'footer' => $footer,
|
||||
'cover_page_render' => $cover_page_render,
|
||||
'index_render' => $index_render,
|
||||
]
|
||||
);
|
||||
|
||||
|
@ -2736,6 +2748,8 @@ switch ($action) {
|
|||
$id_group_edit = $report['id_group_edit'];
|
||||
$report_id_user = $report['id_user'];
|
||||
$non_interactive = $report['non_interactive'];
|
||||
$cover_page_render = $report['cover_page_render'];
|
||||
$index_render = $report['index_render'];
|
||||
break;
|
||||
|
||||
case 'delete':
|
||||
|
@ -3106,22 +3120,23 @@ if ($enterpriseEnable) {
|
|||
}
|
||||
}
|
||||
|
||||
$urlB = 'index.php?sec=reporting&sec2=godmode/reporting/reporting_builder';
|
||||
$buttons = [
|
||||
'list_reports' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&pure='.$pure.'">'.html_print_image('images/report_list.png', true, ['title' => __('Reports list')]).'</a>',
|
||||
'text' => '<a href="'.$urlB.'&pure='.$pure.'">'.html_print_image('images/report_list.png', true, ['title' => __('Reports list')]).'</a>',
|
||||
],
|
||||
'main' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=main&action=edit&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/op_reporting.png', true, ['title' => __('Main data')]).'</a>',
|
||||
'text' => '<a href="'.$urlB.'&tab=main&action=edit&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/op_reporting.png', true, ['title' => __('Main data')]).'</a>',
|
||||
],
|
||||
'list_items' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=list_items&action=edit&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('List items')]).'</a>',
|
||||
'text' => '<a href="'.$urlB.'&tab=list_items&action=edit&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/list.png', true, ['title' => __('List items')]).'</a>',
|
||||
],
|
||||
'item_editor' => [
|
||||
'active' => false,
|
||||
'text' => '<a href="index.php?sec=reporting&sec2=godmode/reporting/reporting_builder&tab=item_editor&action=new&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/pen.png', true, ['title' => __('Item editor')]).'</a>',
|
||||
'text' => '<a href="'.$urlB.'&tab=item_editor&action=new&id_report='.$idReport.'&pure='.$pure.'">'.html_print_image('images/pen.png', true, ['title' => __('Item editor')]).'</a>',
|
||||
],
|
||||
];
|
||||
|
||||
|
|
|
@ -1473,6 +1473,8 @@ CREATE TABLE IF NOT EXISTS `treport` (
|
|||
`non_interactive` tinyint(1) UNSIGNED NOT NULL default 0,
|
||||
`hidden` tinyint(1) DEFAULT 0,
|
||||
`orientation` varchar(25) NOT NULL default 'vertical',
|
||||
`cover_page_render` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`index_render` tinyint(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY(`id_report`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
@ -3052,6 +3054,8 @@ CREATE TABLE IF NOT EXISTS `treport_template` (
|
|||
`custom_font` varchar(200) default NULL,
|
||||
`metaconsole` tinyint(1) DEFAULT 0,
|
||||
`agent_regex` varchar(600) BINARY NOT NULL default '',
|
||||
`cover_page_render` tinyint(1) NOT NULL DEFAULT 1,
|
||||
`index_render` tinyint(1) NOT NULL DEFAULT 1,
|
||||
PRIMARY KEY(`id_report`)
|
||||
) ENGINE = InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
|
|
Loading…
Reference in New Issue