[Rt-commit] rt branch, records_history, updated. rt-3.8.8-106-g9795a8e
Ruslan Zakirov
ruz at bestpractical.com
Wed Jun 30 00:29:29 EDT 2010
The branch, records_history has been updated
via 9795a8e14a17b3e3fc66fb3565ad279bf7d7e7c4 (commit)
via 9373a3a251aa21a12b24cd9e86da936db6dae982 (commit)
via 361b3ebd0b95aa8819695c77b4acf53464853a75 (commit)
via db3b5d3111b00c719c160b7e89fc32773997033a (commit)
via 04df6ee659c62a1ff4f611b3a36b5d36021148f8 (commit)
via b9184d7b2abc805d24da125ca464988f7120e4ce (commit)
via 530f450f4f6778e7c0866df54f7fef0ea2b773e1 (commit)
via c60fc6b47f10744fa0d19235cc881a8d6cc12b4c (commit)
from 83ace0a90979429c8784623f0dde1d4d638c362e (commit)
Summary of changes:
lib/RT/Record.pm | 73 +++++++++++-
lib/RT/Ticket_Overlay.pm | 78 ++++++++++++
share/html/Elements/ShowHistory | 151 ++++++++++++++++++++++++
share/html/Ticket/Elements/FindAttachments | 61 +++++-----
share/html/Ticket/Elements/LoadTextAttachments | 41 +------
share/html/Ticket/Elements/ShowHistory | 80 ++++++-------
6 files changed, 367 insertions(+), 117 deletions(-)
create mode 100644 share/html/Elements/ShowHistory
- Log -----------------------------------------------------------------
commit c60fc6b47f10744fa0d19235cc881a8d6cc12b4c
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Jun 29 03:35:14 2010 +0400
indent and minor refactoring
diff --git a/share/html/Ticket/Elements/ShowHistory b/share/html/Ticket/Elements/ShowHistory
index d859483..2846f0f 100755
--- a/share/html/Ticket/Elements/ShowHistory
+++ b/share/html/Ticket/Elements/ShowHistory
@@ -50,17 +50,14 @@
# be generalized at some point.
</%doc>
<%perl>
-if ($ShowDisplayModes or $ShowTitle) {
+if ( $ShowDisplayModes or $ShowTitle ) {
my $title = $ShowTitle
? loc('History')
: ' ';
- my $titleright;
-
- if ($ShowDisplayModes) {
- $titleright = '';
-
- if ($ShowHeaders) {
+ my $titleright = '';
+ if ( $ShowDisplayModes ) {
+ if ( $ShowHeaders ) {
$titleright .= qq{<a href="$URIFile?id=} .
$Ticket->id.qq{">} .
loc("Brief headers") .
@@ -85,6 +82,7 @@ if ($ShowDisplayModes or $ShowTitle) {
my @attachments = @{$Attachments->ItemsArrayRef()};
my @attachment_content = @{$AttachmentContent->ItemsArrayRef()};
+my $i = 1;
while ( my $Transaction = $Transactions->Next ) {
my $skip = 0;
$m->callback(
@@ -95,37 +93,36 @@ while ( my $Transaction = $Transactions->Next ) {
);
next if $skip;
- $i++;
-
my @trans_attachments = grep { $_->TransactionId == $Transaction->Id } @attachments;
my $trans_content = {};
grep { ($_->TransactionId == $Transaction->Id ) && ($trans_content->{$_->Id} = $_) } @attachment_content;
-
my $IsLastTransaction = 0;
if ( $OldestFirst ) {
$IsLastTransaction = $Transactions->IsLast;
} else {
- $IsLastTransaction = 1 if ( $i == 1 );
+ $IsLastTransaction = 1 if $i == 1;
}
#Args is first because we're clobbering the "Attachments" parameter
$m->comp( 'ShowTransaction',
- %ARGS,
+ %ARGS,
- Ticket => $Ticket,
- Transaction => $Transaction,
- ShowHeaders => $ShowHeaders,
- RowNum => $i,
- Attachments => \@trans_attachments,
- AttachmentContent => $trans_content,
- LastTransaction => $IsLastTransaction
- );
+ Ticket => $Ticket,
+ Transaction => $Transaction,
+ ShowHeaders => $ShowHeaders,
+ RowNum => $i,
+ Attachments => \@trans_attachments,
+ AttachmentContent => $trans_content,
+ LastTransaction => $IsLastTransaction
+ );
-# manually flush the content buffer after each txn, so the user sees
-# some update
-$m->flush_buffer();
+ # manually flush the content buffer after each txn,
+ # so the user sees some update
+ $m->flush_buffer;
+
+ $i++;
}
</%perl>
@@ -136,7 +133,7 @@ $m->flush_buffer();
% }
<%INIT>
my $Transactions = new RT::Transactions($session{'CurrentUser'});
-if ($Tickets) {
+if ( $Tickets ) {
while (my $t = $Tickets->Next) {
$Transactions->LimitToTicket($t->id);
}
@@ -144,18 +141,19 @@ if ($Tickets) {
$Transactions = $Ticket->Transactions;
}
-
my $OldestFirst = RT->Config->Get( 'OldestTransactionsFirst', $session{'CurrentUser'} );
my $SortOrder = $OldestFirst? 'ASC': 'DESC';
-$Transactions->OrderByCols( { FIELD => 'Created',
- ORDER => $SortOrder },
- { FIELD => 'id',
- ORDER => $SortOrder },
- );
-
-my $i;
-$Attachments ||= $m->comp('/Ticket/Elements/FindAttachments', Ticket => $Ticket, Tickets => $Tickets || undef);
-$AttachmentContent ||= $m->comp('/Ticket/Elements/LoadTextAttachments', Ticket => $Ticket);
+$Transactions->OrderByCols(
+ { FIELD => 'Created', ORDER => $SortOrder },
+ { FIELD => 'id', ORDER => $SortOrder },
+);
+
+$Attachments ||= $m->comp('/Ticket/Elements/FindAttachments',
+ Ticket => $Ticket, Tickets => $Tickets,
+);
+$AttachmentContent ||= $m->comp('/Ticket/Elements/LoadTextAttachments',
+ Ticket => $Ticket
+);
</%INIT>
<%ARGS>
commit 530f450f4f6778e7c0866df54f7fef0ea2b773e1
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Tue Jun 29 06:57:09 2010 +0400
prepare attachments only once for whole history
diff --git a/share/html/Ticket/Elements/ShowHistory b/share/html/Ticket/Elements/ShowHistory
index 2846f0f..f8c7101 100755
--- a/share/html/Ticket/Elements/ShowHistory
+++ b/share/html/Ticket/Elements/ShowHistory
@@ -79,9 +79,6 @@ if ( $ShowDisplayModes or $ShowTitle ) {
<div id="ticket-history">
<%perl>
-my @attachments = @{$Attachments->ItemsArrayRef()};
-my @attachment_content = @{$AttachmentContent->ItemsArrayRef()};
-
my $i = 1;
while ( my $Transaction = $Transactions->Next ) {
my $skip = 0;
@@ -93,11 +90,6 @@ while ( my $Transaction = $Transactions->Next ) {
);
next if $skip;
- my @trans_attachments = grep { $_->TransactionId == $Transaction->Id } @attachments;
-
- my $trans_content = {};
- grep { ($_->TransactionId == $Transaction->Id ) && ($trans_content->{$_->Id} = $_) } @attachment_content;
-
my $IsLastTransaction = 0;
if ( $OldestFirst ) {
$IsLastTransaction = $Transactions->IsLast;
@@ -113,8 +105,8 @@ while ( my $Transaction = $Transactions->Next ) {
Transaction => $Transaction,
ShowHeaders => $ShowHeaders,
RowNum => $i,
- Attachments => \@trans_attachments,
- AttachmentContent => $trans_content,
+ Attachments => $attachments{ $Transaction->id } || [],
+ AttachmentContent => \%attachment_content,
LastTransaction => $IsLastTransaction
);
@@ -155,6 +147,12 @@ $AttachmentContent ||= $m->comp('/Ticket/Elements/LoadTextAttachments',
Ticket => $Ticket
);
+my %attachments;
+push @{ $attachments{ $_->TransactionId } ||= [] }, $_
+ foreach @{ $Attachments->ItemsArrayRef };
+my %attachment_content = map { $_->id => $_ }
+ @{ $AttachmentContent->ItemsArrayRef };
+
</%INIT>
<%ARGS>
$URIFile => RT->Config->Get('WebPath')."/Ticket/Display.html"
commit b9184d7b2abc805d24da125ca464988f7120e4ce
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Wed Jun 30 03:43:32 2010 +0400
minor refactoring
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 9ecad76..0d5a0e3 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -1493,7 +1493,7 @@ sub _NewTransaction {
=head2 Transactions
- Returns an RT::Transactions object of all transactions on this record object
+Returns an L<RT::Transactions> object of all transactions on this record object
=cut
@@ -1502,8 +1502,6 @@ sub Transactions {
use RT::Transactions;
my $transactions = RT::Transactions->new( $self->CurrentUser );
-
- #If the user has no rights, return an empty object
$transactions->Limit(
FIELD => 'ObjectId',
VALUE => $self->id,
@@ -1513,9 +1511,10 @@ sub Transactions {
VALUE => ref($self),
);
- return ($transactions);
+ return $transactions;
}
+
# }}}
# }}}
#
commit 04df6ee659c62a1ff4f611b3a36b5d36021148f8
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Wed Jun 30 03:44:24 2010 +0400
Attachments and TextAttachments for all records in the system
diff --git a/lib/RT/Record.pm b/lib/RT/Record.pm
index 0d5a0e3..299f11f 100755
--- a/lib/RT/Record.pm
+++ b/lib/RT/Record.pm
@@ -1514,6 +1514,72 @@ sub Transactions {
return $transactions;
}
+=head2 Attachments
+
+Returns an L<RT::Attachments> object of all attachments on this record object
+(for all its L</Transactions>).
+
+By default Content and Headers of attachments are not fetched right away from
+database. Use C<WithContent> and C<WithHeaders> options to override this.
+
+=cut
+
+sub Attachments {
+ my $self = shift;
+ my %args = (
+ WithHeaders => 0,
+ WithContent => 0,
+ @_
+ );
+ my @columns = qw(
+ id TransactionId Parent MessageId
+ Subject Filename
+ ContentType ContentEncoding
+ Creator Created
+ );
+ push @columns, 'Headers' if $args{'WithHeaders'};
+ push @columns, 'Content' if $args{'WithContent'};
+
+ my $res = RT::Attachments->new( $self->CurrentUser );
+ $res->Columns( @columns );
+ my $txn_alias = $res->TransactionAlias;
+ $res->Limit(
+ ALIAS => $txn_alias,
+ FIELD => 'ObjectType',
+ VALUE => ref($self),
+ );
+ $res->Limit(
+ ALIAS => $txn_alias,
+ FIELD => 'ObjectId',
+ VALUE => $self->id,
+ );
+ return $res;
+}
+
+=head2 TextAttachments
+
+Returns an L<RT::Attachments> object of all attachments, like L<Attachments>,
+but only those that are text.
+
+By default Content and Headers are fetched. Use C<WithContent> and
+C<WithHeaders> options to override this.
+
+=cut
+
+sub TextAttachments {
+ my $self = shift;
+ my $res = $self->Attachments(
+ WithHeaders => 1,
+ WithContent => 1,
+ @_
+ );
+ $res->Limit( FIELD => 'ContentType', OPERATOR => '=', VALUE => 'text/plain');
+ $res->Limit( FIELD => 'ContentType', OPERATOR => 'STARTSWITH', VALUE => 'message/');
+ $res->Limit( FIELD => 'ContentType', OPERATOR => '=', VALUE => 'text');
+ $res->Limit( FIELD => 'Filename', OPERATOR => 'IS', VALUE => 'NULL')
+ if RT->Config->Get( 'SuppressInlineTextFiles', $self->CurrentUser );
+ return $res;
+}
# }}}
# }}}
commit db3b5d3111b00c719c160b7e89fc32773997033a
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Wed Jun 30 03:49:17 2010 +0400
Attachments and TextAttachments customizations for tickets
diff --git a/lib/RT/Ticket_Overlay.pm b/lib/RT/Ticket_Overlay.pm
index 2c54a22..470f2fb 100755
--- a/lib/RT/Ticket_Overlay.pm
+++ b/lib/RT/Ticket_Overlay.pm
@@ -3554,6 +3554,84 @@ sub Transactions {
# }}}
+=head2 Attachments
+
+Customization of L<RT::Record/Attachments> for tickets.
+
+=cut
+
+sub Attachments {
+ my $self = shift;
+ my %args = (
+ WithHeaders => 0,
+ WithContent => 0,
+ @_
+ );
+ my $res = RT::Attachments->new( $self->CurrentUser );
+ unless ( $self->CurrentUserHasRight('ShowTicket') ) {
+ $res->Limit(
+ SUBCLAUSE => 'acl',
+ FIELD => 'id',
+ VALUE => 0,
+ ENTRYAGGREGATOR => 'AND'
+ );
+ return $res;
+ }
+
+ my @columns = qw(
+ id TransactionId Parent MessageId
+ Subject Filename
+ ContentType ContentEncoding
+ Creator Created
+ );
+ push @columns, 'Headers' if $args{'WithHeaders'};
+ push @columns, 'Content' if $args{'WithContent'};
+
+ $res->Columns( @columns );
+ my $txn_alias = $res->TransactionAlias;
+ $res->Limit(
+ ALIAS => $txn_alias,
+ FIELD => 'ObjectType',
+ VALUE => ref($self),
+ );
+ my $ticket_alias = $res->Join(
+ ALIAS1 => $txn_alias,
+ FIELD1 => 'id',
+ TABLE2 => 'Tickets',
+ FIELD2 => 'EffectiveId',
+ );
+ $res->Limit(
+ ALIAS => $ticket_alias,
+ FIELD => 'EffectiveId',
+ VALUE => $self->id,
+ );
+ return $res;
+}
+
+=head2 Attachments
+
+Customization of L<RT::Record/TextAttachments> for tickets.
+
+=cut
+
+sub TextAttachments {
+ my $self = shift;
+
+ my $res = $self->SUPER::TextAttachments( @_ );
+ unless ( $self->CurrentUserHasRight('ShowTicketComments') ) {
+ # if the user may not see comments do not return them
+ $res->Limit(
+ SUBCLAUSE => 'ACL',
+ ALIAS => $res->TransactionAlias,
+ FIELD => 'Type',
+ OPERATOR => '!=',
+ VALUE => 'Comment',
+ );
+ }
+
+ return $res;
+}
+
# {{{ TransactionCustomFields
commit 361b3ebd0b95aa8819695c77b4acf53464853a75
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Wed Jun 30 03:51:58 2010 +0400
replace mason comp with new methods
diff --git a/share/html/Ticket/Elements/LoadTextAttachments b/share/html/Ticket/Elements/LoadTextAttachments
index 84732b9..4b1e68c 100644
--- a/share/html/Ticket/Elements/LoadTextAttachments
+++ b/share/html/Ticket/Elements/LoadTextAttachments
@@ -47,47 +47,10 @@
%# END BPS TAGGED BLOCK }}}
<%INIT>
-my $attachments = RT::Attachments->new( $session{'CurrentUser'} );
+# DON'T USE IT. it's here for backwards
-$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 => 'ObjectId',
- ALIAS2 => $tickets,
- FIELD2 => 'id' );
-
- $attachments->Limit( ALIAS => $transactions,
- FIELD => 'ObjectType',
- VALUE => 'RT::Ticket');
-
-
- $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');
- $attachments->Limit ( FIELD => 'Filename', OPERATOR => 'IS', VALUE => 'NULL')
- if RT->Config->Get('SuppressInlineTextFiles', $Ticket->CurrentUser );
-}
-return ($attachments);
+return $Ticket->TextAttachments;
</%INIT>
<%ARGS>
$Ticket => undef
</%ARGS>
-
commit 9373a3a251aa21a12b24cd9e86da936db6dae982
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Wed Jun 30 03:59:30 2010 +0400
use new method, other code there we have is messy
diff --git a/share/html/Ticket/Elements/FindAttachments b/share/html/Ticket/Elements/FindAttachments
index 1ce75fd..344a6a1 100644
--- a/share/html/Ticket/Elements/FindAttachments
+++ b/share/html/Ticket/Elements/FindAttachments
@@ -46,50 +46,47 @@
%#
%# END BPS TAGGED BLOCK }}}
<%INIT>
-my %documents;
-
-#A default implementation here loops through all transactions and pulls out all their attachments.
+# A default implementation here loops through all transactions and pulls out all their attachments.
# We end up doing an end-run around that to get a bit more performance
-# We force the cache of ticket transactions to get populated up front. otherwise, the
+# We force the cache of ticket transactions to get populated up front. otherwise, the
# code that looks at attachments will look at each one in turn.
+
+return $Ticket->Attachments unless $Tickets;
+
my $attachments = RT::Attachments->new( $session{'CurrentUser'} );
+$attachments->Columns( qw(
+ id TransactionId Parent MessageId
+ Subject Filename
+ ContentType ContentEncoding
+ Creator Created
+) );
-$attachments->Columns( qw( Id Filename Headers Subject Parent ContentEncoding ContentType TransactionId Created));
+my $transactions = $attachments->TransactionsAlias;
+my $tickets = $attachments->Join(
+ ALIAS1 => $transactions,
+ FIELD1 => 'ObjectId',
+ TABLE2 => 'Tickets',
+ FIELD2 => 'id',
+);
-my $transactions = $attachments->NewAlias('Transactions');
-$attachments->Join( ALIAS1 => 'main',
- FIELD1 => 'TransactionId',
- ALIAS2 => $transactions,
- FIELD2 => 'id' );
-
-my $tickets = $attachments->NewAlias('Tickets');
+$attachments->Limit(
+ ALIAS => $transactions,
+ FIELD => 'ObjectType',
+ VALUE => 'RT::Ticket',
+);
- $attachments->Join( ALIAS1 => $transactions,
- FIELD1 => 'ObjectId',
- ALIAS2 => $tickets,
- FIELD2 => 'id' );
-
- $attachments->Limit( ALIAS => $transactions,
- FIELD => 'ObjectType',
- VALUE => 'RT::Ticket');
-if ($Tickets) {
- while ($Ticket = $Tickets->Next) {
- $attachments->Limit( ALIAS => $tickets,
- FIELD => 'EffectiveId',
- VALUE => $Ticket->id() );
- }
-} else {
- $attachments->Limit( ALIAS => $tickets,
- FIELD => 'EffectiveId',
- VALUE => $Ticket->id() );
+while ( my $Ticket = $Tickets->Next) {
+ $attachments->Limit(
+ ALIAS => $tickets,
+ FIELD => 'EffectiveId',
+ VALUE => $Ticket->id,
+ );
}
-
return ($attachments);
</%INIT>
<%ARGS>
$Ticket => undef
$Tickets => undef
</%ARGS>
-
commit 9795a8e14a17b3e3fc66fb3565ad279bf7d7e7c4
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date: Wed Jun 30 07:23:21 2010 +0400
first pass on generic ShowHistory, still on ticket's ShowTransaction
diff --git a/share/html/Elements/ShowHistory b/share/html/Elements/ShowHistory
new file mode 100644
index 0000000..73f7b16
--- /dev/null
+++ b/share/html/Elements/ShowHistory
@@ -0,0 +1,151 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2009 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%perl>
+if ( $ShowDisplayModes or $ShowTitle ) {
+ my $titleright = '';
+ if ( $ShowDisplayModes ) {
+ $Page ||= $m->request_path;
+ if ( $ShowHeaders ) {
+ $titleright .=
+ '<a href="'. RT->Config->Get('WebPath') . $Page
+ . '?id='. $Object->id. '">'
+ . loc("Brief headers") .'</a>'
+ . ' — '
+ . '<span class="selected">'. loc("Full headers") .'</span>';
+ }
+ else {
+ $titleright .= '<span class="selected">'. loc("Brief headers") .'</span>'
+ .' — '
+ .'<a href="'. RT->Config->Get('WebPath') . $Page
+ . '?ShowHeaders=1&id='. $Object->id. '">'
+ . loc("Full headers") .'</a>';
+ }
+ }
+</%perl>
+<div class="history">
+<& /Widgets/TitleBoxStart,
+ title => $ShowTitle ? loc('History') : ' ',
+ titleright_raw => $titleright,
+&>
+% }
+
+<div id="ticket-history">
+<%perl>
+my $i = 1;
+while ( my $Transaction = $Transactions->Next ) {
+ my $skip = 0;
+ $m->callback(
+ %ARGS,
+ Transaction => $Transaction,
+ skip => \$skip,
+ CallbackName => 'SkipTransaction',
+ );
+ next if $skip;
+
+ my $IsLastTransaction = 0;
+ if ( $OldestFirst ) {
+ $IsLastTransaction = $Transactions->IsLast;
+ } else {
+ $IsLastTransaction = 1 if $i == 1;
+ }
+
+ #Args is first because we're clobbering the "Attachments" parameter
+ $m->comp( '/Ticket/Elements/ShowTransaction',
+ %ARGS,
+
+ Ticket => $Object,
+ Transaction => $Transaction,
+ ShowHeaders => $ShowHeaders,
+ RowNum => $i,
+ Attachments => $attachments{ $Transaction->id } || [],
+ AttachmentContent => \%attachment_content,
+ LastTransaction => $IsLastTransaction
+ );
+
+ # manually flush the content buffer after each txn,
+ # so the user sees some update
+ $m->flush_buffer;
+
+ $i++;
+}
+
+</%perl>
+</div>
+% if ($ShowDisplayModes or $ShowTitle) {
+<& /Widgets/TitleBoxEnd &>
+</div>
+% }
+<%INIT>
+my $Transactions = $Object->Transactions;
+
+my $OldestFirst = RT->Config->Get(
+ OldestTransactionsFirst => $session{'CurrentUser'}
+);
+my $SortOrder = $OldestFirst? 'ASC': 'DESC';
+$Transactions->OrderByCols(
+ { FIELD => 'Created', ORDER => $SortOrder },
+ { FIELD => 'id', ORDER => $SortOrder },
+);
+
+my %attachments;
+push @{ $attachments{ $_->TransactionId } ||= [] }, $_
+ foreach @{ $Attachments->ItemsArrayRef };
+my %attachment_content = map { $_->id => $_ }
+ @{ $AttachmentContent->ItemsArrayRef };
+
+</%INIT>
+<%ARGS>
+$Object
+$Attachments => $Object->Attachments( WithHeaders => 1 )
+$AttachmentContent => $Object->TextAttachments
+
+$Page => undef
+$ShowHeaders => 0
+$ShowTitle => 1
+$ShowDisplayModes => 1
+</%ARGS>
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list