[Rt-commit] [svn] r1358 - in rtir/branches/1.1/html/RTIR: Elements Report Search/Elements

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Tue Aug 24 01:31:18 EDT 2004


Author: leira
Date: Tue Aug 24 01:31:17 2004
New Revision: 1358

Modified:
   rtir/branches/1.1/html/RTIR/Elements/QueueTabs
   rtir/branches/1.1/html/RTIR/Report/BulkReject.html
   rtir/branches/1.1/html/RTIR/Search/Elements/ShowResults
Log:
Switch BulkReject to the new search system.


Modified: rtir/branches/1.1/html/RTIR/Elements/QueueTabs
==============================================================================
--- rtir/branches/1.1/html/RTIR/Elements/QueueTabs	(original)
+++ rtir/branches/1.1/html/RTIR/Elements/QueueTabs	Tue Aug 24 01:31:17 2004
@@ -178,7 +178,7 @@
                  subtabs   => $searchtabs };
 
 if ($Type eq 'Report') {
-$tabs->{"h"} = { path      => 'RTIR/Report/BulkReject.html?ClearRestrictions=1',
+$tabs->{"h"} = { path      => 'RTIR/Report/BulkReject.html',
                  title     => loc('Bulk Reject'),
                  separator => 1 };
 }

Modified: rtir/branches/1.1/html/RTIR/Report/BulkReject.html
==============================================================================
--- rtir/branches/1.1/html/RTIR/Report/BulkReject.html	(original)
+++ rtir/branches/1.1/html/RTIR/Report/BulkReject.html	Tue Aug 24 01:31:17 2004
@@ -25,9 +25,16 @@
 <& /RTIR/Elements/Header, 
     Title => $title, 
     Refresh => $session{'tickets_refresh_interval'} &>
-<& Elements/Tabs, 
-    current_tab => 'RTIR/Report/BulkReject.html?ClearRestrictions=1', 
-    Title => $title &>
+<& 'Elements/Tabs', 
+    current_tab => 'RTIR/Report/BulkReject.html', 
+    Title => $title,
+    Format => $Format,
+    Query => $Query,
+    Rows => $Rows,
+    OrderBy => $OrderBy,
+    Order => $Order,
+    QueryString => $QueryString,
+&>
 
 <& /RTIR/Elements/ListActions, actions => \@results &>
 
@@ -44,49 +51,10 @@
 <& /Elements/Submit, Name => "SubmitTicket", Caption => $SubmitCaption, Label => loc("Reject") &>
 </form>
 
-<HR>
-
-<& /RTIR/Elements/SearchFields, Path => '/RTIR/Report/BulkReject.html', 
-    Queue => $QueueObj->Name, %ARGS &>
-
 <%INIT>
 my $title = loc("Reject Incident Reports");
 my $SubmitCaption = loc("Reject selected incident reports");
 
-my $QueueObj = RT::Queue->new($session{'CurrentUser'});
-$QueueObj->Load("Incident Reports");
-
-if (! $session{'tickets'}) {
-    # Init a new search
-    $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
-}
-
-my $ticketcount;
-$session{'i'}++;
-if ($session{'tickets'}) {
-    if ($ARGS{'DeleteRestriction'}) {
-	$session{'tickets'}->DeleteRestriction($ARGS{'DeleteRestriction'});
-    }
-    if ( ($ARGS{'ClearRestrictions'}) || ($ARGS{'NewSearch'}) ) {
-	$session{'tickets'}->ClearRestrictions;
-	$session{'tickets'}->LimitQueue(VALUE => $QueueObj->Name);
-	my $cf = RT::CustomField->new($session{'CurrentUser'});
-	$cf->LoadByNameAndQueue(Queue => $QueueObj->Id, Name => '_RTIR_State');
-	$session{'tickets'}->LimitCustomField(CUSTOMFIELD => $cf->Id, VALUE => 'new');
-    }	
-}
-
-ProcessSearchQuery(ARGS=>\%ARGS);
-$session{'tickets'}->RedoSearch();
-if ( $session{'tickets'}->DescribeRestrictions()) {
-    $ticketcount = $session{tickets}->Count();
-}
-
-# 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'});
-
 my (@tempresults, @results);
 if ($ARGS{'BulkReject'}) {
     #Iterate through each ticket we've been handed
@@ -126,10 +94,40 @@
     }
 }
 
+if (!$Query) {
+    $Query = $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);
+}
+
+$ARGS{'Query'} = $Query;
+
+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 = "'CF.Incident Reports.{_RTIR_State}' = 'new' AND $BaseQuery AND ( $Query )";
+
+$session{'tickets'}->FromSQL($Query);
+
 </%INIT>
 
 <%ARGS>
 $Status => 'rejected'
 $check => 'uncheck'
+$Query => undef
+$BaseQuery => undef
+$Queue => 'Incident Reports'
+$Format => undef 
+$Rows => 50
+$Page => 1
+$OrderBy => 'id'
+$Order => 'ASC'
 </%ARGS>
 

Modified: rtir/branches/1.1/html/RTIR/Search/Elements/ShowResults
==============================================================================
--- rtir/branches/1.1/html/RTIR/Search/Elements/ShowResults	(original)
+++ rtir/branches/1.1/html/RTIR/Search/Elements/ShowResults	Tue Aug 24 01:31:17 2004
@@ -10,11 +10,14 @@
 
    &>
 <div align=right>
-<a href="<%$RT::WebPath%>/Search/Bulk.html<%$QueryString%>"><&|/l&>Update multiple tickets</&></a><br>
-<a href="<%$RT::WebPath%>/Search/Results.html<%$QueryString%>"><&|/l&>Bookmarkable link</&></a><br>
-<a href="<%$RT::WebPath%>/Search/Results.tsv<%$QueryString%>"><&|/l&>spreadsheet</&></a> |
-<a href="<%$RT::WebPath%>/Search/Results.rdf<%$QueryString%>"><&|/l&>RSS</&></a> |
-<a href="<%$RT::WebPath%>/Tools/Offline.html<%$QueryString%>"><&|/l&>Work offline</&></a><br>
+
+% if ($Queue eq 'Incident Reports') {
+%# this would do well as a Callback
+<a href="<%$RT::WebPath%>/RTIR/Report/BulkReject.html?Queue=<%$Queue%><%$QueryString%>"><&|/l&>Bulk Reject</&></a><br>
+% }
+<a href="<%$RT::WebPath%>/RTIR/Search/Results.html?Queue=<%$Queue%><%$QueryString%>"><&|/l&>Bookmarkable link</&></a><br>
+<a href="<%$RT::WebPath%>/Search/Results.tsv?Queue=<%$Queue%><%$QueryString%>"><&|/l&>spreadsheet</&></a> |
+<a href="<%$RT::WebPath%>/Search/Results.rdf?Queue=<%$Queue%><%$QueryString%>"><&|/l&>RSS</&></a> |
 </div>
 
 <%ARGS>
@@ -26,4 +29,5 @@
 $OrderBy => 'id'
 $Order => 'ASC'
 $QueryString => undef
+$Queue => undef
 </%ARGS>


More information about the Rt-commit mailing list