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 => "/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&>
74 % Statistics::DebugLog("Dump of data array is " . Dumper(@data) . "\n");
75 % my $url = 'Elements/Chart?x_labels=';
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') . ',';
91 % for (1..(scalar keys %queues_to_show)) {
92 % $url .= $m->interp->apply_escapes((shift @data),'u') . ',';
94 % $url .= '&set_legend='.(join ",", @legend);
97 <& /RTx/Statistics/Elements/GraphBox, GraphURL => $url &>
99 <& /RTx/Statistics/Elements/ControlsAsTable/ControlBox, Title => "Select Queues", ShowMultiQueues => 1, queues_ref => \@queues &>
101 <a href="<%$RT::WebPath%>/RTx/Statistics/OpenStalled/index.html?<% $QueryString %>"><&|/l&>Bookmarkable link</&></a>
102 %# | <a href="<%$RT::WebPath%>/RTx/Statistics/OpenStalled/Results.tsv?<%$QueryString%>"><&|/l&>spreadsheet</&></a>
108 % Statistics::DebugInit( $m );
111 @queues => @Statistics::OpenStalledQueueList
112 $AllowSorting => undef
120 $AddAllCheck => undef
137 my $record = \%record;
139 $record{values} = \%values;
141 Statistics::DebugClear();
143 # Handle the Add All Checkbox
144 if($AddAllCheck eq "on") {
145 $AddAllCheck = undef;
147 my $q=new RT::Queues($session{'CurrentUser'});
149 while (my $queue=$q->Next) {
150 next if !$queue->CurrentUserHasRight('SeeQueue');
151 push @queues, $queue->Name;
155 # If the user has the right to see the queue, put it into the map
156 for my $q (@queues) {
157 my $Queueobj = new RT::Queue($session{'CurrentUser'});
159 next if !$Queueobj->CurrentUserHasRight('SeeQueue');
160 $queues_to_show{$q} = 1;
163 $maxitems = (scalar @queues) + 2;
165 # Build the new query string
166 $QueryString = "queues=" . join("&queues=", @queues);
168 # Build the format strings
169 $RowFormat = "'__Statistics_Status__'";
170 $BoldRowFormat = "'<B>__Statistics_Status__</B>'";
171 for my $q (@queues) {
172 $RowFormat .= ",'__Statistics_Dynamic__/KEY:$q/TITLE:$q/STYLE:text-align:right;'";
173 $BoldRowFormat .= ",'<B>__Statistics_Dynamic__</B>/KEY:$q/TITLE:$q/STYLE:text-align:right;'";
175 $RowFormat .= ",'<B>__Statistics_Totals__</B>/STYLE:text-align:right;'";
176 $BoldRowFormat .= ",'<B>__Statistics_Totals__</B>/STYLE:text-align:right;'";
177 # Parse the formats into structures.
178 my (@RowFormat) = $m->comp('/RTx/Statistics/Elements/CollectionAsTable/ParseFormat', Format => $RowFormat);
179 my (@BoldRowFormat) = $m->comp('/RTx/Statistics/Elements/CollectionAsTable/ParseFormat', Format => $BoldRowFormat);
182 my $queue = new RT::Queues($session{CurrentUser});
185 my $QueueObj = new RT::Queue($session{'CurrentUser'});
186 $QueueObj->Load($queue);