1 <& /Elements/Header, Title => loc('New, Open and Stalled tickets by Queue') &>
2 <& /RTx/Statistics/Elements/Tabs, Title => loc('New, Open and Stalled tickets by Queue') &>
5 <p>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
6 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
7 viewed once (Open) and how many have had their status changed to stalled.</p>
9 <form method="POST" action="index.html">
11 %my $tix = new RT::Tickets($session{'CurrentUser'});
13 % $tix->LimitQueue (VALUE => $queue);
17 %my $title = "New, Open and Stalled Tickets in " . join(', ', @queues);
18 <& /Elements/TitleBoxStart, title => $title, title_href => $RT::WebPath."/RTx/Statistics/OpenStalled/index.html?$QueryString"&>
19 <TABLE BORDER=0 cellspacing=0 cellpadding=1 WIDTH="100%">
21 <& /RTx/Statistics/Elements/CollectionAsTable/Header,
22 Format => \@RowFormat,
23 FormatString => $RowFormat,
24 AllowSorting => $AllowSorting,
31 maxitems => $maxitems &>
34 % for ( sort keys %queues_to_show) {
40 %# NOTE need to handle all status values (see share/html/Elements/SelectStatus).
41 % foreach my $s (qw(new open stalled)) {
45 % foreach my $q (sort keys %queues_to_show) {
46 % $tix = new RT::Tickets($session{'CurrentUser'});
47 % $tix->LimitQueue(VALUE => "$q");
48 % $tix->LimitStatus(VALUE => "$s");
49 % push @data, $tix->Count;
50 % $totals{$q} += $tix->Count; # Add up columns for each queue
51 % $total += $tix->Count;
52 % $values{$q} = $tix->Count;
54 % $totals{"Totals"} += $total;
55 % $values{Statistics_Status} = $s;
56 % $values{Statistics_Totals} = $total;
57 <& /RTx/Statistics/Elements/CollectionAsTable/Row, Format => \@RowFormat, i => $line, record => $record, maxitems => $maxitems &>
59 % $values{Statistics_Status} = "Totals";
60 % foreach my $q (sort keys %queues_to_show) {
61 % $values{$q} = $totals{$q};
63 % $values{Statistics_Totals} = $totals{"Totals"};
64 <& /RTx/Statistics/Elements/CollectionAsTable/Row, Format => \@BoldRowFormat, i => $line+1, record => $record, maxitems => $maxitems &>
66 <& /Elements/TitleBoxEnd&>
69 % Statistics::DebugLog("Dump of data array is " . Dumper(@data) . "\n");
70 % my $url = 'Elements/Chart?x_labels=';
71 % for (1..(scalar keys %queues_to_show)) {
72 % $url .= $m->interp->apply_escapes((shift @data),'u') . ',';
76 % for (1..(scalar keys %queues_to_show)) {
77 % $url .= $m->interp->apply_escapes((shift @data),'u') . ',';
81 % for (1..(scalar keys %queues_to_show)) {
82 % $url .= $m->interp->apply_escapes((shift @data),'u') . ',';
86 % for (1..(scalar keys %queues_to_show)) {
87 % $url .= $m->interp->apply_escapes((shift @data),'u') . ',';
89 % $url .= '&set_legend='.(join ",", @legend);
92 <& /RTx/Statistics/Elements/GraphBox, GraphURL => $url &>
94 <& /RTx/Statistics/Elements/ControlsAsTable/ControlBox, Title => "Select Queues", ShowMultiQueues => 1, queues_ref => \@queues &>
96 <a href="<%$RT::WebPath%>/RTx/Statistics/OpenStalled/index.html?<% $QueryString %>"><&|/l&>Bookmarkable link</&></a>
97 %# | <a href="<%$RT::WebPath%>/RTx/Statistics/OpenStalled/Results.tsv?<%$QueryString%>"><&|/l&>spreadsheet</&></a>
103 % Statistics::DebugInit( $m );
106 @queues => @Statistics::OpenStalledQueueList
107 $AllowSorting => undef
115 $AddAllCheck => undef
132 my $record = \%record;
134 $record{values} = \%values;
136 Statistics::DebugClear();
138 # Handle the Add All Checkbox
139 if($AddAllCheck eq "on") {
140 $AddAllCheck = undef;
142 my $q=new RT::Queues($session{'CurrentUser'});
144 while (my $queue=$q->Next) {
145 next if !$queue->CurrentUserHasRight('SeeQueue');
146 push @queues, $queue->Name;
150 # If the user has the right to see the queue, put it into the map
151 for my $q (@queues) {
152 my $Queueobj = new RT::Queue($session{'CurrentUser'});
154 next if !$Queueobj->CurrentUserHasRight('SeeQueue');
155 $queues_to_show{$q} = 1;
158 $maxitems = (scalar @queues) + 2;
160 # Build the new query string
161 $QueryString = "queues=" . join("&queues=", @queues);
163 # Build the format strings
164 $RowFormat = "'__Statistics_Status__'";
165 $BoldRowFormat = "'<B>__Statistics_Status__</B>'";
166 for my $q (@queues) {
167 $RowFormat .= ",'__Statistics_Dynamic__/KEY:$q/TITLE:$q/STYLE:text-align:right;'";
168 $BoldRowFormat .= ",'<B>__Statistics_Dynamic__</B>/KEY:$q/TITLE:$q/STYLE:text-align:right;'";
170 $RowFormat .= ",'<B>__Statistics_Totals__</B>/STYLE:text-align:right;'";
171 $BoldRowFormat .= ",'<B>__Statistics_Totals__</B>/STYLE:text-align:right;'";
172 # Parse the formats into structures.
173 my (@RowFormat) = $m->comp('/RTx/Statistics/Elements/CollectionAsTable/ParseFormat', Format => $RowFormat);
174 my (@BoldRowFormat) = $m->comp('/RTx/Statistics/Elements/CollectionAsTable/ParseFormat', Format => $BoldRowFormat);
177 my $queue = new RT::Queues($session{CurrentUser});
180 my $QueueObj = new RT::Queue($session{'CurrentUser'});
181 $QueueObj->Load($queue);