[Rt-commit] r4992 - in rtir/branches/1.9-EXPERIMENTAL: html/RTIR/Incident

ruz at bestpractical.com ruz at bestpractical.com
Fri Apr 7 09:15:32 EDT 2006


Author: ruz
Date: Fri Apr  7 09:15:32 2006
New Revision: 4992

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html

Log:
 r1265 at cubic-pc:  cubic | 2006-04-06 06:11:28 +0400
 * don't forget to disable block queue
 * really filter unique states
 * build QueryString a little bit later when we have Query


Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html	Fri Apr  7 09:15:32 2006
@@ -28,7 +28,7 @@
 
     Queue          => 'Incident Reports',
     Ticket         => $IncidentObj,
-    BaseQuery      => "( $IRBaseQuery ) OR ( $InvBaseQuery ) OR ( $BlockBaseQuery )",
+    BaseQuery      => $BaseQuery,
     QueryString    => $QueryString,
 
     current_tab    => $current_tab,
@@ -48,7 +48,7 @@
 <& /RTIR/Search/Elements/ShowResults,
     Queue     => 'Incident Reports',
     BaseURL   => $current_tab,
-    BaseQuery => $IRBaseQuery,
+    BaseQuery => $BaseQuery{'Incident Reports'},
     Query     => $Query,
     Format    => '__RTIR_Check__,'. $Format,
     Rows      => $Rows,
@@ -62,7 +62,7 @@
 <& /RTIR/Search/Elements/ShowResults,
     Queue     => 'Investigations',
     BaseURL   => $current_tab,
-    BaseQuery => $InvBaseQuery,
+    BaseQuery => $BaseQuery{'Investigations'},
     Query     => $Query,
     Format    => '__RTIR_Check__,'. $Format,
     Rows      => $Rows,
@@ -70,11 +70,12 @@
     OrderBy   => $OrderBy,
     Order     => $Order,
 &>
+% unless( RT->Config->Get('RTIR_DisableBlocksQueue') ) {
 <h2><&|/l&>Blocks Correspondents</&></h2>
 <& /RTIR/Search/Elements/ShowResults,
     Queue     => 'Investigations',
     BaseURL   => $current_tab,
-    BaseQuery => $BlockBaseQuery,
+    BaseQuery => $BaseQuery{'Blocks'},
     Query     => $Query,
     Format    => '__RTIR_Check__,'. $Format,
     Rows      => $Rows,
@@ -83,6 +84,7 @@
     Order     => $Order,
 &>
 % }
+% }
 
 <& Elements/ReplyForm, AllowResponse => ($ARGS{Status} !~ /^(?:resolved|rejected)$/) &>
 
@@ -98,14 +100,6 @@
 # XXX: clear radio, checkboxes from format
 $Format =~ s/__RTIR_(?:Radio|Check)__,//;
 
-my $QueryString = $m->comp( '/Elements/QueryString',
-                            Query => $Query,
-                            Format => $Format,
-                            Rows => $Rows,
-                            OrderBy => $OrderBy,
-                            Order => $Order,
-                            Page => $Page);
-
 my ($title, $SubmitCaption, $SubmitLabel);
 if ($DefaultStatus eq 'resolved') {
     $title = loc("Resolve Incident #[_1] (including children)", $id);
@@ -125,29 +119,30 @@
     }
 }
 
+my @queues = ('Incident Reports', 'Investigations');
+push @queues, 'Blocks' unless RT->Config->Get('RTIR_DisableBlocksQueue');
+
 my $ActiveStatesQuery;
 {
     my @active_states;
-    foreach my $q( 'Incident Reports', 'Investigations', 'Blocks' ) {
+    foreach my $q( @queues ) {
         push @active_states, $m->comp('/RTIR/Elements/States', Queue => $q);
     }
     my %seen;
     $ActiveStatesQuery = join ' OR ',
         map "CF.{_RTIR_State} = '$_'",
-        grep !$seen{ $_ },
+        grep !$seen{ $_ }++,
         @active_states;
 }
 
-unless ( $Query ) {
-    $Query = "( $ActiveStatesQuery )";
-}
+$Query ||= "( $ActiveStatesQuery )";
 
 my $ActiveChildrenQuery = join ' AND ', map "( $_ )", grep $_,
     "MemberOf = $id",
     $ActiveStatesQuery,
     join ' OR ',
         map "Queue = '$_'",
-        'Incident Reports', 'Investigations', 'Blocks';
+        @queues;
 
 $m->comp( '/RTIR/Create.html:ProcessAttachments', %ARGS );
 
@@ -210,14 +205,24 @@
     return $m->comp("Display.html", results => \@results, id => $id);
 }
 
-my $IRBaseQuery = join ' AND ', map "( $_ )", grep $_,
-    $m->comp('/RTIR/Elements/BaseQuery', Queue => 'Incident Reports'), "MemberOf = $id";
-my $InvBaseQuery = join ' AND ', map "( $_ )", grep $_,
-    $m->comp('/RTIR/Elements/BaseQuery', Queue => 'Investigations'), "MemberOf = $id";
-my $BlockBaseQuery = join ' AND ', map "( $_ )", grep $_,
-    $m->comp('/RTIR/Elements/BaseQuery', Queue => 'Blocks'), "MemberOf = $id";
+my ($BaseQuery, %BaseQuery) = ( '', () );
+foreach my $queue ( @queues ) {
+    my $tmp = $m->comp('/RTIR/Elements/BaseQuery', Queue => $queue);
+    $BaseQuery .= ' OR ' if $BaseQuery;
+    $BaseQuery .= "( $tmp )";
 
+    $BaseQuery{ $queue } = join ' AND ', map "( $_ )", grep $_,
+        $tmp, "MemberOf = $id";
+}
+$BaseQuery = join ' AND ', map "( $_ )", grep $_, $BaseQuery, "MemberOf = $id";
 
+my $QueryString = $m->comp( '/Elements/QueryString',
+                            Query => $Query,
+                            Format => $Format,
+                            Rows => $Rows,
+                            OrderBy => $OrderBy,
+                            Order => $Order,
+                            Page => $Page);
 
 my $current_tab = "RTIR/Incident/Reply.html?".
     $m->comp('/Elements/QueryString',


More information about the Rt-commit mailing list