import rt 3.0.12
[freeside.git] / rt / html / index.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=>loc("RT at a glance"), Refresh => $session{'home_refresh_interval'} &>
25 <& /Elements/Tabs, 
26     current_toptab => '', 
27     Title=>loc("RT at a glance") &>
28 <TABLE BORDER=0 WIDTH=100%>
29 <TR VALIGN=TOP>
30 <TD WIDTH=70%>
31 <& /Elements/MyTickets &>
32 <BR>
33 <& /Elements/MyRequests &>
34 </TD>
35 <TD>
36 <& /Elements/Quicksearch &>
37 <BR>
38 <form method=get action="index.html">
39 <& /Elements/Refresh, Name => 'HomeRefreshInterval', Default => $session {'home_refresh_interval'} &>
40 <div align=right><input type=submit value="<&|/l&>Go!</&>"></div>
41 </form>
42 </TD>
43 </TR>
44 </TABLE>
45 <%init>
46 if ( $ARGS{'q'} ) {
47     my $query = $ARGS{'q'};
48
49     if ( $query =~ m/^\s*(\d+)\s*$/ ) {
50         $m->comp("/Ticket/Display.html" , id=> $1);
51         return();
52     }
53
54     $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
55
56     if ( $query =~ m/\@/ ) {
57         $session{'tickets'}->LimitWatcher( VALUE    => $query,
58                                             TYPE => 'Requestor',
59                                              OPERATOR => '=', );
60         $m->comp("/Search/Listing.html");
61
62         return();
63     }
64
65     #
66     # Any search on queue name or subject will be for new/open tickets
67     # only.
68     #
69
70     $session{'tickets'}->LimitStatus( VALUE    => $_,
71                                       OPERATOR => '=', ) for qw(open new);
72
73
74
75     my $queue = RT::Queue->new( $session{'CurrentUser'} );
76     if ( $queue->Load($query) && $queue->Id ) {
77         $session{'tickets'}->LimitQueue( VALUE    => $queue->Id,
78                                          OPERATOR => '=', );
79
80
81         $m->comp("/Search/Listing.html");
82         return();
83     }
84     $session{'tickets'}->LimitSubject( VALUE    =>  $query, 
85                                        OPERATOR => 'LIKE' );
86         $m->comp("/Search/Listing.html");
87
88     return();
89
90 }
91
92 if ($ARGS{'HomeRefreshInterval'}) {
93         $session{'home_refresh_interval'} = $ARGS{'HomeRefreshInterval'};
94 }
95
96 </%init>