[Rt-commit] r3503 - in RT-View-Tree: .
html/Callbacks/RT-Tree-View/Elements/RT__Ticket/ColumnMap
html/Search
trs at bestpractical.com
trs at bestpractical.com
Mon Jul 18 16:53:05 EDT 2005
Author: trs
Date: Mon Jul 18 16:53:05 2005
New Revision: 3503
Modified:
RT-View-Tree/ (props changed)
RT-View-Tree/MANIFEST
RT-View-Tree/html/Callbacks/RT-Tree-View/Elements/RT__Ticket/ColumnMap/ColumnMap
RT-View-Tree/html/Search/Tree.html
Log:
r5235 at wintermute: tom | 2005-07-18 16:52:11 -0400
Applied Ruslan's customization patch with one bug fix (changed DependentOn to the correct DependsOn). Patch has been tested to work on 3.4.2 and as of this revision.
Modified: RT-View-Tree/MANIFEST
==============================================================================
--- RT-View-Tree/MANIFEST (original)
+++ RT-View-Tree/MANIFEST Mon Jul 18 16:53:05 2005
@@ -16,7 +16,6 @@
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
lib/RT/View/Tree.pm
-Makefile
Makefile.PL
MANIFEST This list of files
MANIFEST.SKIP
Modified: RT-View-Tree/html/Callbacks/RT-Tree-View/Elements/RT__Ticket/ColumnMap/ColumnMap
==============================================================================
--- RT-View-Tree/html/Callbacks/RT-Tree-View/Elements/RT__Ticket/ColumnMap/ColumnMap (original)
+++ RT-View-Tree/html/Callbacks/RT-Tree-View/Elements/RT__Ticket/ColumnMap/ColumnMap Mon Jul 18 16:53:05 2005
@@ -2,5 +2,11 @@
$COLUMN_MAP => undef
</%ARGS>
<%init>
-$COLUMN_MAP->{'_RT_TreeView_Indent'} = { value => sub { my $ticket = shift; my $depth = shift; return \(" "x$depth)} };
+$COLUMN_MAP->{'_RT_TreeView_Indent'} = {
+ value => sub {
+ my $ticket = shift;
+ my $depth = shift;
+ return \(" "x$depth);
+ }
+};
</%init>
Modified: RT-View-Tree/html/Search/Tree.html
==============================================================================
--- RT-View-Tree/html/Search/Tree.html (original)
+++ RT-View-Tree/html/Search/Tree.html Mon Jul 18 16:53:05 2005
@@ -10,15 +10,20 @@
$MaxDepth => 7
$ShowChildren => undef
$ShowDependencies => undef
+ at ShowStatus => ();
</%ARGS>
<%init>
+my @statuses = RT::Queue->new($session{'CurrentUser'})->StatusArray;
unless ($TreeviewMagic) {
unless (defined $ShowChildren) {
$ShowChildren = 1;
}
unless (defined $ShowDependencies) {
- $ShowDependencies = 1;
+ $ShowDependencies = 1;
+ }
+ unless( @ShowStatus ) {
+ @ShowStatus = qw(new open stalled);
}
}
@@ -27,8 +32,8 @@
my $title = loc('Tree view');
-my $QueryString = "?"
- . $m->comp(
+my $QueryString = "?".
+ $m->comp(
'/Elements/QueryString',
Query => $Query,
Format => $Format,
@@ -38,8 +43,12 @@
Page => $Page,
MaxDepth => $MaxDepth,
ShowChildren => $ShowChildren,
- ShowDependencies => $ShowDependencies
+ ShowDependencies => $ShowDependencies,
);
+# QueryString couldn't handle array refs
+$QueryString = join( '&', $QueryString,
+ map { 'ShowStatus='. $m->interp->apply_escapes($_,'u') }
+ @ShowStatus);
# }}}
@@ -53,9 +62,9 @@
}
# }}}
-# {{{ Scrub the html of the format string to remove any potential nasties.a
+# {{{ Scrub the html of the format string to remove any potential nasties.
$Format = $m->comp( '/Elements/ScrubHTML', Content => ($Format||
-$RT::DefaultSearchResultFormat));
+ $RT::DefaultSearchResultFormat));
my (@Format) =
$m->comp( '/Elements/CollectionAsTable/ParseFormat', Format => $Format );
@@ -64,13 +73,19 @@
my @output;
foreach my $item ( @{ $entry->{'output'} } ) {
if ( $item eq '__Subject__' ) {
- push @output,
- '___RT_TreeView_Indent__', $item;
+ # add indent whitespaces before link
+ unshift @output, '___RT_TreeView_Indent__';
+ push @output, $item;
}
else {
push @output, $item;
}
}
+ if( lc $entry->{'attribute'} eq 'id' ) {
+ for my $item ( @output ) {
+ $item =~ s/<A\s/<A target="_blank" /iso if $item =~ /<A\s/iso;
+ }
+ }
$entry->{'output'} = \@output;
}
# }}}
@@ -79,16 +94,11 @@
$tickets->FromSQL($Query);
$tickets->OrderBy( FIELD => $OrderBy, ORDER => $Order );
-my $TopTickets = ();
my @tickets = @{ $tickets->ItemsArrayRef || [] };
-
-
-foreach my $ticket (@tickets) {
- $TopTickets->{ $ticket->id } = $ticket;
-}
+my $TopTickets = {};
+$TopTickets->{ $_->id } = $_ foreach( @tickets );
my @tree;
-
foreach my $ticket (@tickets) {
# If the parent ticket hasn't been invalidated by being displayed deeper...
@@ -100,11 +110,14 @@
Depth => 1,
MaxDepth => $MaxDepth,
ShowChildren => $ShowChildren,
- ShowDependencies => $ShowDependencies
+ ShowDependencies => $ShowDependencies,
+ ShowStatus => \@ShowStatus,
);
+ unless( $kids && @$kids ) {
+ next unless grep $_ eq $ticket->Status, @ShowStatus;
+ }
push @tree, [ $ticket, $kids ];
-
}
# Ok. Let's build up our tree of tickets, recursing down.
@@ -114,44 +127,39 @@
TopTickets => undef,
ShowChildren => undef,
ShowDependencies => undef,
+ ShowStatus => undef,
Depth => undef,
MaxDepth => undef,
@_
);
- return if ( $args{'Depth'} > $args{'MaxDepth'} );
-
- my $ticket = $args{'Ticket'};
- my $TopTickets = $args{'TopTickets'};
+ return if ( $args{'Depth'} > $args{'MaxDepth'} );
- my $deps = RT::Tickets->new( $session{'CurrentUser'} );
my @query;
+ push @query, 'DependsOn = ' . $args{'Ticket'}->id
+ if ( $args{'ShowDependencies'} );
+ push @query, 'MemberOf = ' . $args{'Ticket'}->id
+ if ( $args{'ShowChildren'} );
- my @tickets;
-
- push @query, 'DependentOn = ' . $ticket->id
- if ( $args{'ShowDependencies'} );
- push @query, 'MemberOf = ' . $ticket->id if ( $args{'ShowChildren'} );
-
+ my $deps = RT::Tickets->new( $session{'CurrentUser'} );
$deps->FromSQL( join( ' OR ', @query ) );
$deps->OrderBy( FIELD => $args{'OrderBy'}, ORDER => $args{'Order'} );
+ my @tickets;
while ( my $dep = $deps->Next ) {
- delete $TopTickets->{ $dep->id };
+ delete $args{'TopTickets'}->{ $dep->id };
my $kids = undef;
$kids = build_subtree(
- Ticket => $dep,
- TopTickets => $TopTickets,
- Depth => ( $args{'Depth'} + 1 ),
- MaxDepth => $args{'MaxDepth'},
- ShowChildren => $args{'ShowChildren'},
- ShowDependencies => $args{'ShowDependencies'}
+ %args,
+ Ticket => $dep,
+ Depth => $args{'Depth'} + 1,
);
+ unless( $kids && @$kids ) {
+ next unless grep $_ eq $dep->Status, @{ $args{'ShowStatus'} };
+ }
push @tickets, [ $dep, $kids ];
-
}
-
return ( \@tickets );
}
@@ -208,6 +216,11 @@
'CHECKED'%>><&|/l&>Show children in sublevels</&></li>
<li><input type="checkbox" name="ShowDependencies" <%$ShowDependencies&&
'CHECKED'%>><&|/l&>Show dependencies in sublevels</&></li>
+<li><&|/l&>Status</&>:<SELECT name="ShowStatus" multiple size=6>
+% foreach my $s(@statuses) {
+<option value="<% $s %>" <% (grep $_ eq $s, @ShowStatus)? 'selected': ''%>><&|/l&><% $s %></&></option>
+% }
+</select></li>
</ul>
<& /Elements/Submit &>
<& /Elements/TitleBoxEnd &>
More information about the Rt-commit
mailing list