%# BEGIN LICENSE BLOCK %# %# Copyright (c) 1996-2003 Jesse Vincent %# %# (Except where explictly superceded by other copyright notices) %# %# 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. %# %# %# Unless otherwise specified, all modifications, corrections or %# extensions to this work which alter its source code become the %# property of Best Practical Solutions, LLC when submitted for %# inclusion in the work. %# %# %# END LICENSE BLOCK <& /RTIR/Elements/Header, Title => $title &> <& '/RTIR/'.$Type.'/Elements/Tabs', current_tab => "RTIR/Listing.html?NewSearch=1&Queue=".$Queue, current_subtab => "RTIR/Listing.html?NewSearch=1&Queue=".$Queue, Title => $title &> <& /RTIR/Elements/Listing, Type => $Type, Queue => $Queue, %ARGS &>
<& /RTIR/Elements/SearchFields, Path => '/RTIR/Listing.html', Queue => $QueueObj->Name, %ARGS &> <%INIT> my $QueueObj = new RT::Queue($session{'CurrentUser'}); $QueueObj->Load($Queue) || Abort(loc("Queue $Queue could not be loaded.")); my ($Type, @states); if ($Queue eq "Incidents") { $Type = 'Incident'; @states = ('new', 'open'); } elsif ($Queue eq "Incident Reports") { $Type = 'Report'; @states = ('new', 'open'); } elsif ($Queue eq "Investigations") { $Type = 'Investigation'; @states = ('open'); } if ($Queue eq "Blocks") { $Type = 'Block'; @states = ('pending activation', 'active', 'pending removal'); } if (! $session{'tickets'}) { # Init a new search $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} ); } my ($title, $ticketcount); $session{'i'}++; if ($session{'tickets'}) { if ($ARGS{'DeleteRestriction'}) { $session{'tickets'}->DeleteRestriction($ARGS{'DeleteRestriction'}); } if ( ($ARGS{'ClearRestrictions'}) || ($ARGS{'NewSearch'}) ) { $session{'tickets'}->ClearRestrictions; $session{'tickets'}->LimitQueue(VALUE => $QueueObj->Name); if (!$setstate) { my $cf = RT::CustomField->new($session{'CurrentUser'}); $cf->LoadByNameAndQueue(Queue => $QueueObj->Id, Name => '_RTIR_State'); foreach my $state (@states) { $session{'tickets'}->LimitCustomField(CUSTOMFIELD => $cf->Id, VALUE => $state); } } } } ProcessSearchQuery(ARGS=>\%ARGS); $session{'tickets'}->RedoSearch(); if ( $session{'tickets'}->DescribeRestrictions()) { $ticketcount = $session{tickets}->Count(); $title = loc('Found [quant,_1,_2]', $ticketcount, $Type); } else { $title = loc("Find [_1]", $Type); } <%ARGS> $Queue => undef $setstate => undef