Revision 06118149
Von Tamino Steinert vor etwa 1 Jahr hinzugefügt
SL/Controller/EmailJournal.pm | ||
---|---|---|
use SL::Helper::Flash;
|
||
use SL::Locale::String;
|
||
use SL::System::TaskServer;
|
||
use SL::Presenter::EmailJournal;
|
||
|
||
use Rose::Object::MakeMethods::Generic
|
||
(
|
||
... | ... | |
);
|
||
|
||
__PACKAGE__->run_before('add_stylesheet');
|
||
__PACKAGE__->run_before('add_js');
|
||
|
||
#
|
||
# actions
|
||
... | ... | |
$self->send_file($ref, name => $attachment->name, type => $attachment->mime_type);
|
||
}
|
||
|
||
sub action_update_attachment_preview {
|
||
my ($self) = @_;
|
||
$::auth->assert('email_journal');
|
||
my $attachment_id = $::form->{attachment_id};
|
||
|
||
my $attachment;
|
||
$attachment = SL::DB::EmailJournalAttachment->new(
|
||
id => $attachment_id,
|
||
)->load if $attachment_id;
|
||
|
||
$self->js
|
||
->replaceWith('#attachment_preview',
|
||
SL::Presenter::EmailJournal::attachment_preview(
|
||
$attachment,
|
||
style => "width:489px;border:1px solid black;margin:9px"
|
||
)
|
||
)
|
||
->render();
|
||
}
|
||
|
||
#
|
||
# filters
|
||
#
|
||
... | ... | |
# helpers
|
||
#
|
||
|
||
sub add_js {
|
||
$::request->{layout}->use_javascript("${_}.js") for qw(
|
||
kivi.EmailJournal
|
||
);
|
||
}
|
||
|
||
sub init_can_view_all { $::auth->assert('email_employee_readall', 1) }
|
||
|
||
sub init_models {
|
SL/Presenter/EmailJournal.pm | ||
---|---|---|
sub attachment_preview {
|
||
my ($attachment, %params) = @_;
|
||
|
||
if (! $attachment) {
|
||
return is_escaped(html_tag('div', '', id => 'attachment_preview'));
|
||
}
|
||
|
||
# clean up mime_type
|
||
my $mime_type = $attachment->mime_type;
|
||
$mime_type =~ s/;.*//;
|
js/kivi.EmailJournal.js | ||
---|---|---|
namespace('kivi.EmailJournal', function(ns) {
|
||
'use strict';
|
||
|
||
ns.update_attachment_preview = function() {
|
||
let $form = $('#attachment_form');
|
||
if ($form == undefined) { return; }
|
||
|
||
let data = $form.serializeArray();
|
||
data.push({ name: 'action', value: 'EmailJournal/update_attachment_preview' });
|
||
|
||
$.post("controller.pl", data, kivi.eval_json_result);
|
||
}
|
||
});
|
locale/de/all | ||
---|---|---|
'Create Invoice' => 'Rechnung erstellen',
|
||
'Create PDF' => 'PDF erzeugen',
|
||
'Create Reclamation' => 'Reklamation erstellen',
|
||
'Create Record with Attachment' => 'Erzeuge Beleg mit Anhang',
|
||
'Create Sub-Version' => 'Unterversion erzeugen',
|
||
'Create a new background job' => 'Einen neuen Hintergrund-Job anlegen',
|
||
'Create a new client' => 'Einen neuen Mandanten anlegen',
|
||
... | ... | |
'No article has been selected yet.' => 'Es wurde noch kein Artikel ausgewählt.',
|
||
'No articles have been added yet.' => 'Es wurden noch keine Artikel hinzugefügt.',
|
||
'No assembly has been selected yet.' => 'Es wurde noch kein Erzeugnis ausgewahlt.',
|
||
'No attachment' => 'Kein Anhang',
|
||
'No background job has been created yet.' => 'Es wurden noch keine Hintergrund-Jobs angelegt.',
|
||
'No bank account chosen!' => 'Kein Bankkonto ausgewählt!',
|
||
'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 | ||
---|---|---|
'Create Invoice' => '',
|
||
'Create PDF' => '',
|
||
'Create Reclamation' => '',
|
||
'Create Record with Attachment' => '',
|
||
'Create Sub-Version' => '',
|
||
'Create a new background job' => '',
|
||
'Create a new client' => '',
|
||
... | ... | |
'No article has been selected yet.' => '',
|
||
'No articles have been added yet.' => '',
|
||
'No assembly has been selected yet.' => '',
|
||
'No attachment' => '',
|
||
'No background job has been created yet.' => '',
|
||
'No bank account chosen!' => '',
|
||
'No bank account configured for bank code/BIC #1, account number/IBAN #2.' => '',
|
templates/design40_webpages/email_journal/show.html | ||
---|---|---|
|
||
[% INCLUDE 'common/flash.html' %]
|
||
|
||
<div class="wrapper" id="wrapper-1">
|
||
<div class="wrapper" id="wrapper-0">
|
||
|
||
<div class="input-panel" style="vertical-align:top;" id="wrapper-1">
|
||
|
||
<table id="email_journal_details" class="tbl-horizontal">
|
||
<tbody>
|
||
... | ... | |
|
||
</div> <!-- wrapper-1 -->
|
||
|
||
<div class="wrapper" id="wrapper-2">
|
||
[% SET attachments = SELF.entry.attachments_sorted %]
|
||
[% IF attachments.size %]
|
||
|
||
<div class="input-panel" style="vertical-align:top;" id="wrapper-2">
|
||
|
||
[% IF attachments.size %]
|
||
<table id="email_journal_details" class="tbl-list">
|
||
<caption>[% LxERP.t8("Attachments") %]</caption>
|
||
<thead>
|
||
... | ... | |
[% END %]
|
||
</tbody>
|
||
</table>
|
||
[% END %]
|
||
|
||
[% ELSE %]
|
||
<form method="post" action="controller.pl" id="attachment_form">
|
||
[% L.hidden_tag('id', SELF.entry.id) %]
|
||
[% L.select_tag('attachment_id',
|
||
attachments, value_key='id', title_key='name',
|
||
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"),
|
||
'data-title'=LxERP.t8("Attachment"), class="wi-normal",
|
||
onchange='kivi.EmailJournal.update_attachment_preview();'
|
||
)
|
||
%]
|
||
[% L.select_tag('record_type', [ ["value", "Name"] ], class="wi-normal") %]
|
||
|
||
<p>[% LxERP.t8("No attachments") %]</p>
|
||
[% L.button_tag('kivi.EmailJournal.create_record();', LxERP.t8('Create Record with Attachment')) %]
|
||
</form>
|
||
|
||
<!-- <div id="attachment_preview"> -->
|
||
[% P.email_journal.attachment_preview(attachments.0,
|
||
style="width:489px;border:1px solid black;margin:9px") %]
|
||
|
||
[% END %]
|
||
</div> <!-- wrapper-2 -->
|
||
|
||
</div> <!-- wrapper-0 -->
|
templates/webpages/email_journal/show.html | ||
---|---|---|
<tr class="listrow">
|
||
<th>[%- LxERP.t8("Status") %]</th>
|
||
<td>
|
||
[% IF SELF.entry.status == 'sent' %]
|
||
[% LxERP.t8('sent') %]
|
||
[% ELSIF SELF.entry.status == 'send_failed' %]
|
||
[% LxERP.t8('send failed') %]
|
||
[% ELSIF SELF.entry.status == 'imported' %]
|
||
[% LxERP.t8('imported') %]
|
||
[% ELSE %]
|
||
[% SELF.entry.status %]
|
||
[% END %]
|
||
[% P.email_journal.entry_status(SELF.entry) %]
|
||
</td>
|
||
</tr>
|
||
|
||
... | ... | |
</table>
|
||
|
||
[% SET attachments = SELF.entry.attachments_sorted %]
|
||
[% IF attachments.size %]
|
||
<h2>[% LxERP.t8("Attachments") %]</h2>
|
||
[% IF attachments.size %]
|
||
|
||
<table id="email_journal_details" class="email_journal_details">
|
||
<thead>
|
||
... | ... | |
</tbody>
|
||
</table>
|
||
[% END %]
|
||
<div>
|
||
<form method="post" action="controller.pl" id="attachment_form">
|
||
[% L.hidden_tag('id', SELF.entry.id) %]
|
||
[% L.select_tag('attachment_id',
|
||
attachments, value_key='id', title_key='name',
|
||
with_empty=1, empty_value='', empty_title=LxERP.t8("No attachment"),
|
||
'data-title'=LxERP.t8("Attachment"), class="wi-normal",
|
||
onchange='kivi.EmailJournal.update_attachment_preview();'
|
||
)
|
||
%]
|
||
[% L.select_tag('record_type', [ ["value", "Name"] ], class="wi-normal") %]
|
||
|
||
[% L.button_tag('kivi.EmailJournal.create_record();', LxERP.t8('Create Record with Attachment')) %]
|
||
</form>
|
||
|
||
<!-- <div id="attachment_preview"> -->
|
||
[% P.email_journal.attachment_preview(attachments.0,
|
||
style="width:489px;border:1px solid black;margin:9px") %]
|
||
</div>
|
Auch abrufbar als: Unified diff
EmailJournal: Zeige Vorschau von Anhängen an