[Rt-commit] [svn] r1162 - in rtir/trunk: . etc html/RTIR/Elements
html/RTIR/Tools
jesse at pallas.eruditorum.org
jesse at pallas.eruditorum.org
Mon Jun 28 11:51:24 EDT 2004
Author: jesse
Date: Mon Jun 28 11:51:23 2004
New Revision: 1162
Modified:
rtir/trunk/ (props changed)
rtir/trunk/etc/RTIR_Config.pm
rtir/trunk/html/RTIR/Elements/ChildSummary
rtir/trunk/html/RTIR/Tools/Lookup.html
Log:
----------------------------------------------------------------------
r1973 at tinbook: jesse | 2004-06-26T16:11:42.123272Z
----------------------------------------------------------------------
r1999 at tinbook: jesse | 2004-06-28T15:23:21.837515Z
Performance improvements and code cleanups to the Lookup tool
----------------------------------------------------------------------
Modified: rtir/trunk/etc/RTIR_Config.pm
==============================================================================
--- rtir/trunk/etc/RTIR_Config.pm (original)
+++ rtir/trunk/etc/RTIR_Config.pm Mon Jun 28 11:51:23 2004
@@ -75,4 +75,11 @@
# Set($ReplyString , "Re:");
+# RTIR_OldestRelatedTickets controls how far back, in days, RTIR
+# should look for tickets which might contain a specific string,
+# such as an IP address.
+
+Set($RTIR_OldestRelatedTickets, 60);
+
+
1;
Modified: rtir/trunk/html/RTIR/Elements/ChildSummary
==============================================================================
--- rtir/trunk/html/RTIR/Elements/ChildSummary (original)
+++ rtir/trunk/html/RTIR/Elements/ChildSummary Mon Jun 28 11:51:23 2004
@@ -24,11 +24,11 @@
%# END LICENSE BLOCK
<TABLE width=100% border=0 cellpadding=2 CELLSPACING=0>
<TR>
-<td><b><&|/l&>id<b></&></td>
-<td><b><&|/l&>Subject<b></&></td>
-<td><b><&|/l&>State<b></&></td>
-<td><b><&|/l&>Priority<b></&></td>
-<td align=right><b><&|/l&>Actions<b></&></td>
+<th><b><&|/l&>id<b></&></th>
+<th><b><&|/l&>Subject<b></&></th>
+<th><b><&|/l&>State<b></&></th>
+<th><b><&|/l&>Priority<b></&></th>
+<th align=right><b><&|/l&>Actions<b></&></th>
</TR>
% my $i=0;
%while (my $Ticket = $session{'tickets'}->Next) {
Modified: rtir/trunk/html/RTIR/Tools/Lookup.html
==============================================================================
--- rtir/trunk/html/RTIR/Tools/Lookup.html (original)
+++ rtir/trunk/html/RTIR/Tools/Lookup.html Mon Jun 28 11:51:23 2004
@@ -39,30 +39,55 @@
<hr>
% }
-%if (! $ARGS{'HideResults'}) {
+% unless ( $ARGS{'HideResults'}) {
<TABLE WIDTH=100% border=0 cellpadding=2 CELLSPACING=0>
<tr><td valign=top width=50%>
-<& /Elements/TitleBoxStart, title => loc('Incidents: [_1]', $q) &>
-<& /RTIR/Elements/IncidentSummary, Type => $TicketType, ticket => $ticket, q => $q &>
-<& /Elements/TitleBoxEnd&>
+<& /Elements/TitleBoxStart,
+ title => loc('Incidents: [_1]', $q) &>
+<& /RTIR/Elements/IncidentSummary,
+ Type => $TicketType,
+ ticket => $ticket,
+ q => $q &>
+<& /Elements/TitleBoxEnd &>
<br>
-<& /Elements/TitleBoxStart, title => loc('Incident Reports: [_1]', $q), color=> "#336633"&>
-<& /RTIR/Elements/ChildSummary, Queue => 'Incident Reports', Type => $TicketType, ticket => $ticket, lookuptype => $type, q => $q &>
+<& /Elements/TitleBoxStart,
+ title => loc('Incident Reports: [_1]', $q),
+ color=> "#336633"&>
+<& /RTIR/Elements/ChildSummary,
+ Queue => 'Incident Reports',
+ Type => $TicketType,
+ ticket => $ticket,
+ lookuptype => $type,
+ q => $q &>
<& /Elements/TitleBoxEnd&>
</td><td width=50% valign=top>
-<& /Elements/TitleBoxStart, title => loc('Investigations: [_1]', $q), color=> "#336633" &>
-<& /RTIR/Elements/ChildSummary, Queue => 'Investigations', Type => $TicketType, ticket => $ticket, lookuptype => $type, q => $q &>
+<& /Elements/TitleBoxStart,
+ title => loc('Investigations: [_1]', $q),
+ color=> "#336633" &>
+<& /RTIR/Elements/ChildSummary,
+ Queue => 'Investigations',
+ Type => $TicketType,
+ ticket => $ticket,
+ lookuptype => $type,
+ q => $q &>
<& /Elements/TitleBoxEnd &>
<br>
-<& /Elements/TitleBoxStart, title => loc('Blocks: [_1]', $q), color=> "#336633" &>
-<& /RTIR/Elements/ChildSummary, Queue => 'Blocks', Type => $TicketType, ticket => $ticket, lookuptype => $type, q => $q &>
+<& /Elements/TitleBoxStart,
+ title => loc('Blocks: [_1]', $q),
+ color=> "#336633" &>
+<& /RTIR/Elements/ChildSummary,
+ Queue => 'Blocks',
+ Type => $TicketType,
+ ticket => $ticket,
+ lookuptype => $type,
+ q => $q &>
<& /Elements/TitleBoxEnd &>
</TABLE>
% }
@@ -136,6 +161,13 @@
% }
<%init>
+
+my $title = loc("Lookup '[_1]' using server [_2]", $q, $server);
+
+my $current_subtab;
+my $TicketType;
+my $TicketObj;
+# {{{ Set up the whois query
foreach my $s (sort keys %$servers) {
# just pick the first one
$server = $servers->{$s} unless ($server);
@@ -148,42 +180,39 @@
if ($query) {
$iterator = $query->query_iterator($q);
} else {
- $error = "Unable to connect to whois server '$server'";
+ $error = loc( "Unable to connect to WHOIS server '[_1]'", $server);
}
-$ARGS{'ClearRestrictions'}="1";
-$ARGS{'AttachmentField'}="Content";
-$ARGS{'AttachmentFieldOp'}="LIKE";
-$ARGS{'ValueOfAttachmentField'}=$q;
-if (! $session{'tickets'}) {
- # Init a new search
- $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
-}
+# }}}
-my $title = "Lookup $q using server $server";
-my $ticketcount;
-$session{'i'}++;
-if ($session{'tickets'}) {
- if ($ARGS{'DeleteRestriction'}) {
- $session{'tickets'}->DeleteRestriction($ARGS{'DeleteRestriction'});
+ my $max_age;
+ if ($RT::RTIR_OldestRelatedTickets) {
+ $max_age = 0 - $RT::RTIR_OldestRelatedTickets;
+ } else {
+ $max_age = -60;
}
- if ( ($ARGS{'ClearRestrictions'}) || ($ARGS{'NewSearch'}) ) {
- $session{'tickets'}->ClearRestrictions;
- }
-}
- ProcessSearchQuery(ARGS=>\%ARGS);
- $session{'tickets'}->RedoSearch();
- if ( $session{'tickets'}->DescribeRestrictions()) {
- $ticketcount = $session{tickets}->Count();
- }
-my $current_subtab;
+ my $now = RT::Date->new($session{'CurrentUser'});
+ $now->SetToNow();
+ $now->AddDays($max_age);
+
+ # Init a new search
+ $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
+
if ($q) {
$current_subtab = 'RTIR/Tools/Lookup.html?q='.$q."&server=".$server;
+ my ( $val, $msg ) =
+ $session{'tickets'}->FromSQL(
+ "( ContentType = 'text/plain' "
+ . "OR ContentType = 'text' "
+ . "OR ContentType = 'text/html' )"
+ . " AND Content LIKE '$q' "
+ . " AND TransactionDate > '"
+ . $now->ISO
+ . "'" );
+
}
-my $TicketType;
-my $TicketObj;
if ($ticket) {
$TicketType = $m->scomp("/RTIR/Elements/Type", Ticket => $ticket);
$TicketType =~ s/\s*$//;
More information about the Rt-commit
mailing list