summaryrefslogtreecommitdiff
path: root/rt/html/RTx/Statistics/CallsQueueDay
diff options
context:
space:
mode:
Diffstat (limited to 'rt/html/RTx/Statistics/CallsQueueDay')
-rwxr-xr-xrt/html/RTx/Statistics/CallsQueueDay/Elements/Chart29
-rw-r--r--rt/html/RTx/Statistics/CallsQueueDay/Results.tsv191
-rwxr-xr-xrt/html/RTx/Statistics/CallsQueueDay/index.html275
3 files changed, 0 insertions, 495 deletions
diff --git a/rt/html/RTx/Statistics/CallsQueueDay/Elements/Chart b/rt/html/RTx/Statistics/CallsQueueDay/Elements/Chart
deleted file mode 100755
index 9a3a505..0000000
--- a/rt/html/RTx/Statistics/CallsQueueDay/Elements/Chart
+++ /dev/null
@@ -1,29 +0,0 @@
-<%perl>
-$r->content_type("image/$format");
-print $graph->plot(\@data)->$format();
-$m->abort();
-print $#data+1 . " Elements:<p>";
-for (0..$#data) {
-print $data[$_];
-print "<p>";
-}
-</%perl>
-<%INIT>
-use GD::Graph::lines;
-
-my @data;
-my $graph = GD::Graph::lines->new($Statistics::GraphWidth,$Statistics::GraphHeight);
-$graph->set(export_format => "png",
- x_label => 'Day of Week',
- y_label => 'Tickets per Day',
- x_labels_vertical => 1,
- );
-my $format = $graph->export_format;
-$graph->set_legend(split /,/ , $ARGS{set_legend});
-push @data, [split /,/ , $ARGS{x_labels}];
-push @data, [split /,/ , $ARGS{data1}];
-push @data, [split /,/ , $ARGS{data2}];
-push @data, [split /,/ , $ARGS{data3}];
-</%INIT>
-<%ARGS>
-</%ARGS>
diff --git a/rt/html/RTx/Statistics/CallsQueueDay/Results.tsv b/rt/html/RTx/Statistics/CallsQueueDay/Results.tsv
deleted file mode 100644
index 23f0c69..0000000
--- a/rt/html/RTx/Statistics/CallsQueueDay/Results.tsv
+++ /dev/null
@@ -1,191 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
-%# <jesse@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 }}}
-<%ARGS>
-$Queue => undef
-$weekends => $Statistics::PerDayWeekends;
-$sMonth=>undef
-$sDay=>undef
-$sYear=>undef
-$eMonth=>undef
-$eDay=>undef
-$eYear=>undef
-$days=>undef
-$currentMonth=>undef
-</%ARGS>
-
-<%INIT>
-use RTx::Statistics;
-use Time::Local;
-my @dates;
-my $n = 0;
-my %Totals;
-my $now = new RT::Date($session{CurrentUser});
-my $sEpoch;
-my $eEpoch;
-
-if (!defined $Queue) {
- $Queue = $Statistics::PerDayQueue;
-}
-
-if ($sDay > $Statistics::monthsMaxDay{$sMonth}) {
- $sDay = $Statistics::monthsMaxDay{$sMonth};
-}
-
-if ($eDay > $Statistics::monthsMaxDay{$eMonth}) {
- $eDay = $Statistics::monthsMaxDay{$eMonth};
-}
-
-if ($sYear){
- $sEpoch = timelocal(0, 0, 0, $sDay, $sMonth, $sYear-1900);
-}
-if ($eYear){
-Statistics::DebugLog("eMonth = " . $eMonth . "\n");
- $eEpoch = timelocal(0, 0, 0, $eDay, $eMonth, $eYear-1900);
-} else {
- # This case happens when the page is first loaded
- my @local = localtime(time);
- ($eDay, $eMonth, $eYear) = ($local[3], $local[4], $local[5]);
- $eYear += 1900;
- $eEpoch = timelocal(0, 0, 0, $local[3], $local[4], $local[5], $local[6], $local[7], $local[8]);
-Statistics::DebugLog("Setting eEpoch=$eEpoch from current time.\n");
-}
-
-if (($eEpoch < $sEpoch) || ($sEpoch == 0)) {
- # We have an end, but not a start, or, overlapping.
-
- # if $currentMonth is set, just set the day to 1
- if($currentMonth) {
- # set start vars from end, but with day set to 1
- (undef, undef, undef, $sDay, $sMonth, $sYear) = localtime($eEpoch);
- $sDay=1;
- $sEpoch = timelocal(0, 0, 0, $sDay, $sMonth, $sYear);
- } else {
- # If the user has specified how many days back to go, use that,
- # If not, set start to configured default period before end
- if(defined $days) {
- $sEpoch = $eEpoch - ($days * $Statistics::secsPerDay);
- } else {
- $sEpoch = $eEpoch - ($Statistics::PerDayPeriod * $Statistics::secsPerDay);
- }
- (undef, undef, undef, $sDay, $sMonth, $sYear) = localtime($sEpoch);
- }
- $sYear += 1900;
-}
-
-# set content type
-$r->content_type('application/vnd.ms-excel');
-
-# Put out some data about the generation of this file
-$m->out("Tickets per day for Queue:\t" . $Queue . "\tGenerated at:\t" . Statistics::FormatDate("%x %X", $now). "\n\n");
-
-
-# Compute days to chart.
-# The +1 is because we need to generate one more date. If the user
-# selected a 10 day range, we need to generate 11 days.
-my $diff = int(($eEpoch - $sEpoch + $Statistics::secsPerDay - 1) / $Statistics::secsPerDay)+1;
-
-# Build array of dates
-my $endRange = $eEpoch + $Statistics::secsPerDay;
-my $QueueObj = new RT::Queue($session{'CurrentUser'});
-$QueueObj->Load($Queue);
-until ($#dates == $diff) {
- my $date = new RT::Date($session{CurrentUser});
- $date->Set(Value=>$endRange - $n, Format => 'unix');
- # Note: we used to adjust the time to local midnight, but
- # none of the other date entry fields in RT seem to adjust, so we've stopped.
- #Statistics::DebugLog("Before adjust to midnight date " . Statistics::FormatDate("%c", $date) . "\n");
- $n+= $Statistics::secsPerDay;
- # If we aren't showing weekends and this is one, decrement the number
- # of days to show and skip to the next date.
- if(!$weekends and Statistics::RTDateIsWeekend($date)) {$diff--; next;}
- unshift @dates, $date;
-}
-
-# Output header row
-$m->out("Date\tcreate\tresolved\tdeleted\n");
-
-
-LINE: for my $d (0..$#dates) {
- if ($d == $#dates){
- next LINE;
- }
- my $x = 1;
- # Output the date for this row
- $m->out(Statistics::FormatDate($Statistics::PerDayDateFormat, $dates[$d]));
-
- # output the 3 columns for this row
- for my $status (qw(created resolved deleted)) {
- my $tix = new RT::Tickets($session{'CurrentUser'});
- if ($status eq "created") {
- $tix->LimitCreated(VALUE => $dates[$d]->ISO, OPERATOR => ">=");
- if ($dates[$d+1]) {
- $tix->LimitCreated(VALUE => $dates[$d+1]->ISO, OPERATOR => "<=");
- }
- } elsif ($status eq "resolved") {
- $tix->LimitStatus(VALUE => $status);
- $tix->LimitResolved(VALUE => $dates[$d]->ISO, OPERATOR => ">=");
- if ($dates[$d+1]) {
- $tix->LimitResolved(VALUE => $dates[$d+1]->ISO, OPERATOR => "<=");
- }
- } 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 => "<=");
- }
- }
- $tix->LimitQueue (VALUE => $Queue);
- $m->out( "\t" . $tix->Count );
- $Totals{$status} += $tix->Count;
- }
- $m->out("\n");
-}
-
-# Output the totals
-$m->out("Totals\t$Totals{created}\t$Totals{resolved}\t$Totals{deleted}\n");
-
-$m->abort();
-</%INIT>
diff --git a/rt/html/RTx/Statistics/CallsQueueDay/index.html b/rt/html/RTx/Statistics/CallsQueueDay/index.html
deleted file mode 100755
index 06fc484..0000000
--- a/rt/html/RTx/Statistics/CallsQueueDay/index.html
+++ /dev/null
@@ -1,275 +0,0 @@
-<& /Elements/Header, Title => loc("Tickets per day in Queue:" . $QueueObj->Name()) &>
-<& /RTx/Statistics/Elements/Tabs, Title => loc("Tickets by status per day in Queue:" . $QueueObj->Name()) &>
-
-<h3>Description</h3>
-<p>This page displays details about tickets in the selected queue over the date range chosen. It shows how many tickets were created on
-each day in the chosen range, and how many of those were either Resolved or Deleted.</p>
-<p>To always show the current month to date, bookmark this <a href="<%$RT::WebPath%>/RTx/Statistics/CallsQueueDay/index.html?currentMonth=1">link</a>, or
-for a spreadsheet, use this <a href="<%$RT::WebPath%>/RTx/Statistics/CallsQueueDay/Results.tsv?currentMonth=1">link</a>.</p>
-
-<form method="POST" action="index.html">
-
-% Statistics::DebugLog("queue name=" . $QueueObj->Name() . "\n");
-
-%my $title = "Ticket counts in " . $QueueObj->Name() . " by status per day from " .
-% Statistics::FormatDate($Statistics::PerDayDateFormat, $dates[0]) . " through " .
-% Statistics::FormatDate($Statistics::PerDayDateFormat, $dates[$#dates-1]);
-<&|/Elements/TitleBox,
- title => $title,
- title_href => "/RTx/Statistics/CallsQueueDay/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;
-% LINE: for my $d (0..$#dates) {
-% if ($d == $#dates){
-% next LINE;
-% }
-% my $x = 1;
-% $values{Statistics_Date} = Statistics::FormatDate($Statistics::PerDayDateFormat, $dates[$d]);
-%# NOTE need to handle all status values here....
-% for my $status (qw(created resolved deleted)) {
-% my $tix = new RT::Tickets($session{'CurrentUser'});
-% $tix->LimitQueue (VALUE => $Queue);
-% if ($status eq "created") {
-% $tix->LimitCreated(VALUE => $dates[$d]->ISO, OPERATOR => ">=");
-% if ($dates[$d+1]) {
-% $tix->LimitCreated(VALUE => $dates[$d+1]->ISO, OPERATOR => "<=");
-% }
-% $values{Statistics_Created_Count} = $tix->Count;
-% $Totals{Statistics_Created_Count} += $tix->Count;
-% }
-% elsif ($status eq "resolved") {
-% $tix->LimitStatus(VALUE => $status);
-% $tix->LimitResolved(VALUE => $dates[$d]->ISO, OPERATOR => ">=");
-% if ($dates[$d+1]) {
-% $tix->LimitResolved(VALUE => $dates[$d+1]->ISO, OPERATOR => "<=");
-% }
-% $values{Statistics_Resolved_Count} = $tix->Count;
-% $Totals{Statistics_Resolved_Count} += $tix->Count;
-% }
-% 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 => "<=");
-% }
-% $values{Statistics_Deleted_Count} = $tix->Count;
-% $Totals{Statistics_Deleted_Count} += $tix->Count;
-% }
-% $data[$x++][$d] = $tix->Count;
-% }
-<& /RTx/Statistics/Elements/CollectionAsTable/Row, Format => \@Format, i => $line, record => $record, maxitems => $maxitems &>
-% $line++;
-% }
-% $values {Statistics_Date} = "Totals";
-% $values {Statistics_Created_Count} = $Totals{Statistics_Created_Count};
-% $values {Statistics_Resolved_Count} = $Totals{Statistics_Resolved_Count};
-% $values {Statistics_Deleted_Count} = $Totals{Statistics_Deleted_Count};
-<& /RTx/Statistics/Elements/CollectionAsTable/Row, Format => \@BoldFormat, i => $line, record => $record, maxitems => $maxitems &>
-</table>
-</&>
-
-<hr>
-
-<BR />
-<BR />
-
-<%perl>
-# Create the graph URL
-my $url= 'Elements/Chart?x_labels=';
-for (1..$diff) {
- $url .= $data[0][$_] . ",";
-}
-chop $url;
-$url .= "&";
-shift @data;
-for (0..$#data) {
- $url .= "data".(1+$_)."=".(join ",", @{$data[$_]})."&";
-}
-chop $url;
-$url .= "&set_legend=Created,Resolved,Deleted";
-</%perl>
-
-<& /RTx/Statistics/Elements/GraphBox, GraphURL => $url &>
-
-<& /RTx/Statistics/Elements/ControlsAsTable/ControlBox,
- Title => "Change Queue or Dates",
- ShowDates => 1, sMonth => \$sMonth, sDay => \$sDay, sYear => \$sYear,
- eMonth => \$eMonth, eDay => \$eDay, eYear => \$eYear,
- weekends => $weekends,
- ShowSingleQueue => 1, Queue => $Queue
- &>
-
-</form>
-
-<a href="<%$RT::WebPath%>/RTx/Statistics/CallsQueueDay/index.html?<% $QueryString %>"><&|/l&>Bookmarkable link</&></a> |
-<a href="<%$RT::WebPath%>/RTx/Statistics/CallsQueueDay/Results.tsv?<%$QueryString%>"><&|/l&>spreadsheet</&></a>
-<BR>
-<BR>
-
-
-% Statistics::DebugLog("ref of eMonth is " . ref($eMonth) . "\n");
-% Statistics::DebugInit( $m );
-
-<%ARGS>
-$Queue => undef
-$weekends => $Statistics::PerDayWeekends;
-$sMonth=>undef
-$sDay=>undef
-$sYear=>undef
-$eMonth=>undef
-$eDay=>undef
-$eYear=>undef
-$days=>undef
-$currentMonth=>undef
-
-$AllowSorting => undef
-$Order => undef
-$OrderBy => undef
-$ShowNavigation => 1
-$ShowHeader => 1
-$Rows => 50
-$Page => 1
-$BaseURL => undef
-</%ARGS>
-
-<%INIT>
-use RTx::Statistics;
-use Time::Local;
-my $selected;
-my $n = 0;
-my @data = ([]);
-my @dates;
-my @msgs;
-my $diff;
-my $sEpoch=0;
-my $eEpoch=0;
-my %Totals;
-my $QueryString;
-my $maxitems = 4;
-my %record;
-my %values;
-my $record = \%record;
-
-$record{values} = \%values;
-
-
-# If debugging, set things up and display all the args
-Statistics::DebugClear();
-Statistics::DebugLog("CallsQueueDay/index.html ARGS:\n");
-for my $key (keys %ARGS) {
- Statistics::DebugLog("ARG{ $key }=" . $ARGS{$key} . "\n");
-}
-
-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);
-Statistics::DebugLog("CallsQueueDay/index.html Format array=" . join(',', @Format) . "\n");
-
-if (!defined $Queue) {
- my $QueueObj = new RT::Queue($session{'CurrentUser'});
- $QueueObj->Load($Statistics::PerDayQueue);
- $Queue = $QueueObj->Id();
-}
-
-if ($sDay > $Statistics::monthsMaxDay{$sMonth}) {
- $sDay = $Statistics::monthsMaxDay{$sMonth};
-}
-
-if ($eDay > $Statistics::monthsMaxDay{$eMonth}) {
- $eDay = $Statistics::monthsMaxDay{$eMonth};
-}
-
-if ($sYear){
- $sEpoch = timelocal(0, 0, 0, $sDay, $sMonth, $sYear-1900);
-}
-if ($eYear){
-Statistics::DebugLog("eMonth = " . $eMonth . "\n");
- $eEpoch = timelocal(0, 0, 0, $eDay, $eMonth, $eYear-1900);
-} else {
- # This case happens when the page is first loaded
- my @local = localtime(time);
- ($eDay, $eMonth, $eYear) = ($local[3], $local[4], $local[5]);
- $eYear += 1900;
- $eEpoch = timelocal(0, 0, 0, $local[3], $local[4], $local[5], $local[6], $local[7], $local[8]);
-Statistics::DebugLog("Setting eEpoch=$eEpoch from current time.\n");
-}
-
-if (($eEpoch < $sEpoch) || ($sEpoch == 0)) {
- # We have an end, but not a start, or, overlapping.
-
- # if $currentMonth is set, just set the day to 1
- if($currentMonth) {
- # set start vars from end, but with day set to 1
- (undef, undef, undef, $sDay, $sMonth, $sYear) = localtime($eEpoch);
- $sDay=1;
- $sEpoch = timelocal(0, 0, 0, $sDay, $sMonth, $sYear);
- } else {
- # If the user has specified how many days back to go, use that,
- # If not, set start to configured default period before end
- if(defined $days) {
- $sEpoch = $eEpoch - ($days * $Statistics::secsPerDay);
- } else {
- $sEpoch = $eEpoch - ($Statistics::PerDayPeriod * $Statistics::secsPerDay);
- }
- (undef, undef, undef, $sDay, $sMonth, $sYear) = localtime($sEpoch);
- }
- $sYear += 1900;
-}
-
-# Compute days to chart.
-# The +1 is because we need to generate one more date. If the user
-# selected a 10 day range, we need to generate 11 days.
-$diff = int(($eEpoch - $sEpoch + $Statistics::secsPerDay - 1) / $Statistics::secsPerDay)+1;
-Statistics::DebugLog("Setting diff=$diff\n");
-
-Statistics::DebugLog("sEpoch=$sEpoch, components=" . join(',', localtime($sEpoch)) . "\n");
-Statistics::DebugLog("eEpoch=$eEpoch, components=" . join(',', localtime($eEpoch)) . "\n");
-
-# Set up the string for the current query for bookmarkable link
-$QueryString = "sDay=$sDay&sMonth=$sMonth&sYear=$sYear&eDay=$eDay&eMonth=$eMonth&eYear=$eYear&weekends=$weekends&Queue=$Queue";
-
-# Set up the end date to be midnight(morning) of the date after the one the user wanted.
-my $endRange = $eEpoch + $Statistics::secsPerDay;
-my $QueueObj = new RT::Queue($session{'CurrentUser'});
-$QueueObj->Load($Queue);
-$n = 0;
-until ($#dates == $diff) {
- my $date = new RT::Date($session{CurrentUser});
- $date->Set(Value=>$endRange - $n, Format => 'unix');
- # Note: we used to adjust the time to local midnight, but
- # none of the other date entry fields in RT seem to adjust, so we've stopped.
- #Statistics::DebugLog("Before adjust to midnight date " . Statistics::FormatDate("%c", $date) . "\n");
- $n+= $Statistics::secsPerDay;
- # If we aren't showing weekends and this is one, decrement the number
- # of days to show and skip to the next date.
- if(!$weekends and Statistics::RTDateIsWeekend($date)) {$diff--; next;}
- unshift @dates, $date;
-Statistics::DebugLog("pushing date " . Statistics::FormatDate("%c", $date) . "\n");
- unshift @{ $data[0] }, Statistics::FormatDate($Statistics::PerDayLabelDateFormat, $date);
-}
-
-# We put an extra day into the lists to cover up till midnight of the next day,
-# But we don't want that to appear in the labels, so pop it off.
-pop( @{ $data[0] } );
-
-</%INIT>