Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 15b4d5a3

Von Moritz Bunkus vor mehr als 17 Jahren hinzugefügt

  • ID 15b4d5a3fdf1a6aafbd696f107a6dd7995edbc8c
  • Vorgänger 35648bc6
  • Nachfolger afe6d1f6

Berichtsklasse:
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.

Unterschiede anzeigen:

SL/ReportGenerator.pm
181 181
    print $self->generate_html_content();
182 182

  
183 183
  } elsif ($format eq 'csv') {
184
    print qq|content-type: text/plain\n\n|;
185
#     print qq|content-disposition: attachment; filename=${filename}.csv\n\n|;
184
    print qq|content-type: text/csv\n|;
185
    print qq|content-disposition: attachment; filename=${filename}.csv\n\n|;
186 186
    $self->generate_csv_content();
187 187

  
188 188
  } elsif ($format eq 'pdf') {
......
202 202
  return grep { my $c = $self->{columns}->{$_}; $c && $c->{visible} && (($c->{visible} == 1) || ($c->{visible} =~ /${format}/i)) } @{ $self->{column_order} };
203 203
}
204 204

  
205
sub html_format {
206
  my $self  = shift;
207
  my $value = shift;
208

  
209
  $value =  $self->{form}->quote_html($value);
210
  $value =~ s/\r//g;
211
  $value =~ s/\n/<br>/g;
212

  
213
  return $value;
214
}
215

  
205 216
sub prepare_html_content {
206 217
  my $self = shift;
207 218

  
......
233 244
    foreach my $row (@{ $row_set }) {
234 245
      $inner_idx++;
235 246

  
247
      map { $row->{$_}->{data} = $self->html_format($row->{$_}->{data}) } @visible_columns;
248

  
236 249
      my $row_data = {
237 250
        'COLUMNS'       => [ map { $row->{$_} } @visible_columns ],
238 251
        'outer_idx'     => $outer_idx,
......
253 266

  
254 267
  my $variables = {
255 268
    'TITLE'                => $opts->{title},
256
    'TOP_INFO_TEXT'        => $opts->{top_info_text},
269
    'TOP_INFO_TEXT'        => $self->html_format($opts->{top_info_text}),
257 270
    'RAW_TOP_INFO_TEXT'    => $opts->{raw_top_info_text},
258
    'BOTTOM_INFO_TEXT'     => $opts->{bottom_info_text},
271
    'BOTTOM_INFO_TEXT'     => $self->html_format($opts->{bottom_info_text}),
259 272
    'RAW_BOTTOM_INFO_TEXT' => $opts->{raw_bottom_info_text},
260 273
    'ALLOW_PDF_EXPORT'     => $allow_pdf_export,
261 274
    'ALLOW_CSV_EXPORT'     => $opts->{allow_csv_export},
templates/webpages/report_generator/csv_export_options_de.html
1
<body>
2

  
3
 <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
4

  
5
 <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
6

  
7
  <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
8
  </TMPL_LOOP>
9

  
10
  <input type="hidden" name="report_generator_csv_options_set" value="1">
11

  
12
  <table>
13
   <tr>
14
    <td align="right">Anf&uuml;hrungszeichen</td>
15
    <td>
16
     <select name="report_generator_csv_options_quote_char" style="width: 300px">
17
      <option value="&quot;" selected>&quot;</option>
18
      <option value="'">'</option>
19
     </select>
20
    </td>
21
   </tr>
22

  
23
   <tr>
24
    <td align="right">Escape-Zeichen</td>
25
    <td>
26
     <select name="report_generator_csv_options_escape_char" style="width: 300px">
27
      <option value="QUOTE_CHAR" selected>Wie Anf&uuml;hrungszeichen</option>
28
      <option value="&quot;">&quot;</option>
29
      <option value="'">'</option>
30
     </select>
31
    </td>
32
   </tr>
33

  
34
   <tr>
35
    <td align="right">Feldtrennzeichen</td>
36
    <td>
37
     <select name="report_generator_csv_options_sep_char" style="width: 300px">
38
      <option value=";" selected>;</option>
39
      <option value=",">,</option>
40
      <option value=":">:</option>
41
      <option value="TAB">TAB (Das Tabulator-Symbol)</option>
42
     </select>
43
    </td>
44
   </tr>
45

  
46
   <tr>
47
    <td align="right">Zeilenumbr&uuml;che</td>
48
    <td>
49
     <select name="report_generator_csv_options_eol_style" style="width: 300px">
50
      <option value="DOS" selected>DOS/Windows (CR/LF)</option>
51
      <option value="Unix">Unix (LF)</option>
52
     </select>
53
    </td>
54
   </tr>
55

  
56
   <tr>
57
    <td align="right" valign="top">Optionen:</td>
58
    <td valign="top">
59
     <input type="checkbox" name="report_generator_csv_options_headers" value="1" checked>
60
     Spalten&uuml;berschriften erzeugen
61
    </td>
62
   </tr>
63

  
64
  </table>
65

  
66
  <p><input type="submit" name="action" class="submit" value="Als CSV exportieren"></p>
67

  
68
 </form>
69
</body>
70
</html>
templates/webpages/report_generator/csv_export_options_master.html
1
<body>
2

  
3
 <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
4

  
5
 <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
6

  
7
  <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
8
  </TMPL_LOOP>
9

  
10
  <input type="hidden" name="report_generator_csv_options_set" value="1">
11

  
12
  <table>
13
   <tr>
14
    <td align="right"><translate>Quote chararacter</translate></td>
15
    <td>
16
     <select name="report_generator_csv_options_quote_char" style="width: 300px">
17
      <option value="&quot;" selected>&quot;</option>
18
      <option value="'">'</option>
19
     </select>
20
    </td>
21
   </tr>
22

  
23
   <tr>
24
    <td align="right"><translate>Escape character</translate></td>
25
    <td>
26
     <select name="report_generator_csv_options_escape_char" style="width: 300px">
27
      <option value="QUOTE_CHAR" selected><translate>Same as the quote character</translate></option>
28
      <option value="&quot;">&quot;</option>
29
      <option value="'">'</option>
30
     </select>
31
    </td>
32
   </tr>
33

  
34
   <tr>
35
    <td align="right"><translate>Separator chararacter</translate></td>
36
    <td>
37
     <select name="report_generator_csv_options_sep_char" style="width: 300px">
38
      <option value=";" selected>;</option>
39
      <option value=",">,</option>
40
      <option value=":">:</option>
41
      <option value="TAB">TAB (<translate>The tabulator character</translate>)</option>
42
     </select>
43
    </td>
44
   </tr>
45

  
46
   <tr>
47
    <td align="right"><translate>Line endings</translate></td>
48
    <td>
49
     <select name="report_generator_csv_options_eol_style" style="width: 300px">
50
      <option value="DOS" selected>DOS/Windows (CR/LF)</option>
51
      <option value="Unix">Unix (LF)</option>
52
     </select>
53
    </td>
54
   </tr>
55

  
56
   <tr>
57
    <td align="right" valign="top"><translate>Options</translate>:</td>
58
    <td valign="top">
59
     <input type="checkbox" name="report_generator_csv_options_headers" value="1" checked>
60
     <translate>Include column headings</translate>
61
    </td>
62
   </tr>
63

  
64
  </table>
65

  
66
  <p><input type="submit" name="action" class="submit" value="<translate>Export as CSV</translate>"></p>
67

  
68
 </form>
69
</body>
70
</html>
templates/webpages/report_generator/html_report_de.html
1
<body>
2

  
3
 <div class="listtop" width="100%"><TMPL_VAR TITLE></div>
4

  
5
 <TMPL_IF TOP_INFO_TEXT>
6
  <p><TMPL_VAR TOP_INFO_TEXT></p>
7
 </TMPL_IF>
8

  
9
 <TMPL_VAR RAW_TOP_INFO_TEXT>
10

  
11
 <p>
12
  <table width="100%">
13
   <tr>
14
    <TMPL_LOOP COLUMN_HEADERS>
15
     <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>
16
    </TMPL_LOOP>
17
   </tr>
18

  
19
   <TMPL_LOOP ROWS>
20
    <tr class="listrow<TMPL_VAR outer_idx_odd>">
21
     <TMPL_LOOP COLUMNS>
22
      <td<TMPL_IF align> align="<TMPL_VAR align>"</TMPL_IF><TMPL_IF valign> valign="<TMPL_VAR valign>"</TMPL_IF>>
23
       <TMPL_IF raw_data><TMPL_VAR raw_data></TMPL_IF>
24
       <TMPL_IF data>
25
        <TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF>
26
        <TMPL_VAR data><TMPL_IF link></a></TMPL_IF>
27
       </TMPL_IF>
28
      </td>
29
     </TMPL_LOOP>
30
    </tr>
31
   </TMPL_LOOP>
32

  
33
   <tr><td colspan="<TMPL_VAR NUM_COLUMNS>"><hr size="3" noshade></td></tr>
34

  
35
  </table>
36
 </p>
37

  
38
 <TMPL_VAR RAW_BOTTOM_INFO_TEXT>
39

  
40
 <TMPL_IF BOTTOM_INFO_TEXT>
41
  <p><TMPL_VAR BOTTOM_INFO_TEXT></p>
42
 </TMPL_IF>
43

  
44
 <TMPL_IF SHOW_EXPORT_BUTTONS>
45
  <form action="<TMPL_VAR script ESCAPE=HTML>" name="generate_report_form" method="post">
46
   <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
47
   <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
48

  
49
   <TMPL_LOOP EXPORT_VARIABLES><input type="hidden" name="report_generator_hidden_<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
50
   </TMPL_LOOP>
51

  
52
   <input type="hidden" name="report_generator_nextsub" value="<TMPL_VAR EXPORT_NEXTSUB ESCAPE=HTML>">
53
   <input type="hidden" name="report_generator_variable_list" value="<TMPL_VAR EXPORT_VARIABLE_LIST ESCAPE=HTML>">
54

  
55
   <p>
56
    Listenexport<br>
57
    <TMPL_IF ALLOW_PDF_EXPORT><input type="submit" class="submit" name="action" value="Als PDF exportieren"></TMPL_IF>
58
    <TMPL_IF ALLOW_CSV_EXPORT><input type="submit" class="submit" name="action" value="Als CSV exportieren"></TMPL_IF>
59
   </p>
60
  </form>
61
 </TMPL_IF>
62

  
63
</body>
templates/webpages/report_generator/html_report_master.html
1
<body>
2

  
3
 <div class="listtop" width="100%"><TMPL_VAR TITLE></div>
4

  
5
 <TMPL_IF TOP_INFO_TEXT>
6
  <p><TMPL_VAR TOP_INFO_TEXT></p>
7
 </TMPL_IF>
8

  
9
 <TMPL_VAR RAW_TOP_INFO_TEXT>
10

  
11
 <p>
12
  <table width="100%">
13
   <tr>
14
    <TMPL_LOOP COLUMN_HEADERS>
15
     <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>
16
    </TMPL_LOOP>
17
   </tr>
18

  
19
   <TMPL_LOOP ROWS>
20
    <tr class="listrow<TMPL_VAR outer_idx_odd>">
21
     <TMPL_LOOP COLUMNS>
22
      <td<TMPL_IF align> align="<TMPL_VAR align>"</TMPL_IF><TMPL_IF valign> valign="<TMPL_VAR valign>"</TMPL_IF>>
23
       <TMPL_IF raw_data><TMPL_VAR raw_data></TMPL_IF>
24
       <TMPL_IF data>
25
        <TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF>
26
        <TMPL_VAR data><TMPL_IF link></a></TMPL_IF>
27
       </TMPL_IF>
28
      </td>
29
     </TMPL_LOOP>
30
    </tr>
31
   </TMPL_LOOP>
32

  
33
   <tr><td colspan="<TMPL_VAR NUM_COLUMNS>"><hr size="3" noshade></td></tr>
34

  
35
  </table>
36
 </p>
37

  
38
 <TMPL_VAR RAW_BOTTOM_INFO_TEXT>
39

  
40
 <TMPL_IF BOTTOM_INFO_TEXT>
41
  <p><TMPL_VAR BOTTOM_INFO_TEXT></p>
42
 </TMPL_IF>
43

  
44
 <TMPL_IF SHOW_EXPORT_BUTTONS>
45
  <form action="<TMPL_VAR script ESCAPE=HTML>" name="generate_report_form" method="post">
46
   <input type="hidden" name="login" value="<TMPL_VAR login ESCAPE=HTML>">
47
   <input type="hidden" name="password" value="<TMPL_VAR password ESCAPE=HTML>">
48

  
49
   <TMPL_LOOP EXPORT_VARIABLES><input type="hidden" name="report_generator_hidden_<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
50
   </TMPL_LOOP>
51

  
52
   <input type="hidden" name="report_generator_nextsub" value="<TMPL_VAR EXPORT_NEXTSUB ESCAPE=HTML>">
53
   <input type="hidden" name="report_generator_variable_list" value="<TMPL_VAR EXPORT_VARIABLE_LIST ESCAPE=HTML>">
54

  
55
   <p>
56
    <translate>List export</translate><br>
57
    <TMPL_IF ALLOW_PDF_EXPORT><input type="submit" class="submit" name="action" value="<translate>Export as PDF</translate>"></TMPL_IF>
58
    <TMPL_IF ALLOW_CSV_EXPORT><input type="submit" class="submit" name="action" value="<translate>Export as CSV</translate>"></TMPL_IF>
59
   </p>
60
  </form>
61
 </TMPL_IF>
62

  
63
</body>
templates/webpages/report_generator/pdf_export_options_de.html
1
<body>
2

  
3
 <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
4

  
5
 <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
6

  
7
  <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
8
  </TMPL_LOOP>
9

  
10
  <input type="hidden" name="report_generator_pdf_options_set" value="1">
11

  
12
  <table>
13
   <tr>
14
    <td align="right">Seitenformat</td>
15
    <td>
16
     <select name="report_generator_pdf_options_paper_size">
17
      <option value="A3">A3</option>
18
      <option value="A4" selected>A4</option>
19
      <option value="letter">Letter</option>
20
      <option value="legal">Legal</option>
21
     </select>
22
     <select name="report_generator_pdf_options_orientation">
23
      <option value="portrait">Hochformat</option>
24
      <option value="landscape" selected>Querformat</option>
25
     </select>
26
    </td>
27
   </tr>
28

  
29
   <tr>
30
    <td align="right">Schriftgr&ouml;&szlig;e</td>
31
    <td><input name="report_generator_pdf_options_font_size" size="4" value="10">pt</td>
32
   </tr>
33

  
34
   <tr>
35
    <td align="right">Seitenr&auml;nder:</td>
36
   </tr>
37

  
38
   <tr>
39
    <td align="right">Oben</td>
40
    <td><input name="report_generator_pdf_options_margin_top" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
41
   </tr>
42

  
43
   <tr>
44
    <td align="right">Links</td>
45
    <td><input name="report_generator_pdf_options_margin_left" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
46
   </tr>
47

  
48
   <tr>
49
    <td align="right">Unten</td>
50
    <td><input name="report_generator_pdf_options_margin_bottom" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
51
   </tr>
52

  
53
   <tr>
54
    <td align="right">Rechts</td>
55
    <td><input name="report_generator_pdf_options_margin_right" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
56
   </tr>
57

  
58
   <tr>
59
    <td align="right" valign="top">Optionen:</td>
60
    <td valign="top">
61
     <input type="checkbox" name="report_generator_pdf_options_number" value="1" checked>
62
     Seiten nummerieren
63
    </td>
64
   </tr>
65

  
66

  
67
  </table>
68

  
69
  <p><input type="submit" name="action" class="submit" value="Als PDF exportieren"></p>
70

  
71
 </form>
72
</body>
73
</html>
templates/webpages/report_generator/pdf_export_options_master.html
1
<body>
2

  
3
 <div class="listheading" width="100%"><TMPL_VAR title ESCAPE=HTML></div>
4

  
5
 <form action="<TMPL_VAR script ESCAPE=HTML>" method="post">
6

  
7
  <TMPL_LOOP HIDDEN><input type="hidden" name="<TMPL_VAR key ESCAPE=HTML>" value="<TMPL_VAR value ESCAPE=HTML>">
8
  </TMPL_LOOP>
9

  
10
  <input type="hidden" name="report_generator_pdf_options_set" value="1">
11

  
12
  <table>
13
   <tr>
14
    <td align="right"><translate>Orientation</translate></td>
15
    <td>
16
     <select name="report_generator_pdf_options_paper_size">
17
      <option value="A3">A3</option>
18
      <option value="A4" selected>A4</option>
19
      <option value="letter">Letter</option>
20
      <option value="legal">Legal</option>
21
     </select>
22
     <select name="report_generator_pdf_options_orientation">
23
      <option value="portrait"><translate>Portrait</translate></option>
24
      <option value="landscape" selected><translate>Landscape</translate></option>
25
     </select>
26
    </td>
27
   </tr>
28

  
29
   <tr>
30
    <td align="right"><translate>Font size</translate></td>
31
    <td><input name="report_generator_pdf_options_font_size" size="4" value="10">pt</td>
32
   </tr>
33

  
34
   <tr>
35
    <td align="right"><translate>Margins</translate>:</td>
36
   </tr>
37

  
38
   <tr>
39
    <td align="right"><translate>Top</translate></td>
40
    <td><input name="report_generator_pdf_options_margin_top" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
41
   </tr>
42

  
43
   <tr>
44
    <td align="right"><translate>Left</translate></td>
45
    <td><input name="report_generator_pdf_options_margin_left" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
46
   </tr>
47

  
48
   <tr>
49
    <td align="right"><translate>Bottom</translate></td>
50
    <td><input name="report_generator_pdf_options_margin_bottom" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
51
   </tr>
52

  
53
   <tr>
54
    <td align="right"><translate>Right</translate></td>
55
    <td><input name="report_generator_pdf_options_margin_right" size="4" value="<TMPL_VAR default_margin ESCAPE=HTML>">cm</td>
56
   </tr>
57

  
58
   <tr>
59
    <td align="right" valign="top"><translate>Options</translate>:</td>
60
    <td valign="top">
61
     <input type="checkbox" name="report_generator_pdf_options_number" value="1" checked>
62
     <translate>Number pages</translate>
63
    </td>
64
   </tr>
65

  
66

  
67
  </table>
68

  
69
  <p><input type="submit" name="action" class="submit" value="<translate>Export as PDF</translate>"></p>
70

  
71
 </form>
72
</body>
73
</html>
templates/webpages/report_generator/pdf_report_de.html
1
<html>
2
 <body>
3

  
4
  <div width="100%"><TMPL_VAR TITLE></div>
5

  
6
  <TMPL_IF TOP_INFO_TEXT>
7
   <p><TMPL_VAR TOP_INFO_TEXT ESCAPE=HTML></p>
8
  </TMPL_IF>
9

  
10
  <p>
11
   <table width="100%">
12
    <tr>
13
     <TMPL_LOOP COLUMN_HEADERS>
14
      <th><TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF><TMPL_VAR text ESCAPE=HTML><TMPL_IF link></a></TMPL_IF></th>
15
     </TMPL_LOOP>
16
    </tr>
17

  
18
    <TMPL_LOOP ROWS>
19
     <tr>
20
      <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>
21
     </tr>
22
    </TMPL_LOOP>
23

  
24
   </table>
25
  </p>
26

  
27
  <TMPL_IF BOTTOM_INFO_TEXT>
28
   <p><TMPL_VAR BOTTOM_INFO_TEXT ESCAPE=HTML></p>
29
  </TMPL_IF>
30

  
31
 </body>
32
</html>
templates/webpages/report_generator/pdf_report_master.html
1
<html>
2
 <body>
3

  
4
  <div width="100%"><TMPL_VAR TITLE></div>
5

  
6
  <TMPL_IF TOP_INFO_TEXT>
7
   <p><TMPL_VAR TOP_INFO_TEXT ESCAPE=HTML></p>
8
  </TMPL_IF>
9

  
10
  <p>
11
   <table width="100%">
12
    <tr>
13
     <TMPL_LOOP COLUMN_HEADERS>
14
      <th><TMPL_IF link><a href="<TMPL_VAR link>"></TMPL_IF><TMPL_VAR text ESCAPE=HTML><TMPL_IF link></a></TMPL_IF></th>
15
     </TMPL_LOOP>
16
    </tr>
17

  
18
    <TMPL_LOOP ROWS>
19
     <tr>
20
      <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>
21
     </tr>
22
    </TMPL_LOOP>
23

  
24
   </table>
25
  </p>
26

  
27
  <TMPL_IF BOTTOM_INFO_TEXT>
28
   <p><TMPL_VAR BOTTOM_INFO_TEXT ESCAPE=HTML></p>
29
  </TMPL_IF>
30

  
31
 </body>
32
</html>

Auch abrufbar als: Unified diff