diff --git a/classes/DataWarehouse/Access/ReportGenerator.php b/classes/DataWarehouse/Access/ReportGenerator.php index 8bf0512a0d..40d20d448f 100644 --- a/classes/DataWarehouse/Access/ReportGenerator.php +++ b/classes/DataWarehouse/Access/ReportGenerator.php @@ -9,7 +9,6 @@ class ReportGenerator extends Common const REPORT_ID_REGEX = '/^[0-9]+-(?(?=autogenerated)autogenerated-[a-z]+|[0-9\.]+)$/'; const REPORT_DATE_REGEX = '/^[0-9]{4}(-[0-9]{2}){2}$/'; const REPORT_FORMATS_REGEX = '/^doc|pdf$/'; - const REPORT_FONT_REGEX = '/^Arial$/'; const REPORT_SCHEDULE_REGEX = '/^Once|Daily|Weekly|Monthly|Quarterly|Semi-annually|Annually$/'; const REPORT_DELIVERY_REGEX = '/^E-Mail$/'; diff --git a/classes/ReportTemplates/GenericReportTemplate.php b/classes/ReportTemplates/GenericReportTemplate.php index 5e4ed51b72..e8a0185f30 100644 --- a/classes/ReportTemplates/GenericReportTemplate.php +++ b/classes/ReportTemplates/GenericReportTemplate.php @@ -38,7 +38,6 @@ public function buildReportFromTemplate(array &$params = array(), $report_id_suf $this->_report_skeleton['general']['title'], $this->_report_skeleton['general']['header'], $this->_report_skeleton['general']['footer'], - $this->_report_skeleton['general']['font'], $this->_report_skeleton['general']['format'], $this->_report_skeleton['general']['charts_per_page'], $this->_report_skeleton['general']['schedule'], diff --git a/classes/ReportTemplates/ParameterizedReportTemplate.php b/classes/ReportTemplates/ParameterizedReportTemplate.php index ec90e6819a..907efb7003 100644 --- a/classes/ReportTemplates/ParameterizedReportTemplate.php +++ b/classes/ReportTemplates/ParameterizedReportTemplate.php @@ -58,7 +58,6 @@ public function buildReportFromTemplate(array &$params = array(), $report_id_suf $report_title, $report_header, $report_footer, - $this->_report_skeleton['general']['font'], $this->_report_skeleton['general']['format'], $this->_report_skeleton['general']['charts_per_page'], $this->_report_skeleton['general']['schedule'], diff --git a/classes/XDReportManager.php b/classes/XDReportManager.php index 12aecdb2cc..94f2a22e49 100644 --- a/classes/XDReportManager.php +++ b/classes/XDReportManager.php @@ -101,7 +101,6 @@ public function configureSelectedReport( $report_title, $report_header, $report_footer, - $report_font, $report_format, $charts_per_page, $report_schedule, @@ -112,7 +111,6 @@ public function configureSelectedReport( $this->_report_title = $report_title; $this->_report_header = $report_header; $this->_report_footer = $report_footer; - $this->_report_font = $report_font; $this->_report_format = $report_format; $this->_charts_per_page = $charts_per_page; $this->_report_schedule = $report_schedule; @@ -134,7 +132,6 @@ public function saveThisReport() title = :report_title, header = :report_header, footer = :report_footer, - font = :font, charts_per_page = :charts_per_page, format = :format, schedule = :schedule, @@ -146,7 +143,6 @@ public function saveThisReport() 'report_title' => $this->_report_title, 'report_header' => $this->_report_header, 'report_footer' => $this->_report_footer, - 'font' => $this->_report_font, 'charts_per_page' => $this->_charts_per_page, 'format' => $this->_report_format, 'schedule' => $this->_report_schedule, @@ -156,11 +152,13 @@ public function saveThisReport() ); } - private function fontWrapper($text, $font_name, $font_size = 12) + private function fontWrapper($text, $font_size = 12) { - return '' . $text . ''; - + return sprintf( + '%s', + $font_size, + $text + ); } public static function sanitizeFilename($filename) @@ -175,8 +173,6 @@ public function getPreviewData($report_id, $token, $charts_per_page) { $report_data = $this->loadReportData($report_id, false); - $report_font = $report_data['general']['font']; - $rData = array(); $chartSlot = array(); @@ -224,12 +220,12 @@ public function getPreviewData($report_id, $token, $charts_per_page) } $chartSlot[$suffix] = array( - 'report_title' => (count($rData) == 0 && !empty($report_data['general']['title'])) ? $this->fontWrapper($report_data['general']['title'], $report_font, 22) . '
' : '', - 'header_text' => $this->fontWrapper($report_data['general']['header'], $report_font, 12), - 'footer_text' => $this->fontWrapper($report_data['general']['footer'], $report_font, 12), - 'chart_title_' . $suffix => $this->fontWrapper($report_chart['chart_title'], $report_font, 16), - 'chart_drill_details_' . $suffix => $this->fontWrapper($report_chart['chart_drill_details'], $report_font, 12), - 'chart_timeframe_' . $suffix => $this->fontWrapper($report_chart['chart_date_description'], $report_font, 14), + 'report_title' => (count($rData) == 0 && !empty($report_data['general']['title'])) ? $this->fontWrapper($report_data['general']['title'], 22) . '
' : '', + 'header_text' => $this->fontWrapper($report_data['general']['header'], 12), + 'footer_text' => $this->fontWrapper($report_data['general']['footer'], 12), + 'chart_title_' . $suffix => $this->fontWrapper($report_chart['chart_title'], 16), + 'chart_drill_details_' . $suffix => $this->fontWrapper($report_chart['chart_drill_details'], 12), + 'chart_timeframe_' . $suffix => $this->fontWrapper($report_chart['chart_date_description'], 14), 'chart_id_' . $suffix => '/report_image_renderer.php?type=report&ref=' . $report_id . ';' . $report_chart['ordering'] ); @@ -286,7 +282,6 @@ public function insertThisReport($report_derivation_method = 'Manual') title, header, footer, - font, format, schedule, delivery, @@ -300,7 +295,6 @@ public function insertThisReport($report_derivation_method = 'Manual') :report_title, :report_header, :report_footer, - :report_font, :report_format, :report_schedule, :report_delivery, @@ -316,7 +310,6 @@ public function insertThisReport($report_derivation_method = 'Manual') 'report_title' => $this->_report_title, 'report_header' => $this->_report_header, 'report_footer' => $this->_report_footer, - 'report_font' => $this->_report_font, 'report_format' => $this->_report_format, 'report_schedule' => $this->_report_schedule, 'report_delivery' => $this->_report_delivery, @@ -560,7 +553,6 @@ public function loadReportData($report_id) footer, format, charts_per_page, - font, schedule, delivery FROM Reports @@ -591,7 +583,6 @@ public function loadReportData($report_id) $return_data['general']['footer'] = $results[0]['footer']; $return_data['general']['format'] = $results[0]['format']; $return_data['general']['charts_per_page'] = $results[0]['charts_per_page']; - $return_data['general']['font'] = $results[0]['font']; $return_data['general']['schedule'] = $results[0]['schedule']; $return_data['general']['delivery'] = $results[0]['delivery']; @@ -966,23 +957,6 @@ public function getReportFormat($report_id) return $results[0]['format']; } - public function getReportFont($report_id) - { - $results = $this->_pdo->query( - " - SELECT font - FROM Reports - WHERE user_id = :user_id AND report_id = :report_id - ", - array( - 'user_id' => $this->_user_id, - 'report_id' => $report_id, - ) - ); - - return $results[0]['font']; - } - public function getReportName($report_id, $sanitize = false) { $results = $this->_pdo->query( @@ -1597,8 +1571,8 @@ public function generateChartBlob( /* * writeXMLConfiguration() * - * This function generates the XML configuration file and image files for - * processing by jasper-builder. The files are placed in the supplied + * This function generates the XML configuration file and image files for + * processing by jasper-builder. The files are placed in the supplied * directory (which must exist) * * \param outputdir the name of an existing, writable directory in which to put the files. @@ -1811,8 +1785,6 @@ public function buildReport($report_id, $export_format) $report_format = ($export_format != null) ? $export_format : $this->getReportFormat($report_id); - $report_font = $this->getReportFont($report_id); - // Initialize a temporary working directory for the report generation $template_path = tempnam(sys_get_temp_dir(), $report_id . '-'); @@ -1829,8 +1801,6 @@ public function buildReport($report_id, $export_format) } // Copy all report templates into this working directory - // (All templates? Probably want to copy just the template of - // interest -- dictated by the font) $paths = glob("$base_path/*.jrxml"); @@ -1859,7 +1829,6 @@ public function buildReport($report_id, $export_format) $template_path, $report_file_name, $report_template, - $report_font, $log_file ); @@ -1884,14 +1853,12 @@ public function buildReport($report_id, $export_format) * @param string $templatePath Directory containing template files. * @param string $reportFileName Name used for report files. * @param string $reportTemplate Template name. - * @param string $reportFont Report font name. * @param string $logFile Log file name. */ protected function executeReportBuilder( $templatePath, $reportFileName, $reportTemplate = 'template', - $reportFont = 'Arial', $logFile = 'build.log' ) { $builderPath = $templatePath; @@ -1912,9 +1879,7 @@ protected function executeReportBuilder( 'mail' => false, )); - $templateFile = "$reportTemplate.$reportFont"; - - $logger->info("Using template $templateFile"); + $logger->info("Using template $reportTemplate"); $currentDir = getcwd(); chdir($builderPath); @@ -1952,7 +1917,7 @@ protected function executeReportBuilder( $outputDir, $outputFile, $templateDir, - $templateFile, + $reportTemplate ); $cmd = implode(' ', array_map('escapeshellarg', $args)); @@ -2150,7 +2115,6 @@ public static function retrieveReportTemplate($user, $template_id) header, footer, format, - font, schedule, delivery, charts_per_page diff --git a/configuration/etl/etl.d/xdmod-migration-9_0_0-9_5_0.json b/configuration/etl/etl.d/xdmod-migration-9_0_0-9_5_0.json index fe839d4280..645b02379c 100644 --- a/configuration/etl/etl.d/xdmod-migration-9_0_0-9_5_0.json +++ b/configuration/etl/etl.d/xdmod-migration-9_0_0-9_5_0.json @@ -28,6 +28,23 @@ "schema": "moddb" } } + }, + { + "name": "update-moddb-tables", + "description": "Update moddb tables", + "class": "ManageTables", + "definition_file_list": [ + "xdb/report-templates.json", + "xdb/reports.json" + ], + "endpoints": { + "destination": { + "type": "mysql", + "name": "XDMoD Database", + "config": "database", + "schema": "moddb" + } + } } ] } diff --git a/configuration/etl/etl_data.d/xdb/report-templates.json b/configuration/etl/etl_data.d/xdb/report-templates.json index aa4eca8e98..1e482c720d 100644 --- a/configuration/etl/etl_data.d/xdb/report-templates.json +++ b/configuration/etl/etl_data.d/xdb/report-templates.json @@ -1,6 +1,6 @@ [ - ["id", "name", "description", "template", "title", "header", "footer", "format", "font", "schedule", "delivery", "charts_per_page", "use_submenu"], - [1, "Quarterly Report - Center Director", "Quarterly Report - Center Director", "GenericReportTemplate", "Quarterly Report - Center Director", "", "", "Pdf", "Arial", "Quarterly", "E-mail", 1, 0], - [2, "Dashboard Tab Report", "Dashboard Tab Report", "GenericReportTemplate", "Dashboard Tab Report", "", "", "Pdf", "Arial", "Once", "E-mail", 1, 0], - [3, "Dashboard Tab Report", "Dashboard Tab Report", "GenericReportTemplate", "Dashboard Tab Report", "", "", "Pdf", "Arial", "Once", "E-mail", 1, 0] + ["id", "name", "description", "template", "title", "header", "footer", "format", "schedule", "delivery", "charts_per_page", "use_submenu"], + [1, "Quarterly Report - Center Director", "Quarterly Report - Center Director", "GenericReportTemplate", "Quarterly Report - Center Director", "", "", "Pdf", "Quarterly", "E-mail", 1, 0], + [2, "Dashboard Tab Report", "Dashboard Tab Report", "GenericReportTemplate", "Dashboard Tab Report", "", "", "Pdf", "Once", "E-mail", 1, 0], + [3, "Dashboard Tab Report", "Dashboard Tab Report", "GenericReportTemplate", "Dashboard Tab Report", "", "", "Pdf", "Once", "E-mail", 1, 0] ] diff --git a/configuration/etl/etl_tables.d/xdb/report-templates.json b/configuration/etl/etl_tables.d/xdb/report-templates.json index b74c82686d..54d5d3aa1b 100644 --- a/configuration/etl/etl_tables.d/xdb/report-templates.json +++ b/configuration/etl/etl_tables.d/xdb/report-templates.json @@ -44,11 +44,6 @@ "type": "enum('Pdf','Pptx','Doc','Xls','Html')", "nullable": true }, - { - "name": "font", - "type": "enum('Times','Arial')", - "nullable": true - }, { "name": "schedule", "type": "enum('Once','Daily','Weekly','Monthly','Quarterly','Semi-annually','Annually')", diff --git a/configuration/etl/etl_tables.d/xdb/reports.json b/configuration/etl/etl_tables.d/xdb/reports.json index 78050597b5..8fea35ba53 100644 --- a/configuration/etl/etl_tables.d/xdb/reports.json +++ b/configuration/etl/etl_tables.d/xdb/reports.json @@ -46,12 +46,6 @@ "nullable": false, "default": "Pdf" }, - { - "name": "font", - "type": "enum('Times','Arial')", - "nullable": false, - "default": "Arial" - }, { "name": "schedule", "type": "enum('Once','Daily','Weekly','Monthly','Quarterly','Semi-annually','Annually')", diff --git a/html/controllers/report_builder/save_report.php b/html/controllers/report_builder/save_report.php index 2ef12d0693..4cefeb8211 100644 --- a/html/controllers/report_builder/save_report.php +++ b/html/controllers/report_builder/save_report.php @@ -11,10 +11,6 @@ 'filter' => FILTER_VALIDATE_REGEXP, 'options' => array('regexp' => ReportGenerator::REPORT_ID_REGEX) ), - 'report_font' => array( - 'filter' => FILTER_VALIDATE_REGEXP, - 'options' => array('regexp' => ReportGenerator::REPORT_FONT_REGEX) - ), 'report_format' => array( 'filter' => FILTER_VALIDATE_REGEXP, 'options' => array('regexp' => ReportGenerator::REPORT_FORMATS_REGEX . 'i') @@ -33,192 +29,132 @@ ) ); - try { - - $user = \xd_security\getLoggedInUser(); - $rm = new XDReportManager($user); - - $base_path = \xd_utilities\getConfiguration('reporting', 'base_path'); - - $post = filter_input_array(INPUT_POST, $filters); - - $map = array(); - - // ----------------------------------- - - \xd_security\assertParameterSet('phase'); - - switch($post['phase']) { - - case 'create': - +try { + $user = \xd_security\getLoggedInUser(); + $rm = new XDReportManager($user); + $base_path = \xd_utilities\getConfiguration('reporting', 'base_path'); + $post = filter_input_array(INPUT_POST, $filters); + $map = array(); + + \xd_security\assertParameterSet('phase'); + + switch ($post['phase']) { + case 'create': $report_id = $user->getUserID()."-".time(); - break; - - case 'update': - + case 'update': \xd_security\assertParameterSet('report_id'); - $report_id = $post['report_id']; - + // Cache the blobs so they can be re-introduced as necessary during the report update process $rm->buildBlobMap($report_id, $map); - $rm->removeReportCharts($report_id); - break; - - } - - // ----------------------------------- - - $report_name = mb_convert_encoding($_POST['report_name'], ReportGenerator::REPORT_CHAR_ENCODING, 'UTF-8'); - $report_title = mb_convert_encoding($_POST['report_title'], ReportGenerator::REPORT_CHAR_ENCODING, 'UTF-8'); - $report_header = mb_convert_encoding($_POST['report_header'], ReportGenerator::REPORT_CHAR_ENCODING, 'UTF-8'); - $report_footer = mb_convert_encoding($_POST['report_footer'], ReportGenerator::REPORT_CHAR_ENCODING, 'UTF-8'); - - $rm->configureSelectedReport( - - $report_id, - $report_name, - $report_title, - $report_header, - $report_footer, - $post['report_font'], - $post['report_format'], - $post['charts_per_page'], - $post['report_schedule'], - $post['report_delivery'] - - ); - - // ----------------------------------- - - if ($rm->isUniqueName($report_name, $report_id) == false) { - - \xd_response\presentError('Another report you have created is already using this name.'); - - } - - // ----------------------------------- - - switch($post['phase']) { - - case 'create': - + } + + $report_name = mb_convert_encoding($_POST['report_name'], ReportGenerator::REPORT_CHAR_ENCODING, 'UTF-8'); + $report_title = mb_convert_encoding($_POST['report_title'], ReportGenerator::REPORT_CHAR_ENCODING, 'UTF-8'); + $report_header = mb_convert_encoding($_POST['report_header'], ReportGenerator::REPORT_CHAR_ENCODING, 'UTF-8'); + $report_footer = mb_convert_encoding($_POST['report_footer'], ReportGenerator::REPORT_CHAR_ENCODING, 'UTF-8'); + + $rm->configureSelectedReport( + $report_id, + $report_name, + $report_title, + $report_header, + $report_footer, + $post['report_format'], + $post['charts_per_page'], + $post['report_schedule'], + $post['report_delivery'] + ); + + if ($rm->isUniqueName($report_name, $report_id) == false) { + \xd_response\presentError('Another report you have created is already using this name.'); + } + + switch ($post['phase']) { + case 'create': $rm->insertThisReport("Manual"); break; - - case 'update': - - $rm->saveThisReport(); + case 'update': + $rm->saveThisReport(); break; - - } - - // ----------------------------------- - - foreach($_POST as $k => $v) { - - if (preg_match('/chart_data_(\d+)/', $k, $m) > 0) { - + } + + foreach ($_POST as $k => $v) { + if (preg_match('/chart_data_(\d+)/', $k, $m) > 0) { $order = $m[1]; - - list($chart_id, $chart_title, $chart_drill_details, $chart_date_description, $timeframe_type, $entry_type) = explode(';', $v); - + + list($chart_id, $chart_title, $chart_drill_details, $chart_date_description, $timeframe_type, $entry_type) = explode(';', $v); + $chart_title = str_replace('%3B', ';', $chart_title); $chart_drill_details = str_replace('%3B', ';', $chart_drill_details); - + $cache_ref_variable = 'chart_cacheref_'.$order; - // Transfer blobs residing in the directory used for temporary files into the database as necessary for each chart which comprises the report. + // Transfer blobs residing in the directory used for temporary + // files into the database as necessary for each chart which + // comprises the report. if (isset($_POST[$cache_ref_variable])) { - $cache_ref = filter_var( $_POST[$cache_ref_variable], FILTER_VALIDATE_REGEXP, array('options' => array('regexp' => ReportGenerator::CHART_CACHEREF_REGEX)) ); - list($start_date, $end_date, $ref, $rank) = explode(';', $cache_ref); - - $location = sys_get_temp_dir() . "/{$ref}_{$rank}_{$start_date}_{$end_date}.png"; - - // Generate chart blob if it doesn't exist. This file - // should have already been created by - // report_image_renderer.php, but is not in Firefox. - // See Mantis 0001336 - if (!is_file($location)) { - $insertion_rank = array( - 'rank' => $rank, - 'did' => '', - ); - $cached_blob = $start_date . ',' . $end_date . ';' - . $rm->generateChartBlob('volatile', $insertion_rank, $start_date, $end_date); - } - else { - $cached_blob = $start_date.','.$end_date.';'.file_get_contents($location); - } - - // ========================== - - //todo: consider refactoring !!! - - $chart_id_found = false; - - foreach ($map as &$e) { - - if ($e['chart_id'] == $chart_id) { - - $e['image_data'] = $cached_blob; - $chart_id_found = true; - - } - - }//foreach - - if ($chart_id_found == false) { - - $map[] = array( - 'chart_id' => $chart_id, - 'image_data' => $cached_blob - ); - - } - - // ========================== - - //print "Cached blob for $order: ".$cached_blob; - + list($start_date, $end_date, $ref, $rank) = explode(';', $cache_ref); + + $location = sys_get_temp_dir() . "/{$ref}_{$rank}_{$start_date}_{$end_date}.png"; + + // Generate chart blob if it doesn't exist. This file + // should have already been created by + // report_image_renderer.php, but is not in Firefox. + // See Mantis 0001336 + if (!is_file($location)) { + $insertion_rank = array( + 'rank' => $rank, + 'did' => '', + ); + $cached_blob = $start_date . ',' . $end_date . ';' + . $rm->generateChartBlob('volatile', $insertion_rank, $start_date, $end_date); + } else { + $cached_blob = $start_date.','.$end_date.';'.file_get_contents($location); + } + + $chart_id_found = false; + + foreach ($map as &$e) { + if ($e['chart_id'] == $chart_id) { + $e['image_data'] = $cached_blob; + $chart_id_found = true; + } + } + + if ($chart_id_found == false) { + $map[] = array( + 'chart_id' => $chart_id, + 'image_data' => $cached_blob + ); + } } - - $rm->saveCharttoReport($report_id, $chart_id, $chart_title, $chart_drill_details, $chart_date_description, $order, $timeframe_type, $entry_type, $map); - - }//if - - }//foreach - - // ----------------------------------- - - $returnData['action'] = 'save_report'; - $returnData['phase'] = $post['phase']; - $returnData['report_id'] = $report_id; - $returnData['success'] = true; - $returnData['status'] = 'success'; - - \xd_controller\returnJSON($returnData); - - } - catch (SessionExpiredException $see) { - // TODO: Refactor generic catch block below to handle specific exceptions, - // which would allow this block to be removed. - throw $see; - } - catch (\Exception $e) { - - \xd_response\presentError($e->getMessage()); - - } - + + $rm->saveCharttoReport($report_id, $chart_id, $chart_title, $chart_drill_details, $chart_date_description, $order, $timeframe_type, $entry_type, $map); + } + } + + $returnData['action'] = 'save_report'; + $returnData['phase'] = $post['phase']; + $returnData['report_id'] = $report_id; + $returnData['success'] = true; + $returnData['status'] = 'success'; + + \xd_controller\returnJSON($returnData); +} catch (SessionExpiredException $see) { + // TODO: Refactor generic catch block below to handle specific exceptions, + // which would allow this block to be removed. + throw $see; +} catch (\Exception $e) { + \xd_response\presentError($e->getMessage()); +} diff --git a/html/gui/js/report_builder/ReportCreator.js b/html/gui/js/report_builder/ReportCreator.js index c20215399b..ecb7b519dc 100644 --- a/html/gui/js/report_builder/ReportCreator.js +++ b/html/gui/js/report_builder/ReportCreator.js @@ -35,7 +35,6 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { txtReportHeader.setValue(''); txtReportFooter.setValue(''); - cmbFont.setValue('Arial'); cmbFormat.setValue('Pdf'); cmbSchedule.setValue('Once'); cmbDelivery.setValue('E-mail'); @@ -65,10 +64,6 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { txtReportFooter.setValue(value); }; - self.setReportFont = function (value) { - cmbFont.setValue(value); - }; - self.setReportFormat = function (value) { cmbFormat.setValue(value); }; @@ -162,29 +157,6 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { } }); - var font_store = new Ext.data.SimpleStore({ - fields: ['name'], - data: [['Arial']] - }); - - var cmbFont = new Ext.form.ComboBox({ - editable: false, - width: 140, - fieldLabel: 'Font', - mode: 'local', - store: font_store, - triggerAction: 'all', - displayField: 'name', - hidden: true, - valueField: 'name', - emptyText: 'No Font Selected', - listeners: { - change: self.dirtyConfig - } - }); - - cmbFont.setValue(1); - var format_store = new Ext.data.SimpleStore({ fields: ['name', 'format'], data: [ @@ -414,7 +386,6 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { reportData.charts_per_page = rdoChartLayout.getValue().charts_per_page; - reportData.report_font = cmbFont.getRawValue(); reportData.report_format = cmbFormat.getValue(); reportData.report_schedule = cmbSchedule.getRawValue(); reportData.report_delivery = cmbDelivery.getRawValue(); @@ -924,7 +895,6 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { defaultType: 'textfield', items: [ - cmbFont, cmbFormat, cmbSchedule, cmbDelivery, @@ -1135,4 +1105,3 @@ XDMoD.ReportCreator = Ext.extend(Ext.form.FormPanel, { XDMoD.ReportCreator.superclass.initComponent.call(this); } }); - diff --git a/html/gui/js/report_builder/ReportsOverview.js b/html/gui/js/report_builder/ReportsOverview.js index ce50903b8b..0426fd3204 100644 --- a/html/gui/js/report_builder/ReportsOverview.js +++ b/html/gui/js/report_builder/ReportsOverview.js @@ -443,7 +443,6 @@ XDMoD.ReportsOverview = Ext.extend(Ext.Panel, { self.parent.reportCreator.setChartsPerPage(reportGeneralData.charts_per_page); self.parent.reportCreator.setReportFormat(reportGeneralData.format); - self.parent.reportCreator.setReportFont(reportGeneralData.font); self.parent.reportCreator.setReportSchedule(reportGeneralData.schedule); self.parent.reportCreator.setReportDelivery(reportGeneralData.delivery); @@ -616,7 +615,6 @@ XDMoD.ReportsOverview = Ext.extend(Ext.Panel, { self.parent.reportCreator.setReportFooter(reportGeneralData.footer); self.parent.reportCreator.setReportFormat(reportGeneralData.format); - self.parent.reportCreator.setReportFont(reportGeneralData.font); self.parent.reportCreator.setReportSchedule(reportGeneralData.schedule); self.parent.reportCreator.setReportDelivery(reportGeneralData.delivery); diff --git a/reporting/jasper_builder/ReportBuilder.sh b/reporting/jasper_builder/ReportBuilder.sh index d825b13ef7..e4b6333ef0 100755 --- a/reporting/jasper_builder/ReportBuilder.sh +++ b/reporting/jasper_builder/ReportBuilder.sh @@ -7,26 +7,21 @@ PATH=$PATH:/opt/java/bin/ -#java -version -#java version "1.7.0_13" -#OpenJDK Runtime Environment (IcedTea7 2.3.6) (7u13-2.3.6-0ubuntu0.12.04.1) -#OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode) - function getSetting { - # This settings file path is replaced during the (open source) - # installation process, so make sure that works if this is ever - # changed. - DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - SETTINGS="$DIR/../../configuration/portal_settings.ini" + # This settings file path is replaced during the (open source) + # installation process, so make sure that works if this is ever + # changed. + DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" + SETTINGS="$DIR/../../configuration/portal_settings.ini" - if ! [ -e "$SETTINGS" ]; then - return - fi + if ! [ -e "$SETTINGS" ]; then + return + fi - SECTION=$1 - PARAM=$2 + SECTION=$1 + PARAM=$2 - sed -n -e "/\[$SECTION\]/,/\[/ p" $SETTINGS | grep $PARAM | sed "s/$PARAM = \(['\"]\)\(.*\)\1/\2/" + sed -n -e "/\[$SECTION\]/,/\[/ p" $SETTINGS | grep $PARAM | sed "s/$PARAM = \(['\"]\)\(.*\)\1/\2/" } # ================================================================== @@ -43,127 +38,102 @@ BASEPATH="$(cd "$(dirname "$0")" && pwd -P)" # ================================================================== displayUsage() { - - echo "Invalid arguments" - echo "Usage: ReportBuilder.sh [options]" - echo "-C : compile java source code" - echo "-W : working directory (the temporary space used for the build)" - echo "-E : execute report builder, it requires the following arguments:" - echo " -W + working directory (source and destination, including template files)" - echo " -B + base filename (without file type extension, .xml, .pdf, .docx, …) " - echo " -T + JasperReport template file name (without file type extension, .jrxml)" - echo " -F + Report Font (if not specified, defaults to 'Arial')" - - exit - + echo "Invalid arguments" + echo "Usage: ReportBuilder.sh [options]" + echo "-C : compile java source code" + echo "-W : working directory (the temporary space used for the build)" + echo "-E : execute report builder, it requires the following arguments:" + echo " -W + working directory (source and destination, including template files)" + echo " -B + base filename (without file type extension, .xml, .pdf, .docx, …) " + echo " -T + JasperReport template file name (without file type extension, .jrxml)" + + exit } # Set up java classpath string ===================================== - path="$BASEPATH/" - path="$path:$BASEPATH/lib/commons-beanutils/commons-beanutils-1.8.0.jar" - path="$path:$BASEPATH/lib/commons-logging/commons-logging.jar" - path="$path:$BASEPATH/lib/jasperreports/jasperreports-3.7.6.jar" - path="$path:$BASEPATH/lib/commons-collections/commons-collections-2.1.1.jar" - path="$path:$BASEPATH/lib/poi/poi-3.6-20091214.jar" - path="$path:$BASEPATH/lib/commons-digester/commons-digester-1.7.jar" - path="$path:$BASEPATH/lib/itextpdf/itext-2.1.7.jar" - path="$path:$BASEPATH/lib/xalan/xalan.jar" - - CLASSPATH=${CLASSPATH}:${path} - +path="$BASEPATH/" +path="$path:$BASEPATH/lib/commons-beanutils/commons-beanutils-1.8.0.jar" +path="$path:$BASEPATH/lib/commons-logging/commons-logging.jar" +path="$path:$BASEPATH/lib/jasperreports/jasperreports-3.7.6.jar" +path="$path:$BASEPATH/lib/commons-collections/commons-collections-2.1.1.jar" +path="$path:$BASEPATH/lib/poi/poi-3.6-20091214.jar" +path="$path:$BASEPATH/lib/commons-digester/commons-digester-1.7.jar" +path="$path:$BASEPATH/lib/itextpdf/itext-2.1.7.jar" +path="$path:$BASEPATH/lib/xalan/xalan.jar" + +CLASSPATH=${CLASSPATH}:${path} + # Must take parameters ============================================= if [ $# = 0 ]; then - displayUsage - exit + displayUsage + exit fi # Default values =================================================== template="template" inputfile="NULL" -outputfile="NULL" +outputfile="NULL" execute=0 compile=0 builder_path="." -font="Arial" # ================================================================== while getopts "W:B:T:F:CE" OPTION do - - case $OPTION in - - E) - execute=1 - ;; - - W) - builder_path=$OPTARG - inputdir=$OPTARG - outputdir=$OPTARG - templatedir=$OPTARG - ;; - - B) - inputfile=$OPTARG - outputfile=$OPTARG - ;; - - T) - template=$OPTARG - ;; - - F) - font=$OPTARG - ;; - - C) - compile=1 - ;; - - ?) - displayUsage - exit - ;; - - esac - + case $OPTION in + E) + execute=1 + ;; + W) + builder_path=$OPTARG + inputdir=$OPTARG + outputdir=$OPTARG + templatedir=$OPTARG + ;; + B) + inputfile=$OPTARG + outputfile=$OPTARG + ;; + T) + template=$OPTARG + ;; + C) + compile=1 + ;; + ?) + displayUsage + exit + ;; + esac done # Compile (if -C passed in) ======================================== if [ $compile = 1 ]; then - - cd $builder_path - - echo "Attempting to compile JasperReport code..." - echo "$JAVAC -classpath ${CLASSPATH} *.java" - echo - $JAVAC -classpath ${CLASSPATH} *.java - - exit - + cd $builder_path + echo "Attempting to compile JasperReport code..." + echo "$JAVAC -classpath ${CLASSPATH} *.java" + echo + $JAVAC -classpath ${CLASSPATH} *.java + exit fi # Execute report builder =========================================== if [ $execute = 1 ]; then + if [ $inputfile = "NULL" ] || [ $outputfile = "NULL" ]; then + displayUsage + exit + fi - - if [ $inputfile = "NULL" ] || [ $outputfile = "NULL" ]; then - displayUsage - exit - fi - - templatefile="$template.$font" - cd $builder_path - - echo "Start: `date` `date +%s`" > $outputdir/build_info - $JAVA -cp ${CLASSPATH} Builder $inputdir $inputfile $outputdir $outputfile $templatedir $templatefile - echo "End: `date` `date +%s`" >> $outputdir/build_info - chmod 444 $outputdir/build_info + cd $builder_path + echo "Start: `date` `date +%s`" > $outputdir/build_info + $JAVA -cp ${CLASSPATH} Builder $inputdir $inputfile $outputdir $outputfile $templatedir $template + echo "End: `date` `date +%s`" >> $outputdir/build_info + chmod 444 $outputdir/build_info fi diff --git a/reporting/jasper_builder/template_1up.Arial.jrxml b/reporting/jasper_builder/template_1up.jrxml similarity index 100% rename from reporting/jasper_builder/template_1up.Arial.jrxml rename to reporting/jasper_builder/template_1up.jrxml diff --git a/reporting/jasper_builder/template_2up.Arial.jrxml b/reporting/jasper_builder/template_2up.jrxml similarity index 100% rename from reporting/jasper_builder/template_2up.Arial.jrxml rename to reporting/jasper_builder/template_2up.jrxml diff --git a/tests/artifacts/xdmod/report_builder/input/create_report.json b/tests/artifacts/xdmod/report_builder/input/create_report.json index 1d1c5bea8b..d4afecd7d9 100644 --- a/tests/artifacts/xdmod/report_builder/input/create_report.json +++ b/tests/artifacts/xdmod/report_builder/input/create_report.json @@ -29,7 +29,6 @@ "report_header": "", "report_footer": "", "charts_per_page": "1", - "report_font": "Arial", "report_format": "Pdf", "report_schedule": "Once", "report_delivery": "E-mail", @@ -70,7 +69,6 @@ "report_header": "", "report_footer": "", "charts_per_page": "1", - "report_font": "Arial", "report_format": "Pdf", "report_schedule": "Once", "report_delivery": "E-mail", @@ -111,7 +109,6 @@ "report_header": "", "report_footer": "", "charts_per_page": "1", - "report_font": "Arial", "report_format": "Pdf", "report_schedule": "Once", "report_delivery": "E-mail", @@ -152,7 +149,6 @@ "report_header": "", "report_footer": "", "charts_per_page": "1", - "report_font": "Arial", "report_format": "Pdf", "report_schedule": "Once", "report_delivery": "E-mail",