diff --git a/pandora_console/ChangeLog b/pandora_console/ChangeLog index 2e91c52f37..24bb5e4d0d 100644 --- a/pandora_console/ChangeLog +++ b/pandora_console/ChangeLog @@ -1,3 +1,10 @@ +2010-05-04 Miguel de Dios + + * godmode/reporting/reporting_builder.preview.php: added file to show the + html preview of report. + + * godmode/reporting/reporting_builder.php: added the tab for the preview. + 2010-05-04 Sergio Martin * godmode/db/db_audit.php diff --git a/pandora_console/godmode/reporting/reporting_builder.php b/pandora_console/godmode/reporting/reporting_builder.php index 07e33dc5a3..b171f4bc1a 100644 --- a/pandora_console/godmode/reporting/reporting_builder.php +++ b/pandora_console/godmode/reporting/reporting_builder.php @@ -379,6 +379,10 @@ $buttons = array( if ($enterpriseEnable) { $buttons = enterprise_addTabs($buttons, $idReport); } + +$buttons['preview'] = array('active' => false, + 'text' => '' . + print_image("images/reporting.png", true, array ("title" => __('Preview'))) .''); $buttons[$activeTab]['active'] = true; @@ -409,6 +413,9 @@ switch ($activeTab) { case 'item_editor': require_once('godmode/reporting/reporting_builder.item_editor.php'); break; + case 'preview': + require_once('godmode/reporting/reporting_builder.preview.php'); + break; default: enterprise_selectTab($activeTab); break; diff --git a/pandora_console/godmode/reporting/reporting_builder.preview.php b/pandora_console/godmode/reporting/reporting_builder.preview.php new file mode 100644 index 0000000000..4f61a08af1 --- /dev/null +++ b/pandora_console/godmode/reporting/reporting_builder.preview.php @@ -0,0 +1,143 @@ +" + . print_image ("images/fullscreen.png", true, array ("title" => __('Full screen mode'))) + . ""; +} else { + $options[] = "" + . print_image ("images/normalscreen.png", true, array ("title" => __('Back to normal mode'))) + . ""; +} + +$table->width = '99%'; +$table->class = 'databox'; +$table->style = array (); +$table->style[0] = 'font-weight: bold'; +$table->size = array (); +$table->size[0] = '50px'; +$table->data = array (); +$table->data[0][0] = ''; +if ($report['description'] != '') { + $table->data[0][1] = $report['description']; +} else { + $table->data[0][1] = $report['name']; +} +$table->data[1][0] = __('Date'); +$table->data[1][1] = print_input_text ('date', $date, '', 10, 10, true). ' '; +$table->data[1][1] .= print_input_text ('time', $time, '', 7, 7, true). ' '; +$table->data[1][1] .= print_submit_button (__('Update'), 'date_submit', false, 'class="sub next"', true); + +echo '
'; +print_table ($table); +print_input_hidden ('id_report', $id_report); +echo '
'; + +echo '
'; +echo '
'; +echo ''.__('Loading').'...'; +echo '
'; + +/* We must add javascript here. Otherwise, the date picker won't + work if the date is not correct because php is returning. */ + +require_css_file ('datepicker'); +require_jquery_file ('ui.core'); +require_jquery_file ('ui.datepicker'); +require_jquery_file ('timeentry'); +?> + + +'.__('Invalid date selected').''; + return; +} + +// TODO: Evaluate if it's better to render blocks when are calculated (enabling realtime flush) or if it's better to wait report to be finished before showing anything (this could break the execution by overflowing the running PHP memory on HUGE reports). + + +$table->size = array (); +$table->style = array (); +$table->width = '99%'; +$table->class = 'databox report_table'; +$table->rowclass = array (); +$table->rowclass[0] = 'datos3'; + +$report["group_name"] = get_group_name ($report['id_group']); + +$contents = get_db_all_rows_field_filter ("treport_content", "id_report", $id_report, "`order`"); +if ($contents === false) { + return; +} + +foreach ($contents as $content) { + $table->data = array (); + $table->head = array (); + $table->style = array (); + $table->colspan = array (); + $table->rowstyle = array (); + + render_report_html_item ($content, $table, $report); + + print_table ($table); + flush (); +} +?> \ No newline at end of file