From e10a9432cd997f156ab28b0c111bed5b5f24bb58 Mon Sep 17 00:00:00 2001 From: juanmanuelr Date: Wed, 7 May 2014 16:42:12 +0000 Subject: [PATCH] 2014-05-07 Juan Manuel Ramon * 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 --- pandora_console/ChangeLog | 14 ++ .../pandoradb_migrate_5.0.x_to_5.1.mysql.sql | 11 ++ .../pandoradb_migrate_5.0.x_to_5.1.oracle.sql | 10 ++ ...doradb_migrate_5.0.x_to_5.1.postgreSQL.sql | 11 ++ .../godmode/reporting/reporting_builder.php | 26 +++- .../godmode/setup/setup_visuals.php | 140 ++++++++++++++++++ pandora_console/include/functions_config.php | 47 +++++- pandora_console/pandoradb.data.oracle.sql | 5 + pandora_console/pandoradb.data.postgreSQL.sql | 7 +- pandora_console/pandoradb_data.sql | 7 +- 10 files changed, 271 insertions(+), 7 deletions(-) diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 105331fe7b..961843a3c0 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,17 @@ +2014-05-07 Juan Manuel Ramon + + * 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 * godmode/agentes/planned_downtime.editor.php, diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql index f70b7a97ff..5caceb6e28 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.mysql.sql @@ -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', ''); \ No newline at end of file diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql index 85b44b6d08..082c67a1fc 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.oracle.sql @@ -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', ''); diff --git a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql index 78d391566c..ac3346854a 100644 --- a/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql +++ b/pandora_console/extras/pandoradb_migrate_5.0.x_to_5.1.postgreSQL.sql @@ -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', ''); \ No newline at end of file diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 080c0cdf36..c6eb2ec618 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -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 = "<p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><img src="" . $start_url . "/images/pandora_report_logo.png" alt="" width="800" /></p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p> <p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>"; + // 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 = "<p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><img src="" . $start_url . "/images/pandora_report_logo.png" alt="" width="800" /></p> <p style="text-align: center;">&nbsp;</p> <p style="text-align: center;"><span style="font-size: xx-large;">(_REPORT_NAME_)</span></p> <p style="text-align: center;"><span style="font-size: large;">(_DATETIME_)</span></p>"; + $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 diff --git a/pandora_console/godmode/setup/setup_visuals.php b/pandora_console/godmode/setup/setup_visuals.php index 1836ef2ac8..1ba258c119 100644 --- a/pandora_console/godmode/setup/setup_visuals.php +++ b/pandora_console/godmode/setup/setup_visuals.php @@ -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] = '' . html_print_image ($config['custom_report_front_logo'], true) . ''; + +$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 '
'; 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/'); + ?>