[Rt-commit] [svn] r1392 - in rtir/branches/1.1: etc html/RTIR/Elements html/RTIR/Incident html/RTIR/Incident/Elements html/RTIR/Search/Elements

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Wed Sep 1 03:00:00 EDT 2004


Author: leira
Date: Wed Sep  1 02:59:59 2004
New Revision: 1392

Modified:
   rtir/branches/1.1/etc/RTIR_Config.pm
   rtir/branches/1.1/html/RTIR/Elements/QueueTabs
   rtir/branches/1.1/html/RTIR/Incident/BulkBlocks.html
   rtir/branches/1.1/html/RTIR/Incident/BulkInvestigations.html
   rtir/branches/1.1/html/RTIR/Incident/BulkReports.html
   rtir/branches/1.1/html/RTIR/Incident/Display.html
   rtir/branches/1.1/html/RTIR/Incident/Elements/BulkLink
   rtir/branches/1.1/html/RTIR/Incident/Elements/ReportTabs
   rtir/branches/1.1/html/RTIR/Incident/LinkBlocks.html
   rtir/branches/1.1/html/RTIR/Incident/LinkInvestigations.html
   rtir/branches/1.1/html/RTIR/Incident/LinkReports.html
   rtir/branches/1.1/html/RTIR/Incident/LinkToIncident.html
   rtir/branches/1.1/html/RTIR/Search/Elements/ShowResults
Log:
Initial pass of making BulkLink work with new components.


Modified: rtir/branches/1.1/etc/RTIR_Config.pm
==============================================================================
--- rtir/branches/1.1/etc/RTIR_Config.pm	(original)
+++ rtir/branches/1.1/etc/RTIR_Config.pm	Wed Sep  1 02:59:59 2004
@@ -88,4 +88,14 @@
 '<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__Subject__</a></B>/Title:Subject',
 __Requestors__,__OwnerName__,__CreatedRelative__,__DueRelative__});
 
+Set ($RTIRLinkSearchResultFormat, qq{___RTIR_Check__,
+'<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
+'<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__Subject__</a></B>/Title:Subject',
+__Requestors__,__OwnerName__,__CreatedRelative__,__DueRelative__});
+
+Set ($RTIRLinkIncidentSearchResultFormat, qq{___RTIR_Radio__,
+'<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
+'<B><A HREF="$RT::WebPath/Ticket/Display.html?id=__id__">__Subject__</a></B>/Title:Subject',
+__Requestors__,__OwnerName__,__CreatedRelative__,__DueRelative__});
+
 1;

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	Wed Sep  1 02:59:59 2004
@@ -119,7 +119,7 @@
 }
 
 foreach my $tab ( sort keys %{$ticket_page_tabs} ) {
-    if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_tab ) {
+    if ( $ticket_page_tabs->{$tab}->{'path'} eq $current_subtab ) {
         $ticket_page_tabs->{$tab}->{"subtabs"}        = $subtabs;
         $tabs->{'this'}->{"current_subtab"}        = 
         $ticket_page_tabs->{$tab}->{"path"};

Modified: rtir/branches/1.1/html/RTIR/Incident/BulkBlocks.html
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/BulkBlocks.html	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/BulkBlocks.html	Wed Sep  1 02:59:59 2004
@@ -31,7 +31,6 @@
 
 <& Elements/BulkLink, 
     id => $id, 
-    Type = 'Block', 
     %ARGS &>
 
 <%ARGS>

Modified: rtir/branches/1.1/html/RTIR/Incident/BulkInvestigations.html
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/BulkInvestigations.html	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/BulkInvestigations.html	Wed Sep  1 02:59:59 2004
@@ -31,7 +31,6 @@
 
 <& Elements/BulkLink,
     id => $id, 
-    Type => 'Investigation', 
     %ARGS &>
 
 <%INIT>

Modified: rtir/branches/1.1/html/RTIR/Incident/BulkReports.html
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/BulkReports.html	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/BulkReports.html	Wed Sep  1 02:59:59 2004
@@ -31,7 +31,6 @@
 
 <& Elements/BulkLink,
     id => $id, 
-    Type => 'Report', 
     %ARGS &>
 
 <%INIT>

Modified: rtir/branches/1.1/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/Display.html	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/Display.html	Wed Sep  1 02:59:59 2004
@@ -302,9 +302,11 @@
       push(@Actions, $msg);
     }
   } elsif ($ARGS{'BulkLink'}) {
+$m->print("bulk linking!<br>");
     #Iterate through each ticket we've been handed
     my $IncidentObj = LoadTicket($id);
     while (my $t = $session{'tickets'}->Next) {
+$m->print("ticket: " . $t->Id . "<br>");
       next unless ($ARGS{"UpdateTicket".$t->Id});
       &$DoLinks($t, $IncidentObj);
     }

Modified: rtir/branches/1.1/html/RTIR/Incident/Elements/BulkLink
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/Elements/BulkLink	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/Elements/BulkLink	Wed Sep  1 02:59:59 2004
@@ -26,67 +26,83 @@
 <input type=hidden name=id value=<%$id%>>
 <input type=hidden name=BulkLink value=1>
 
-<& /RTIR/Elements/Listing, 
-    Type => $Type, Queue => $Queue, check => 'check', %ARGS &>
+<& /RTIR/Search/Elements/ShowResults, 
+    Queue => $Queue,
+    QueryString => $QueryString, 
+    BaseURL => $BaseURL,
+    Format => $Format,
+    %ARGS &>
 
 <& /Elements/Submit, Name => "SubmitTicket", Caption => $SubmitCaption, Label => loc("Link") &>
 </form>
 
-<HR>
+<%INIT>
+$Format = $RT::RTIRLinkSearchResultFormat;
 
-<& /RTIR/Elements/SearchFields, Path => $Path, %ARGS &>
+my $TicketObj = new RT::Ticket($session{'CurrentUser'});
+$TicketObj->Load($id);
 
-<%INIT>
-my ($Queue, @states);
-if ($Type eq "Report") {
-  $Queue = 'Incident Reports';
-  @states = ('new', 'open');
-} elsif ($Type eq "Investigation") {
-  $Queue = 'Investigations';
-  @states = ('open');
-} if ($Type eq "Block") {
-  $Queue = 'Blocks';
-  @states = ('pending activation', 'active', 'pending removal');
-}
+my $Queue = $TicketObj->QueueObj->Name;
+my ($Type, @states) = $m->comp('/RTIR/Elements/Type', Ticket => $id);
+
+my ($LinkType, @linkstates) = $m->comp('/RTIR/Elements/Type', Queue => $LinkQ);
 
 my $QueueObj = new RT::Queue($session{'CurrentUser'});
 $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded."));
 
-if (! $session{'tickets'}) {
-    # Init a new search
-    $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
-}
-
 my ($title, $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');
-	foreach my $state (@states) {
-	    $session{'tickets'}->LimitCustomField(CUSTOMFIELD => $cf->Id, VALUE => $state);
-	}
-    }
+$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'};
 }
 
-ProcessSearchQuery(ARGS=>\%ARGS);
-$session{'tickets'}->RedoSearch();
-if ( $session{'tickets'}->DescribeRestrictions()) {
-    $ticketcount = $session{tickets}->Count();
-    $title = loc('Found [quant,_1,_2]', $ticketcount, $Type);
+if ( $session{'tickets'}->Query()) {
+    $ticketcount = $session{tickets}->CountAll();
+    $title = loc('Found [quant,_1,ticket]', $ticketcount);
 } else {
-    $title = loc("Find [_1]", $Type);
+    $title = loc("Find tickets");
 }
+
+if (!$Query) {
+    $Query = $m->comp('/RTIR/Elements/NewQuery', Queue => $LinkQ);
+}
+
+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 => $LinkQ);
+}
+
+$Query = "$BaseQuery AND ( $Query )";
+$ARGS{'Query'} = $Query;
+
 </%INIT>
 
 <%ARGS>
 $id => undef
+$LinkQ => undef
 $SubmitCaption => loc("Link Tickets")
-$Path => "/RTIR/Incident/LinkReports.html"
-$Type => undef
+$BaseURL => "/RTIR/Incident/LinkReports.html"
+$BaseQuery => undef
+$Query => undef
+$Format => undef 
+$HideResults => 0
+$Rows => 50
+$Page => 1
+$OrderBy => 'id'
+$Order => 'ASC'
 </%ARGS>

Modified: rtir/branches/1.1/html/RTIR/Incident/Elements/ReportTabs
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/Elements/ReportTabs	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/Elements/ReportTabs	Wed Sep  1 02:59:59 2004
@@ -25,7 +25,6 @@
 % if (defined $Ticket) {
 <& /RTIR/Incident/Elements/Tabs, 
     Ticket => $Ticket, 
-    current_tab => 'RTIR/Display.html?id='.$Ticket->id,
     current_subtab => 'RTIR/Incident/ShowReports.html?id='.$Ticket->id,
     subtabs => $subtabs,
     Title => $Title &>

Modified: rtir/branches/1.1/html/RTIR/Incident/LinkBlocks.html
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/LinkBlocks.html	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/LinkBlocks.html	Wed Sep  1 02:59:59 2004
@@ -31,7 +31,6 @@
 
 <& Elements/BulkLink,
     SubmitCaption => $SubmitCaption, 
-    Type => 'Block',
     id => $id,
     Path => "/RTIR/Incident/LinkBlocks.html",
     %ARGS &>

Modified: rtir/branches/1.1/html/RTIR/Incident/LinkInvestigations.html
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/LinkInvestigations.html	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/LinkInvestigations.html	Wed Sep  1 02:59:59 2004
@@ -31,7 +31,7 @@
 
 <& Elements/BulkLink,
     SubmitCaption => $SubmitCaption, 
-    Type => 'Investigation',
+    id => $id,
     Path => "/RTIR/Incident/LinkInvestigations.html",
     %ARGS &>
 

Modified: rtir/branches/1.1/html/RTIR/Incident/LinkReports.html
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/LinkReports.html	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/LinkReports.html	Wed Sep  1 02:59:59 2004
@@ -25,6 +25,7 @@
 <& /RTIR/Elements/Header, 
     Title => $title, 
     Refresh => $session{'tickets_refresh_interval'} &>
+
 <& Elements/ReportTabs, 
     Ticket => $IncidentObj, 
     current_subtab => 'RTIR/Incident/ShowReports.html',
@@ -32,9 +33,10 @@
 
 <& Elements/BulkLink,
     SubmitCaption => $SubmitCaption, 
+    id => $id,
     Status => 'open',
-    Type => 'Report',
-    Path => "/RTIR/Incident/LinkReports.html",
+    BaseURL => "/RTIR/Incident/LinkReports.html",
+    LinkQ => 'Incident Reports',
     %ARGS &>
 
 <%INIT>

Modified: rtir/branches/1.1/html/RTIR/Incident/LinkToIncident.html
==============================================================================
--- rtir/branches/1.1/html/RTIR/Incident/LinkToIncident.html	(original)
+++ rtir/branches/1.1/html/RTIR/Incident/LinkToIncident.html	Wed Sep  1 02:59:59 2004
@@ -34,8 +34,12 @@
 <form action='Display.html' method=get>
 <input type=hidden name=child value=<%$id%>>
 
-<& /RTIR/Elements/Listing, 
-    url => "LinkToIncident.html?id=$id", Type => 'Incident', Queue => 'Incidents', check => 'radio', %ARGS &>
+<& /RTIR/Search/Elements/ShowResults, 
+    Queue => $Queue,
+    QueryString => $QueryString, 
+    BaseURL => $BaseURL,
+    Format => $Format,
+    %ARGS &>
 
 <& /Elements/Submit, Name => "SubmitTicket", Caption => $SubmitCaption, Label => loc("Link") &>
 </form>
@@ -43,23 +47,18 @@
 <HR>
 
 <%INIT>
+$Format = $RT::RTIRLinkIncidentSearchResultFormat;
+
 my ($Type, undef) = $m->comp('/RTIR/Elements/Type', Ticket => $id);
 
 my $ChildObj = LoadTicket($id);
+my $Queue = $ChildObj->QueueObj->Name;
+
 my $SubmitCaption = loc("Link #[_1] with selected Incident", $ChildObj->id);
 
 my $QueueObj = new RT::Queue($session{'CurrentUser'});
 $QueueObj->Load('Incidents') || Abort(loc("Queue could not be loaded."));
 
-my $name;
-if ($ChildObj->QueueObj->Name eq "Incident Reports") {
-    $name = "Incident Report";
-} elsif ($ChildObj->QueueObj->Name eq "Investigations") {
-    $name = "Investigation";
-} elsif ($ChildObj->QueueObj->Name eq "Blocks") {
-    $name = "Block";
-}
-
 if (! $session{'tickets'}) {
     # Init a new search
     $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
@@ -95,10 +94,51 @@
 
 Abort(loc("No search to operate on.")) unless ($session{'tickets'});
 
-$title = loc("Link [_1] #[_2] to selected Incident", $name, $id);
+$title = loc("Link [_1] #[_2] to selected Incident", $Type, $id);
+
+$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 => 'Incidents');
+}
+
+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 => 'Incidents');
+}
+
+$Query = "$BaseQuery AND ( $Query )";
+$ARGS{'Query'} = $Query;
 
 </%INIT>
 
 <%ARGS>
 $id => undef
+$BaseURL => "/RTIR/Incident/LinkToIncident.html"
+$BaseQuery => undef
+$Query => undef
+$Format => undef 
+$HideResults => 0
+$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	Wed Sep  1 02:59:59 2004
@@ -20,6 +20,22 @@
 <a href="<%$RT::WebPath%>/Search/Results.rdf?Queue=<%$Queue%><%$QueryString%>"><&|/l&>RSS</&></a> |
 </div>
 
+<%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); 
+
+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'};
+}
+
+</%INIT>
+
 <%ARGS>
 $Query => undef
 $Format => undef 


More information about the Rt-commit mailing list