<& /Elements/Header, Title => loc('New, Open and Stalled tickets by Queue') &> <& /RTx/Statistics/Elements/Tabs, Title => loc('New, Open and Stalled tickets by Queue') &>

### Description

The purpose of this page is to show a snapshot of the current status of tickets by Queue. You can multi select Queues from the dropdown list or simply show all available queues. This will indicate how many tickets have not yet been viewed (New), how many have been at least viewed once (Open) and how many have had their status changed to stalled.

%my $tix = new RT::Tickets($session{'CurrentUser'}); %if ($queue) { % $tix->LimitQueue (VALUE => $queue); %} %my $title = "New, Open and Stalled Tickets in " . join(', ', @queues); <& /Elements/TitleBoxStart, title => $title, title_href => "/RTx/Statistics/OpenStalled/index.html?$QueryString"&>

% if ($ShowHeader) { <& /RTx/Statistics/Elements/CollectionAsTable/Header, Format => \@RowFormat, FormatString => $RowFormat, AllowSorting => $AllowSorting, Order => $Order, Query => undef, Rows => $Rows, Page => $Page, OrderBy => $OrderBy , BaseURL => $BaseURL, maxitems => $maxitems &> % } % for ( sort keys %queues_to_show) { % push @data, $_; % } % my @legend; % my $total = 0; % my $line = 0; %# NOTE need to handle all status values (see share/html/Elements/SelectStatus). % foreach my $s (qw(new open stalled)) { % $line++; % push @legend, $s; % $total=0; % foreach my $q (sort keys %queues_to_show) { % $tix = new RT::Tickets($session{'CurrentUser'}); % $tix->LimitQueue(VALUE => "$q"); % $tix->LimitStatus(VALUE => "$s"); % push @data, $tix->Count; % $totals{$q} += $tix->Count; # Add up columns for each queue % $total += $tix->Count; % $values{$q} = $tix->Count; % } % $totals{"Totals"} += $total; % $values{Statistics_Status} = $s; % $values{Statistics_Totals} = $total; <& /RTx/Statistics/Elements/CollectionAsTable/Row, Format => \@RowFormat, i => $line, record => $record, maxitems => $maxitems &> % } % $values{Statistics_Status} = "Totals"; % foreach my $q (sort keys %queues_to_show) { % $values{$q} = $totals{$q}; % } % $values{Statistics_Totals} = $totals{"Totals"}; <& /RTx/Statistics/Elements/CollectionAsTable/Row, Format => \@BoldRowFormat, i => $line+1, record => $record, maxitems => $maxitems &>

<& /Elements/TitleBoxEnd&> % use Data::Dumper; % Statistics::DebugLog("Dump of data array is " . Dumper(@data) . "\n"); % my $url = 'Elements/Chart?x_labels='; % for (1..(scalar keys %queues_to_show)) { % $url .= $m->interp->apply_escapes((shift @data),'u') . ','; % } % chop $url; % $url .= '&data1=' ; % for (1..(scalar keys %queues_to_show)) { % $url .= $m->interp->apply_escapes((shift @data),'u') . ','; % } % chop $url; % $url .= '&data2=' ; % for (1..(scalar keys %queues_to_show)) { % $url .= $m->interp->apply_escapes((shift @data),'u') . ','; % } % chop $url; % $url .= '&data3=' ; % for (1..(scalar keys %queues_to_show)) { % $url .= $m->interp->apply_escapes((shift @data),'u') . ','; % } % $url .= '&set_legend='.(join ",", @legend); <& /RTx/Statistics/Elements/GraphBox, GraphURL => $url &> <& /RTx/Statistics/Elements/ControlsAsTable/ControlBox, Title => "Select Queues", ShowMultiQueues => 1, queues_ref => \@queues &> <&|/l&>Bookmarkable link %# | <&|/l&>spreadsheet
% Statistics::DebugInit( $m ); <%ARGS> @queues => @Statistics::OpenStalledQueueList $AllowSorting => undef $Order => undef $OrderBy => undef $ShowNavigation => 1 $ShowHeader => 1 $Rows => 50 $Page => 1 $BaseURL => undef $AddAllCheck => undef <%INIT> use RTx::Statistics; my $n = 0; my @data; my @msgs; my %totals; my $QueryString; my %queues_to_show; my $maxitems; my $RowFormat; my $BoldRowFormat; my %record; my %values; my $record = \%record; $record{values} = \%values; Statistics::DebugClear(); # Handle the Add All Checkbox if($AddAllCheck eq "on") { $AddAllCheck = undef; undef (@queues); my $q=new RT::Queues($session{'CurrentUser'}); $q->UnLimit; while (my $queue=$q->Next) { next if !$queue->CurrentUserHasRight('SeeQueue'); push @queues, $queue->Name; } } # If the user has the right to see the queue, put it into the map for my $q (@queues) { my $Queueobj = new RT::Queue($session{'CurrentUser'}); $Queueobj->Load($q); next if !$Queueobj->CurrentUserHasRight('SeeQueue'); $queues_to_show{$q} = 1; } $maxitems = (scalar @queues) + 2; # Build the new query string $QueryString = "queues=" . join("&queues=", @queues); # Build the format strings $RowFormat = "'__Statistics_Status__'"; $BoldRowFormat = "'__Statistics_Status__'"; for my $q (@queues) { $RowFormat .= ",'__Statistics_Dynamic__/KEY:$q/TITLE:$q/STYLE:text-align:right;'"; $BoldRowFormat .= ",'__Statistics_Dynamic__/KEY:$q/TITLE:$q/STYLE:text-align:right;'"; } $RowFormat .= ",'__Statistics_Totals__/STYLE:text-align:right;'"; $BoldRowFormat .= ",'__Statistics_Totals__/STYLE:text-align:right;'"; # Parse the formats into structures. my (@RowFormat) = $m->comp('/RTx/Statistics/Elements/CollectionAsTable/ParseFormat', Format => $RowFormat); my (@BoldRowFormat) = $m->comp('/RTx/Statistics/Elements/CollectionAsTable/ParseFormat', Format => $BoldRowFormat); my $queue = new RT::Queues($session{CurrentUser}); $queue->UnLimit; my $QueueObj = new RT::Queue($session{'CurrentUser'}); $QueueObj->Load($queue);