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

ruz at bestpractical.com ruz at bestpractical.com
Thu Nov 3 16:43:41 EST 2005


Author: ruz
Date: Thu Nov  3 16:43:41 2005
New Revision: 4022

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Search/Results.html
Log:
 r256 at cubic-pc:  cubic | 2005-11-03 16:49:26 +0300
  r249 at cubic-pc:  cubic | 2005-11-03 12:12:34 +0300
  * get rid of code duplication
 


Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Search/Results.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Search/Results.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Search/Results.html	Thu Nov  3 16:43:41 2005
@@ -45,7 +45,7 @@
 %# }}} END BPS TAGGED BLOCK
 <& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &>
 <& '/RTIR/'.$Type.'/Elements/Tabs', 
-    current_tab => "RTIR/Search/Results.html?Queue=$Queue$QueryString", 
+    current_tab => "RTIR/Search/Results.html?Queue=$Queue&$QueryString",
     Title => $title,
     Format => $Format,
     Query => $Query,
@@ -56,57 +56,38 @@
 &>
 
 <& /Elements/ListActions, actions => \@results &>
-<hr>
+<hr />
 
-<& Elements/ShowResults, 
-   Query => $Query, 
-   QueryString => $QueryString, 
-   Format => $Format,
+<& Elements/ShowResults,
+    %ARGS,
+    Query => $Query, 
+    QueryString => $QueryString, 
+    Format => $Format,
 &>
 
 <%INIT>
-my ($Type, @states) = $m->comp("/RTIR/Elements/Type", Queue => $Queue);
-$Format = $RT::RTIRSearchResultFormats->{$Type . 'Default'};
+my ($Type, undef) = $m->comp("/RTIR/Elements/Type", Queue => $Queue);
+$Format ||= $RT::RTIRSearchResultFormats->{$Type . 'Default'};
 
 my $title = loc("Results");
-$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); 
-
-if ($OrderBy ne $session{'CurrentSearchHash'}->{'OrderBy'}
-    or $Order ne $session{'CurrentSearchHash'}->{'Order'}) {
-    $session{'CurrentSearchHash'}->{'OrderBy'} = $OrderBy;
-    $session{'CurrentSearchHash'}->{'Order'}   = $Order;
-    # Invalidate the ordering cache
-    undef $session{'tickets'}->{'items_array'};
-}
-
-if (!$Query) {
-    $Query = $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);
-}
-
-my $QueryString = "&".$m->comp('/Elements/QueryString',
-                               Query => $Query,
-                               Format => $Format,
-                               Rows => $Rows,
-                               OrderBy => $OrderBy,
-                               Order => $Order,
-                               Page => $Page);
-
-if (!$BaseQuery) {
-    $BaseQuery = $m->comp('/RTIR/Elements/BaseQuery', Queue => $Queue);
-}
 
-$Query = "$BaseQuery AND ( $Query )";
-$ARGS{'Query'} = $Query;
+$Query ||= $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);
+$BaseQuery ||= $m->comp('/RTIR/Elements/BaseQuery', Queue => $Queue);
 
-</%INIT>
+my $QueryString = $m->comp( '/Elements/QueryString',
+                            BaseQuery => $BaseQuery,
+                            Query => $Query,
+                            Format => $Format,
+                            Rows => $Rows,
+                            OrderBy => $OrderBy,
+                            Order => $Order,
+                            Page => $Page
+                          );
 
-<%CLEANUP>
-$session{'tickets'}->PrepForSerialization();
-</%CLEANUP>
 
+$Query = "($BaseQuery) AND ( $Query )";
+
+</%INIT>
 <%ARGS>
 $BaseQuery => undef
 $Query => undef


More information about the Rt-commit mailing list