
sartak at bestpractical
Nov 17, 2009, 4:04 PM
Post #1 of 1
(301 views)
Permalink
|
|
rt branch, create-action, updated. 67ff7341864fb625683e7082293fb2f86a6e2ca8
|
|
The branch, create-action has been updated via 67ff7341864fb625683e7082293fb2f86a6e2ca8 (commit) from 1e8e66ac79bffe5431ee94542ed1dfeb89d1aedc (commit) Summary of changes: lib/RT/Action/CreateTicket.pm | 20 +++++++++++++++++++- 1 files changed, 19 insertions(+), 1 deletions(-) - Log ----------------------------------------------------------------- commit 67ff7341864fb625683e7082293fb2f86a6e2ca8 Author: Shawn M Moore <sartak [at] bestpractical> Date: Tue Nov 17 19:03:38 2009 -0500 Steal some attachment handling code from Hiveminder Clearly Jifty needs to get better about this :) diff --git a/lib/RT/Action/CreateTicket.pm b/lib/RT/Action/CreateTicket.pm index a36d94f..9beb40a 100644 --- a/lib/RT/Action/CreateTicket.pm +++ b/lib/RT/Action/CreateTicket.pm @@ -26,7 +26,7 @@ use Jifty::Action schema { max_length is 200, label is _('Subject'); - param attachments => + param attachment => render as 'upload', label is _('Attach file'); @@ -189,6 +189,24 @@ sub set_final_priority { $self->fill_parameter(final_priority => default_value => $queue->final_priority); } +sub take_action { + my $self = shift; + my $fh = $self->argument_value('attachment'); + $self->argument_value(attachment_filename => "$fh"); + + my $info = Jifty->handler->cgi->uploadInfo( $fh ); + $self->argument_value(attachment_content_type => $info->{'Content-Type'}) + if defined $info; + + my $ret = $self->SUPER::take_action( @_ ); + + # Kill file handle so it's not in the session or request + $self->argument_value(attachment => ''); + Jifty->web->request->delete('J:A:F-attachment-'.$self->moniker); + + return $ret; +} + sub report_success { my $self = shift; my $id = $self->record->id; ----------------------------------------------------------------------- _______________________________________________ Rt-commit mailing list Rt-commit [at] lists http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-commit
|