Changeset 1158 for trunk/LATMOS-Accounts-Web
- Timestamp:
- 09/20/12 10:37:15 (12 years ago)
- Location:
- trunk/LATMOS-Accounts-Web
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Ajax/Services/Mailing.pm
r1135 r1158 86 86 } 87 87 88 sub attachments :Local { 89 my ( $self, $c ) = @_; 90 foreach ($c->req->param('rm_attachment')) { 91 $c->session->{mailing}{attachments}[$_ -1] = undef; 92 } 93 94 $c->session->{mailing}{attachments} = [ 95 grep { $_ } 96 @{ 97 $c->session->{mailing}{attachments} || []} 98 ]; 99 } 100 88 101 sub end : Private { 89 102 my ( $self, $c ) = @_; -
trunk/LATMOS-Accounts-Web/lib/LATMOS/Accounts/Web/Controller/Services/Mailing.pm
r1148 r1158 47 47 $c->go('send'); 48 48 } 49 50 if ($c->req->upload('attachment')) { 51 $c->forward('attachment'); 52 } 49 53 } 50 54 … … 52 56 my ( $self, $c ) = @_; 53 57 } 58 59 sub attachment :Private { 60 my ( $self, $c ) = @_; 61 my $upload = $c->req->upload('attachment'); 62 my $attach = Email::MIME->create( 63 attributes => { 64 content_type => $upload->type, 65 filename => $upload->filename, 66 encoding => 'base64', 67 name => $upload->filename,, 68 }, 69 body => $upload->slurp, 70 ); 71 push(@{$c->session->{mailing}{attachments}}, $attach); 72 } 54 73 55 74 sub filter :Local { … … 96 115 charset => 'utf-8', 97 116 }, 98 parts => [ $bodypart ],117 parts => [ $bodypart, @{$c->session->{mailing}{attachments}} ], 99 118 ); 100 119 $email->header_set( Subject => $c->req->param('subject') ); … … 118 137 $c->session->{mailing}{subject} = ''; 119 138 $c->session->{mailing}{body} = ''; 139 $c->session->{mailing}{attachments} = []; 120 140 $c->session->{to} = {}; 121 141 122 142 } 143 123 144 124 145 =head1 AUTHOR -
trunk/LATMOS-Accounts-Web/root/html/services/mailing/index.tt
r1136 r1158 15 15 16 16 </form> 17 18 <div id="attachment_list"> 19 [% INCLUDE 'ajax/services/mailing/attachments.tt' %] 20 </div> 21 <form action="[% c.uri_for('/services', 'mailing') %]" 22 enctype="multipart/form-data" method="POST"> 23 <input type=file name="attachment"> 24 <input type="submit" value="Ajouter"> 25 </form>
Note: See TracChangeset
for help on using the changeset viewer.