[Rt-commit] r4261 - in rtir/branches/1.9-EXPERIMENTAL: . html/RTIR/Search/Elements

ruz at bestpractical.com ruz at bestpractical.com
Wed Dec 7 07:59:41 EST 2005


Author: ruz
Date: Wed Dec  7 07:59:41 2005
New Revision: 4261

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Search/Elements/ShowResults
Log:
 r463 at cubic-pc:  cubic | 2005-12-07 16:01:19 +0300
  r455 at cubic-pc:  cubic | 2005-12-07 15:55:52 +0300
  * build collection only once and send it to RT comp
  * get default order values from user's session
 


Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Search/Elements/ShowResults
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Search/Elements/ShowResults	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Search/Elements/ShowResults	Wed Dec  7 07:59:41 2005
@@ -1,12 +1,11 @@
 <& /Elements/TicketList,
     %ARGS,
+    Collection => $collection,
     RTIRCheck => $RTIRCheck,
-    Query => $Query,
     OrderBy => $OrderBy,
     Order => $Order,
     Rows => $Rows,
     Page => $Page,
-    Format => $Format,
     BaseURL => $BaseURL,
     ShowNavigation => $ShowNavigation,
     AllowSorting => $AllowSorting,
@@ -22,29 +21,31 @@
 % }
 
 <%INIT>
-$session{'i'}++;
-$session{'tickets'} = RT::Tickets->new($session{'CurrentUser'})  unless ($session{'tickets'});
-$session{'tickets'}->FromSQL($Query) if ($Query);
-$session{'tickets'}->OrderBy(FIELD => $OrderBy, ORDER => $Order); 
+my $collection = $session{'tickets'} || RT::Tickets->new( $session{'CurrentUser'} );
+$collection->FromSQL( $Query ) if $Query;
+$session{'tickets'} = $collection;
 
-if ($OrderBy ne $session{'CurrentSearchHash'}->{'OrderBy'}
-    or $Order ne $session{'CurrentSearchHash'}->{'Order'}) {
+if ( $OrderBy ne $session{'CurrentSearchHash'}->{'OrderBy'}
+     || $Order ne $session{'CurrentSearchHash'}->{'Order'} )
+{
     $session{'CurrentSearchHash'}->{'OrderBy'} = $OrderBy;
     $session{'CurrentSearchHash'}->{'Order'}   = $Order;
 }
+
+return '' if !$ShowEmpty && !$collection->CountAll;
+
 </%INIT>
 <%ARGS>
 $Queue => undef
 $Query => undef
-$Format => undef
-$HideResults => 0
 $Rows => 50
 $Page => 1
-$OrderBy => 'id'
-$Order => 'ASC'
+$OrderBy => $session{'CurrentSearchHash'}->{'OrderBy'} || 'id'
+$Order => $session{'CurrentSearchHash'}->{'Order'} || 'ASC'
 $QueryString => undef
 $BaseURL => $RT::WebPath."/Search/Results.html?"
 $RTIRCheck => undef
 $ShowNavigation => 0
 $AllowSorting => 1
+$ShowEmpty => 0
 </%ARGS>


More information about the Rt-commit mailing list