1. Commit der vorher vergessenen HTML-Templates für die Berichte und die Exportoptionen.
2. HTML-Berichte: Zeilenumbrüche mit "\n" werden in "<br>" umgewandelt.
3. CSV-Export: Richtiger MIME-Type; Download der Datei forcieren; Option für die Spaltenüberschriften gefixt.
print $self->generate_html_content();
} elsif ($format eq 'csv') {
- print qq|content-type: text/plain\n\n|;
-# print qq|content-disposition: attachment; filename=${filename}.csv\n\n|;
+ print qq|content-type: text/csv\n|;
+ print qq|content-disposition: attachment; filename=${filename}.csv\n\n|;
$self->generate_csv_content();
} elsif ($format eq 'pdf') {
return grep { my $c = $self->{columns}->{$_}; $c && $c->{visible} && (($c->{visible} == 1) || ($c->{visible} =~ /${format}/i)) } @{ $self->{column_order} };
}
+sub html_format {
+ my $self = shift;
+ my $value = shift;
+
+ $value = $self->{form}->quote_html($value);
+ $value =~ s/\r//g;
+ $value =~ s/\n/<br>/g;
+
+ return $value;
+}
+
sub prepare_html_content {
my $self = shift;
foreach my $row (@{ $row_set }) {
$inner_idx++;
+ map { $row->{$_}->{data} = $self->html_format($row->{$_}->{data}) } @visible_columns;
+
my $row_data = {
'COLUMNS' => [ map { $row->{$_} } @visible_columns ],
'outer_idx' => $outer_idx,
my $variables = {
'TITLE' => $opts->{title},
- 'TOP_INFO_TEXT' => $opts->{top_info_text},
+ 'TOP_INFO_TEXT' => $self->html_format($opts->{top_info_text}),
'RAW_TOP_INFO_TEXT' => $opts->{raw_top_info_text},
- 'BOTTOM_INFO_TEXT' => $opts->{bottom_info_text},
+ 'BOTTOM_INFO_TEXT' => $self->html_format($opts->{bottom_info_text}),
'RAW_BOTTOM_INFO_TEXT' => $opts->{raw_bottom_info_text},
'ALLOW_PDF_EXPORT' => $allow_pdf_export,
'ALLOW_CSV_EXPORT' => $opts->{allow_csv_export},
--- /dev/null
+<body>
+
+ <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
+
+ <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+
+ <input type="hidden" name="report_generator_csv_options_set" value="1">
+
+ <table>
+ <tr>
+ <td align="right">Anführungszeichen</td>
+ <td>
+ <select name="report_generator_csv_options_quote_char" style="width: 300px">
+ <option value=""" selected>"</option>
+ <option value="'">'</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">Escape-Zeichen</td>
+ <td>
+ <select name="report_generator_csv_options_escape_char" style="width: 300px">
+ <option value="QUOTE_CHAR" selected>Wie Anführungszeichen</option>
+ <option value=""">"</option>
+ <option value="'">'</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">Feldtrennzeichen</td>
+ <td>
+ <select name="report_generator_csv_options_sep_char" style="width: 300px">
+ <option value=";" selected>;</option>
+ <option value=",">,</option>
+ <option value=":">:</option>
+ <option value="TAB">TAB (Das Tabulator-Symbol)</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">Zeilenumbrüche</td>
+ <td>
+ <select name="report_generator_csv_options_eol_style" style="width: 300px">
+ <option value="DOS" selected>DOS/Windows (CR/LF)</option>
+ <option value="Unix">Unix (LF)</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top">Optionen:</td>
+ <td valign="top">
+ <input type="checkbox" name="report_generator_csv_options_headers" value="1" checked>
+ Spaltenüberschriften erzeugen
+ </td>
+ </tr>
+
+ </table>
+
+ <p><input type="submit" name="action" class="submit" value="Als CSV exportieren"></p>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<body>
+
+ <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
+
+ <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+
+ <input type="hidden" name="report_generator_csv_options_set" value="1">
+
+ <table>
+ <tr>
+ <td align="right"><translate>Quote chararacter</translate></td>
+ <td>
+ <select name="report_generator_csv_options_quote_char" style="width: 300px">
+ <option value=""" selected>"</option>
+ <option value="'">'</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Escape character</translate></td>
+ <td>
+ <select name="report_generator_csv_options_escape_char" style="width: 300px">
+ <option value="QUOTE_CHAR" selected><translate>Same as the quote character</translate></option>
+ <option value=""">"</option>
+ <option value="'">'</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Separator chararacter</translate></td>
+ <td>
+ <select name="report_generator_csv_options_sep_char" style="width: 300px">
+ <option value=";" selected>;</option>
+ <option value=",">,</option>
+ <option value=":">:</option>
+ <option value="TAB">TAB (<translate>The tabulator character</translate>)</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Line endings</translate></td>
+ <td>
+ <select name="report_generator_csv_options_eol_style" style="width: 300px">
+ <option value="DOS" selected>DOS/Windows (CR/LF)</option>
+ <option value="Unix">Unix (LF)</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><translate>Options</translate>:</td>
+ <td valign="top">
+ <input type="checkbox" name="report_generator_csv_options_headers" value="1" checked>
+ <translate>Include column headings</translate>
+ </td>
+ </tr>
+
+ </table>
+
+ <p><input type="submit" name="action" class="submit" value="<translate>Export as CSV</translate>"></p>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<body>
+
+ <div class="listtop" width="100%"><TMPL_VAR TITLE></div>
+
+ <TMPL_IF TOP_INFO_TEXT>
+ <p><TMPL_VAR TOP_INFO_TEXT></p>
+ </TMPL_IF>
+
+ <TMPL_VAR RAW_TOP_INFO_TEXT>
+
+ <p>
+ <table width="100%">
+ <tr>
+ <TMPL_LOOP COLUMN_HEADERS>
+ <th class="listheading"><TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF><TMPL_VAR text ESCAPE=HTML><TMPL_IF link></a></TMPL_IF></th>
+ </TMPL_LOOP>
+ </tr>
+
+ <TMPL_LOOP ROWS>
+ <tr class="listrow<TMPL_VAR outer_idx_odd>">
+ <TMPL_LOOP COLUMNS>
+ <td<TMPL_IF align> align="<TMPL_VAR align>"</TMPL_IF><TMPL_IF valign> valign="<TMPL_VAR valign>"</TMPL_IF>>
+ <TMPL_IF raw_data><TMPL_VAR raw_data></TMPL_IF>
+ <TMPL_IF data>
+ <TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF>
+ <TMPL_VAR data><TMPL_IF link></a></TMPL_IF>
+ </TMPL_IF>
+ </td>
+ </TMPL_LOOP>
+ </tr>
+ </TMPL_LOOP>
+
+ <tr><td colspan="<TMPL_VAR NUM_COLUMNS>"><hr size="3" noshade></td></tr>
+
+ </table>
+ </p>
+
+ <TMPL_VAR RAW_BOTTOM_INFO_TEXT>
+
+ <TMPL_IF BOTTOM_INFO_TEXT>
+ <p><TMPL_VAR BOTTOM_INFO_TEXT></p>
+ </TMPL_IF>
+
+ <TMPL_IF SHOW_EXPORT_BUTTONS>
+ <form action="<TMPL_VAR script ESCAPE=HTML>" name="generate_report_form" method="post">
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <TMPL_LOOP EXPORT_VARIABLES><input type="hidden" name="report_generator_hidden_<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+
+ <input type="hidden" name="report_generator_nextsub" value="<TMPL_VAR EXPORT_NEXTSUB ESCAPE=HTML>">
+ <input type="hidden" name="report_generator_variable_list" value="<TMPL_VAR EXPORT_VARIABLE_LIST ESCAPE=HTML>">
+
+ <p>
+ Listenexport<br>
+ <TMPL_IF ALLOW_PDF_EXPORT><input type="submit" class="submit" name="action" value="Als PDF exportieren"></TMPL_IF>
+ <TMPL_IF ALLOW_CSV_EXPORT><input type="submit" class="submit" name="action" value="Als CSV exportieren"></TMPL_IF>
+ </p>
+ </form>
+ </TMPL_IF>
+
+</body>
--- /dev/null
+<body>
+
+ <div class="listtop" width="100%"><TMPL_VAR TITLE></div>
+
+ <TMPL_IF TOP_INFO_TEXT>
+ <p><TMPL_VAR TOP_INFO_TEXT></p>
+ </TMPL_IF>
+
+ <TMPL_VAR RAW_TOP_INFO_TEXT>
+
+ <p>
+ <table width="100%">
+ <tr>
+ <TMPL_LOOP COLUMN_HEADERS>
+ <th class="listheading"><TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF><TMPL_VAR text ESCAPE=HTML><TMPL_IF link></a></TMPL_IF></th>
+ </TMPL_LOOP>
+ </tr>
+
+ <TMPL_LOOP ROWS>
+ <tr class="listrow<TMPL_VAR outer_idx_odd>">
+ <TMPL_LOOP COLUMNS>
+ <td<TMPL_IF align> align="<TMPL_VAR align>"</TMPL_IF><TMPL_IF valign> valign="<TMPL_VAR valign>"</TMPL_IF>>
+ <TMPL_IF raw_data><TMPL_VAR raw_data></TMPL_IF>
+ <TMPL_IF data>
+ <TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF>
+ <TMPL_VAR data><TMPL_IF link></a></TMPL_IF>
+ </TMPL_IF>
+ </td>
+ </TMPL_LOOP>
+ </tr>
+ </TMPL_LOOP>
+
+ <tr><td colspan="<TMPL_VAR NUM_COLUMNS>"><hr size="3" noshade></td></tr>
+
+ </table>
+ </p>
+
+ <TMPL_VAR RAW_BOTTOM_INFO_TEXT>
+
+ <TMPL_IF BOTTOM_INFO_TEXT>
+ <p><TMPL_VAR BOTTOM_INFO_TEXT></p>
+ </TMPL_IF>
+
+ <TMPL_IF SHOW_EXPORT_BUTTONS>
+ <form action="<TMPL_VAR script ESCAPE=HTML>" name="generate_report_form" method="post">
+ <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
+ <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
+
+ <TMPL_LOOP EXPORT_VARIABLES><input type="hidden" name="report_generator_hidden_<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+
+ <input type="hidden" name="report_generator_nextsub" value="<TMPL_VAR EXPORT_NEXTSUB ESCAPE=HTML>">
+ <input type="hidden" name="report_generator_variable_list" value="<TMPL_VAR EXPORT_VARIABLE_LIST ESCAPE=HTML>">
+
+ <p>
+ <translate>List export</translate><br>
+ <TMPL_IF ALLOW_PDF_EXPORT><input type="submit" class="submit" name="action" value="<translate>Export as PDF</translate>"></TMPL_IF>
+ <TMPL_IF ALLOW_CSV_EXPORT><input type="submit" class="submit" name="action" value="<translate>Export as CSV</translate>"></TMPL_IF>
+ </p>
+ </form>
+ </TMPL_IF>
+
+</body>
--- /dev/null
+<body>
+
+ <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
+
+ <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+
+ <input type="hidden" name="report_generator_pdf_options_set" value="1">
+
+ <table>
+ <tr>
+ <td align="right">Seitenformat</td>
+ <td>
+ <select name="report_generator_pdf_options_paper_size">
+ <option value="A3">A3</option>
+ <option value="A4" selected>A4</option>
+ <option value="letter">Letter</option>
+ <option value="legal">Legal</option>
+ </select>
+ <select name="report_generator_pdf_options_orientation">
+ <option value="portrait">Hochformat</option>
+ <option value="landscape" selected>Querformat</option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right">Schriftgröße</td>
+ <td><input name="report_generator_pdf_options_font_size" size="4" value="10">pt</td>
+ </tr>
+
+ <tr>
+ <td align="right">Seitenränder:</td>
+ </tr>
+
+ <tr>
+ <td align="right">Oben</td>
+ <td><input name="report_generator_pdf_options_margin_top" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right">Links</td>
+ <td><input name="report_generator_pdf_options_margin_left" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right">Unten</td>
+ <td><input name="report_generator_pdf_options_margin_bottom" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right">Rechts</td>
+ <td><input name="report_generator_pdf_options_margin_right" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top">Optionen:</td>
+ <td valign="top">
+ <input type="checkbox" name="report_generator_pdf_options_number" value="1" checked>
+ Seiten nummerieren
+ </td>
+ </tr>
+
+
+ </table>
+
+ <p><input type="submit" name="action" class="submit" value="Als PDF exportieren"></p>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<body>
+
+ <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
+
+ <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
+
+ <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
+ </TMPL_LOOP>
+
+ <input type="hidden" name="report_generator_pdf_options_set" value="1">
+
+ <table>
+ <tr>
+ <td align="right"><translate>Orientation</translate></td>
+ <td>
+ <select name="report_generator_pdf_options_paper_size">
+ <option value="A3">A3</option>
+ <option value="A4" selected>A4</option>
+ <option value="letter">Letter</option>
+ <option value="legal">Legal</option>
+ </select>
+ <select name="report_generator_pdf_options_orientation">
+ <option value="portrait"><translate>Portrait</translate></option>
+ <option value="landscape" selected><translate>Landscape</translate></option>
+ </select>
+ </td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Font size</translate></td>
+ <td><input name="report_generator_pdf_options_font_size" size="4" value="10">pt</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Margins</translate>:</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Top</translate></td>
+ <td><input name="report_generator_pdf_options_margin_top" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Left</translate></td>
+ <td><input name="report_generator_pdf_options_margin_left" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Bottom</translate></td>
+ <td><input name="report_generator_pdf_options_margin_bottom" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right"><translate>Right</translate></td>
+ <td><input name="report_generator_pdf_options_margin_right" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
+ </tr>
+
+ <tr>
+ <td align="right" valign="top"><translate>Options</translate>:</td>
+ <td valign="top">
+ <input type="checkbox" name="report_generator_pdf_options_number" value="1" checked>
+ <translate>Number pages</translate>
+ </td>
+ </tr>
+
+
+ </table>
+
+ <p><input type="submit" name="action" class="submit" value="<translate>Export as PDF</translate>"></p>
+
+ </form>
+</body>
+</html>
--- /dev/null
+<html>
+ <body>
+
+ <div width="100%"><TMPL_VAR TITLE></div>
+
+ <TMPL_IF TOP_INFO_TEXT>
+ <p><TMPL_VAR TOP_INFO_TEXT ESCAPE=HTML></p>
+ </TMPL_IF>
+
+ <p>
+ <table width="100%">
+ <tr>
+ <TMPL_LOOP COLUMN_HEADERS>
+ <th><TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF><TMPL_VAR text ESCAPE=HTML><TMPL_IF link></a></TMPL_IF></th>
+ </TMPL_LOOP>
+ </tr>
+
+ <TMPL_LOOP ROWS>
+ <tr>
+ <TMPL_LOOP COLUMNS><td<TMPL_IF align> align="<TMPL_VAR align>"</TMPL_IF><TMPL_IF valign> valign="<TMPL_VAR valign>"</TMPL_IF>><TMPL_IF data><TMPL_VAR data ESCAPE=HTML></TMPL_IF></td></TMPL_LOOP>
+ </tr>
+ </TMPL_LOOP>
+
+ </table>
+ </p>
+
+ <TMPL_IF BOTTOM_INFO_TEXT>
+ <p><TMPL_VAR BOTTOM_INFO_TEXT ESCAPE=HTML></p>
+ </TMPL_IF>
+
+ </body>
+</html>
--- /dev/null
+<html>
+ <body>
+
+ <div width="100%"><TMPL_VAR TITLE></div>
+
+ <TMPL_IF TOP_INFO_TEXT>
+ <p><TMPL_VAR TOP_INFO_TEXT ESCAPE=HTML></p>
+ </TMPL_IF>
+
+ <p>
+ <table width="100%">
+ <tr>
+ <TMPL_LOOP COLUMN_HEADERS>
+ <th><TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF><TMPL_VAR text ESCAPE=HTML><TMPL_IF link></a></TMPL_IF></th>
+ </TMPL_LOOP>
+ </tr>
+
+ <TMPL_LOOP ROWS>
+ <tr>
+ <TMPL_LOOP COLUMNS><td<TMPL_IF align> align="<TMPL_VAR align>"</TMPL_IF><TMPL_IF valign> valign="<TMPL_VAR valign>"</TMPL_IF>><TMPL_IF data><TMPL_VAR data ESCAPE=HTML></TMPL_IF></td></TMPL_LOOP>
+ </tr>
+ </TMPL_LOOP>
+
+ </table>
+ </p>
+
+ <TMPL_IF BOTTOM_INFO_TEXT>
+ <p><TMPL_VAR BOTTOM_INFO_TEXT ESCAPE=HTML></p>
+ </TMPL_IF>
+
+ </body>
+</html>