[Bps-public-commit] r19434 - in RT-Extension-SLA: . html html/Callbacks html/Callbacks/RT-Extension-SLA html/Callbacks/RT-Extension-SLA/Tools html/Callbacks/RT-Extension-SLA/Tools/Reports html/Callbacks/RT-Extension-SLA/Tools/Reports/Elements html/Callbacks/RT-Extension-SLA/Tools/Reports/Elements/Tabs html/Tools html/Tools/Reports t
ruz at bestpractical.com
ruz at bestpractical.com
Mon May 4 21:11:12 EDT 2009
Author: ruz
Date: Mon May 4 21:11:11 2009
New Revision: 19434
Added:
RT-Extension-SLA/html/
RT-Extension-SLA/html/Callbacks/
RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/
RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Tools/
RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Tools/Reports/
RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Tools/Reports/Elements/
RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Tools/Reports/Elements/Tabs/
RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Tools/Reports/Elements/Tabs/Default
RT-Extension-SLA/html/Tools/
RT-Extension-SLA/html/Tools/Reports/
RT-Extension-SLA/html/Tools/Reports/SLA.html
Modified:
RT-Extension-SLA/META.yml
RT-Extension-SLA/lib/RT/Extension/SLA/Summary.pm
RT-Extension-SLA/t/basics.t
Log:
* add first html, more simple tests and changes Summary
Modified: RT-Extension-SLA/META.yml
==============================================================================
--- RT-Extension-SLA/META.yml (original)
+++ RT-Extension-SLA/META.yml Mon May 4 21:11:11 2009
@@ -17,6 +17,7 @@
no_index:
directory:
- etc
+ - html
- inc
- t
requires:
Added: RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Tools/Reports/Elements/Tabs/Default
==============================================================================
--- (empty file)
+++ RT-Extension-SLA/html/Callbacks/RT-Extension-SLA/Tools/Reports/Elements/Tabs/Default Mon May 4 21:11:11 2009
@@ -0,0 +1,9 @@
+<%ARGS>
+$tabs => {}
+</%ARGS>
+<%INIT>
+$tabs->{'s'} = {
+ title => loc('Service Level Aggreements'),
+ path => 'Tools/Reports/SLA.html',
+};
+</%INIT>
Added: RT-Extension-SLA/html/Tools/Reports/SLA.html
==============================================================================
--- (empty file)
+++ RT-Extension-SLA/html/Tools/Reports/SLA.html Mon May 4 21:11:11 2009
@@ -0,0 +1,43 @@
+<& /Elements/Header, Title => $title &>
+<& /Tools/Reports/Elements/Tabs, current_tab => 'Tools/Reports/SLA.html', Title => $title &>
+
+<table>
+<tr>
+<th><% loc('Owner') %></th>
+% my @columns = $summary->Labels;
+% my $i = 0;
+% foreach ( map $_->[0], grep $i++%2, @columns ) {
+<th><% loc($_) %></th>
+% }
+</tr>
+
+% while ( my ($owner, $stats) = each %$result ) {
+ <tr><td><% $owner %><td>
+% my $i = 1;
+% foreach ( map $stats->{ $_ }, grep $i++%2, @columns ) {
+<td><% $_ || 0 %></td>
+% }
+ </tr>
+% }
+</table>
+
+<%ARGS>
+$Query => undef
+</%ARGS>
+<%INIT>
+my $title = loc("Report on Service Level Agreements");
+
+use RT::Extension::SLA::Summary;
+my $summary = new RT::Extension::SLA::Summary;
+
+my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
+$tickets->FromSQL( $Query );
+$tickets->OrderByCols( {FIELD => 'id', ORDER => 'ASC'} );
+while ( my $ticket = $tickets->Next ) {
+ my $report = RT::Extension::SLA->Report( Ticket => $ticket );
+ $summary->AddReport( $report );
+}
+
+my $result = $summary->Result;
+
+</%INIT>
Modified: RT-Extension-SLA/lib/RT/Extension/SLA/Summary.pm
==============================================================================
--- RT-Extension-SLA/lib/RT/Extension/SLA/Summary.pm (original)
+++ RT-Extension-SLA/lib/RT/Extension/SLA/Summary.pm Mon May 4 21:11:11 2009
@@ -20,6 +20,18 @@
return $self->{'Result'} ||= { };
}
+our @known_stats = (
+ 'passed' => ['Passed', 'Replied before a deadline'],
+ 'failed' => ['Failed', 'Replied after a deadline or not replied at all'],
+ 'helped' => ['Helped', 'Helped another user to reach a deadline'],
+ 'late help' => ['Helped (late)', 'Helped another user, however failed a deadline'],
+ 'got help' => ['Got help', 'Got help from another user within a deadline'],
+);
+
+sub Labels {
+ return @known_stats;
+}
+
sub AddReport {
my $self = shift;
my $report = shift;
Modified: RT-Extension-SLA/t/basics.t
==============================================================================
--- RT-Extension-SLA/t/basics.t (original)
+++ RT-Extension-SLA/t/basics.t Mon May 4 21:11:11 2009
@@ -3,10 +3,11 @@
use strict;
use warnings;
-use Test::More tests => 2;
+use Test::More tests => 3;
use_ok 'RT::Extension::SLA';
use_ok 'RT::Extension::SLA::Report';
+use_ok 'RT::Extension::SLA::Summary';
1;
More information about the Bps-public-commit
mailing list