[rt-commit] [svn] r546 - rt/trunk/html/Ticket/Elements
jesse at fsck.com
jesse at fsck.com
Thu Mar 11 00:24:42 EST 2004
Author: jesse
Date: Thu Mar 11 00:24:42 2004
New Revision: 546
Added:
rt/trunk/html/Ticket/Elements/LoadTextAttachments (contents, props changed)
Modified:
rt/trunk/html/Ticket/Elements/ShowHistory
Log:
Adding in even yet more attachment caching
Added: rt/trunk/html/Ticket/Elements/LoadTextAttachments
==============================================================================
--- (empty file)
+++ rt/trunk/html/Ticket/Elements/LoadTextAttachments Thu Mar 11 00:24:42 2004
@@ -0,0 +1,39 @@
+<%INIT>
+
+my $attachments = RT::Attachments->new( $session{'CurrentUser'} );
+
+$attachments->Columns( qw(id Content ContentType TransactionId ContentEncoding));
+
+if ( $Ticket->CurrentUserHasRight('ShowTicket') ) {
+ my $transactions = $attachments->NewAlias('Transactions');
+ $attachments->Join( ALIAS1 => 'main',
+ FIELD1 => 'TransactionId',
+ ALIAS2 => $transactions,
+ FIELD2 => 'id' );
+
+ my $tickets = $attachments->NewAlias('Tickets');
+
+ $attachments->Join( ALIAS1 => $transactions,
+ FIELD1 => 'Ticket',
+ ALIAS2 => $tickets,
+ FIELD2 => 'id' );
+
+ $attachments->Limit( ALIAS => $tickets,
+ FIELD => 'EffectiveId',
+ VALUE => $Ticket->id() );
+ # if the user may not see comments do not return them
+ unless ( $Ticket->CurrentUserHasRight('ShowTicketComments') ) {
+ $attachments->Limit( ALIAS => $transactions, FIELD => 'Type', OPERATOR => '!=', VALUE => "Comment" );
+ }
+
+ $attachments->Limit ( FIELD => 'ContentType', OPERATOR => '=', VALUE => 'text/plain');
+ $attachments->Limit ( FIELD => 'ContentType', OPERATOR => 'STARTSWITH', VALUE => 'message/');
+ $attachments->Limit ( FIELD => 'ContentType', OPERATOR => '=', VALUE => 'text');
+
+}
+return ($attachments);
+</%INIT>
+<%ARGS>
+$Ticket => undef
+</%ARGS>
+
Modified: rt/trunk/html/Ticket/Elements/ShowHistory
==============================================================================
--- rt/trunk/html/Ticket/Elements/ShowHistory (original)
+++ rt/trunk/html/Ticket/Elements/ShowHistory Thu Mar 11 00:24:42 2004
@@ -107,6 +107,9 @@
$Attachments ||= $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket);
+$AttachmentContent ||= $m->comp('/Ticket/Elements/LoadTextAttachments', Ticket => $Ticket);
+
+
</%INIT>
<%ARGS>
More information about the Rt-commit
mailing list