[rt-devel] New Release of the Statistics package
Autrijus Tang
autrijus at autrijus.org
Fri Jul 25 07:09:44 EDT 2003
On Thu, Jul 24, 2003 at 01:19:22PM +0200, Harald Wagener wrote:
> - no localization - everything is in english.
The patch below provides internationalization framework,
as well as s/killed/deleted/ for $status.
Thanks,
/Autrijus/
diff -dur Statistics.old/CallsMultiQueue/Elements/Chart Statistics/CallsMultiQueue/Elements/Chart
--- Statistics.old/CallsMultiQueue/Elements/Chart Thu Jul 24 20:01:10 2003
+++ Statistics/CallsMultiQueue/Elements/Chart Fri Jul 25 14:38:59 2003
@@ -1,28 +1,22 @@
-<%perl>
-print $graph->plot(\@data)->$format();
-$m->abort();
-print "<em>";
-print $#data+1 . " Plot Elements:</em><p>";
-for (0..$#data) {
- print $data[$_];
- print "<p>";
-}
-print "<em>x_labels:</em><p>";
-print $ARGS{x_labels};
-print "<p>";
-print "<em>legend:</em><p>";
-print $ARGS{set_legend};
-print "<p>";
+% $m->print($graph->plot(\@data)->$format());
+% $m->abort();
+
+<em><&|/l, $#data+1&>[_1] Plot Elements</&></em><p>
+% foreach my $value (@data) {
+<% $value %><p>
+% }
+<em><&|/l&>x_labels</&>:</em><p>
+<% $ARGS{x_labels} %>
+<p>
+<em><&|/l&>legend</&>:</em><p>
+<% $ARGS{set_legend} %>
+<p>
+<em><&|/l, (keys %ARGS) - 2&>[_1] data sets</&>:</em><p>
+
+% for (1..(scalar keys %ARGS)-2) {
+<% $_ %> <% $ARGS{"data$_"} %><p>
+% }
-print "<em>";
-print ((scalar keys %ARGS)-2);
-print " data sets:</em><p>";
-for (1..(scalar keys %ARGS)-2) {
- print "$_ ";
- #print $ARGS{data1};
- print $ARGS{"data".$_} . "<p>";
-}
-</%perl>
<%INIT>
use GD::Graph::lines;
@@ -31,7 +25,7 @@
my $format = $graph->export_format;
$graph->set(export_format => "png");
$graph->set_legend(split /,/ , $ARGS{set_legend});
-print $r->header_out("image/$format");
+$r->content_type("image/$format");
push @data, [split /,/ , $ARGS{x_labels}];
for (1..((scalar keys %ARGS)-2)) {
push @data, [split /,/ , $ARGS{"data".$_}];
diff -dur Statistics.old/CallsMultiQueue/index.html Statistics/CallsMultiQueue/index.html
--- Statistics.old/CallsMultiQueue/index.html Thu Jul 24 20:01:10 2003
+++ Statistics/CallsMultiQueue/index.html Fri Jul 25 14:41:32 2003
@@ -1,5 +1,5 @@
-<& /Elements/Header, Title => 'RT Statistics: Calls per queue per day' &>
-<& /Statistics/Elements/Tabs, Title => 'RT Statistics: Calls per queue per day' &>
+<& /Elements/Header, Title => loc('RT Statistics: Calls per queue per day') &>
+<& /Statistics/Elements/Tabs, Title => loc('RT Statistics: Calls per queue per day') &>
<form method="POST">
@@ -12,7 +12,7 @@
<table border=1 width="100%">
<tr>
- <th width="<% 100/(keys %queues) %>%" nowrap> Dates </th>
+ <th width="<% 100/(keys %queues) %>%" nowrap> <&|/l&>Dates</&> </th>
% my @legend;
% for (sort keys %queues) {
% push @legend, $_;
@@ -52,8 +52,8 @@
% $tix->LimitCreated(VALUE => $dates[$d+1]->ISO, OPERATOR => "<=");
% }
% }
-% elsif ($status eq "killed") {
-% $tix->LimitStatus(VALUE => "dead");
+% elsif ($status eq "deleted") {
+% $tix->LimitStatus(VALUE => $status);
% $tix->LimitLastUpdated(VALUE => $dates[$d]->ISO, OPERATOR => ">=");
% if ($dates[$d+1]) {
% $tix->LimitLastUpdated(VALUE => $dates[$d+1]->ISO, OPERATOR => "<=");
@@ -68,26 +68,26 @@
% }
</table>
-Show:
+<&|/l&>Show</&>:
<SELECT NAME="status">
-% for (qw(resolved created killed)) {
+% for (qw(resolved created deleted)) {
<OPTION VALUE="<% $_ %>" <% $_ eq $status && "SELECTED" %>>
- <% ucfirst $_ %></OPTION>
+ <% loc($_) %></OPTION>
% }
</SELECT>
-Add Queue: <SELECT NAME="queues"> <OPTION VALUE="">-</OPTION>
+<&|/l&>Add Queue</&>: <SELECT NAME="queues"> <OPTION VALUE="">-</OPTION>
% while (my $q = $queue->Next) {
% next if exists $queues{$q->Name} or !$q->CurrentUserHasRight('SeeQueue');
<OPTION VALUE="<% $q->Name%>"><% $q->Name %></OPTION>
% }
</SELECT>
-Days to see:
+<&|/l&>Days to see</&>:
<INPUT TYPE=text MAXLENGTH=2 SIZE=3 VALUE="<% 1+$max %>" NAME="max">
-See weekends:
+<&|/l&>See weekends</&>:
<INPUT TYPE="checkbox" <% $weekends && 'CHECKED' %> name="weekends">
-<INPUT TYPE="submit" VALUE="Go!"</INPUT>
+<INPUT TYPE="submit" VALUE="<&|/l&>Go!</&>"</INPUT>
<BR>
Only in Statistics.old/CallsQueueDay: .index.html.swp
diff -dur Statistics.old/CallsQueueDay/Elements/Chart Statistics/CallsQueueDay/Elements/Chart
--- Statistics.old/CallsQueueDay/Elements/Chart Thu Jul 24 20:01:10 2003
+++ Statistics/CallsQueueDay/Elements/Chart Fri Jul 25 14:37:49 2003
@@ -1,12 +1,9 @@
-<%perl>
-print $graph->plot(\@data)->$format();
-$m->abort();
-print $#data+1 . " Elements:<p>";
-for (0..$#data) {
-print $data[$_];
-print "<p>";
-}
-</%perl>
+% $m->print($graph->plot(\@data)->$format());
+% $m->abort();
+<&|/l, $#data+1&>[_1] Elements</&>:<p>
+% for (0..$#data) {
+<% $data[$_] %><p>
+% }
<%INIT>
use GD::Graph::lines;
@@ -20,7 +17,7 @@
push @data, [split /,/ , $ARGS{data3}];
my $format = $graph->export_format;
-print $r->header_out("image/$format");
+$r->content_type("image/$format");
</%INIT>
<%ARGS>
</%ARGS>
diff -dur Statistics.old/CallsQueueDay/index.html Statistics/CallsQueueDay/index.html
--- Statistics.old/CallsQueueDay/index.html Thu Jul 24 20:01:10 2003
+++ Statistics/CallsQueueDay/index.html Fri Jul 25 14:41:55 2003
@@ -1,13 +1,13 @@
-<& /Elements/Header, Title => 'RT Statistics: Calls per day' &>
-<& /Statistics/Elements/Tabs, Title => 'RT Statistics: Calls per day' &>
+<& /Elements/Header, Title => loc('RT Statistics: Calls per day') &>
+<& /Statistics/Elements/Tabs, Title => loc('RT Statistics: Calls per day') &>
<form method="POST">
<table border=1 width="100%">
<tr>
- <th width="33%" nowrap> Dates </th>
-% for my $status (qw(resolved created killed)) {
- <th width="33%" nowrap> <% $status %>
+ <th width="33%" nowrap> <&|/l&>Dates</&> </th>
+% for my $status (qw(resolved created deleted)) {
+ <th width="33%" nowrap> <% loc($status) %>
% }
</tr>
% for my $d (0..$#dates) {
@@ -15,7 +15,7 @@
<tr>
<td><% $days[(localtime($dates[$d]->Unix))[6]]." ". (localtime($dates[$d]->Unix))[3]%></th>
-% for my $status (qw(resolved created killed)) {
+% for my $status (qw(resolved created deleted)) {
% my $tix = new RT::Tickets($session{'CurrentUser'});
<td align=right>
% if ($status eq "resolved") {
@@ -31,8 +31,8 @@
% $tix->LimitCreated(VALUE => $dates[$d+1]->ISO, OPERATOR => "<=");
% }
% }
-% elsif ($status eq "killed") {
-% $tix->LimitStatus(VALUE => "dead");
+% elsif ($status eq "deleted") {
+% $tix->LimitStatus(VALUE => $status);
% $tix->LimitLastUpdated(VALUE => $dates[$d]->ISO, OPERATOR => ">=");
% if ($dates[$d+1]) {
% $tix->LimitLastUpdated(VALUE => $dates[$d+1]->ISO, OPERATOR => "<=");
@@ -47,13 +47,13 @@
%}
</table>
-See Queue:<BR>
+<&|/l&>See Queue</&>:<BR>
<& /Elements/SelectQueue, Name=>"queue", ShowNullOption=>0 &>
-Days to see:
+<&|/l&>Days to see</&>:
<INPUT TYPE=text MAXLENGTH=2 SIZE=3 VALUE="<% 1+$max %>" NAME="max">
-See weekends:
+<&|/l&>See weekends</&>:
<INPUT TYPE="checkbox" <% $weekends && 'CHECKED' %> name="weekends">
-<INPUT TYPE="submit" VALUE="Go!"</INPUT>
+<INPUT TYPE="submit" VALUE="<&|/l&>Go!</&>"</INPUT>
</form>
<BR>
<%perl>
@@ -71,8 +71,8 @@
</%perl>
<IMG SRC="<% $url %>" type="image/png">
<BR>
-<font color="red"> Resolved</FONT> <font color="green">Created</font>
-<font color="blue"> Killed </font> <BR>
+<font color="red"> <&|/l&>Resolved</&></FONT> <font color="green"><&|/l&>Created</&></font>
+<font color="blue"> <&|/l&>Killed</&> </font> <BR>
<%ARGS>
$max => 5
diff -dur Statistics.old/DayOfWeek/Elements/Chart Statistics/DayOfWeek/Elements/Chart
--- Statistics.old/DayOfWeek/Elements/Chart Fri Jul 25 14:39:28 2003
+++ Statistics/DayOfWeek/Elements/Chart Fri Jul 25 14:39:04 2003
@@ -1,12 +1,9 @@
-<%perl>
-print $graph->plot(\@data)->$format();
-$m->abort();
-print $#data+1 . " Elements:<p>";
-for (0..$#data) {
-print $data[$_];
-print "<p>";
-}
-</%perl>
+% $m->print($graph->plot(\@data)->$format());
+% $m->abort();
+<&|/l, $#data+1&>[_1] Elements</&>:<p>
+% for (0..$#data) {
+<% $data[$_] %><p>
+% }
<%INIT>
use GD::Graph::bars;
@@ -20,7 +17,7 @@
push @data, [split /,/ , $ARGS{data3}];
my $format = $graph->export_format;
-print $r->header_out("image/$format");
+$r->content_type("image/$format");
</%INIT>
<%ARGS>
</%ARGS>
diff -dur Statistics.old/DayOfWeek/index.html Statistics/DayOfWeek/index.html
--- Statistics.old/DayOfWeek/index.html Thu Jul 24 20:01:10 2003
+++ Statistics/DayOfWeek/index.html Fri Jul 25 14:42:28 2003
@@ -1,30 +1,30 @@
-<& /Elements/Header, Title =>'RT Statistics: Calls by Day Of Week' &>
-<& /Statistics/Elements/Tabs, Title =>'RT Statistics: Calls by Day Of Week' &>
+<& /Elements/Header, Title =>loc('RT Statistics: Calls by Day Of Week') &>
+<& /Statistics/Elements/Tabs, Title =>loc('RT Statistics: Calls by Day Of Week') &>
-<H2> Number of Tickets Handled in <% $QueueObj->Name %> Per Day </H2>
+<H2><&|/l, $QueueObj->Name&>Number of Tickets Handled in [_1] Per Day</&></H2>
<form method="POST">
<table border=1 width="100%">
<tr>
- <th width="33%" nowrap> Dates </th>
-% for my $status (qw(resolved created killed)) {
- <th width="33%" nowrap> <% $status %>
+ <th width="33%" nowrap> <&|/l&>Dates</&> </th>
+% for my $status (qw(resolved created deleted)) {
+ <th width="33%" nowrap> <% loc($status) %>
% }
</tr>
% for my $d (0..$#days) {
<tr>
- <td> <% $days[$d] %> </td>
-% for my $status (qw(resolved created killed)) {
+ <td> <% loc($days[$d]) %> </td>
+% for my $status (qw(resolved created deleted)) {
<td> <% $counts[$d]{$status} %></td>
% }
</tr>
% }
</table>
-See Queue:<BR>
+<&|/l&>See Queue</&>:<BR>
<& /Elements/SelectQueue, Name=>"queue", ShowNullOption=>0 &>
<BR>
-<INPUT TYPE="submit" VALUE="Go!"</INPUT>
+<INPUT TYPE="submit" VALUE="<&|/l&>Go!</&>"</INPUT>
</form>
<BR>
@@ -36,7 +36,7 @@
chop $url;
$url .= "&";
-my @things = qw(resolved created killed);
+my @things = qw(resolved created deleted);
for my $th (0..$#things) {
$url .= "data".(1+$th)."=".(join ",", map { $counts[$_]{$things[$th]} } (0..6))."&";
}
@@ -44,8 +44,8 @@
</%perl>
<IMG SRC="<% $url %>">
<BR>
-<font color="red"> Resolved</FONT> <font color="green">Created</font>
-<font color="blue"> Killed </font> <BR>
+<font color="red"> <&|/l&>Resolved</&></FONT> <font color="green"><&|/l&>Created</&></font>
+<font color="blue"> <&|/l&>Killed</&> </font> <BR>
<%ARGS>
$max => 5
@@ -72,8 +72,8 @@
while (my $t = $tix->RT::SearchBuilder::Next) { # BLOODY HACK
$counts[(localtime($t->ResolvedObj->Unix))[6]]{resolved}++
if $t->Status eq "resolved";
- $counts[(localtime($t->LastUpdatedObj->Unix))[6]]{killed}++
- if $t->Status eq "dead";
+ $counts[(localtime($t->LastUpdatedObj->Unix))[6]]{deleted}++
+ if $t->Status eq "deleted";
$counts[(localtime($t->CreatedObj->Unix))[6]]{created}++
}
}
diff -dur Statistics.old/Elements/CallTabs Statistics/Elements/CallTabs
--- Statistics.old/Elements/CallTabs Thu Jul 24 20:01:10 2003
+++ Statistics/Elements/CallTabs Thu Jul 24 20:02:00 2003
@@ -1,11 +1,11 @@
<%INIT>
- my $tabs = { CallsByDay => { title => 'Calls per Queue per day',
+ my $tabs = { CallsByDay => { title => loc('Calls per Queue per day'),
path => 'CallsByDay.html'
},
- CallsMultiQueue => { title => 'Calls by Multiple Queues per day',
+ CallsMultiQueue => { title => loc('Calls by Multiple Queues per day'),
path => 'CallsMultiQueue.html',
},
- DayOfWeek => { title => 'Calls by Day Of Week',
+ DayOfWeek => { title => loc('Calls by Day Of Week'),
path => 'DayOfWeek.html',
}
};
diff -dur Statistics.old/Elements/DurationAsString Statistics/Elements/DurationAsString
--- Statistics.old/Elements/DurationAsString Thu Jul 24 20:01:10 2003
+++ Statistics/Elements/DurationAsString Thu Jul 24 20:02:39 2003
@@ -1,4 +1,4 @@
-<%$days|'00'%> days <%$hours|'00'%>:<%$minutes|'00'%>
+<%$days|'00'%> <&|/l&>days</&> <%$hours|'00'%>:<%$minutes|'00'%>
<%INIT>
my $MINUTE = 60;
diff -dur Statistics.old/Resolution/Elements/Chart Statistics/Resolution/Elements/Chart
--- Statistics.old/Resolution/Elements/Chart Thu Jul 24 20:01:10 2003
+++ Statistics/Resolution/Elements/Chart Fri Jul 25 14:39:12 2003
@@ -1,12 +1,9 @@
-<%perl>
-print $graph->plot(\@data)->$format();
-$m->abort();
-print $#data+1 . " Elements:<p>";
-for (0..$#data) {
-print $data[$_];
-print "<p>";
-}
-</%perl>
+% $m->print($graph->plot(\@data)->$format());
+% $m->abort();
+<&|/l, $#data+1&>[_1] Elements</&>:<p>
+% for (0..$#data) {
+<% $data[$_] %><p>
+% }
<%INIT>
use GD::Graph::lines;
@@ -20,7 +17,7 @@
push @data, [split /,/ , $ARGS{data3}];
my $format = $graph->export_format;
-print $r->header_out("image/$format");
+$r->content_type("image/$format");
</%INIT>
<%ARGS>
</%ARGS>
diff -dur Statistics.old/Resolution/index.html Statistics/Resolution/index.html
--- Statistics.old/Resolution/index.html Thu Jul 24 20:01:10 2003
+++ Statistics/Resolution/index.html Fri Jul 25 14:28:59 2003
@@ -1,15 +1,15 @@
-<& /Elements/Header, Title => 'RT Statistics: Average Time To Resolution' &>
-<& /Statistics/Elements/Tabs, Title => "RT Statistics: Average Time To Resolution" &>
+<& /Elements/Header, Title => loc('RT Statistics: Average Time To Resolution') &>
+<& /Statistics/Elements/Tabs, Title => loc("RT Statistics: Average Time To Resolution") &>
-<H2> Times for <% $QueueObj->Name || "All Queues" %> </H2>
+<H2><&|/l, $QueueObj->Name || loc('All Queues')&>Times for [_1]</&></H2>
<form method="POST">
<table border=1 width="100%">
<tr>
- <th width="25%" nowrap> Dates </th>
- <th width="25%" nowrap> Tickets Created On This Day</th>
- <th width="25%" nowrap> Resolved</th>
- <th width="25%" nowrap> Time to Resolution </th>
+ <th width="25%" nowrap> <&|/l&>Dates</&> </th>
+ <th width="25%" nowrap> <&|/l&>Tickets Created On This Day</&></th>
+ <th width="25%" nowrap> <&|/l&>Resolved</&></th>
+ <th width="25%" nowrap> <&|/l&>Time to Resolution</&> </th>
</tr>
% for my $d (0..$#dates) {
% my $x = 1;
@@ -42,25 +42,25 @@
<& /Statistics/Elements/DurationAsString, Duration => $average &>
% $data[$x++][$d] = $average;
% } else {
- N/A
+ <&|/l&>N/A</&>
% }
</td>
</tr>
%}
</table>
-See Queue:<BR>
+<&|/l&>See Queue</&>:<BR>
<& /Elements/SelectQueue, Name=>"queue", ShowNullOption=>1 &>
<BR>
-Days to see:
+<&|/l&>Days to see</&>:
<INPUT TYPE=text MAXLENGTH=3 SIZE=5 VALUE="<% 1+$max %>" NAME="max">
-See weekends:
+<&|/l&>See weekends</&>:
<INPUT TYPE="checkbox" <% $weekends && 'CHECKED' %> name="weekends">
<BR>
<BR>
-<INPUT TYPE="submit" VALUE="Go!"</INPUT>
+<INPUT TYPE="submit" VALUE="<&|/l&>Go!</&>"</INPUT>
</form>
<BR>
diff -dur Statistics.old/TimeToResolve/Elements/Chart Statistics/TimeToResolve/Elements/Chart
--- Statistics.old/TimeToResolve/Elements/Chart Thu Jul 24 20:01:10 2003
+++ Statistics/TimeToResolve/Elements/Chart Fri Jul 25 14:39:19 2003
@@ -1,28 +1,22 @@
-<%perl>
-print $graph->plot(\@data)->$format();
-$m->abort();
-print "<em>";
-print $#data+1 . " Plot Elements:</em><p>";
-for (0..$#data) {
- print $data[$_];
- print "<p>";
-}
-print "<em>x_labels:</em><p>";
-print $ARGS{x_labels};
-print "<p>";
-print "<em>legend:</em><p>";
-print $ARGS{set_legend};
-print "<p>";
+% $m->print($graph->plot(\@data)->$format());
+% $m->abort();
+
+<em><&|/l, $#data+1&>[_1] Plot Elements</&></em><p>
+% foreach my $value (@data) {
+<% $value %><p>
+% }
+<em><&|/l&>x_labels</&>:</em><p>
+<% $ARGS{x_labels} %>
+<p>
+<em><&|/l&>legend</&>:</em><p>
+<% $ARGS{set_legend} %>
+<p>
+<em><&|/l, (keys %ARGS) - 2&>[_1] data sets</&>:</em><p>
+
+% for (1..(scalar keys %ARGS)-2) {
+<% $_ %> <% $ARGS{"data$_"} %><p>
+% }
-print "<em>";
-print ((scalar keys %ARGS)-2);
-print " data sets:</em><p>";
-for (1..(scalar keys %ARGS)-2) {
- print "$_ ";
- #print $ARGS{data1};
- print $ARGS{"data".$_} . "<p>";
-}
-</%perl>
<%INIT>
use GD::Graph::points;
@@ -30,7 +24,7 @@
my $graph = GD::Graph::points->new(400,300);
my $format = $graph->export_format;
$graph->set(export_format => "png", marker_size => $ARGS{marker_size});
-print $r->header_out("image/$format");
+$r->content_type("image/$format");
push @data, [split /,/ , $ARGS{x_labels}];
for (1..((scalar keys %ARGS)-2)) {
push @data, [split /,/ , $ARGS{"data".$_}];
diff -dur Statistics.old/TimeToResolve/index.html Statistics/TimeToResolve/index.html
--- Statistics.old/TimeToResolve/index.html Thu Jul 24 20:01:10 2003
+++ Statistics/TimeToResolve/index.html Fri Jul 25 14:29:46 2003
@@ -1,13 +1,13 @@
-<& /Elements/Header, Title => 'RT Statistics: Time to Resolve' &>
-<& /Statistics/Elements/Tabs, Title => 'Time to Resolve, by ticket' &>
+<& /Elements/Header, Title => loc('RT Statistics: Time to Resolve') &>
+<& /Statistics/Elements/Tabs, Title => loc('Time to Resolve, by ticket') &>
<form method="POST">
-See Queue:<BR>
+<&|/l&>See Queue</&>:<BR>
<& /Elements/SelectQueue, Name=>"queue", Default => "$queue" &>
<BR>
-<INPUT TYPE="submit" VALUE="Go!"</INPUT>
+<INPUT TYPE="submit" VALUE="<&|/l&>Go!</&>"</INPUT>
</form>
<BR>
diff -dur Statistics.old/index.html Statistics/index.html
--- Statistics.old/index.html Thu Jul 24 20:01:10 2003
+++ Statistics/index.html Thu Jul 24 20:01:32 2003
@@ -1,6 +1,6 @@
-<HTML><HEAD><TITLE>RT Statistics</TITLE>
+<HTML><HEAD><TITLE><&|/l&>RT Statistics</&></TITLE>
</HEAD>
-<& /Elements/Header, Title => 'Statistics' &>
-<& /Statistics/Elements/Tabs, Title => 'Statistics' &>
+<& /Elements/Header, Title => loc('Statistics') &>
+<& /Statistics/Elements/Tabs, Title => loc('Statistics') &>
</BODY>
</HTML>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: not available
Url : http://pallas.eruditorum.org/pipermail/rt-devel/attachments/20030725/9bad13dc/attachment.pgp
More information about the Rt-devel
mailing list