[Bps-public-commit] r11436 - in RT-Extension-Reports/html/Reports: Elements
sunnavy at bestpractical.com
sunnavy at bestpractical.com
Thu Apr 3 08:38:49 EDT 2008
Author: sunnavy
Date: Thu Apr 3 08:36:46 2008
New Revision: 11436
Modified:
RT-Extension-Reports/html/Reports/Elements/ShowResults
RT-Extension-Reports/html/Reports/Types/ActiveOrInactive
RT-Extension-Reports/html/Reports/Types/CreatedOrResolved
RT-Extension-Reports/html/Reports/Types/General
Log:
new page for screen reports
Modified: RT-Extension-Reports/html/Reports/Elements/ShowResults
==============================================================================
--- RT-Extension-Reports/html/Reports/Elements/ShowResults (original)
+++ RT-Extension-Reports/html/Reports/Elements/ShowResults Thu Apr 3 08:36:46 2008
@@ -63,6 +63,7 @@
</table>
<%INIT>
+my $seg;
if ( @$Results ) {
# we found something
@@ -70,7 +71,7 @@
$#$row = $#$Headers; # enlarge @$row to be the same size of @$Headers
for ( @$row ) {
- $_ = 0 unless defined; # 0 is better looking than undef, which is null
+ $_ = 0 unless defined; # 0 is better looking than undef
}
}
@@ -85,10 +86,11 @@
$m->abort;
}
elsif ( $Type eq 'chart' ) {
- $r->content_type( 'image/png' );
- require GD::Graph::bars;
- my $graph = GD::Graph::bars->new( 800, 600 );
- $graph->set_legend(@$Headers[1 .. $#$Headers]);
+ for ( @$Results ) {
+ # join $day and $queue if possible
+ splice @$_, 0, 2, $_->[1] ? ( join ':', @$_[0 .. 1] ) : $_->[0];
+ }
+ splice @$Headers, 0, 2, join ':', @$Headers[0,1];
my @data;
for ( my $i = 0; $i < @$Results; $i++ ) {
@@ -96,9 +98,13 @@
$data[$j][$i] = $Results->[$i][$j];
}
}
+
+ require GD::Graph::bars;
+ my $graph = GD::Graph::bars->new( 800, 600 );
+ $graph->set_legend(@$Headers[1 .. $#$Headers]);
my $gd = $graph->plot(\@data) or die $graph->error;
+ $r->content_type( 'image/png' );
$m->out( $gd->png );
- $m->abort;
}
}
else {
Modified: RT-Extension-Reports/html/Reports/Types/ActiveOrInactive
==============================================================================
--- RT-Extension-Reports/html/Reports/Types/ActiveOrInactive (original)
+++ RT-Extension-Reports/html/Reports/Types/ActiveOrInactive Thu Apr 3 08:36:46 2008
@@ -74,7 +74,7 @@
<td><& /Reports/Elements/EditFilter, Content => $Filter, Name => 'Filter' &></td>
</tr>
<tr><td /><td>
-<& /Reports/Elements/SelectOutType, Name => 'OutType' &>
+<& /Reports/Elements/SelectOutType, Name => 'OutType', Default => $OutType &>
</td>
</tr>
<tr>
@@ -87,9 +87,6 @@
<table>
</form>
-<& /Reports/Elements/ShowResults, Headers => \@headers, Results => \@results &>
-
-
<%INIT>
my ( @headers, $num, @results, %data );
@@ -187,19 +184,10 @@
}
}
- if ( $ARGS{OutType} eq 'csv' ) {
- $m->comp( '/Reports/Elements/ShowResults', Headers => \@headers,
-Results => \@results, Type => 'csv' );
- }
- elsif ( $ARGS{OutType} eq 'chart' ) {
- for ( @results ) {
- splice @$_, 0, 2, $_->[1] ? ( join ':', @$_[0 .. 1] ) : $_->[0];
- }
- splice @headers, 0, 2, $headers[0 .. 1 ];
+ $m->comp('/Reports/Elements/ShowResults', Headers => \@headers, Results
+=> \@results, Type => $OutType);
+ $m->abort;
- $m->comp( '/Reports/Elements/ShowResults', Headers => \@headers,
-Results => \@results, Type => 'chart' );
- }
}
else {
my $today = RT::Date->new($session{CurrentUser});
@@ -218,5 +206,6 @@
$Run => undef
$Filter => undef
$Type => 'active'
+$OutType => 'screen'
</%ARGS>
Modified: RT-Extension-Reports/html/Reports/Types/CreatedOrResolved
==============================================================================
--- RT-Extension-Reports/html/Reports/Types/CreatedOrResolved (original)
+++ RT-Extension-Reports/html/Reports/Types/CreatedOrResolved Thu Apr 3 08:36:46 2008
@@ -75,7 +75,7 @@
<td><& /Reports/Elements/EditFilter, Content => $Filter, Name => 'Filter' &></td>
</tr>
<tr><td /><td>
-<& /Reports/Elements/SelectOutType, Name => 'OutType' &>
+<& /Reports/Elements/SelectOutType, Name => 'OutType', Default => $OutType &>
</td>
</tr>
<tr>
@@ -88,9 +88,6 @@
<table>
</form>
-<& /Reports/Elements/ShowResults, Headers => \@headers, Results => \@results &>
-
-
<%INIT>
my ( @headers, $num, @results, %data );
@@ -181,19 +178,10 @@
}
}
- if ( $ARGS{OutType} eq 'csv' ) {
- $m->comp( '/Reports/Elements/ShowResults', Headers => \@headers,
-Results => \@results, Type => 'csv' );
- }
- elsif ( $ARGS{OutType} eq 'chart' ) {
- for ( @results ) {
- splice @$_, 0, 2, $_->[1] ? ( join ':', @$_[0 .. 1] ) : $_->[0];
- }
- splice @headers, 0, 2, $headers[0 .. 1 ];
+ $m->comp('/Reports/Elements/ShowResults', Headers => \@headers, Results
+=> \@results, Type => $OutType);
+ $m->abort;
- $m->comp( '/Reports/Elements/ShowResults', Headers => \@headers,
-Results => \@results, Type => 'chart' );
- }
}
else {
my $today = RT::Date->new($session{CurrentUser});
@@ -212,5 +200,6 @@
$Run => undef
$Filter => undef
$Type => 'created'
+$OutType => 'screen'
</%ARGS>
Modified: RT-Extension-Reports/html/Reports/Types/General
==============================================================================
--- RT-Extension-Reports/html/Reports/Types/General (original)
+++ RT-Extension-Reports/html/Reports/Types/General Thu Apr 3 08:36:46 2008
@@ -66,7 +66,7 @@
<td><& /Reports/Elements/EditFilter, Content => $Filter, Name => 'Filter' &></td>
</tr>
<tr><td /><td>
-<& /Reports/Elements/SelectOutType, Name => 'OutType' &>
+<& /Reports/Elements/SelectOutType, Name => 'OutType', Default => $OutType &>
</td>
</tr>
<tr>
@@ -79,9 +79,6 @@
<table>
</form>
-<& /Reports/Elements/ShowResults, Headers => \@headers, Results => \@results &>
-
-
<%INIT>
my ( @headers, $num, @results, %data );
@@ -145,11 +142,6 @@
}
}
- use Data::Dumper;
- open my $fh, '>', '/tmp/t';
- print $fh Dumper \%data;
- close $fh;
-
for my $day ( sort keys %data ) {
if ( keys %{$data{$day}} == 0 ) {
push @results, [$day];
@@ -162,19 +154,9 @@
}
}
- if ( $ARGS{OutType} eq 'csv' ) {
- $m->comp( '/Reports/Elements/ShowResults', Headers => \@headers,
-Results => \@results, Type => 'csv' );
- }
- elsif ( $ARGS{OutType} eq 'chart' ) {
- for ( @results ) {
- splice @$_, 0, 2, $_->[1] ? ( join ':', @$_[0 .. 1] ) : $_->[0];
- }
- splice @headers, 0, 2, $headers[0 .. 1 ];
-
- $m->comp( '/Reports/Elements/ShowResults', Headers => \@headers,
-Results => \@results, Type => 'chart' );
- }
+ $m->comp('/Reports/Elements/ShowResults', Headers => \@headers, Results
+=> \@results, Type => $OutType);
+ $m->abort;
}
else {
my $today = RT::Date->new($session{CurrentUser});
@@ -192,5 +174,6 @@
$EndDate => undef
$Run => undef
$Filter => undef
+$OutType => 'screen'
</%ARGS>
More information about the Bps-public-commit
mailing list