[Rt-commit] r11824 - in rt/branches/3.8-TESTING: html/Ticket/Graphs html/Ticket/Graphs/Elements lib/RT/Graph
alexmv at bestpractical.com
alexmv at bestpractical.com
Tue Apr 22 16:52:35 EDT 2008
Author: alexmv
Date: Tue Apr 22 16:52:23 2008
New Revision: 11824
Modified:
rt/branches/3.8-TESTING/ (props changed)
rt/branches/3.8-TESTING/html/Ticket/Graphs/Elements/EditGraphProperties
rt/branches/3.8-TESTING/html/Ticket/Graphs/Elements/ShowGraph
rt/branches/3.8-TESTING/html/Ticket/Graphs/dhandler
rt/branches/3.8-TESTING/html/Ticket/Graphs/index.html
rt/branches/3.8-TESTING/lib/RT/Graph/Tickets.pm
Log:
r30075 at kohr-ah: chmrr | 2008-04-22 16:50:19 -0400
* Put Type=Members back
Modified: rt/branches/3.8-TESTING/html/Ticket/Graphs/Elements/EditGraphProperties
==============================================================================
--- rt/branches/3.8-TESTING/html/Ticket/Graphs/Elements/EditGraphProperties (original)
+++ rt/branches/3.8-TESTING/html/Ticket/Graphs/Elements/EditGraphProperties Tue Apr 22 16:52:23 2008
@@ -80,6 +80,23 @@
<br />
% }
+<%PERL>
+if ( $AllowAdditionalProperties ) {
+ for my $i ( 1..($Depth||6) ) {
+ my @default;
+ if ( my $tmp = $ARGS{ 'Level-'. $i .'-Properties' } ) {
+ @default = ref $tmp? @$tmp : ($tmp);
+ }
+
+ $m->comp('SELF:Properties',
+ Level => $i,
+ Available => \@properties,
+ Default => \@default,
+ );
+ }
+}
+</%PERL>
+
<& /Elements/Submit, Label => loc('Update Graph'), Name => 'Update' &>
</&>
@@ -89,6 +106,7 @@
$Depth => 3
$FillUsing => ''
$ShowLinkDescriptions => 0
+$AllowAdditionalProperties => 1
</%ARGS>
<%INIT>
require RT::Graph::Tickets;
Modified: rt/branches/3.8-TESTING/html/Ticket/Graphs/Elements/ShowGraph
==============================================================================
--- rt/branches/3.8-TESTING/html/Ticket/Graphs/Elements/ShowGraph (original)
+++ rt/branches/3.8-TESTING/html/Ticket/Graphs/Elements/ShowGraph Tue Apr 22 16:52:23 2008
@@ -45,12 +45,13 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<div><img src="<% $RT::WebPath %>/Ticket/Graphs/<% $id %>?<% $m->comp('/Elements/QueryString', %graphargs) %>" usemap="#<% $graph->{'NAME'} || 'test' %>" style="border: none" />
+<div><img src="<% $RT::WebPath %>/Ticket/Graphs/<% $Type %>/<% $id %>?<% $m->comp('/Elements/QueryString', %ARGS) %>" usemap="#<% $graph->{'NAME'} || 'test' %>" style="border: none" />
<% Encode::decode_utf8( $graph->as_cmapx ) |n %>
</div>
<& ShowLegends, %ARGS, Ticket => $ticket &>
<%ARGS>
$id => undef;
+$Type => 'Links',
</%ARGS>
<%INIT>
my $ticket = RT::Ticket->new( $session{'CurrentUser'} );
@@ -61,11 +62,16 @@
}
$ARGS{'id'} = $id = $ticket->id;
-my $graph = RT::Graph::Tickets->TicketLinks(
+$Type = ucfirst lc $Type;
+unless ( $Type eq 'Links' || $Type eq 'Members' ) {
+ $RT::Logger->error("'$Type' is incorrect type of ticket graph");
+ $Type = 'Links';
+}
+
+require RT::Graph::Tickets;
+my $method = 'Ticket'. $Type;
+my $graph = RT::Graph::Tickets->$method(
%ARGS,
Ticket => $ticket,
);
-
-my %graphargs;
-$graphargs{$_} = $ARGS{$_} for qw/Depth FillUsing/;
</%INIT>
Modified: rt/branches/3.8-TESTING/html/Ticket/Graphs/dhandler
==============================================================================
--- rt/branches/3.8-TESTING/html/Ticket/Graphs/dhandler (original)
+++ rt/branches/3.8-TESTING/html/Ticket/Graphs/dhandler Tue Apr 22 16:52:23 2008
@@ -49,8 +49,8 @@
my $arg = $m->dhandler_arg;
my ($type, $id);
-if ( $arg =~ m{^(\d+)$}i ) {
- ($id) = ($1);
+if ( $arg =~ m{^(Members|Links)/(\d+)$}i ) {
+ ($type, $id) = ($1, $2);
} else {
return $m->abort( 404 );
}
@@ -63,7 +63,8 @@
}
require RT::Graph::Tickets;
-my $graph = RT::Graph::Tickets->TicketLinks(
+my $method = 'Ticket'. ucfirst lc $type;
+my $graph = RT::Graph::Tickets->$method(
%ARGS,
Ticket => $ticket,
);
Modified: rt/branches/3.8-TESTING/html/Ticket/Graphs/index.html
==============================================================================
--- rt/branches/3.8-TESTING/html/Ticket/Graphs/index.html (original)
+++ rt/branches/3.8-TESTING/html/Ticket/Graphs/index.html Tue Apr 22 16:52:23 2008
@@ -45,10 +45,10 @@
%# those contributions and any derivatives thereof.
%#
%# END BPS TAGGED BLOCK }}}
-<& /Elements/Header, Title => loc( "Ticket #[_1] relationships graph", $id ) &>
+<& /Elements/Header, Title => $title &>
<& /Ticket/Elements/Tabs,
Ticket => $ticket,
- Title => loc( "Ticket #[_1] relationships graph", $id ),
+ Title => $title,
current_tab => "Ticket/ModifyLinks.html?id=$id",
&>
@@ -58,10 +58,13 @@
<form action="<% $RT::WebPath %><% $m->request_comp->path %>">
<input type="hidden" class="hidden" name="id" value="<% $id %>" />
+<input type="hidden" class="hidden" name="Type" value="<% $ARGS{'Type'} %>" />
<& Elements/EditGraphProperties,
%ARGS,
Ticket => $ticket,
+ Type => $Type,
+ AllowAdditionalProperties => $Type eq 'Links'? 0 : 1,
&>
<& /Search/Elements/EditSearches,
@@ -80,7 +83,7 @@
use RT::Graph::Tickets;
my @results;
-my @save_arguments = qw(id Depth FillUsing ShowLinkDescriptions);
+my @save_arguments = qw(Type id Depth FillUsing ShowLinkDescriptions);
foreach my $level ( 0 .. 6 ) {
push @save_arguments, "Level-". $level ."-Properties";
}
@@ -93,5 +96,19 @@
my $id = $ARGS{'id'};
my $ticket = LoadTicket( $id );
$ARGS{'id'} = $id = $ticket->id;
+
+my $Type = $ARGS{'Type'} || 'Links';
+$Type = ucfirst lc $Type;
+unless ( $Type eq 'Links' || $Type eq 'Members' ) {
+ $RT::Logger->error("'$Type' is incorrect type of ticket graph");
+ $Type = 'Links';
+}
$ARGS{'Depth'} = 3 unless defined $ARGS{'Depth'} && length $ARGS{'Depth'};
+
+my $title;
+if ( $Type eq 'Links' ) {
+ $title = loc( "Ticket #[_1] full relationships graph", $id );
+} else {
+ $title = loc( "Ticket #[_1] relationships graph", $id );
+}
</%INIT>
Modified: rt/branches/3.8-TESTING/lib/RT/Graph/Tickets.pm
==============================================================================
--- rt/branches/3.8-TESTING/lib/RT/Graph/Tickets.pm (original)
+++ rt/branches/3.8-TESTING/lib/RT/Graph/Tickets.pm Tue Apr 22 16:52:23 2008
@@ -104,6 +104,58 @@
our (%fill_cache, @available_colors) = ();
+sub TicketMembers {
+ my $self = shift;
+ my %args = (
+ Ticket => undef,
+ Graph => undef,
+ Seen => undef,
+ Depth => 0,
+ CurrentDepth => 1,
+ @_
+ );
+ unless ( $args{'Graph'} ) {
+ $args{'Graph'} = GraphViz->new(
+ name => "ticket_members_". $args{'Ticket'}->id,
+ bgcolor => "transparent",
+ node => { shape => 'box', style => 'rounded,filled', fillcolor => 'white' },
+ );
+ %fill_cache = ();
+ @available_colors = @fill_colors;
+ }
+
+ $self->AddTicket( %args );
+
+ $args{'Seen'} ||= {};
+ return $args{'Graph'} if $args{'Seen'}{ $args{'Ticket'}->id }++;
+
+ return $args{'Graph'} if $args{'Depth'} && $args{'CurrentDepth'} >= $args{'Depth'};
+
+ my $show_link_descriptions = $args{'ShowLinkDescriptions'}
+ && RT::Link->can('Description');
+
+ my $to_links = $args{'Ticket'}->Links('Target', 'MemberOf');
+ $to_links->GotoFirstItem;
+ while ( my $link = $to_links->Next ) {
+ my $base = $link->BaseObj;
+ next unless $base->isa('RT::Ticket');
+
+ $self->TicketMembers(
+ %args,
+ Ticket => $base,
+ CurrentDepth => $args{'CurrentDepth'} + 1,
+ );
+
+ my $desc;
+ $desc = $link->Description if $show_link_descriptions;
+ $args{'Graph'}->add_edge(
+ $args{'Ticket'}->id => $base->id,
+ $desc? (label => gv_escape $desc): (),
+ );
+ }
+ return $args{'Graph'};
+};
+
my %property_cb = (
Queue => sub { return $_[0]->QueueObj->Name || $_[0]->Queue },
CF => sub {
More information about the Rt-commit
mailing list