Revision 84fc52bd
Von Moritz Bunkus vor mehr als 10 Jahren hinzugefügt
SL/Controller/RequirementSpec.pm | ||
---|---|---|
1 | 1 |
package SL::Controller::RequirementSpec; |
2 | 2 |
|
3 | 3 |
use strict; |
4 |
use utf8; |
|
4 | 5 |
|
5 | 6 |
use parent qw(SL::Controller::Base); |
6 | 7 |
|
... | ... | |
20 | 21 |
use SL::DB::RequirementSpec; |
21 | 22 |
use SL::Helper::Flash; |
22 | 23 |
use SL::Locale::String; |
24 |
use SL::Template::LaTeX; |
|
23 | 25 |
|
24 | 26 |
use Rose::Object::MakeMethods::Generic |
25 | 27 |
( |
... | ... | |
193 | 195 |
$self->js->redirect_to($self->url_for(action => 'show', id => $self->requirement_spec->id))->render($self); |
194 | 196 |
} |
195 | 197 |
|
198 |
sub action_create_pdf { |
|
199 |
my ($self, %params) = @_; |
|
200 |
|
|
201 |
my %result = SL::Template::LaTeX->parse_and_create_pdf('requirement_spec.tex', SELF => $self, rspec => $self->requirement_spec); |
|
202 |
|
|
203 |
$::form->error(t8('Conversion to PDF failed: #1', $result{error})) if $result{error}; |
|
204 |
|
|
205 |
my $attachment_name = $self->requirement_spec->type->description . ' ' . ($self->requirement_spec->working_copy_id || $self->requirement_spec->id); |
|
206 |
$attachment_name .= ' (v' . $self->requirement_spec->version->version_number . ')' if $self->requirement_spec->version; |
|
207 |
$attachment_name .= '.pdf'; |
|
208 |
$attachment_name =~ s/[^\wäöüÄÖÜß \-\+\(\)\[\]\{\}\.,]+/_/g; |
|
209 |
|
|
210 |
$self->send_file($result{file_name}, type => 'application/pdf', name => $attachment_name); |
|
211 |
unlink $result{file_name}; |
|
212 |
} |
|
213 |
|
|
196 | 214 |
# |
197 | 215 |
# filters |
198 | 216 |
# |
Auch abrufbar als: Unified diff
Pflichtenhefte: PDFs zu Arbeitskopie und Versionen erzeugen