2014-05-07 Juan Manuel Ramon <juanmanuel.ramon@artica.es>

* pandoradb_data.sql
          include/functions_config.php
          extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql
          extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql
          extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql
          pandoradb.data.postgreSQL.sql
          pandoradb.data.oracle.sql
          godmode/setup/setup_visuals.php       
          godmode/reporting/reporting_builder.php: New feature for
        reports and report templates, user can customize report
        front page in setup.



git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@9880 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
juanmanuelr 2014-05-07 16:42:12 +00:00
parent c94d516426
commit e10a9432cd
10 changed files with 271 additions and 7 deletions

View File

@ -1,3 +1,17 @@
2014-05-07 Juan Manuel Ramon <juanmanuel.ramon@artica.es>
* pandoradb_data.sql
include/functions_config.php
extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql
extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql
extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql
pandoradb.data.postgreSQL.sql
pandoradb.data.oracle.sql
godmode/setup/setup_visuals.php
godmode/reporting/reporting_builder.php: New feature for
reports and report templates, user can customize report
front page in setup.
2014-05-07 Alejandro Gallardo <alejandro.gallardo@artica.es>
* godmode/agentes/planned_downtime.editor.php,

View File

@ -164,3 +164,14 @@ ALTER TABLE `trecon_task` ADD COLUMN `macros` TEXT;
-- Table `tlink`
-- ---------------------------------------------------------------------
UPDATE `tlink` SET `link`='http://wiki.pandorafms.com/?title=Pandora' WHERE `name`='Pandora FMS Manual';
/* 2014/05/07 */
-- ---------------------------------------------------------------------
-- Table `tconfig`
-- ---------------------------------------------------------------------
INSERT INTO `tconfig` (`token`, `value`) VALUES
('custom_report_front', 0),
('custom_report_front_font', 'FreeSans.ttf'),
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', '');

View File

@ -144,3 +144,13 @@ ALTER TABLE trecon_task ADD (macros CLOB default '' NOT NULL);
-- Table tlink
-- ---------------------------------------------------------------------
UPDATE tlink SET link='http://wiki.pandorafms.com/?title=Pandora' WHERE name='Pandora FMS Manual';
/* 2014/05/07 */
-- ---------------------------------------------------------------------
-- Table `tconfig`
-- ---------------------------------------------------------------------
INSERT INTO tconfig (token, value) VALUES ('custom_report_front', 0);
INSERT INTO tconfig (token, value) VALUES ('custom_report_front_font', 'FreeSans.ttf');
INSERT INTO tconfig (token, value) VALUES ('custom_report_front_logo', 'images/pandora_logo_white.jpg');
INSERT INTO tconfig (token, value) VALUES ('custom_report_front_header', '');
INSERT INTO tconfig (token, value) VALUES ('custom_report_front_footer', '');

View File

@ -117,3 +117,14 @@ ALTER TABLE "trecon_task" ADD COLUMN "macros" TEXT default '';
-- Table tlink
-- ---------------------------------------------------------------------
UPDATE "tlink" SET "link"='http://wiki.pandorafms.com/?title=Pandora' WHERE "name"='Pandora FMS Manual';
/* 2014/05/07 */
-- ---------------------------------------------------------------------
-- Table `tconfig`
-- ---------------------------------------------------------------------
INSERT INTO "tconfig" ("token", "value") VALUES
('custom_report_front', 0),
('custom_report_front_font', 'FreeSans.ttf'),
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', '');

View File

@ -66,7 +66,7 @@ if ($schedule_report != '') {
'args' => serialize ($parameters),
'scheduled' => $scheduled,
'flag_delete' => 1);
//html_debug_print($values, "/home/vanessa/code/pandora-code/pandora_console/logDebug.txt");
$result = db_process_sql_insert('tuser_task_scheduled', $values);
ui_print_result_message ($result,
@ -654,8 +654,22 @@ switch ($action) {
else
$metaconsole_report = 0;
$start_url = ui_get_full_url(false, false, false, false);
$first_page = "&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;img&#x20;src=&quot;" . $start_url . "/images/pandora_report_logo.png&quot;&#x20;alt=&quot;&quot;&#x20;width=&quot;800&quot;&#x20;/&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;xx-large;&quot;&gt;&#40;_REPORT_NAME_&#41;&lt;/span&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;large;&quot;&gt;&#40;_DATETIME_&#41;&lt;/span&gt;&lt;/p&gt;";
// Juanma (07/05/2014) New feature: Custom front page for reports
if ($config['custom_report_front']) {
$custom_font = $config['custom_report_front_font'];
$logo = $config['custom_report_front_logo'];
$header = $config['custom_report_front_header'];
$first_page = $config['custom_report_front_firstpage'];
$footer = $config['custom_report_front_footer'];
} else {
$start_url = ui_get_full_url(false, false, false, false);
$first_page = "&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;img&#x20;src=&quot;" . $start_url . "/images/pandora_report_logo.png&quot;&#x20;alt=&quot;&quot;&#x20;width=&quot;800&quot;&#x20;/&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;xx-large;&quot;&gt;&#40;_REPORT_NAME_&#41;&lt;/span&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;large;&quot;&gt;&#40;_DATETIME_&#41;&lt;/span&gt;&lt;/p&gt;";
$logo = $header = $footer = null;
}
$idOrResult = db_process_sql_insert('treport',
array('name' => $reportName,
@ -666,8 +680,12 @@ switch ($action) {
'id_group_edit' => $id_group_edit,
'id_user' => $config['id_user'],
'metaconsole' => $metaconsole_report,
'non_interactive' => $non_interactive,
'custom_font' => $custom_font,
'non_interactive' => $non_interactive));
'custom_logo' => $logo,
'header' => $header,
'footer' => $footer));
if ($idOrResult !== false)
db_pandora_audit( "Report management", "Create report #$idOrResult");
else

View File

@ -24,6 +24,11 @@ if (! check_acl ($config['id_user'], 0, "PM") && ! is_user_admin ($config['id_us
return;
}
// FIX: this constant is declared to in godmode/reporting/reporting_builder.phps
//Constant with fonts directory
define ('_MPDF_TTFONTPATH', $config['homedir'] . '/include/fonts/');
// Load enterprise extensions
enterprise_include ('godmode/setup/setup_visuals.php');
@ -297,6 +302,67 @@ $table->data[$row][1] = html_print_select($arraySelectIcon, "gis_default_icon",
$row++;
// Juanma (07/05/2014) New feature: Table for custom front page for reports
$table->data[$row][0] = __('Custom report front page') . ui_print_help_tip(__('Custom report front page. It will be applied to all reports and templates by default.'), true);
$table->data[$row][1] = html_print_checkbox('custom_report_front', 1, $config['custom_report_front'], true);
$row++;
$dirItems = scandir($config['homedir'] . '/images/custom_logo');
foreach ($dirItems as $entryDir) {
if (strstr($entryDir, '.jpg') !== false) {
$customLogos['images/custom_logo/' . $entryDir] = $entryDir;
}
}
$_fonts = array();
$dirFonts = scandir(_MPDF_TTFONTPATH);
foreach ($dirFonts as $entryDir) {
if (strstr($entryDir, '.ttf') !== false) {
$_fonts[$entryDir] = $entryDir;
}
}
$table->data[$row][0] = __('Custom report front') . ' - ' . __('Font family');
$table->data[$row][1] = html_print_select ($_fonts, 'custom_report_front_font', $config['custom_report_front_font'], false, __('Default'), '', true);
$row++;
$table->data[$row][0] = __('Custom report front') . ' - ' . __('Custom logo') .
ui_print_help_tip(
__("The dir of custom logos is in your www Pandora Console in \"images/custom_logo\". You can upload more files (ONLY JPEG) in upload tool in console."), true);
$table->data[$row][1] = html_print_select ($customLogos, 'custom_report_front_logo', $config['custom_report_front_logo'], 'showPreview()', __('Default'), '', true);
$row++;
$table->data[$row][0] = __('Custom report front') . ' - ' . 'Preview';
if (empty($config['custom_report_front_logo'])) {
$config['custom_report_front_logo'] = 'images/pandora_logo_white.jpg';
}
$table->data[$row][1] = '<span id="preview_image">' . html_print_image ($config['custom_report_front_logo'], true) . '</span>';
$row++;
$table->data[$row][0] = __('Custom report front') . ' - ' . __('Header');
$table->data[$row][1] = html_print_textarea('custom_report_front_header', 5, 15,
$config['custom_report_front_header'], 'style="width: 38em;"', true);
$row++;
$table->data[$row][0] = __('Custom report front') . ' - ' . __('First page');
$table->data[$row][1] = html_print_textarea('custom_report_front_firstpage', 15, 15,
$config['custom_report_front_firstpage'], 'style="width: 38em; height: 20em;"', true);
$row++;
$table->data[$row][0] = __('Custom report front') . ' - ' . __('Footer');
$table->data[$row][1] = html_print_textarea('custom_report_front_footer', 5, 15,
$config['custom_report_front_footer'], 'style="width: 38em;"', true);
$row++;
echo '<form id="form_setup" method="post">';
html_print_input_hidden ('update_config', 1);
html_print_table ($table);
@ -324,8 +390,72 @@ function load_fonts() {
return $fonts;
}
ui_require_javascript_file('tiny_mce', 'include/javascript/tiny_mce/');
?>
<script language="javascript" type="text/javascript">
// Juanma (07/05/2014) New feature: Custom front page for reports
function display_custom_report_front (show) {
if (show == true) {
$('#table2-32').show();
$('#table2-33').show();
$('#table2-34').show();
$('#table2-35').show();
$('#table2-36').show();
$('#table2-37').show();
} else {
$('#table2-32').hide();
$('#table2-33').hide();
$('#table2-34').hide();
$('#table2-35').hide();
$('#table2-36').hide();
$('#table2-37').hide();
}
}
function showPreview() {
var img_value = $('#custom_report_front_logo').val();
jQuery.post (<?php echo "'" . ui_get_full_url(false, false, false, false) . "'" ?> + "/ajax.php",
{"page" : "<?php echo ENTERPRISE_DIR ?>/godmode/reporting/reporting_builder.template_advanced",
"get_image_path": "1",
"img_src" : img_value},
function (data, status) {
$("#preview_image").html(data);
}
);
}
tinyMCE.init({
mode : "exact",
elements: "textarea_custom_report_front_header, textarea_custom_report_front_footer",
theme : "advanced",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_buttons1 : "bold,italic, |, cut, copy, paste, |, undo, redo",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_statusbar_location : "none"
});
tinyMCE.init({
mode : "exact",
elements: "textarea_custom_report_front_firstpage",
theme : "advanced",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_buttons1 : "bold,italic, |, image, |, cut, copy, paste, |, undo, redo, |, forecolor, |, fontsizeselect, |, justifyleft, justifycenter, justifyright",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
convert_urls : false,
theme_advanced_statusbar_location : "none"
});
$(document).ready (function () {
$("#form_setup #text-graph_color1").attachColorPicker();
$("#form_setup #text-graph_color2").attachColorPicker();
@ -347,6 +477,16 @@ $(document).ready (function () {
$("#button-interval_add_btn").click( function() {
$('#submit-update_button').trigger('click');
});
// Juanma (06/05/2014) New feature: Custom front page for reports
var custom_report = $('#checkbox-custom_report_front').prop('checked');
console.log(custom_report);
display_custom_report_front(custom_report);
$("#checkbox-custom_report_front").click( function() {
var custom_report = $('#checkbox-custom_report_front').prop('checked');
display_custom_report_front(custom_report);
});
});
function changeIcons() {

View File

@ -460,7 +460,26 @@ function config_update_config () {
if (!config_update_value ('interval_values', $interval_values))
$error_update[] = __('Delete interval');
// Juanma (06/05/2014) New feature: Custom front page for reports
if (!config_update_value ('custom_report_front', get_parameter('custom_report_front')))
$error_update[] = __('Custom report front');
if (!config_update_value ('custom_report_front_font', get_parameter('custom_report_front_font')))
$error_update[] = __('Custom report front') . ' - ' . __('Font family');
if (!config_update_value ('custom_report_front_logo', get_parameter('custom_report_front_logo')))
$error_update[] = __('Custom report front') . ' - ' . __('Custom logo');
if (!config_update_value ('custom_report_front_header', get_parameter('custom_report_front_header')))
$error_update[] = __('Custom report front') . ' - ' . __('Header');
if (!config_update_value ('custom_report_front_firstpage', get_parameter('custom_report_front_firstpage')))
$error_update[] = __('Custom report front') . ' - ' . __('First page');
if (!config_update_value ('custom_report_front_footer', get_parameter('custom_report_front_footer')))
$error_update[] = __('Custom report front') . ' - ' . __('Footer');
break;
case 'net':
if (!config_update_value ('netflow_path', get_parameter ('netflow_path')))
@ -1104,6 +1123,32 @@ function config_process_config () {
if (!isset($config['command_snapshot'])) {
config_update_value ('command_snapshot', 1);
}
// Juanma (06/05/2014) New feature: Custom front page for reports
if (!isset($config['custom_report_front'])) {
config_update_value ('custom_report_front', 0);
}
if (!isset($config['custom_report_front_font'])) {
config_update_value ('custom_report_front_font', 'FreeSans.ttf');
}
if (!isset($config['custom_report_front_logo'])) {
config_update_value ('custom_report_front_logo', 'images/pandora_logo_white.jpg');
}
if (!isset($config['custom_report_front_header'])) {
config_update_value ('custom_report_front_header', '');
}
if (!isset($config['custom_report_front_firstpage'])) {
config_update_value ('custom_report_front_firstpage', "&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;img&#x20;src=&quot;" . ui_get_full_url(false, false, false, false) . "/images/pandora_report_logo.png&quot;&#x20;alt=&quot;&quot;&#x20;width=&quot;800&quot;&#x20;/&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&amp;nbsp;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;xx-large;&quot;&gt;&#40;_REPORT_NAME_&#41;&lt;/span&gt;&lt;/p&gt;&#x0d;&#x0a;&lt;p&#x20;style=&quot;text-align:&#x20;center;&quot;&gt;&lt;span&#x20;style=&quot;font-size:&#x20;large;&quot;&gt;&#40;_DATETIME_&#41;&lt;/span&gt;&lt;/p&gt;");
}
if (!isset($config['custom_report_front_footer'])) {
config_update_value ('custom_report_front_footer', '');
}
/* Finally, check if any value was overwritten in a form */
config_update_config();
}

View File

@ -119,6 +119,11 @@ INSERT INTO tconfig (token, value) VALUES ('update_manager_installed', 1);
INSERT INTO tconfig (token, value) VALUES ('num_files_attachment', 100);
INSERT INTO tconfig (token, value) VALUES ('show_vc', 1);
INSERT INTO tconfig (token, value) VALUES ('inventory_changes_blacklist', '1,2,20,21');
INSERT INTO tconfig (token, value) VALUES ('custom_report_front', 0);
INSERT INTO tconfig (token, value) VALUES ('custom_report_front_font', 'FreeSans.ttf');
INSERT INTO tconfig (token, value) VALUES ('custom_report_front_logo', 'images/pandora_logo_white.jpg');
INSERT INTO tconfig (token, value) VALUES ('custom_report_front_header', '');
INSERT INTO tconfig (token, value) VALUES ('custom_report_front_footer', '');
COMMIT;
END;;

View File

@ -114,7 +114,12 @@ INSERT INTO "tconfig" ("token", "value") VALUES
('update_manager_installed', 1),
('num_files_attachment', 100),
('show_vc', 1),
('inventory_changes_blacklist', '1,2,20,21');
('inventory_changes_blacklist', '1,2,20,21'),
('custom_report_front', 0),
('custom_report_front_font', 'FreeSans.ttf'),
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', '');
COMMIT WORK;

View File

@ -101,7 +101,12 @@ INSERT INTO `tconfig` (`token`, `value`) VALUES
('update_manager_installed', 1),
('num_files_attachment', 250),
('show_vc', 1),
('inventory_changes_blacklist', '1,2,20,21');
('inventory_changes_blacklist', '1,2,20,21'),
('custom_report_front', 0),
('custom_report_front_font', 'FreeSans.ttf'),
('custom_report_front_logo', 'images/pandora_logo_white.jpg'),
('custom_report_front_header', ''),
('custom_report_front_footer', '');
UNLOCK TABLES;