[Rt-devel] RT 3.6.1 Refactoring SelfService MyRequests

David Chandek-Stark david.chandek.stark at duke.edu
Fri Nov 3 17:47:20 EST 2006


The change basically uses the standard paginated listing of tickets from 
/Elements/TicketList.

--David

--- share/html/SelfService/Elements/MyRequests  2006-06-19 
18:44:04.000000000 -0400
+++ local/html/SelfService/Elements/MyRequests  2006-10-30 
20:21:19.000000000 -0500
@@ -44,41 +44,34 @@
 %# 
 %# END BPS TAGGED BLOCK }}}
 <&| /Widgets/TitleBox, title =>  $title &>
-<table border="0" cellspacing="1" cellpadding="1" bgcolor="#eeeeee" 
width="100%">
-<tr>
-<th><&|/l&>Subject</&></th>
-<th><&|/l&>Status</&></th>
-<th><&|/l&>Owner</&></th>
-</tr>
-<tr>
-% while (my $Ticket = $MyTickets->Next) {
-<tr>
-<td>
-<a 
href="<%$RT::WebPath%>/SelfService/Display.html?id=<%$Ticket->Id%>"><%$Ticket->Id%>: 
<%$Ticket->Subject%></a>
-</td>
-<td>
-<%loc($Ticket->Status)%>
-</td><td>
-<%$Ticket->OwnerObj->Name%>
-</tr>
-% }
-</table>
+<& /Elements/TicketList, Title   => $title,
+                        Format  => @Format, 
+                        Query   => $Query, 
+                        Order   => $Order, 
+                        OrderBy => $OrderBy,
+                        BaseURL => $BaseURL,
+                        Page    => $Page &>
 </&>
-
 <%INIT>
 $title ||= loc("My [_1] tickets", $friendly_status);
-my $MyTickets;
-$MyTickets = new RT::Tickets ($session{'CurrentUser'});
-$MyTickets->LimitWatcher(TYPE => 'Requestor', VALUE => 
$session{'CurrentUser'}->EmailAddress);
-$MyTickets->OrderBy(FIELD => 'id', ORDER => 'ASC');
-
-foreach my $status (@status) {
-
-        $MyTickets->LimitStatus(VALUE => $status);
+my $Query = "Requestor = '" . $session{'CurrentUser'}->EmailAddress . 
"'";
+if (@status) {
+   $Query .= " AND ( Status = '";
+   $Query .= join "' OR Status = '", @status; 
+   $Query .= "')";
 }
+my $Order = "ASC";
+my $OrderBy = "Created";
+my @Format = qq{
+   '<B><A 
HREF="$RT::WebPath/SelfService/Display.html?id=__id__">__id__</a></B>/TITLE:#',
+   '<B><A 
HREF="$RT::WebPath/SelfService/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
+   Status,
+   OwnerName};
 </%INIT>
 <%ARGS>
 $title => undef
 $friendly_status => loc('open')
 @status => ('open', 'new', 'stalled')
+$BaseURL => undef
+$Page => 1
 </%ARGS>


More information about the Rt-devel mailing list