[Rt-commit] rt branch, 4.2/collection-list-in-about-requestor-box, created. rt-4.0.0rc4-101-g225eb09

Ruslan Zakirov ruz at bestpractical.com
Wed Mar 2 11:32:34 EST 2011


The branch, 4.2/collection-list-in-about-requestor-box has been created
        at  225eb0970a8566e0afcbbe11543fb90cb89d142e (commit)

- Log -----------------------------------------------------------------
commit 225eb0970a8566e0afcbbe11543fb90cb89d142e
Author: Ruslan Zakirov <ruz at bestpractical.com>
Date:   Wed Mar 2 19:31:08 2011 +0300

    use collection list in ShowRequestor box

diff --git a/share/html/Ticket/Elements/ShowRequestorTickets b/share/html/Ticket/Elements/ShowRequestorTickets
index bbdd071..4d2b786 100644
--- a/share/html/Ticket/Elements/ShowRequestorTickets
+++ b/share/html/Ticket/Elements/ShowRequestorTickets
@@ -45,31 +45,51 @@
 %# those contributions and any derivatives thereof.
 %#
 %# END BPS TAGGED BLOCK }}}
-<span class="label">
-  <a href="<% $url %>"><&|/l, $Rows, $Description &>This user's [_1] highest priority [_2] tickets</&>:</a>
-</span>
-<ul>
-%while (my $w=$tickets->Next) {
-%my $uri = RT::URI->new( $session{'CurrentUser'} );
-%$uri->FromObject($w);
-<li class="value"><& /Elements/ShowLink, URI => $uri &></li>
-%}
-</ul>
+<span class="label"><a href="<% $url %>"><% $title %>:</a></span>
+
+<& /Elements/CollectionList,
+    %QueryProperties,
+
+    Class          => 'RT::Tickets',
+    Page           => 1,
+    AllowSorting   => 0,
+    ShowNavigation => 0,
+&>
 <%INIT>
+
+my $title = loc("This user's [_1] highest priority [_2] tickets", $Rows, $Description );
+
 my $sql = "Requestor.id = ". $Requestor->id;
 if (@$conditions) {
     $sql .= " AND (".join( " OR ", map $_->{cond}, @$conditions).")";
 }
-my $tickets = RT::Tickets->new( $session{'CurrentUser'} );
-$tickets->FromSQL( $sql );
-$tickets->RowsPerPage( $Rows );
-$tickets->OrderBy( FIELD => 'Priority', ORDER => 'DESC' );
+
+my %QueryProperties = (
+    Query      => $sql,
+    OrderBy    => 'Priority',
+    Order      => 'DESC',
+    Rows       => $Rows || 10,
+    ShowHeader => 0,
+    Format     => qq{
+       '<a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a>',
+       '(__OwnerName__)&nbsp;<a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a>&nbsp;[__Status__]'
+    },
+);
 
 my $url  = RT->Config->Get('WebPath') . '/Search/Results.html?';
    $url .= $m->comp('/Elements/QueryString',
-                    Query       => $sql,
-                    OrderBy     => 'Priority',
-                    Order       => 'DESC' );
+                    Query       => $QueryProperties{'Query'},
+                    OrderBy     => $QueryProperties{'OrderBy'},
+                    Order       => $QueryProperties{'Order'},
+           );
+
+$m->callback(
+    %ARGS,
+
+    Title           => \$title,
+    QueryProperties => \%QueryProperties,
+);
+
 </%INIT>
 <%ARGS>
 $Requestor => undef

-----------------------------------------------------------------------


More information about the Rt-commit mailing list