import rt 3.8.11
[freeside.git] / rt / html / Search / Listing.html
1 %# BEGIN LICENSE BLOCK
2 %# 
3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
4 %# 
5 %# (Except where explictly superceded by other copyright notices)
6 %# 
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
10 %# from www.gnu.org.
11 %# 
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 %# General Public License for more details.
16 %# 
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
21 %# 
22 %# 
23 %# END LICENSE BLOCK
24 <& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &>
25 <& /Ticket/Elements/Tabs, 
26     current_tab => 'Search/Listing.html', 
27     Title => $title &>
28
29 %if ($ticketcount && !  $ARGS{'HideResults'}) {
30 <TABLE WIDTH=100% border=0 cellpadding=2 CELLSPACING=0>
31 <& Elements/TicketHeader, %ARGS &>
32 % my $i;
33 %while (my $Ticket = $session{'tickets'}->Next) {
34 % $i++;
35 <& Elements/TicketRow, Ticket => $Ticket, i=> $i, %ARGS &>
36 %}
37 </TABLE>
38 <div align=center>
39 <font size=2>
40 <a href="<%$RT::WebPath%>/Search/Listing.html?GotoPage=1"><&|/l&>First page</&></a>
41 &nbsp;&nbsp;
42 %  if ( $session{'tickets'}->FirstRow >= $session{'tickets_rows_per_page'}-1 ) {
43 <a href="<%$RT::WebPath%>/Search/Listing.html?GotoPage=Prev">&lt;<&|/l&>Previous page</&></a>
44 &nbsp;&nbsp;
45 %  }                                                                           
46 %  if ( $session{'tickets'}->FirstRow + $session{'tickets_rows_per_page'} < $ticketcount ) {                                                               
47 <a href="<%$RT::WebPath%>/Search/Listing.html?GotoPage=Next"><&|/l&>Next page</&>&gt;</a>
48 %  }
49 %#&nbsp;&nbsp;<form method=get action="<%$RT::WebPath%>/Search/Listing.html"><&|/l&>Goto page</&> <input name=GotoPage size=2></form>
50 </font>
51 </div>
52 <!--<div align=right>-->
53 <table width="100%" border=0 cellpadding=3 CELLSPACING=1>
54 <tr>
55 <td align=left>
56 (<&|/l, ($session{'tickets'}->FirstRow+1), ($session{'tickets'}->FirstRow() + $session{'tickets'}->RowsPerPage()  ) &>[_1] - [_2] shown</&>)
57 </td>
58 <td align=right>
59
60 <a href="<%$RT::WebPath%>/Search/Bulk.html"><&|/l&>Update all these tickets at once</&></a>
61 <!--</div>-->
62 </td>
63 </tr>
64 </table>
65
66 % }
67 <TABLE WIDTH="100%">
68 <TR>
69 <TD VALIGN="TOP">
70 <& /Elements/TitleBoxStart, title => loc('Current search criteria')&>
71
72 %my %restrictions=$session{'tickets'}->DescribeRestrictions();
73 %foreach my $row (keys %restrictions){
74 <%$restrictions{"$row"}%> <A HREF="<% $RT::WebPath %>/Search/Listing.html?DeleteRestriction=<%$row%>">[<&|/l&>delete</&>]</a><br>
75 %}
76 <BR>
77 <BR>
78 <A HREF="<% $RT::WebPath%>/Search/Listing.html?Bookmark=<%$session{'tickets'}->FreezeLimits()|nu%>&TicketsSortBy=<%$session{'tickets_sort_by'}%>&TicketsSortOrder=<%$session{'tickets_sort_order'}%>&RowsPerPage=<%$session{'tickets_rows_per_page'}%>"><&|/l&>Bookmarkable URL for this search</&></a>
79 <& /Elements/TitleBoxEnd&>
80 </TD>
81 <TD>
82
83 <& Elements/PickRestriction, %ARGS &>
84
85 </TD>
86 </TR>
87 </TABLE>
88
89 <%INIT>
90
91 my ($title, $ticketcount);
92 $session{'i'}++;
93 if ($session{'tickets'}) {
94     if ($ARGS{'DeleteRestriction'}) {
95             $session{'tickets'}->DeleteRestriction($ARGS{'DeleteRestriction'});
96     }
97     if ( ($ARGS{'ClearRestrictions'}) || ($ARGS{'NewSearch'}) ) {
98             $session{'tickets'}->ClearRestrictions;
99             $session{'tickets'}->CleanSlate;
100         }       
101 }
102    ProcessSearchQuery(ARGS=>\%ARGS);
103    $session{'tickets'}->RedoSearch();
104    if ( $session{'tickets'}->DescribeRestrictions()) {
105        $ticketcount = $session{tickets}->CountAll();
106         $title = loc('Found [quant,_1,ticket]', $ticketcount);
107     } else {
108         $title = loc("Find tickets");
109    }
110 </%INIT>
111 <%CLEANUP>
112 $session{'tickets'}->PrepForSerialization();
113 </%CLEANUP>