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

leira at pallas.eruditorum.org leira at pallas.eruditorum.org
Wed Sep 1 18:22:37 EDT 2004


Author: leira
Date: Wed Sep  1 18:22:36 2004
New Revision: 1399

Added:
   rtir/branches/1.1/html/RTIR/Search/LinkRefine.html
Modified:
   rtir/branches/1.1/html/RTIR/Elements/QueueTabs
   rtir/branches/1.1/html/RTIR/Incident/LinkToIncident.html
Log:
Now we can refine the search when we want to link a child to an incident.


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 18:22:36 2004
@@ -43,7 +43,7 @@
 my ($actions, $mytab);
 my $searchtabs = { } ;
 
-if ( $Ticket) {
+if ( $Ticket && $Ticket->QueueObj->Name eq $QueueName) {
 	
     my $id   = $Ticket->id();
     $mytab = "RTIR/Display.html?id=".$id;
@@ -233,6 +233,13 @@
 				  separator => 1 };
 }
 
+foreach my $tab ( sort keys %{$tabs} ) {
+    if ( $tabs->{$tab}->{'path'} eq $current_tab ) {
+        $tabs->{$tab}->{"subtabs"}        = $subtabs;
+        $tabs->{'this'}->{"current_subtab"}        = 
+        $tabs->{$tab}->{"path"};
+    }
+}
 </%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 18:22:36 2004
@@ -30,16 +30,24 @@
     ChildObj => $ChildObj, 
     current_tab => "RTIR/Incident/LinkToIncident.html?child=$child",
     current_subtab => "RTIR/Incident/LinkToIncident.html?child=$child",
-    Title => $title &>
+    subtabs => $refinetabs,
+    Title => $title,
+    Format => $Format,
+    Query => $Query,
+    Rows => $Rows,
+    OrderBy => $OrderBy,
+    Order => $Order,
+    QueryString => $QueryString,
+&>
 
 <form action='Display.html' method=get>
 <input type=hidden name=child value=<%$child%>>
 
 <& /RTIR/Search/Elements/ShowResults, 
     Queue => $Queue,
+    Query => $Query,
     QueryString => $QueryString, 
     BaseURL => $BaseURL,
-    Format => $Format,
     %ARGS &>
 
 <& /Elements/Submit, Name => "SubmitTicket", Caption => $SubmitCaption, Label => loc("Link") &>
@@ -48,9 +56,11 @@
 <HR>
 
 <%INIT>
+$child = $ARGS{'id'} if !$child;
+
 $Format = $RT::RTIRLinkIncidentSearchResultFormat;
 
-my ($Type, undef) = $m->comp('/RTIR/Elements/Type', Ticket => $child);
+my ($Type, undef) = $m->comp('/RTIR/Elements/Type', Queue => 'Incidents');
 
 my $ChildObj = LoadTicket($child);
 my $Queue = $ChildObj->QueueObj->Name;
@@ -60,55 +70,7 @@
 my $QueueObj = new RT::Queue($session{'CurrentUser'});
 $QueueObj->Load('Incidents') || 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');
-	$session{'tickets'}->LimitCustomField(CUSTOMFIELD => $cf->Id, VALUE => 'open');
-    }
-}
-
-ProcessSearchQuery(ARGS=>\%ARGS);
-$session{'tickets'}->RedoSearch();
-if ( $session{'tickets'}->DescribeRestrictions()) {
-    $ticketcount = $session{tickets}->Count();
-} else {
-}
-
-# Iterate through the ARGS hash and remove anything with a null value.
-map ($ARGS{$_} =~ /^$/ && (delete $ARGS{$_}), keys %ARGS);
-
-my ($bgcolor);
-my @cols = qw(id Status Priority Subject QueueObj->Name OwnerObj->Name RequestorAddresses DueAsString );
-
-Abort(loc("No search to operate on.")) unless ($session{'tickets'});
-
-$title = loc("Link [_1] #[_2] to selected Incident", $Type, $child);
-
-$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'};
-}
+my $title = loc("Link [_1] #[_2] to selected Incident", $Type, $child);
 
 if (!$Query) {
     $Query = $m->comp('/RTIR/Elements/NewQuery', Queue => 'Incidents');
@@ -129,6 +91,13 @@
 $Query = "$BaseQuery AND ( $Query )";
 $ARGS{'Query'} = $Query;
 
+my $refinetabs = { };
+
+$refinetabs->{'_a'} = {
+    class => "nav",
+    path => "RTIR/Search/LinkRefine.html?Queue=Incidents&child=$child$QueryString",
+    title => loc('Refine') };
+	
 </%INIT>
 
 <%ARGS>

Added: rtir/branches/1.1/html/RTIR/Search/LinkRefine.html
==============================================================================
--- (empty file)
+++ rtir/branches/1.1/html/RTIR/Search/LinkRefine.html	Wed Sep  1 18:22:36 2004
@@ -0,0 +1,163 @@
+%# {{{ BEGIN BPS TAGGED BLOCK
+%# 
+%# COPYRIGHT:
+%#  
+%# This software is Copyright (c) 1996-2004 Best Practical Solutions, LLC 
+%#                                          <jesse at bestpractical.com>
+%# 
+%# (Except where explicitly superseded by other copyright notices)
+%# 
+%# 
+%# LICENSE:
+%# 
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%# 
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+%# General Public License for more details.
+%# 
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+%# 
+%# 
+%# CONTRIBUTION SUBMISSION POLICY:
+%# 
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%# 
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions,  LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%# 
+%# }}} END BPS TAGGED BLOCK
+<& /Elements/Header, Title => $title &>
+<& '/RTIR/Incident/Elements/Tabs', 
+    ChildObj => $Ticket, 
+    current_tab => $current_tab, 
+    current_subtab => $current_subtab, 
+    subtabs => $refinetabs,
+    Title => $title &>
+
+<& /RTIR/Search/Elements/BuildQuery, 
+    queues => \%queues, 
+    actions => $results, 
+    optionlist => $optionlist,
+    search_hash => $search_hash,
+    dirty => $dirty,
+    AvailableColumns => $AvailableColumns,
+    CurrentFormat => $CurrentFormat,
+    BaseQuery => $BaseQuery,
+    FormAction => $FormAction,
+    %ARGS &>
+
+<%INIT>
+$child = $ARGS{'id'} if !$child;
+my $title = loc("Query Builder");
+
+my $Ticket = new RT::Ticket($session{'CurrentUser'});
+$Ticket->Load($child);
+
+my $mergetabs = { } ;
+
+$mergetabs->{'_a'} = {
+    class => "nav",
+    path => $current_subtab,
+    title => loc('Refine') };
+	
+my %queues = ();
+my $results;
+my $optionlist;
+my $search_hash;
+my $dirty;
+my $AvailableColumns;
+my $CurrentFormat;
+my ( $Format, $Order, $OrderBy, $RowsPerPage );
+
+my $BaseQuery = $m->comp('/RTIR/Elements/BaseQuery', Queue => $Queue);
+
+my $QueryString;
+if ($NewQuery) {
+    # If it's a new query, wipe it ourselves...
+
+    # Wipe all data-carrying variables clear if we want a new
+    # search, or we're deleting an old one..
+
+    $Query = '';
+    $Format = '';
+    $Order = '';
+    $OrderBy = '';
+    $RowsPerPage = '';
+    # ($search hasn't been set yet; no need to clear)
+
+    $m->comp('Elements/ClearQuery', %ARGS);
+
+    # and replace it with our standard new query...
+
+    $ARGS{'Query'} = $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);
+    $Query = $ARGS{'Query'};
+
+    # and claim it isn't a new query any more
+
+    $ARGS{'NewQuery'} = 0;
+}
+
+( $Query, $Format, $Order, $OrderBy, $RowsPerPage ) = 
+    $m->comp('/RTIR/Search/Elements/ProcessQuery', 
+	     queues => \%queues, 
+	     results => \$results, 
+	     optionlist => \$optionlist,
+	     search_hash => \$search_hash,
+	     dirty => \$dirty,
+	     AvailableColumns => \$AvailableColumns,
+	     CurrentFormat => \$CurrentFormat,
+	     BaseQuery => $BaseQuery,
+	     ResultPage => $ResultPage,
+	     %ARGS);
+
+my ($Type, @states) = $m->comp("/RTIR/Elements/Type", Queue => $Queue);
+
+# {{{ Build a querystring for the tabs
+
+    $QueryString = '&' . $m->comp('/Elements/QueryString', 
+	    Query => $Query,
+	    Format => $Format,
+            Order => $Order,
+            OrderBy => $OrderBy,
+            Rows => $RowsPerPage) if ($Query);
+# }}}
+
+$ARGS{'Query'} = $Query;
+
+my $refinetabs = { };
+
+$refinetabs->{'_a'} = {
+    class => "nav",
+    path => "RTIR/Search/LinkRefine.html?Queue=".$Queue."&child=$child$QueryString",
+    title => loc('Refine') };
+
+$ARGS{'id'} = $child;
+</%INIT>
+
+<%ARGS>
+$NewQuery => 0
+$Queue => undef
+$Query => undef
+$child => undef
+$current_tab => "RTIR/Incident/LinkToIncident.html?child=".$child
+$current_subtab => "RTIR/Search/LinkRefine.html?Queue=$Queue&child=".$child
+$FormAction => 'LinkRefine.html'
+$ResultPage => '/RTIR/Incident/LinkToIncident.html'
+</%ARGS>


More information about the Rt-commit mailing list