[Rt-commit] r2834 - in rt/branches/QUEBEC-EXPERIMENTAL: .
html/Elements html/Search html/Search/Elements
html/Tools/Elements html/Tools/Reports html/Tools/Reports/Elements
jesse at bestpractical.com
jesse at bestpractical.com
Fri May 6 13:59:36 EDT 2005
Author: jesse
Date: Fri May 6 13:59:35 2005
New Revision: 2834
Added:
rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/Chart
rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/
rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/CreatedByDates.html
rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/Elements/
rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/Elements/Tabs
rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/ResolvedByDates.html
rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/ResolvedByOwner.html
rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/index.html
Modified:
rt/branches/QUEBEC-EXPERIMENTAL/ (props changed)
rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Tabs
rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Chart.html
rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Chart.png
rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Elements/Tabs
Log:
r15824 at hualien: jesse | 2005-05-06 13:57:04 -0400
* First cut at new reports
Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Tabs
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Tabs (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Elements/Tabs Fri May 6 13:59:35 2005
@@ -72,7 +72,7 @@
path => 'Search/Build.html'
},
C => { title => loc('Tools'),
- path => 'Tools/Offline.html'
+ path => 'Tools/index.html'
},
P => { title => loc('Approval'),
path => 'Approvals/'
Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Chart.html
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Chart.html (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Chart.html Fri May 6 13:59:35 2005
@@ -1,76 +1,12 @@
<%args>
$Query => "id > 0"
$PrimaryGroupBy => 'Queue'
-$SecondaryGroupBy => undef
-$ChartStyle => 'bars'
</%args>
<%init>
-my @keys;
-my @values;
-
-use RT::Report::Tickets;
-
-my $tix = RT::Report::Tickets->new( $session{'CurrentUser'} );
-
-my @groupby = (
- { FIELD => $PrimaryGroupBy },
-
- #{ FIELD => $SecondaryGroupBy}
-);
-$tix->GroupByCols(@groupby);
-$tix->Column( FUNCTION => 'COUNT', FIELD => 'id' );
-$tix->Column( FIELD => $PrimaryGroupBy );
-
-#$tix->Column( FIELD => $SecondaryGroupBy);
-$tix->FromSQL($Query);
-$tix->_DoSearch();
-while ( my $entry = $tix->Next ) {
- my $class;
- if ( $PrimaryGroupBy eq 'Queue' ) {
- $class = "RT::Queue";
- }
- elsif ( $PrimaryGroupBy eq 'Owner' ) {
- $class = "RT::User";
- }
- if ($class) {
- my $q = $class->new( $session{'CurrentUser'} );
- $q->Load( $entry->__Value($PrimaryGroupBy) );
- push @keys, $q->Name();
- }
- else {
- push @keys, $entry->__Value($PrimaryGroupBy);
- }
- push @values, $entry->id;
- }
my $title = loc("[_1] grouped by [_2]",$Query, $PrimaryGroupBy);
-my $query_string = $m->comp('/Elements/QueryString', %ARGS);
</%init>
<& /Elements/Header, Title => $title &>
-<& /Ticket/Elements/Tabs &>
-
-<img src="<%$RT::WebPath%>/Search/Chart.png?<%$query_string|n%>">
-<br>
-
-<table class="collection-as-table">
-<tr>
-<th class="collection-as-table"><%loc($PrimaryGroupBy)%>
-</th>
-<th class="collection-as-table"><&|/l&>Tickets</&>
-</th>
-</tr>
-% my $i;
-% while (my $key = shift @keys) {
-% $i++;
-<tr class="<%$i%2 ? 'evenline' : 'oddline' %>">
-<td class="label collection-as-table">
-<%$key%>
-</td>
-<td class="value collection-as-table">
-<%shift @values%>
-</td>
-</tr>
-% }
-</table>
-
+<& /Ticket/Elements/Tabs, Title => $title &>
+<& /Search/Elements/Chart, %ARGS &>
Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Chart.png
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Chart.png (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Chart.png Fri May 6 13:59:35 2005
@@ -45,7 +45,6 @@
#$tix->Column( FIELD => $SecondaryGroupBy);
$tix->FromSQL($Query);
$tix->_DoSearch();
-warn YAML::Dump($tix);
while ( my $entry = $tix->Next ) {
my $class;
if ( $PrimaryGroupBy eq 'Queue' ) {
@@ -79,6 +78,11 @@
) or die $chart->error;
+ unless (@keys && @values) {
+ @keys = ('');
+ @values = (0);
+ }
+
my $plot = $chart->plot( [ [@keys], [@values] ] ) or die $chart->error;
$r->content_type('image/png');
$m->out( $plot->png );
Added: rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/Chart
==============================================================================
--- (empty file)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/Chart Fri May 6 13:59:35 2005
@@ -0,0 +1,73 @@
+<%args>
+$Query => "id > 0"
+$PrimaryGroupBy => 'Queue'
+$SecondaryGroupBy => undef
+$ChartStyle => 'bars'
+</%args>
+<%init>
+my @keys;
+my @values;
+
+use RT::Report::Tickets;
+
+my $tix = RT::Report::Tickets->new( $session{'CurrentUser'} );
+
+my @groupby = (
+ { FIELD => $PrimaryGroupBy },
+
+ #{ FIELD => $SecondaryGroupBy}
+);
+$tix->GroupByCols(@groupby);
+$tix->Column( FUNCTION => 'COUNT', FIELD => 'id' );
+$tix->Column( FIELD => $PrimaryGroupBy );
+
+#$tix->Column( FIELD => $SecondaryGroupBy);
+$tix->FromSQL($Query);
+$tix->_DoSearch();
+while ( my $entry = $tix->Next ) {
+ my $class;
+ if ( $PrimaryGroupBy eq 'Queue' ) {
+ $class = "RT::Queue";
+ }
+ elsif ( $PrimaryGroupBy eq 'Owner' ) {
+ $class = "RT::User";
+ }
+ if ($class) {
+ my $q = $class->new( $session{'CurrentUser'} );
+ $q->Load( $entry->__Value($PrimaryGroupBy) );
+ push @keys, $q->Name();
+ }
+ else {
+ push @keys, $entry->__Value($PrimaryGroupBy);
+ }
+ push @values, $entry->id;
+ }
+
+
+my $query_string = $m->comp('/Elements/QueryString', %ARGS);
+</%init>
+
+<img src="<%$RT::WebPath%>/Search/Chart.png?<%$query_string|n%>">
+<br>
+
+<table class="collection-as-table">
+<tr>
+<th class="collection-as-table"><%loc($PrimaryGroupBy)%>
+</th>
+<th class="collection-as-table"><&|/l&>Tickets</&>
+</th>
+</tr>
+% my $i;
+% while (my $key = shift @keys) {
+% $i++;
+<tr class="<%$i%2 ? 'evenline' : 'oddline' %>">
+<td class="label collection-as-table">
+<%$key%>
+</td>
+<td class="value collection-as-table">
+<%shift @values%>
+</td>
+</tr>
+% }
+</table>
+
Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Elements/Tabs
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Elements/Tabs (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Elements/Tabs Fri May 6 13:59:35 2005
@@ -45,25 +45,28 @@
%# END BPS TAGGED BLOCK }}}
<& /Elements/Tabs,
tabs => $tabs,
- current_toptab => 'Tools/Offline.html',
+ current_toptab => 'Tools/index.html',
current_tab => $current_tab,
Title => $Title &>
<%INIT>
- my $tabs = { a => { title => loc('Offline'),
- path => 'Tools/Offline.html',
- },
- };
-
- foreach my $tab (sort keys %{$tabs}) {
- if ($tabs->{$tab}->{'path'} eq $current_tab) {
- $tabs->{$tab}->{"subtabs"} = $subtabs;
- $tabs->{$tab}->{"current_subtab"} = $current_subtab;
+my $tabs = {
+ a => {
+ title => loc('Offline'),
+ path => 'Tools/Offline.html',
+ },
+ b => {
+ title => loc('Reports'),
+ path => 'Tools/Reports/index.html',
+ },
+};
+foreach my $tab ( sort keys %{$tabs} ) {
+ if ( $tabs->{$tab}->{'path'} eq $current_tab ) {
+ $tabs->{$tab}->{"subtabs"} = $subtabs;
+ $tabs->{$tab}->{"current_subtab"} = $current_subtab;
}
- }
+}
</%INIT>
-
-
<%ARGS>
$subtabs => undef
$current_tab => undef
Added: rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/CreatedByDates.html
==============================================================================
--- (empty file)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/CreatedByDates.html Fri May 6 13:59:35 2005
@@ -0,0 +1,47 @@
+<%args>
+$Queue => undef
+$CreatedBefore => undef
+$CreatedAfter => undef
+</%args>
+<%init>
+my $title = loc("Created tickets in period, grouped by status");
+my $q = RT::Queue->new($session{'CurrentUser'});
+my $before = RT::Date->new($session{'CurrentUser'});
+my $after = RT::Date->new($session{'CurrentUser'});
+my $query = 'Status != "deleted" ';
+
+
+if ($CreatedAfter) {
+ $after->Set(Format => 'unknown', Value => $CreatedAfter);
+ $CreatedAfter = $after->AsString;
+}
+if ($CreatedBefore) {
+ $before->Set(Format => 'unknown', Value => $CreatedBefore);
+ $CreatedBefore = $before->AsString;
+}
+
+
+$q->LoadByCols(Name => $Queue);
+</%init>
+<& /Elements/Header, Title => $title &>
+<& /Tools/Reports/Elements/Tabs, current_tab => 'Tools/Reports/CreatedByDates.html', Title => $title &>
+<form method="post" action="CreatedByDates.html">
+% if ($Queue|| $CreatedBefore ||$CreatedAfter) {
+% # if we have a queue, do the search
+% if ($Queue) { $query .= " AND Queue = '$Queue'"}
+% if ($CreatedBefore) { $query .= " AND Created < '".$before->ISO."'"; }
+% if ($CreatedAfter) { $query .= " AND Created > '".$after->ISO."'"}
+% my $groupby = 'Status';
+<& /Search/Elements/Chart, Query => $query, PrimaryGroupBy => $groupby &>
+% }
+
+<hr>
+
+<br/><&|/l&>Queue</&>: <& /Elements/SelectQueue, Name => 'Queue', NamedValues => 1, Default => $q->id &>
+<br/><&|/l&>Tickets resolved after</&>:
+<input size=20 name="CreatedAfter" value="<%$CreatedAfter%>"/>
+<br/><&|/l&>Tickets resolved before</&>:
+<input size=20 name="CreatedBefore" value="<%$CreatedBefore%>"/>
+
+<& /Elements/Submit&>
+</form>
Added: rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/Elements/Tabs
==============================================================================
--- (empty file)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/Elements/Tabs Fri May 6 13:59:35 2005
@@ -0,0 +1,82 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2005 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+%#
+%#
+%# 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 }}}
+<& /Tools/Elements/Tabs,
+ subtabs => $tabs,
+ current_tab => 'Tools/Reports/index.html',
+ current_subtab => $current_tab,
+ Title => $Title &>
+
+<%INIT>
+my $tabs = {
+ a => {
+ title => loc('Resolved by owner'),
+ path => 'Tools/Reports/ResolvedByOwner.html',
+ },
+ b => {
+ title => loc('Resolved in date range'),
+ path => 'Tools/Reports/ResolvedByDates.html',
+ },
+ c => {
+ title => loc('Created in a date range'),
+ path => 'Tools/Reports/CreatedByDates.html',
+ },
+};
+
+foreach my $tab ( sort keys %{$tabs} ) {
+ if ( $tabs->{$tab}->{'path'} eq $current_tab ) {
+ $tabs->{$tab}->{"subtabs"} = $subtabs;
+ $tabs->{$tab}->{"current_subtab"} = $current_subtab;
+ }
+}
+</%INIT>
+
+
+<%ARGS>
+$subtabs => undef
+$current_tab => undef
+$current_subtab => undef
+$Title => undef
+</%ARGS>
Added: rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/ResolvedByDates.html
==============================================================================
--- (empty file)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/ResolvedByDates.html Fri May 6 13:59:35 2005
@@ -0,0 +1,48 @@
+<%args>
+$Queue => undef
+$ResolvedBefore => undef
+$ResolvedAfter => undef
+</%args>
+<%init>
+my $title = loc("Resolved tickets in period, grouped by owner");
+my $q = RT::Queue->new($session{'CurrentUser'});
+my $before = RT::Date->new($session{'CurrentUser'});
+my $after = RT::Date->new($session{'CurrentUser'});
+my $query = '';
+
+
+if ($ResolvedAfter) {
+ $after->Set(Format => 'unknown', Value => $ResolvedAfter);
+ $ResolvedAfter = $after->AsString;
+}
+if ($ResolvedBefore) {
+ $before->Set(Format => 'unknown', Value => $ResolvedBefore);
+ $ResolvedBefore = $before->AsString;
+}
+
+
+$q->LoadByCols(Name => $Queue);
+</%init>
+<& /Elements/Header, Title => $title &>
+<& /Tools/Reports/Elements/Tabs, current_tab => 'Tools/Reports/ResolvedByDates.html', Title => $title &>
+<form method="post" action="ResolvedByDates.html">
+% if ($Queue|| $ResolvedBefore ||$ResolvedAfter) {
+% # if we have a queue, do the search
+% $query = "Status = 'resolved'";
+% if ($Queue) { $query .= " AND Queue = '$Queue'"}
+% if ($ResolvedBefore) { $query .= " AND Resolved < '".$before->ISO."'"; }
+% if ($ResolvedAfter) { $query .= " AND Resolved > '".$after->ISO."'"}
+% my $groupby = 'Owner';
+<& /Search/Elements/Chart, Query => $query, PrimaryGroupBy => $groupby &>
+% }
+
+<hr>
+
+<br/><&|/l&>Queue</&>: <& /Elements/SelectQueue, Name => 'Queue', NamedValues => 1, Default => $q->id &>
+<br/><&|/l&>Tickets resolved after</&>:
+<input size=20 name="ResolvedAfter" value="<%$ResolvedAfter%>"/>
+<br/><&|/l&>Tickets resolved before</&>:
+<input size=20 name="ResolvedBefore" value="<%$ResolvedBefore%>"/>
+
+<& /Elements/Submit&>
+</form>
Added: rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/ResolvedByOwner.html
==============================================================================
--- (empty file)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/ResolvedByOwner.html Fri May 6 13:59:35 2005
@@ -0,0 +1,23 @@
+<%args>
+$Queue => undef
+</%args>
+<%init>
+my $title = loc("Resolved tickets, grouped by owner");
+my $q = RT::Queue->new($session{'CurrentUser'});
+$q->LoadByCols(Name => $Queue);
+</%init>
+<& /Elements/Header, Title => $title &>
+<& /Tools/Reports/Elements/Tabs, current_subtab => '/Tools/Reports/ResolvedByOwner', Title => $title &>
+<form method="post" action="ResolvedByOwner.html">
+% if ($Queue) {
+% # if we have a queue, do the search
+% my $query = "Status = 'resolved' AND Queue = '$Queue'";
+% my $groupby = 'Owner';
+<& /Search/Elements/Chart, Query => $query, PrimaryGroupBy => $groupby &>
+% }
+
+<hr>
+
+<&|/l&>Queue</&>: <& /Elements/SelectQueue, Name => 'Queue', NamedValues => 1, Default => $q->id &>
+<& /Elements/Submit&>
+</form>
Added: rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/index.html
==============================================================================
--- (empty file)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/Reports/index.html Fri May 6 13:59:35 2005
@@ -0,0 +1,7 @@
+<& /Elements/Header, title => 'Reports'&>
+<& /Tools/Reports/Elements/Tabs &>
+
+
+Find all tickets
+
+Group the results by
More information about the Rt-commit
mailing list