Revision 8635c0d6
Von Tamino Steinert vor 11 Monaten hinzugefügt
SL/Controller/EmailJournal.pm | ||
---|---|---|
11 | 11 |
use SL::Helper::Flash; |
12 | 12 |
use SL::Locale::String; |
13 | 13 |
use SL::System::TaskServer; |
14 |
use SL::Presenter::EmailJournal; |
|
14 | 15 |
|
15 | 16 |
use Rose::Object::MakeMethods::Generic |
16 | 17 |
( |
... | ... | |
19 | 20 |
); |
20 | 21 |
|
21 | 22 |
__PACKAGE__->run_before('add_stylesheet'); |
23 |
__PACKAGE__->run_before('add_js'); |
|
22 | 24 |
|
23 | 25 |
# |
24 | 26 |
# actions |
... | ... | |
76 | 78 |
$self->send_file($ref, name => $attachment->name, type => $attachment->mime_type); |
77 | 79 |
} |
78 | 80 |
|
81 |
sub action_update_attachment_preview { |
|
82 |
my ($self) = @_; |
|
83 |
$::auth->assert('email_journal'); |
|
84 |
my $attachment_id = $::form->{attachment_id}; |
|
85 |
|
|
86 |
my $attachment; |
|
87 |
$attachment = SL::DB::EmailJournalAttachment->new( |
|
88 |
id => $attachment_id, |
|
89 |
)->load if $attachment_id; |
|
90 |
|
|
91 |
$self->js |
|
92 |
->replaceWith('#attachment_preview', |
|
93 |
SL::Presenter::EmailJournal::attachment_preview( |
|
94 |
$attachment, |
|
95 |
style => "width:489px;border:1px solid black;margin:9px" |
|
96 |
) |
|
97 |
) |
|
98 |
->render(); |
|
99 |
} |
|
100 |
|
|
79 | 101 |
# |
80 | 102 |
# filters |
81 | 103 |
# |
... | ... | |
88 | 110 |
# helpers |
89 | 111 |
# |
90 | 112 |
|
113 |
sub add_js { |
|
114 |
$::request->{layout}->use_javascript("${_}.js") for qw( |
|
115 |
kivi.EmailJournal |
|
116 |
); |
|
117 |
} |
|
118 |
|
|
91 | 119 |
sub init_can_view_all { $::auth->assert('email_employee_readall', 1) } |
92 | 120 |
|
93 | 121 |
sub init_models { |
SL/Presenter/EmailJournal.pm | ||
---|---|---|
47 | 47 |
sub attachment_preview { |
48 | 48 |
my ($attachment, %params) = @_; |
49 | 49 |
|
50 |
if (! $attachment) { |
|
51 |
return is_escaped(html_tag('div', '', id => 'attachment_preview')); |
|
52 |
} |
|
53 |
|
|
50 | 54 |
# clean up mime_type |
51 | 55 |
my $mime_type = $attachment->mime_type; |
52 | 56 |
$mime_type =~ s/;.*//; |
js/kivi.EmailJournal.js | ||
---|---|---|
1 |
namespace('kivi.EmailJournal', function(ns) { |
|
2 |
'use strict'; |
|
3 |
|
|
4 |
ns.update_attachment_preview = function() { |
|
5 |
let $form = $('#attachment_form'); |
|
6 |
if ($form == undefined) { return; } |
|
7 |
|
|
8 |
let data = $form.serializeArray(); |
|
9 |
data.push({ name: 'action', value: 'EmailJournal/update_attachment_preview' }); |
|
10 |
|
|
11 |
$.post("controller.pl", data, kivi.eval_json_result); |
|
12 |
} |
|
13 |
}); |
locale/de/all | ||
---|---|---|
866 | 866 |
'Create Invoice' => 'Rechnung erstellen', |
867 | 867 |
'Create PDF' => 'PDF erzeugen', |
868 | 868 |
'Create Reclamation' => 'Reklamation erstellen', |
869 |
'Create Record with Attachment' => 'Erzeuge Beleg mit Anhang', |
|
869 | 870 |
'Create Sub-Version' => 'Unterversion erzeugen', |
870 | 871 |
'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen', |
871 | 872 |
'Create a new client' => 'Einen neuen Mandanten anlegen', |
... | ... | |
2454 | 2455 |
'No article has been selected yet.' => 'Es wurde noch kein Artikel ausgewählt.', |
2455 | 2456 |
'No articles have been added yet.' => 'Es wurden noch keine Artikel hinzugefügt.', |
2456 | 2457 |
'No assembly has been selected yet.' => 'Es wurde noch kein Erzeugnis ausgewahlt.', |
2458 |
'No attachment' => 'Kein Anhang', |
|
2457 | 2459 |
'No background job has been created yet.' => 'Es wurden noch keine Hintergrund-Jobs angelegt.', |
2458 | 2460 |
'No bank account chosen!' => 'Kein Bankkonto ausgewählt!', |
2459 | 2461 |
'No bank account configured for bank code/BIC #1, account number/IBAN #2.' => 'Kein Bankkonto für BLZ/BIC #1, Kontonummer/IBAN #2 konfiguriert.', |
locale/en/all | ||
---|---|---|
866 | 866 |
'Create Invoice' => '', |
867 | 867 |
'Create PDF' => '', |
868 | 868 |
'Create Reclamation' => '', |
869 |
'Create Record with Attachment' => '', |
|
869 | 870 |
'Create Sub-Version' => '', |
870 | 871 |
'Create a new background job' => '', |
871 | 872 |
'Create a new client' => '', |
... | ... | |
2454 | 2455 |
'No article has been selected yet.' => '', |
2455 | 2456 |
'No articles have been added yet.' => '', |
2456 | 2457 |
'No assembly has been selected yet.' => '', |
2458 |
'No attachment' => '', |
|
2457 | 2459 |
'No background job has been created yet.' => '', |
2458 | 2460 |
'No bank account chosen!' => '', |
2459 | 2461 |
'No bank account configured for bank code/BIC #1, account number/IBAN #2.' => '', |
templates/design40_webpages/email_journal/show.html | ||
---|---|---|
7 | 7 |
|
8 | 8 |
[% INCLUDE 'common/flash.html' %] |
9 | 9 |
|
10 |
<div class="wrapper" id="wrapper-1"> |
|
10 |
<div class="wrapper" id="wrapper-0"> |
|
11 |
|
|
12 |
<div class="input-panel" style="vertical-align:top;" id="wrapper-1"> |
|
11 | 13 |
|
12 | 14 |
<table id="email_journal_details" class="tbl-horizontal"> |
13 | 15 |
<tbody> |
... | ... | |
60 | 62 |
|
61 | 63 |
</div> <!-- wrapper-1 --> |
62 | 64 |
|
63 |
<div class="wrapper" id="wrapper-2"> |
|
64 | 65 |
[% SET attachments = SELF.entry.attachments_sorted %] |
65 |
[% IF attachments.size %] |
|
66 | 66 |
|
67 |
<div class="input-panel" style="vertical-align:top;" id="wrapper-2"> |
|
68 |
|
|
69 |
[% IF attachments.size %] |
|
67 | 70 |
<table id="email_journal_details" class="tbl-list"> |
68 | 71 |
<caption>[% LxERP.t8("Attachments") %]</caption> |
69 | 72 |
<thead> |
... | ... | |
83 | 86 |
[% END %] |
84 | 87 |
</tbody> |
85 | 88 |
</table> |
89 |
[% END %] |
|
86 | 90 |
|
87 |
[% ELSE %] |
|
91 |
<form method="post" action="controller.pl" id="attachment_form"> |
|
92 |
[% L.hidden_tag('id', SELF.entry.id) %] |
|
93 |
[% L.select_tag('attachment_id', |
|
94 |
attachments, value_key='id', title_key='name', |
|
95 |
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"), |
|
96 |
'data-title'=LxERP.t8("Attachment"), class="wi-normal", |
|
97 |
onchange='kivi.EmailJournal.update_attachment_preview();' |
|
98 |
) |
|
99 |
%] |
|
100 |
[% L.select_tag('record_type', [ ["value", "Name"] ], class="wi-normal") %] |
|
88 | 101 |
|
89 |
<p>[% LxERP.t8("No attachments") %]</p> |
|
102 |
[% L.button_tag('kivi.EmailJournal.create_record();', LxERP.t8('Create Record with Attachment')) %] |
|
103 |
</form> |
|
104 |
|
|
105 |
<!-- <div id="attachment_preview"> --> |
|
106 |
[% P.email_journal.attachment_preview(attachments.0, |
|
107 |
style="width:489px;border:1px solid black;margin:9px") %] |
|
90 | 108 |
|
91 |
[% END %] |
|
92 | 109 |
</div> <!-- wrapper-2 --> |
110 |
|
|
111 |
</div> <!-- wrapper-0 --> |
templates/webpages/email_journal/show.html | ||
---|---|---|
29 | 29 |
<tr class="listrow"> |
30 | 30 |
<th>[%- LxERP.t8("Status") %]</th> |
31 | 31 |
<td> |
32 |
[% IF SELF.entry.status == 'sent' %] |
|
33 |
[% LxERP.t8('sent') %] |
|
34 |
[% ELSIF SELF.entry.status == 'send_failed' %] |
|
35 |
[% LxERP.t8('send failed') %] |
|
36 |
[% ELSIF SELF.entry.status == 'imported' %] |
|
37 |
[% LxERP.t8('imported') %] |
|
38 |
[% ELSE %] |
|
39 |
[% SELF.entry.status %] |
|
40 |
[% END %] |
|
32 |
[% P.email_journal.entry_status(SELF.entry) %] |
|
41 | 33 |
</td> |
42 | 34 |
</tr> |
43 | 35 |
|
... | ... | |
64 | 56 |
</table> |
65 | 57 |
|
66 | 58 |
[% SET attachments = SELF.entry.attachments_sorted %] |
67 |
[% IF attachments.size %] |
|
68 | 59 |
<h2>[% LxERP.t8("Attachments") %]</h2> |
60 |
[% IF attachments.size %] |
|
69 | 61 |
|
70 | 62 |
<table id="email_journal_details" class="email_journal_details"> |
71 | 63 |
<thead> |
... | ... | |
87 | 79 |
</tbody> |
88 | 80 |
</table> |
89 | 81 |
[% END %] |
82 |
<div> |
|
83 |
<form method="post" action="controller.pl" id="attachment_form"> |
|
84 |
[% L.hidden_tag('id', SELF.entry.id) %] |
|
85 |
[% L.select_tag('attachment_id', |
|
86 |
attachments, value_key='id', title_key='name', |
|
87 |
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"), |
|
88 |
'data-title'=LxERP.t8("Attachment"), class="wi-normal", |
|
89 |
onchange='kivi.EmailJournal.update_attachment_preview();' |
|
90 |
) |
|
91 |
%] |
|
92 |
[% L.select_tag('record_type', [ ["value", "Name"] ], class="wi-normal") %] |
|
93 |
|
|
94 |
[% L.button_tag('kivi.EmailJournal.create_record();', LxERP.t8('Create Record with Attachment')) %] |
|
95 |
</form> |
|
96 |
|
|
97 |
<!-- <div id="attachment_preview"> --> |
|
98 |
[% P.email_journal.attachment_preview(attachments.0, |
|
99 |
style="width:489px;border:1px solid black;margin:9px") %] |
|
100 |
</div> |
Auch abrufbar als: Unified diff
EmailJournal: Zeige Vorschau von Anhängen an