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

ruz at bestpractical.com ruz at bestpractical.com
Mon Mar 13 14:57:57 EST 2006


Author: ruz
Date: Mon Mar 13 14:57:50 2006
New Revision: 4737

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Create.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkArticles.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkChildren.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Reply.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Report/BulkReject.html

Log:
 r937 at cubic-pc:  cubic | 2006-03-13 23:02:01 +0300
  r929 at cubic-pc:  cubic | 2006-03-13 23:00:23 +0300
  * update things to new refine tabs
  * build BaseURL in all pages that use ShowResults with AllowSorting
  * disable AllowSorting thing where it's not required or wouldn't work
  * Format should be cleaned from Radio or Check when it's used and sorting is allowed
    because sorting href pass format it shows
  
 


Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Create.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Create.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Create.html	Mon Mar 13 14:57:50 2006
@@ -32,12 +32,11 @@
     current_subtab => "RTIR/Split.html?Ticket=".$TicketObj->Id,
 &>
 % } elsif ( $Incident ) {
-<& "/RTIR/Incident/Elements/LinkTabs",
+<& "/RTIR/Search/Elements/RefineTabs",
     Title          => $Title,
     Ticket         => $IncidentObj,
     Queue          => $Queue,
     current_tab    => "RTIR/Create.html?Incident=$Incident&$EscapedQueue",
-    current_subtab => "RTIR/Create.html?Incident=$Incident&$EscapedQueue",
 &>
 % } else {
 <& "/RTIR/".$Type."/Elements/Tabs",
@@ -97,8 +96,8 @@
     <td>
       <& /Elements/SelectOwner, 
           Name => "Owner", 
-	  QueueObj => $QueueObj, 
-	  Default => $ARGS{Owner}||$session{'CurrentUser'}->Id||undef &>
+          QueueObj => $QueueObj, 
+          Default => $ARGS{Owner}||$session{'CurrentUser'}->Id||undef &>
     </td>
   </tr>
   <tr>
@@ -114,9 +113,9 @@
     <td colspan="2">
       <table>
       <tr>
-	<td><input size="3" name="TimeWorked"<% $ARGS{TimeWorked} && " value=\"$ARGS{TimeWorked}\""  %> /></td>
+        <td><input size="3" name="TimeWorked"<% $ARGS{TimeWorked} && " value=\"$ARGS{TimeWorked}\""  %> /></td>
         <td align="right"><&|/l&>Time Left</&>:</td>
-	<td><input size="3" name="TimeLeft"<% $ARGS{TimeLeft} && " value=\"$ARGS{TimeLeft}\"" %> /></td>
+        <td><input size="3" name="TimeLeft"<% $ARGS{TimeLeft} && " value=\"$ARGS{TimeLeft}\"" %> /></td>
       </tr>
       </table>
     </td>     
@@ -177,20 +176,20 @@
         <tr>
           <td>
             <& /RTIR/Elements/EditRTIRField, 
-	      TicketObj => $TicketObj,
+              TicketObj => $TicketObj,
               QueueObj => $QueueObj, 
-	      Name => 'HowReported',
-	      Default => $ARGS{'HowReported-Value'} || RT->Config->Get('_RTIR_HowReported_default') &>
+              Name => 'HowReported',
+              Default => $ARGS{'HowReported-Value'} || RT->Config->Get('_RTIR_HowReported_default') &>
           </td>
     <td class="labeltop">
       <%loc("Reporter Type")%>:
     </td>
     <td class="value" colspan="2">
       <& /RTIR/Elements/EditRTIRField, 
-	TicketObj => $TicketObj,
+        TicketObj => $TicketObj,
         QueueObj => $QueueObj, 
-	Name => 'ReporterType',
-	Default => $ARGS{'ReporterType-Value'} || RT->Config->Get('_RTIR_ReporterType_default'), &>
+        Name => 'ReporterType',
+        Default => $ARGS{'ReporterType-Value'} || RT->Config->Get('_RTIR_ReporterType_default'), &>
     </td>
         </tr>
       </table>
@@ -203,10 +202,10 @@
     </td>
     <td class="value">
       <& /RTIR/Elements/EditRTIRField, 
-	TicketObj => $TicketObj,
+        TicketObj => $TicketObj,
         QueueObj => $QueueObj, 
-	Name => 'IP',
-	Default => $ARGS{'IP-Value'} || RT->Config->Get('_RTIR_IP_default'), &>
+        Name => 'IP',
+        Default => $ARGS{'IP-Value'} || RT->Config->Get('_RTIR_IP_default'), &>
     </td>
   </tr>
   <tr>
@@ -215,9 +214,9 @@
     </td>
     <td class="value" colspan="2">
       <& /RTIR/Elements/EditRTIRField, 
-	TicketObj => $TicketObj,
+        TicketObj => $TicketObj,
         QueueObj => $QueueObj, Name => 'Netmask',
-	Default => $ARGS{'Netmask-Value'} || RT->Config->Get('_RTIR_Netmask_default'), &>
+        Default => $ARGS{'Netmask-Value'} || RT->Config->Get('_RTIR_Netmask_default'), &>
     </td>
   </tr>
   <tr>
@@ -237,9 +236,9 @@
     </td>
     <td class="value" colspan="2">
       <& /RTIR/Elements/EditRTIRField, 
-	TicketObj => $TicketObj,
+        TicketObj => $TicketObj,
         QueueObj => $QueueObj, Name => 'WhereBlocked',
-	Default => $ARGS{'WhereBlocked-Value'} || RT->Config->Get('_RTIR_WhereBlocked_default'), &>
+        Default => $ARGS{'WhereBlocked-Value'} || RT->Config->Get('_RTIR_WhereBlocked_default'), &>
     </td>
   </tr>
 % } elsif ($Type eq "Investigation") {
@@ -256,7 +255,7 @@
     <td colspan="2">
       <& /Ticket/Elements/EditCustomFields, 
         TicketObj => $TicketObj, 
-	QueueObj => $QueueObj &>
+        QueueObj => $QueueObj &>
     </td>
   </tr>
 
@@ -302,17 +301,17 @@
   </td>
   <td valign="top">
     <& /Widgets/TitleBoxStart, title => loc("Dates"),
-		title_class=> 'inverse',  
-		 color => "#663366" &>
+                title_class=> 'inverse',  
+                 color => "#663366" &>
 
     <table border="0">
       <tr>
         <td align="right"><&|/l&>Starts</&>:</td>
-	  <td><input size="10" name="Starts" value="<% $ARGS{Starts} || '' %>" /></td>
+          <td><input size="10" name="Starts" value="<% $ARGS{Starts} || '' %>" /></td>
       </tr>
       <tr>
         <td align="right"><&|/l&>Due</&>:</td>
-	<td><input size="10" name="Due" value="<% $ARGS{Due} || '' %>" /></td>
+        <td><input size="10" name="Due" value="<% $ARGS{Due} || '' %>" /></td>
       </tr>
     </table>
     <& /Widgets/TitleBoxEnd &>
@@ -335,8 +334,7 @@
 
 my ($Type) = $m->comp('/RTIR/Elements/Type', Queue => $Queue );
 if ($Type eq 'Incident') {
-    $m->comp("/RTIR/Incident/Create.html", %ARGS);
-    $m->abort;
+    return $m->comp("/RTIR/Incident/Create.html", %ARGS);
 }
 if ($Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
     Abort(loc("Blocks queue is disabled via config file"));
@@ -355,7 +353,6 @@
 my $TicketObj = $ARGS{'TicketObj'};
 
 if ( $Incident ) {
-    $IncidentObj = new RT::Ticket( $session{'CurrentUser'} );
     $IncidentObj = LoadTicket( $Incident );
     $Subject ||= $IncidentObj->Subject;
 }

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/BulkAbandon.html	Mon Mar 13 14:57:50 2006
@@ -24,16 +24,11 @@
 %# END LICENSE BLOCK
 <& '/RTIR/Elements/Header', Title => $title &>
 <& '/RTIR/Search/Elements/RefineTabs',
-    path        => $path,
-    Queue       => $Queue,
-    current_tab => $current_tab, 
     Title       => $title,
-    Format      => $Format,
-    Query       => $Query,
-    Rows        => $Rows,
-    OrderBy     => $OrderBy,
-    Order       => $Order,
+    Queue       => $Queue,
     QueryString => $QueryString,
+    BaseQuery   => $BaseQuery,
+    current_tab => $current_tab, 
 &>
 
 <& /Elements/ListActions, actions => \@results &>
@@ -41,11 +36,11 @@
 <form action="<%RT->Config->Get('WebPath')%>/RTIR/Incident/BulkAbandon.html" method="post">
 <input type="hidden" name="Status" value="<% $Status %>" />
 
-<%perl>
+<%PERL>
 # XXX: cache result set to check if get empty results
-my $result_set = $m->scomp(
-    '/RTIR/Search/Elements/ShowResults',
+my $result_set = $m->scomp('/RTIR/Search/Elements/ShowResults',
     Queue       => $Queue,
+    BaseURL     => $BaseURL,
     BaseQuery   => $BaseQuery,
     Query       => $Query,
     Format      => '__RTIR_Check__,'. $Format,
@@ -53,9 +48,8 @@
     OrderBy     => $OrderBy,
     Order       => $Order,
     Page        => $Page,
-    BaseURL     => $BaseURL,
 );
-</%perl>
+</%PERL>
 
 % if( $session{'tickets'}->Count ) {
 % $m->out( $result_set );
@@ -97,7 +91,7 @@
     my @tempresults;
 
     foreach my $id ( @SelectedTickets ) {
-        $m->out('<!--  Processing <%$t->id%> -->'); $m->flush_buffer;
+        $m->out('<!--  Processing <% $t->id %> -->'); $m->flush_buffer;
 
         my $t = RT::Ticket->new( $session{'CurrentUser'} );
         $t->Load( $id );
@@ -123,7 +117,7 @@
                 push @tempresults, ProcessUpdateMessage(TicketObj => $member, ARGSRef => \%ARGS );
             }
         }
-        
+
         # process status updates
         my @tmp;
         my $members = new RT::Tickets( $t->CurrentUser );
@@ -152,15 +146,9 @@
          @tempresults;
 
     # force redo search if we changed tickets
-    $session{'tickets'}->RedoSearch;
+    $session{'tickets'}->RedoSearch if $session{'tickets'};
 }
 
-
-# FIXME: Doesn't work as expected with refined search.
-# also is not clear should it use Query from
-# /RTIR/Search/Results.html?Queue=Incident%20Reports or 
-# own? and can it be refined at all?
-
 # We can only reject new tickets, so set the states.
 my $QueryString = $m->comp(
     '/Elements/QueryString',
@@ -171,30 +159,23 @@
     Order   => $Order,
     Page    => $Page
 );
-$current_tab ||= "RTIR/Incident/BulkAbandon.html?"
-    . $m->comp('/Elements/QueryString', Queue => $Queue)
-    . "&$QueryString";
-
-my $path = "RTIR/Search/Refine.html?$QueryString&";
-$path .= $m->comp( '/Elements/QueryString',
-                   ResultPage  => $BaseURL,
-                   current_tab => $current_tab,
-                   Queue       => $Queue,
-                 );
+my $BaseURL = "RTIR/Incident/BulkAbandon.html?"
+    . $m->comp('/Elements/QueryString', Queue => $Queue, Status => $Status);
+my $current_tab = $BaseURL ."&$QueryString";
 
 </%INIT>
 <%ARGS>
-$Status    => 'rejected'
-$Queue     => 'Incidents'
-$BaseQuery => $m->comp( '/RTIR/Elements/BaseQuery', Queue => $Queue );
-$Query     => $m->comp( '/RTIR/Elements/NewQuery', Queue => $Queue, Inactive => 1 );
-$Format    => RT->Config->Get('RTIRSearchResultFormats')->{'AbandonIncidents'};
-$Rows      => 50
-$Page      => 1
-$OrderBy   => 'id'
-$Order     => 'ASC'
-$BaseURL   => RT->Config->Get('WebPath') . "/RTIR/Incident/BulkAbandon.html"
-$current_tab => undef
+$Status          => 'rejected'
+$Queue           => 'Incidents'
+
+$BaseQuery       => $m->comp( '/RTIR/Elements/BaseQuery', Queue => $Queue );
+$Query           => $m->comp( '/RTIR/Elements/NewQuery', Queue => $Queue, Inactive => 1 );
+$Format          => RT->Config->Get('RTIRSearchResultFormats')->{'AbandonIncidents'};
+$Rows            => 50
+$Page            => 1
+$OrderBy         => 'id'
+$Order           => 'ASC'
+
 @SelectedTickets => ()
- at ReplyToAll => ()
+ at ReplyToAll      => ()
 </%ARGS>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkArticles.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkArticles.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkArticles.html	Mon Mar 13 14:57:50 2006
@@ -23,14 +23,14 @@
 %# 
 %# END LICENSE BLOCK
 <& /RTIR/Elements/Header, 
-    Title => $title, 
-    Refresh => $session{'tickets_refresh_interval'} &>
-
-<& Elements/LinkTabs, 
-    Ticket => $IncidentObj, 
-    current_subtab => 'RTIR/Incident/LinkArticles.html?id='.$IncidentObj->id,
-    Tab => loc('Link article'),
     Title => $title,
+    Refresh => $session{'tickets_refresh_interval'},
+&>
+
+<& /RTIR/Search/Elements/RefineTabs, 
+    Title       => $title,
+    Ticket      => $IncidentObj,
+    current_tab => "RTIR/Incident/LinkArticles.html?id=$id",
 &>
 
 <form action="LinkArticles.html" method="get">

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkChildren.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkChildren.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkChildren.html	Mon Mar 13 14:57:50 2006
@@ -22,20 +22,24 @@
 %# 
 %# 
 %# END LICENSE BLOCK
-<& /RTIR/Elements/Header, 
-    Title => $title, 
-    Refresh => $session{'tickets_refresh_interval'} &>
-
-<& Elements/LinkTabs, 
-    Queue => $Queue,
-    Ticket => $IncidentObj, 
-    current_subtab => 'RTIR/Incident/LinkChildren.html?id='.$IncidentObj->id.'&Queue='.$Queue,
-    Tab => loc('Link [_1]', $Queue),
+<& /RTIR/Elements/Header,
     Title => $title,
+    Refresh => $session{'tickets_refresh_interval'},
+&>
+
+<& /RTIR/Search/Elements/RefineTabs, 
+    Title             => $title,
+    Ticket            => $IncidentObj,
+    Queue             => $Queue,
+    BaseQuery         => $BaseQuery,
+    QueryString       => $QueryString,
+
+    current_tab       => $current_tab,
+    current_subtab    => 'RTIR/Search/Refine.html',
 &>
 
 <form action="Display.html" method="get">
-<input type="hidden" name="id" value="<%$id%>" />
+<input type="hidden" name="id" value="<% $id %>" />
 <input type="hidden" name="BulkLink" value="1" />
 
 <& /RTIR/Search/Elements/ShowResults, 
@@ -47,8 +51,7 @@
     Page        => $Page,
     OrderBy     => $OrderBy,
     Order       => $Order,
-    BaseURL     => $BaseURL,
-    QueryString => $QueryString, 
+    BaseURL     => $current_tab,
 &>
 
 <& /Elements/Submit, Name => "SubmitTicket", Caption => $title, Label => loc("Link") &>
@@ -61,29 +64,36 @@
 my ($Type) = $m->comp('/RTIR/Elements/Type', Queue => $Queue);
 my $title = loc("Link selected [_1] to Incident #[_2]", $Type, $id);
 
+# XXX: clear radio, checkboxes from format
+$Format =~ s/__RTIR_(?:Radio|Check)__,//;
+
 my $QueryString = $m->comp('/Elements/QueryString',
                                Query   => $Query,
                                Format  => $Format,
                                Rows    => $Rows,
+                               Page    => $Page,
                                OrderBy => $OrderBy,
                                Order   => $Order,
-                               Page    => $Page,
                           );
 
-$BaseQuery = join ' AND ', map "( $_ )", $BaseQuery, "MemberOf != $id";
+unless ( $BaseQuery ) {
+    $BaseQuery = $m->comp('/RTIR/Elements/BaseQuery', Queue => $Queue);
+    $BaseQuery = join ' AND ', map "( $_ )", $BaseQuery, "MemberOf != $id";
+}
+
+my $current_tab = 'RTIR/Incident/LinkChildren.html?'
+    . $m->comp( '/Elements/QueryString', id => $id, Queue => $Queue );
 
 </%INIT>
 
 <%ARGS>
 $id          => undef
 $Queue       => undef
-$Status      => 'open',
-$BaseQuery   => $m->comp('/RTIR/Elements/BaseQuery', Queue => $Queue);
-$Query       => $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);
+$BaseQuery   => undef
+$Query       => $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue)
 $Format      => RT->Config->Get('RTIRSearchResultFormats')->{'LinkChildren'}
 $Rows        => 50
 $Page        => 1
 $OrderBy     => 'id'
 $Order       => 'ASC'
-$BaseURL     => RT->Config->Get('WebPath') . "/RTIR/Incident/LinkChildren.html"
 </%ARGS>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/LinkToIncident.html	Mon Mar 13 14:57:50 2006
@@ -23,36 +23,34 @@
 %# 
 %# END LICENSE BLOCK
 <& /RTIR/Elements/Header, 
-    Title => $title, 
-    Refresh => $session{'tickets_refresh_interval'} &>
+    Title => $title,
+    Refresh => $session{'tickets_refresh_interval'},
+&>
 
 <& '/RTIR/Search/Elements/RefineTabs',
-   path => $path,
-   current_tab => "RTIR/Incident/LinkToIncident.html?id=$id",
-   Ticket => $ChildObj, 
-   Queue => 'Incidents',
-   Title => $title,
-   Format => $Format,
-   Query => $Query,
-   Rows => $Rows,
-   OrderBy => $OrderBy,
-   Order => $Order,
-   QueryString => $QueryString,
+   Title          => $title,
+   Ticket         => $ChildObj, 
+   Queue          => $Queue,
+   BaseQuery      => $BaseQuery,
+   QueryString    => $QueryString,
+
+   current_tab    => $current_tab,
+   current_subtab => "RTIR/Search/Refine.html",
 &>
 
-<form action="<%RT->Config->Get('WebPath')%>/RTIR/Incident/Display.html" method="post">
+<form action="<% RT->Config->Get('WebPath') %>/RTIR/Incident/Display.html" method="post">
 <input type="hidden" name="Child" value="<% $id %>" />
 
 <& /RTIR/Search/Elements/ShowResults, 
     Queue     => $Queue,
     BaseQuery => $BaseQuery,
     Query     => $Query,
-    BaseURL   => $BaseURL,
     Format    => '__RTIR_Radio__,'. $Format,
     Rows      => $Rows,
     Page      => $Page,
     OrderBy   => $OrderBy,
     Order     => $Order,
+    BaseURL   => $current_tab,
 &>
 
 <& /Elements/Submit,
@@ -64,39 +62,41 @@
 
 <%INIT>
 my $ChildObj = LoadTicket($id);
+$ARGS{'id'} = $id = $ChildObj->id;
 
 my ($Type) = $m->comp( '/RTIR/Elements/Type', TicketObj => $ChildObj );
 my $title = loc( "Link [_1] #[_2] to selected Incident", $Type, $id );
 
+# XXX: clear radio, checkboxes from format
+$Format =~ s/__RTIR_(?:Radio|Check)__,//;
+
+my $Queue = 'Incidents';
 my $BaseQuery = $m->comp( '/RTIR/Elements/BaseQuery', Queue => $Queue );
-$BaseQuery = join ' AND ', map "( $_ )", $BaseQuery, "HasMember != ". $ChildObj->id;
+$BaseQuery = join ' AND ', map "( $_ )", grep $_,
+             $BaseQuery, "HasMember != $id";
 
-my $current_tab = "RTIR/Incident/LinkToIncident.html?id=9"; #XXX: WTF id=9 does here?
-my $tab = $m->interp->apply_escapes($current_tab,'u');
+$Query ||= $m->comp( '/RTIR/Elements/NewQuery', Queue => $Queue );
 
 my $QueryString = $m->comp('/Elements/QueryString',
-                               Query => $Query,
-                               Format => $Format,
-                               Rows => $Rows,
+                               Query   => $Query,
+                               Format  => $Format,
+                               Rows    => $Rows,
+                               Page    => $Page,
                                OrderBy => $OrderBy,
-                               Order => $Order,
-                               Page => $Page,
+                               Order   => $Order,
                           );
 
-my $path = "RTIR/Search/Refine.html?"
+my $current_tab = "RTIR/Incident/LinkToIncident.html?"
     . $m->comp( '/Elements/QueryString',
-                ResultPage  => $BaseURL,
-                Queue       => $Queue,
-                id          => $id,
-                current_tab => $tab,
-    ) ."&$QueryString";
+        id    => $id,
+        Queue => $Queue,
+    );
 
 </%INIT>
 <%ARGS>
 $id      => undef
-$Queue   => 'Incidents'
-$BaseURL => RT->Config->Get('WebPath') . "/RTIR/Incident/LinkToIncident.html"
-$Query   => $m->comp( '/RTIR/Elements/NewQuery', Queue => $Queue )
+
+$Query   => undef
 $Format  => RT->Config->Get('RTIRSearchResultFormats')->{'LinkIncident'}
 $Rows    => 50
 $Page    => 1

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	Mon Mar 13 14:57:50 2006
@@ -23,50 +23,51 @@
 %# 
 %# END LICENSE BLOCK
 <& /RTIR/Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &>
-<& Elements/LinkTabs, 
-    Queue => 'Incident Reports',
-    Ticket => $IncidentObj, 
-    current_tab => "RTIR/Incident/ShowChildren.html?Queue=Incident%20Reports&id=$id",
-    current_subtab => "RTIR/Incident/Reply.html?id=$id&All=$All&$QueryString",
-    Tab => 'Bulk Reply',
-    Title => $title &>
+<& /RTIR/Search/Elements/RefineTabs, 
+    Title          => $title,
+
+    Queue          => 'Incident Reports',
+    Ticket         => $IncidentObj,
+    BaseQuery      => $BaseQuery || "( $IRBaseQuery OR $InvBaseQuery )",
+    QueryString    => $QueryString,
+
+    current_tab    => $current_tab,
+    current_subtab => "RTIR/Search/Refine.html",
+&>
 
 <& /Elements/ListActions, actions => \@results &>
 
 <form action="Reply.html" method="get">
 <input type="hidden" name="id" value="<% $id %>" />
-<input type="hidden" name="Status" value="<% $ARGS{'DefaultStatus'} %>" />
+<input type="hidden" name="Status" value="<% $DefaultStatus %>" />
 <input type="hidden" name="All" value="<% $All %>" />
 <input type="hidden" name="Query" value="<% $Query %>" />
-<input type="hidden" name="BaseQuery" value="<% $BaseQuery %>" />
 
 <h2><&|/l&>Reporters</&></h2>
 <& /RTIR/Search/Elements/ShowResults,
-    Queue       => 'Incident Reports',
-    BaseQuery   => $BaseQuery || $m->comp('/RTIR/Elements/BaseQuery', Queue => 'Incident Reports'),
-    Query       => $Query,
-    Format      => '__RTIR_Check__,'. $Format,
-    Rows        => $Rows,
-    Page        => $Page,
-    OrderBy     => $OrderBy,
-    Order       => $Order,
-    QueryString => $QueryString,
-    BaseURL     => $BaseURL,
+    Queue     => 'Incident Reports',
+    BaseURL   => $current_tab,
+    BaseQuery => $BaseQuery || $IRBaseQuery,
+    Query     => $Query,
+    Format    => '__RTIR_Check__,'. $Format,
+    Rows      => $Rows,
+    Page      => $Page,
+    OrderBy   => $OrderBy,
+    Order     => $Order,
 &>
 
 % if ( $All ) {
 <h2><&|/l&>Investigation Correspondents</&></h2>
 <& /RTIR/Search/Elements/ShowResults,
-    Queue       => 'Investigations',
-    BaseQuery   => $BaseQuery || $m->comp('/RTIR/Elements/BaseQuery', Queue => 'Investigations'),
-    Query       => $Query,
-    Format      => '__RTIR_Check__,'. $Format,
-    Rows        => $Rows,
-    Page        => $Page,
-    OrderBy     => $OrderBy,
-    Order       => $Order,
-    QueryString => $QueryString, 
-    BaseURL     => $BaseURL,
+    Queue     => 'Investigations',
+    BaseURL   => $current_tab,
+    BaseQuery => $BaseQuery || $InvBaseQuery,
+    Query     => $Query,
+    Format    => '__RTIR_Check__,'. $Format,
+    Rows      => $Rows,
+    Page      => $Page,
+    OrderBy   => $OrderBy,
+    Order     => $Order,
 &>
 % }
 
@@ -81,6 +82,9 @@
 my $IncidentObj = LoadTicket( $id );
 $id = $ARGS{'id'} = $IncidentObj->id;
 
+# XXX: clear radio, checkboxes from format
+$Format =~ s/__RTIR_(?:Radio|Check)__,//;
+
 my $QueryString = $m->comp( '/Elements/QueryString',
                             Query => $Query,
                             Format => $Format,
@@ -90,11 +94,11 @@
                             Page => $Page);
 
 my ($title, $SubmitCaption, $SubmitLabel);
-if ($ARGS{'DefaultStatus'} eq 'resolved') {
+if ($DefaultStatus eq 'resolved') {
     $title = loc("Resolve Incident #[_1] (including children)", $id);
     $SubmitCaption = loc("Resolve Incident");
     $SubmitLabel = loc("Resolve");
-} elsif ($ARGS{'DefaultStatus'} eq 'rejected') {
+} elsif ($DefaultStatus eq 'rejected') {
     $title = loc("Abandon Incident #[_1] (including children)", $id);
     $SubmitCaption = loc("Abandon Incident");
     $SubmitLabel = loc("Abandon");
@@ -108,13 +112,6 @@
     }
 }
 
-
-
-# Iterate through the ARGS hash and remove anything with a null value.
-map (!$ARGS{$_} && (delete $ARGS{$_}), keys %ARGS);
-
-Abort(loc("No search to operate on.")) unless ($session{'tickets'});
-
 if ( $SubmitTicket ) {
     foreach my $id( @SelectedTickets ) {
         my $Ticket = RT::Ticket->new( $session{'CurrentUser'} );
@@ -143,20 +140,38 @@
     push @results, ProcessTicketBasics( TicketObj => $IncidentObj, ARGSRef => \%ARGS );
 }
 
+my ($InvBaseQuery, $IRBaseQuery );
+unless ( $BaseQuery ) {
+    $InvBaseQuery = join ' AND ', map "( $_ )", grep $_,
+        $m->comp('/RTIR/Elements/BaseQuery', Queue => 'Investigations'), "MemberOf = $id";
+    $IRBaseQuery = join ' AND ', map "( $_ )", grep $_,
+        $m->comp('/RTIR/Elements/BaseQuery', Queue => 'Incident Reports'), "MemberOf = $id";
+}
+
+my $current_tab = "RTIR/Incident/Reply.html?".
+    $m->comp('/Elements/QueryString',
+        id            => $id,
+        All           => $All,
+        DefaultStatus => $DefaultStatus,
+        Action        => $Action,
+    );
+
 </%INIT>
 
 <%ARGS>
 $id              => undef
 $All             => 0
-$BaseURL         => RT->Config->Get('WebPath') . "/RTIR/Incident/Reply.html?DefaultStatus=stalled&id=$id"
+$DefaultStatus   => ''
+$Action          => 'Correspond'
+
 $BaseQuery       => undef
-$Query           => "CF.{_RTIR_State} = 'open' AND MemberOf = $id";
-$Format          => RT->Config->Get('RTIRSearchResultFormats')->{'BulkReply'};
+$Query           => "CF.{_RTIR_State} = 'open'"
+$Format          => RT->Config->Get('RTIRSearchResultFormats')->{'BulkReply'}
 $Rows            => 0
 $Page            => 1
 $OrderBy         => 'id'
 $Order           => 'ASC'
-$Action          => 'Correspond'
+
 @SelectedTickets => ()
-$SubmitTicket    => 1
+$SubmitTicket    => 0
 </%ARGS>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/ShowChildren.html	Mon Mar 13 14:57:50 2006
@@ -23,11 +23,11 @@
 %# 
 %# END LICENSE BLOCK
 <& /RTIR/Elements/Header, Title => $Title &>
-<& /RTIR/Incident/Elements/LinkTabs, 
-    Queue => $Queue,
-    Ticket => $Incident,
-    current_tab => "RTIR/Incident/ShowChildren.html?Queue=$Queue&id=". $Incident->id,
-    Title => $Title,
+<& /RTIR/Search/Elements/RefineTabs, 
+    Title             => $Title,
+    Ticket            => $Incident,
+    Queue             => $Queue,
+    current_tab       => $current_tab,
 &>
 
 <& /Elements/ListActions, actions => \@results &>
@@ -39,14 +39,14 @@
 % }
 
 <form action="ShowChildren.html" method="post">
-<input type="hidden" name="id" value="<%$Incident->id%>" />
-<input type="hidden" name="Queue" value="<%$Queue%>" />
+<input type="hidden" name="id" value="<% $id %>" />
+<input type="hidden" name="Queue" value="<% $Queue %>" />
 
 <& /RTIR/Elements/ShowChildren,
     Ticket             => $Incident,
     Queue              => $Queue,
     States             => [@States],
-    FullList           => RT->Config->Get('WebPath')."/RTIR/Incident/ShowChildren.html?Queue=$Queue&id=".$Incident->id,
+    FullList           => RT->Config->Get('WebPath')."/RTIR/Incident/ShowChildren.html?Queue=$Queue&id=$id",
     Delete             => $delete,
     ShowHeader         => 1,
     ShowStatesSelector => 1,
@@ -56,28 +56,25 @@
 </form>
 
 <%INIT>
-unless ($id) {
-    Abort('No incident specified');
-}
-
 my @results;
 my $Incident = LoadTicket($id);
+$id = $ARGS{'id'} = $Incident->Id;
 
 if( $ARGS{'Unlink'} ) {
     # translate the checkbox args to what ProcessTicketLinks expects
-    $ARGS{'DeleteLink-' . $_ . '-MemberOf-'} = 1 for @SelectedTickets;
+    $ARGS{'DeleteLink-'. $_ .'-MemberOf-'} = 1 for @SelectedTickets;
     push @results, ProcessTicketLinks( TicketObj => $Incident, ARGSRef => \%ARGS );
 }
 
-unless ($Incident->CurrentUserHasRight('ShowTicket')) {
+unless ( $Incident->CurrentUserHasRight('ShowTicket') ) {
     Abort("No permission to view ticket");
 }
 
-my $Title = loc("$Queue for Incident #[_1]: [_2]", $Incident->Id, $Incident->Subject);
+my $Title = loc("$Queue for Incident #[_1]: [_2]", $id, $Incident->Subject);
 
 my $delete = $Incident->CurrentUserHasRight('ModifyTicket') ? 1: 0;
 
-my $children = new RT::Tickets($session{'CurrentUser'});
+my $children = RT::Tickets->new( $session{'CurrentUser'} );
 $children->FromSQL( $m->comp( '/RTIR/Elements/ChildrenQuery',
                               Queue  => $Queue,
                               Ticket => $Incident,
@@ -86,17 +83,20 @@
                   );
 
 my @possible_states = $m->comp("/RTIR/Elements/States", Queue => $Queue, Inactive => 1 );
-my $all_children = new RT::Tickets($session{'CurrentUser'});
+my $all_children = RT::Tickets->new( $session{'CurrentUser'} );
 $all_children->FromSQL( $m->comp( '/RTIR/Elements/ChildrenQuery',
                                   Queue  => $Queue,
                                   Ticket => $Incident,
                                   States => [@possible_states],
                                 )
                       );
+my $current_tab = 'RTIR/Incident/ShowChildren.html?'
+    . $m->comp( '/Elements/QueryString', id => $id, Queue => $Queue );
 </%INIT>
 <%ARGS>
-$id => undef
-$Queue => 'Incident Reports'
+$id              => undef
+$Queue           => 'Incident Reports'
+
 @SelectedTickets => ()
- at States => ()
+ at States          => ()
 </%ARGS>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Merge.html	Mon Mar 13 14:57:50 2006
@@ -25,99 +25,93 @@
 <& /Elements/Header, Title => $title, Refresh => $session{'tickets_refresh_interval'} &>
 
 <& '/RTIR/Search/Elements/RefineTabs',
-   path => $path,
-   Ticket => $Ticket,
-   id => $id, 
-   current_subtab => "RTIR/Merge.html?id=".$Ticket->Id. "$QueryString", 
-   Queue => $Queue,
-   Title => $title,
-   Format => $Format,
-   Query => $Query,
-   Rows => $Rows,
-   OrderBy => $OrderBy,
-   Order => $Order,
-   QueryString => $QueryString,
+    Title          => $title,
+    Ticket         => $Ticket,
+    Queue          => $Queue,
+    BaseQuery      => $BaseQuery,
+    QueryString    => $QueryString,
+
+    current_tab    => $current_tab,
+    current_subtab => 'RTIR/Search/Refine.html',
 &>
 
 <& /Elements/ListActions, actions => \@results &>
 
-% if (!$Ticket->CurrentUserHasRight('ModifyTicket')) {
-<%loc("You are not allowed to merge this [_1].", $Type)%>
+% unless ( $Ticket->CurrentUserHasRight('ModifyTicket') ) {
+<% loc("You are not allowed to merge this [_1].", $Type) %>
 %    $m->abort();
 % }
 
-<form action="<%RT->Config->Get('WebPath')%>/RTIR/Merge.html" method="post">
-<input type="hidden" name="id" value="<%$Ticket->id%>" />
-<input type="hidden" name="<%$Ticket->Id%>-MergeInto" />
+<form action="<% RT->Config->Get('WebPath') %>/RTIR/Merge.html" method="post">
+<input type="hidden" name="id" value="<% $id %>" />
+<input type="hidden" name="<% $id %>-MergeInto" />
 
 <& /RTIR/Search/Elements/ShowResults, 
-    Queue => $Queue,
-    Query => $Query,
-    QueryString => $QueryString, 
-    BaseURL => RT->Config->Get('WebPath')."/RTIR/Merge.html?id=$id&",
-    Format => '__RTIR_Radio__,'. $Format,
-    &>
-
-<hr>
+    Queue       => $Queue,
+    BaseQuery   => $BaseQuery,
+    Query       => $Query,
+    Format      => '__RTIR_Radio__,'. $Format,
+    Rows        => $Rows,
+    Page        => $Page,
+    OrderBy     => $OrderBy,
+    Order       => $Order,
+    BaseURL     => $current_tab,
+&>
 
 <& /Elements/Submit, Caption=> loc('Merge into selected Ticket'), Label => loc("Merge") &>
 </form>
 
 <%INIT>
-$Format = RT->Config->Get('RTIRSearchResultFormats')->{'Merge'};
-
 my $Ticket = LoadTicket($id);
+$id = $ARGS{'id'} = $Ticket->id;
+my ($Type) = $m->comp( 'Elements/Type', TicketObj => $Ticket );
 my $Queue = $Ticket->QueueObj->Name;
 
-my ($Type) = $m->comp('Elements/Type', Ticket => $Ticket->Id);
-
-my $merge = $ARGS{'SelectedTicket'};
-my ($MergeTicket, @results);
+# XXX: clear radio, checkboxes from format
+$Format =~ s/__RTIR_(?:Radio|Check)__,//;
 
-if ($merge) {
-  $ARGS{$id.'-MergeInto'} = $merge;
-  $MergeTicket = LoadTicket($merge);
-  if ($MergeTicket->QueueObj->id ne $Ticket->QueueObj->id) {
-    push @results, loc("Merge failed: Ticket #[_1] is not the right type", $MergeTicket->Id);
-  } else {
-    @results = ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
-  }
+my (@results);
+if ( $SelectedTicket ) {
+    $ARGS{ $id .'-MergeInto' } = $SelectedTicket;
+    my $MergeTicket = LoadTicket( $SelectedTicket );
+    if ( $MergeTicket->QueueObj->id ne $Ticket->QueueObj->id ) {
+        push @results, loc("Merge failed: Ticket #[_1] is not the right type", $MergeTicket->Id );
+    } else {
+        push @results, ProcessTicketLinks( TicketObj => $Ticket, ARGSRef => \%ARGS);
+    }
 }
 
 my $title = loc("Merge [_1] #[_2]: [_3]", $Type, $id, $Ticket->Subject);
 
-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) {
+$Query ||= $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);
+unless ( $BaseQuery ) {
     $BaseQuery = $m->comp('/RTIR/Elements/BaseQuery', Queue => $Queue);
-    $BaseQuery .= " AND id != $id"
+    $BaseQuery = join ' AND ', map "( $_ )", grep $_, $BaseQuery, " id != $id";
 }
 
-$Query = "$BaseQuery AND ( $Query )";
+my $QueryString = $m->comp('/Elements/QueryString',
+    Query   => $Query,
+    Format  => $Format,
+    Rows    => $Rows,
+    Page    => $Page,
+    OrderBy => $OrderBy,
+    Order   => $Order,
+);
 
-my $path = "RTIR/Search/Refine.html?ResultPage=$BaseURL&current_tab=$current_tab&Queue=" . $Ticket->QueueObj->Name . "&id=$id&$QueryString";
+my $current_tab = "RTIR/Merge.html?id=$id";
 
 </%INIT>
       
 <%ARGS>
-$BaseQuery => undef
-$Query => undef
-$Format => undef 
-$Rows => 50
-$Page => 1
-$OrderBy => 'id'
-$Order => 'ASC'
-$id => undef
-$BaseURL => RT->Config->Get('WebPath') . '/RTIR/Merge.html'
-$current_tab => 'RTIR/Merge.html'
+$id             => undef
+
+$BaseQuery      => undef
+$Query          => undef
+$Format         => RT->Config->Get('RTIRSearchResultFormats')->{'Merge'} 
+$Rows           => 50
+$Page           => 1
+$OrderBy        => 'id'
+$Order          => 'ASC'
+
+$SelectedTicket => undef
 </%ARGS>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Report/BulkReject.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Report/BulkReject.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Report/BulkReject.html	Mon Mar 13 14:57:50 2006
@@ -24,16 +24,11 @@
 %# END LICENSE BLOCK
 <& '/RTIR/Elements/Header', Title => $title &>
 <& '/RTIR/Search/Elements/RefineTabs',
-   path => $path,
-   Queue => $Queue,
-   current_tab => $current_tab, 
-   Title => $title,
-   Format => $Format,
-   Query => $Query,
-   Rows => $Rows,
-   OrderBy => $OrderBy,
-   Order => $Order,
+   Title       => $title,
+   Queue       => $Queue,
+   BaseQuery   => $BaseQuery,
    QueryString => $QueryString,
+   current_tab => $current_tab,
 &>
 
 <& /Elements/ListActions, actions => \@results &>
@@ -43,6 +38,7 @@
 
 <& /RTIR/Search/Elements/ShowResults,
     Queue     => $Queue,
+    BaseURL   => $BaseURL,
     BaseQuery => $BaseQuery,
     Query     => $Query,
     Format    => '__RTIR_Check__,'. $Format,
@@ -50,7 +46,6 @@
     Page      => $Page,
     OrderBy   => $OrderBy,
     Order     => $Order,
-    BaseURL   => $BaseURL,
 &>
 
 % if( $session{'tickets'}->Count ) {
@@ -71,8 +66,10 @@
 </form>
 
 <%INIT>
-my $title         = loc("Reject Incident Reports");
-my $SubmitCaption = loc("Reject selected incident reports");
+my $title = loc("Reject Incident Reports");
+
+# XXX: clear radio, checkboxes from format
+$Format =~ s/__RTIR_(?:Radio|Check)__,//;
 
 my ( @results );
 if ( $BulkReject ) {
@@ -142,30 +139,23 @@
     }
 }
 
-my $QueryString = $m->comp(
-    '/Elements/QueryString',
+my $QueryString = $m->comp('/Elements/QueryString',
     Query     => $Query,
     Format    => $Format,
     Rows      => $Rows,
+    Page      => $Page,
     OrderBy   => $OrderBy,
     Order     => $Order,
-    Page      => $Page
 );
-$current_tab ||= "RTIR/Report/BulkReject.html?"
-    . $m->comp('/Elements/QueryString', Queue => $Queue)
-    . "&$QueryString";
-
-my $path = "RTIR/Search/Refine.html?$QueryString&";
-$path .= $m->comp( '/Elements/QueryString',
-                   ResultPage  => $BaseURL,
-                   current_tab => $current_tab,
-                   Queue       => $Queue,
-                 );
+my $BaseURL = "RTIR/Report/BulkReject.html?"
+    . $m->comp('/Elements/QueryString', Queue => $Queue, Status => $Status);
+my $current_tab = "$BaseURL&$QueryString";
 
 </%INIT>
 <%ARGS>
 $Status              => 'rejected'
 $Queue               => 'Incident Reports'
+
 $BaseQuery           => $m->comp( '/RTIR/Elements/BaseQuery', Queue => $Queue )
 $Query               => $m->comp( '/RTIR/Elements/NewQuery',  Queue => $Queue )
 $Format              => RT->Config->Get('RTIRSearchResultFormats')->{'RejectReports'};
@@ -173,9 +163,8 @@
 $Page                => 1
 $OrderBy             => 'id'
 $Order               => 'ASC'
-$BaseURL             => RT->Config->Get('WebPath') . "/RTIR/Report/BulkReject.html?"
-$current_tab         => undef
+
 @SelectedTickets     => ()
 $BulkRejectAndReturn => 0
-$BulkReject          => $BulkRejectAndReturn
+$BulkReject          => $BulkRejectAndReturn? 1: 0
 </%ARGS>


More information about the Rt-commit mailing list