From e83604f2c7d6d499d9db8d066cc7f637e6f609de Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 10 Feb 2016 13:55:35 +0100 Subject: [PATCH] Brieffunktion: Verwendung von HTML im Body --- SL/Controller/Letter.pm | 5 +++++ SL/DB/Letter.pm | 6 +++--- SL/DB/LetterDraft.pm | 6 +++--- sql/Pg-upgrade2/use_html_in_letter.pl | 21 +++++++++++++++++++++ templates/webpages/letter/edit.html | 2 +- 5 files changed, 33 insertions(+), 7 deletions(-) create mode 100644 sql/Pg-upgrade2/use_html_in_letter.pl diff --git a/SL/Controller/Letter.pm b/SL/Controller/Letter.pm index 5e07bd0f8..2af59b07d 100644 --- a/SL/Controller/Letter.pm +++ b/SL/Controller/Letter.pm @@ -221,6 +221,9 @@ sub action_print_letter { template => $template_file, variables => $::form, return => 'file_name', + variable_content_types => { + body => 'html', + }, ); my $pdf_file_name; @@ -306,6 +309,8 @@ sub action_delete_drafts { sub _display { my ($self, %params) = @_; + $::request->{layout}->use_javascript("${_}.js") for qw(ckeditor/ckeditor ckeditor/adapters/jquery); + my $letter = $self->letter; $params{title} ||= t8('Edit Letter'); diff --git a/SL/DB/Letter.pm b/SL/DB/Letter.pm index a7deeaeeb..02b54cde8 100644 --- a/SL/DB/Letter.pm +++ b/SL/DB/Letter.pm @@ -1,10 +1,8 @@ -# This file has been auto-generated only because it didn't exist. -# Feel free to modify it at will; it will not be overwritten automatically. - package SL::DB::Letter; use strict; +use SL::DB::Helper::AttrHTML; use SL::DB::MetaSetup::Letter; use SL::DB::Manager::Letter; @@ -19,6 +17,8 @@ __PACKAGE__->meta->add_relationships( __PACKAGE__->meta->initialize; +__PACKAGE__->attr_html('body'); + sub new_from_draft { my ($class, $draft) = @_; diff --git a/SL/DB/LetterDraft.pm b/SL/DB/LetterDraft.pm index 109010e8f..089755bc8 100644 --- a/SL/DB/LetterDraft.pm +++ b/SL/DB/LetterDraft.pm @@ -1,14 +1,14 @@ -# This file has been auto-generated only because it didn't exist. -# Feel free to modify it at will; it will not be overwritten automatically. - package SL::DB::LetterDraft; use strict; +use SL::DB::Helper::AttrHTML; use SL::DB::MetaSetup::LetterDraft; __PACKAGE__->meta->initialize; +__PACKAGE__->attr_html('body'); + # Creates get_all, get_all_count, get_all_iterator, delete_all and update_all. __PACKAGE__->meta->make_manager_class; diff --git a/sql/Pg-upgrade2/use_html_in_letter.pl b/sql/Pg-upgrade2/use_html_in_letter.pl new file mode 100644 index 000000000..7f42cc02e --- /dev/null +++ b/sql/Pg-upgrade2/use_html_in_letter.pl @@ -0,0 +1,21 @@ +# @tag: use_html_in_letter +# @description: Briefe: HTML für Body nutzen können +# @depends: letter letter_draft +package SL::DBUpgrade2::use_html_in_letter; + +use strict; +use utf8; + +use SL::DBUtils; + +use parent qw(SL::DBUpgrade2::Base); + +sub run { + my ($self) = @_; + + $self->convert_column_to_html($_, 'body') for qw(letter letter_draft); + + return 1; +} + +1; diff --git a/templates/webpages/letter/edit.html b/templates/webpages/letter/edit.html index 1e84de808..a43f310af 100644 --- a/templates/webpages/letter/edit.html +++ b/templates/webpages/letter/edit.html @@ -69,7 +69,7 @@ [% 'Body' | $T8 %] - + [% L.textarea_tag('letter.body_as_restricted_html', letter.body_as_restricted_html, style='width:100%', rows=20, class="texteditor") %] [% 'Internal Notes' | $T8 %] -- 2.20.1