[Rt-commit] r2852 - in rt/branches/QUEBEC-EXPERIMENTAL: . etc
html/Search html/Search/Elements html/Tools lib/RT
lib/RT/Report sbin
jesse at bestpractical.com
jesse at bestpractical.com
Sun May 8 23:33:19 EDT 2005
Author: jesse
Date: Sun May 8 23:33:18 2005
New Revision: 2852
Added:
rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/index.html
Modified:
rt/branches/QUEBEC-EXPERIMENTAL/ (props changed)
rt/branches/QUEBEC-EXPERIMENTAL/etc/RT_SiteConfig.pm
rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Chart.png
rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/Chart
rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/SelectGroupBy
rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Report/Tickets.pm
rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/SearchBuilder.pm
rt/branches/QUEBEC-EXPERIMENTAL/sbin/rt-test-dependencies.in
Log:
r16156 at hualien: jesse | 2005-05-08 23:31:32 -0400
* Better reporting functionality; group by day, month, year
Modified: rt/branches/QUEBEC-EXPERIMENTAL/etc/RT_SiteConfig.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/etc/RT_SiteConfig.pm (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/etc/RT_SiteConfig.pm Sun May 8 23:33:18 2005
@@ -15,5 +15,5 @@
# perl -C /opt/rt3/etc/RT_SiteConfig.pm
Set( $rtname, 'example.com');
-
+Set( $DevelMode => 1);
1;
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 Sun May 8 23:33:18 2005
@@ -33,16 +33,10 @@
}
my $tix = RT::Report::Tickets->new( $session{'CurrentUser'} );
-my @groupby = (
- { FIELD => $PrimaryGroupBy },
-
- #{ FIELD => $SecondaryGroupBy}
-);
-$tix->GroupByCols(@groupby);
+$tix->GroupBy($PrimaryGroupBy);
$tix->Column( FUNCTION => 'COUNT', FIELD => 'id' );
$tix->Column( FIELD => $PrimaryGroupBy );
-#$tix->Column( FIELD => $SecondaryGroupBy);
$tix->FromSQL($Query);
$tix->_DoSearch();
while ( my $entry = $tix->Next ) {
Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/Chart
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/Chart (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/Chart Sun May 8 23:33:18 2005
@@ -12,16 +12,9 @@
my $tix = RT::Report::Tickets->new( $session{'CurrentUser'} );
-my @groupby = (
- { FIELD => $PrimaryGroupBy },
-
- #{ FIELD => $SecondaryGroupBy}
-);
-$tix->GroupByCols(@groupby);
+$tix->GroupBy($PrimaryGroupBy);
$tix->Column( FUNCTION => 'COUNT', FIELD => 'id' );
$tix->Column( FIELD => $PrimaryGroupBy );
-
-#$tix->Column( FIELD => $SecondaryGroupBy);
$tix->FromSQL($Query);
$tix->_DoSearch();
while ( my $entry = $tix->Next ) {
Modified: rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/SelectGroupBy
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/SelectGroupBy (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Search/Elements/SelectGroupBy Sun May 8 23:33:18 2005
@@ -3,7 +3,12 @@
$Default => 'Status'
</%args>
<select name="<%$Name%>">
-% foreach my $option qw(Owner Queue Status) {
+% foreach my $option (@options) {
<option value="<%$option%>" <% $option eq $Default ? 'SELECTED' : '' %>><%loc($option)%></option>
% }
</select>
+<%init>
+use RT::Report::Tickets;
+my $report = RT::Report::Tickets->new($session{'CurrentUser'});
+my @options = $report->Groupings;
+</%init>
Added: rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/index.html
==============================================================================
--- (empty file)
+++ rt/branches/QUEBEC-EXPERIMENTAL/html/Tools/index.html Sun May 8 23:33:18 2005
@@ -0,0 +1,50 @@
+%# 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 }}}
+<& /Elements/Header, Title => loc("Tools") &>
+<& Elements/Tabs,
+ current_tab => "Tools/index.html",
+ Title => loc("Tools") &>
+
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Report/Tickets.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Report/Tickets.pm (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/Report/Tickets.pm Sun May 8 23:33:18 2005
@@ -3,6 +3,83 @@
use RT::Report::Tickets::Entry;
+sub Groupings {
+ qw (Owner
+ Status
+ Queue
+ DueDaily
+ DueMonthly
+ DueAnnually
+ ResolvedDaily
+ ResolvedMonthly
+ ResolvedAnnually
+ CreatedDaily
+ CreatedMonthly
+ CreatedAnnually
+ LastUpdatedDaily
+ LastUpdatedMonthly
+ LastUpdatedAnnually
+ StartedDaily
+ StartedMonthly
+ StartedAnnually
+ StartsDaily
+ StartsMonthly
+ StartsAnnually
+ )
+
+}
+
+sub GroupBy {
+ my $self = shift;
+ my $field = shift;
+ my $function;
+ (undef, $function) = $self->_FieldToFunction($field);
+ $self->GroupByCols({ FIELD => $field, FUNCTION => $function});
+
+}
+
+sub Column {
+ my $self = shift;
+ my %args = (@_);
+
+ if ( $args{'FIELD'} ) { ( undef, $args{'FUNCTION'} ) = $self->_FieldToFunction( $args{'FIELD'} ); }
+
+ return $self->SUPER::Column(%args);
+}
+
+=head2 _FieldToFunction FIELD
+
+Returns a tuple of the field or a database function to allow grouping on that
+field.
+
+=cut
+
+sub _FieldToFunction{
+ my $self = shift;
+ my $field = shift;
+ my $func = '';
+
+ if ($field =~ /^(.*)(Daily|Monthly|Annually)$/) {
+ $field = $1;
+ $grouping = $2;
+ if ($grouping =~ /Daily/) {
+ $func = "SUBSTR($field,1,10)";
+ $field = '';
+ }
+ elsif ($grouping =~ /Monthly/) {
+ $func = "SUBSTR($field,1,7)";
+ $field = '';
+ }
+ elsif ($grouping =~ /Annually/) {
+ $func = "SUBSTR($field,1,4)";
+ $field = '';
+ }
+
+ }
+ return ($field, $func);
+}
+
+
# Override the AddRecord from DBI::SearchBuilder::Unique. id isn't id here
# wedon't want to disambiguate all the items with a count of 1.
sub AddRecord {
@@ -29,4 +106,8 @@
return RT::Report::Tickets::Entry->new($RT::SystemUser); # $self->CurrentUser);
}
+
+
+
+
1;
Modified: rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/SearchBuilder.pm
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/SearchBuilder.pm (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/lib/RT/SearchBuilder.pm Sun May 8 23:33:18 2005
@@ -67,7 +67,7 @@
package RT::SearchBuilder;
use RT::Base;
-use DBIx::SearchBuilder;
+use DBIx::SearchBuilder 1.27;
use strict;
use vars qw(@ISA);
Modified: rt/branches/QUEBEC-EXPERIMENTAL/sbin/rt-test-dependencies.in
==============================================================================
--- rt/branches/QUEBEC-EXPERIMENTAL/sbin/rt-test-dependencies.in (original)
+++ rt/branches/QUEBEC-EXPERIMENTAL/sbin/rt-test-dependencies.in Sun May 8 23:33:18 2005
@@ -122,7 +122,7 @@
DBI 1.37
Test::Inline
Class::ReturnValue 0.40
-DBIx::SearchBuilder 1.26
+DBIx::SearchBuilder 1.27
Text::Template
File::Spec 0.8
HTML::Entities
More information about the Rt-commit
mailing list