RTx-Statistics in 2.1 / 3.8
[freeside.git] / rt / html / RTx / Statistics / DayOfWeek / index.html
diff --git a/rt/html/RTx/Statistics/DayOfWeek/index.html b/rt/html/RTx/Statistics/DayOfWeek/index.html
deleted file mode 100755 (executable)
index 2e82b9c..0000000
+++ /dev/null
@@ -1,155 +0,0 @@
-<& /Elements/Header, Title =>loc('Tickets by Day Of Week in Queue:' . $QueueObj->Name()) &>
-<& /RTx/Statistics/Elements/Tabs, Title =>loc('Trends in ticket status by Day Of Week in Queue:' . $QueueObj->Name()) &>
-
-<h3>Description</h3>
-<p>The purpose of this page is to show historical trends for each day of the week. 
-It displays details of number of tickets created in your
-selected queue for each day. It also hows how many of those created tickets were Resolved or Deleted</p>
-
-<form method="POST" action="index.html">
-
-
-%my $title = "Ticket counts by day of week in " . $QueueObj->Name();
-<&|/Elements/TitleBox, 
-       title => $title,
-       title_href => "/RTx/Statistics/DayOfWeek/index.html?$QueryString" &>
-<TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH=100%>
-% if ($ShowHeader) {
-<& /RTx/Statistics/Elements/CollectionAsTable/Header, 
-    Format => \@Format, 
-    FormatString => $Format,
-    AllowSorting => $AllowSorting, 
-    Order => $Order, 
-    Query => undef,
-    Rows => $Rows,
-    Page => $Page,
-    OrderBy => $OrderBy , 
-    BaseURL => $BaseURL,
-    maxitems => $maxitems &> 
-% }
-% my $line = 1;
-% for my $d (0..$#days) {
-%     my $x = 1;
-%     $values{Statistics_Date} = $days[$d];
-%# NOTE Show all status values???
-%     $values{Statistics_Created_Count} = $counts[$d]{new};
-%     $values{Statistics_Resolved_Count} = $counts[$d]{resolved};
-%     $values{Statistics_Deleted_Count} = $counts[$d]{deleted};
-<&   /RTx/Statistics/Elements/CollectionAsTable/Row, Format => \@Format, i => $line, record => $record, maxitems => $maxitems &>
-%    $line++;
-% }
-% $values {Statistics_Date} = "Totals";
-% $values {Statistics_Created_Count} = $Totals{new};
-% $values {Statistics_Resolved_Count} = $Totals{resolved};
-% $values {Statistics_Deleted_Count} = $Totals{deleted};
-<&   /RTx/Statistics/Elements/CollectionAsTable/Row, Format => \@BoldFormat, i => $line, record => $record, maxitems => $maxitems &>
-</table>
-</&>
-
-<hr>
-
-<BR />
-<BR />
-
-<%perl>
-my $url = 'Elements/Chart?&x_labels=';
-for (0..$#days) {
-  $url .= $days[$_] . "," ;
-}
-chop $url;
-$url .= "&";
-
-my @things = qw(new resolved deleted);
-for my $th (0..$#things) {
-  $url .= "data".(1+$th)."=".(join ",", map { $counts[$_]{$things[$th]} } (0..6))."&";
-}
-chop $url;
-$url .= '&set_legend=Created,Resolved,Deleted';
-</%perl>
-
-<& /RTx/Statistics/Elements/GraphBox, GraphURL => $url &>
-
-% Statistics::DebugLog("queue name=" . $QueueObj->Id() . "\n");
-
-<& /RTx/Statistics/Elements/ControlsAsTable/ControlBox, 
-         Title => "Change Queue", 
-         ShowSingleQueue => 1, Queue => $QueueObj->Id()
- &>
-
-</form>
-
-% Statistics::DebugInit( $m );
-
-<%ARGS>
-$Queue => $Statistics::DayOfWeekQueue
-
-$AllowSorting => undef
-$Order => undef
-$OrderBy => undef
-$ShowNavigation => 1
-$ShowHeader => 1
-$Rows => 50
-$Page => 1
-$BaseURL => undef
-</%ARGS>
-
-<%INIT>
-use GD::Graph;
-use RTx::Statistics;
-my @days = qw(Sun Mon Tue Wed Thu Fri Sat);
-my $n = 0;
-my @data = ([]);
-my @msgs;
-my @counts;
-my %Totals = (
-  resolved => 0,
-  deleted => 0,
-  new => 0
-);
-my $QueryString = "Queue=$Queue";
-my $maxitems = 4;
-my %record;
-my %values;
-my $record = \%record;
-
-$record{values} = \%values;
-
-my $Format = qq{ Statistics_Date, 
-                 '__Statistics_Created_Count__/STYLE:text-align:right;', 
-                 '__Statistics_Resolved_Count__/STYLE:text-align:right;', 
-                '__Statistics_Deleted_Count__/STYLE:text-align:right;' };
-my $BoldFormat = qq{ '<B>__Statistics_Date__</B>', 
-                     '<B>__Statistics_Created_Count__</B>/STYLE:text-align:right;',
-                     '<B>__Statistics_Resolved_Count__</B>/STYLE:text-align:right;',
-                    '<B>__Statistics_Deleted_Count__</B>/STYLE:text-align:right;' };
-my (@Format) = $m->comp('/RTx/Statistics/Elements/CollectionAsTable/ParseFormat', Format => $Format);
-my (@BoldFormat) = $m->comp('/RTx/Statistics/Elements/CollectionAsTable/ParseFormat', Format => $BoldFormat);
-
-my $QueueObj = new RT::Queue($session{'CurrentUser'});
-$QueueObj->Load($Queue);
-$RT::Logger->warning("Loaded queue $Queue, name=". $QueueObj->Name());
-
-my $tix = new RT::Tickets($session{'CurrentUser'});
-$tix->LimitQueue (VALUE => $Queue);
-$tix->UnLimit;
-if ($tix->Count) {
-    # Initialize the counters to zero, so that all the cells show up
-    foreach my $day (0..@days) {
-        $counts[$day]{resolved} = 0;
-        $counts[$day]{deleted} = 0;
-        $counts[$day]{new} = 0;
-    }
-    while (my $t = $tix->RT::SearchBuilder::Next) {  # BLOODY HACK
-        if($t->Status eq "resolved") {
-          $counts[(localtime($t->ResolvedObj->Unix))[6]]{resolved}++;
-         $Totals{resolved}++;
-       }
-       if($t->Status eq "deleted") {
-         $counts[(localtime($t->LastUpdatedObj->Unix))[6]]{deleted}++;
-         $Totals{deleted}++;
-        }
-        $counts[(localtime($t->CreatedObj->Unix))[6]]{new}++;
-       $Totals{new}++;
-    }
-}
-</%INIT>