[Rt-commit] r4514 - in rtir/branches/1.9-EXPERIMENTAL: . html/Callbacks/RTIR/Ticket/Display.html html/Callbacks/RTIR/Ticket/Elements/ShowHistory html/RTIR html/RTIR/Elements html/RTIR/Incident html/RTIR/Tools

ruz at bestpractical.com ruz at bestpractical.com
Thu Feb 9 09:14:21 EST 2006


Author: ruz
Date: Thu Feb  9 09:14:19 2006
New Revision: 4514

Modified:
   rtir/branches/1.9-EXPERIMENTAL/   (props changed)
   rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm
   rtir/branches/1.9-EXPERIMENTAL/html/Callbacks/RTIR/Ticket/Display.html/Initial
   rtir/branches/1.9-EXPERIMENTAL/html/Callbacks/RTIR/Ticket/Elements/ShowHistory/SkipTransaction
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Create.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ChildSummary
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/IncidentSummary
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/PickRestriction
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowDates
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/States
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/Tabs
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Tools/Lookup.html
   rtir/branches/1.9-EXPERIMENTAL/html/RTIR/index.html

Log:
 r685 at cubic-pc:  cubic | 2006-02-09 17:16:24 +0300
  r679 at cubic-pc:  cubic | 2006-02-09 17:14:13 +0300
  * allow to hide blocks queue
 


Modified: rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/etc/RTIR_Config.pm	Thu Feb  9 09:14:19 2006
@@ -165,13 +165,13 @@
 			  __TimeLeft__},
     
     Merge => qq{___RTIR_Radio__,
-		'<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
-		'<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
+		'<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></b>/TITLE:#',
+		'<b><a href="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></b>/TITLE:Subject',
 		__Requestors__,
 		__OwnerName__,
 		__CreatedRelative__,
 		__DueRelative__},
-    
+
     LinkChildren => qq{___RTIR_Check__,
 		       '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
 		       '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
@@ -179,13 +179,12 @@
 		       __OwnerName__,
 		       __CreatedRelative__,
 		       __DueRelative__},
-    
+
     LinkIncident => qq{___RTIR_Radio__,
 		       '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
 		       '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
 		       __OwnerName__,
-		       __CreatedRelative__
-		       },
+		       __CreatedRelative__},
     
     RejectReports, qq{___RTIR_Check__,
 		      '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
@@ -212,10 +211,10 @@
 		   },
 
     ChildReport => qq{'<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
-			'<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
-	'<I>__CustomField.{_RTIR_State}__</I>/TITLE:State',
-	__DueRelative__,
-		  },
+                '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
+                '<I>__CustomField.{_RTIR_State}__</I>/TITLE:State',
+                __DueRelative__,
+            },
 
     ChildInvestigation => qq{'<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__id__</a></B>/TITLE:#',
 			     '<B><A HREF="__WebPath__/Ticket/Display.html?id=__id__">__Subject__</a></B>/TITLE:Subject',
@@ -237,6 +236,7 @@
 # on the edit screen.
 Set($DisplayAfterEdit, 1);
 
+# path to traceroute command
 Set($TracerouteCommand, '/usr/bin/traceroute');
 
 # Components that available to add on the first page of the RTIR
@@ -247,4 +247,7 @@
     RefreshHomepage
 )]);
 
+# if true then Blocks queue functionality inactive and disabled
+Set($RTIR_DisableBlocksQueue, 0);
+
 1;

Modified: rtir/branches/1.9-EXPERIMENTAL/html/Callbacks/RTIR/Ticket/Display.html/Initial
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/Callbacks/RTIR/Ticket/Display.html/Initial	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/Callbacks/RTIR/Ticket/Display.html/Initial	Thu Feb  9 09:14:19 2006
@@ -1,25 +1,26 @@
 <%INIT>
-return if ($ARGSRef{'NoRedirect'});
+return if $ARGSRef{'NoRedirect'};
+
 my $Queue;
-if ($TicketObj) {
+if ( $TicketObj ) {
     $Queue = $TicketObj->QueueObj->Name;
-} elsif (!$TicketObj && $ARGSRef{'id'} && $ARGSRef{'id'} ne 'new') {
-    $TicketObj = RT::Ticket->new($session{'CurrentUser'});
-    $TicketObj = LoadTicket($ARGSRef{'id'});
+} elsif ( $ARGSRef{'id'} && $ARGSRef{'id'} ne 'new' ) {
+    $TicketObj = LoadTicket( $ARGSRef{'id'} );
     $Queue = $TicketObj->QueueObj->Name;
-} else {
+} elsif ( $ARGSRef{'Queue'} ) {
     my $QueueObj = RT::Queue->new($session{'CurrentUser'});
-    $QueueObj->Load($ARGSRef{'Queue'});
+    $QueueObj->Load( $ARGSRef{'Queue'} );
     $Queue = $QueueObj->Name;
 }
+return unless $Queue;
 
-if ($Queue eq 'Incidents' ||
-    $Queue eq 'Incident Reports' ||
-    $Queue eq 'Investigations' ||
-    $Queue eq 'Blocks') {
-    
-    $m->comp('/RTIR/Display.html', %ARGSRef);
-    $m->abort();
+if ( $Queue eq 'Incidents' ||
+     $Queue eq 'Incident Reports' ||
+     $Queue eq 'Investigations' ||
+     $Queue eq 'Blocks' )
+{
+    $m->comp( '/RTIR/Display.html', %ARGSRef );
+    $m->abort;
 }
 
 </%INIT>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/Callbacks/RTIR/Ticket/Elements/ShowHistory/SkipTransaction
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/Callbacks/RTIR/Ticket/Elements/ShowHistory/SkipTransaction	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/Callbacks/RTIR/Ticket/Elements/ShowHistory/SkipTransaction	Thu Feb  9 09:14:19 2006
@@ -3,25 +3,17 @@
 # Set $skip to 1 if transaction matches criteria
 # $skip is passed by reference
 
-# check only ticket's transactions
 my $obj = $Transaction->Object;
-unless ( $obj->isa( 'RT::Ticket' ) ) {
-    $$skip = 0;
-    return 0;
-}
+
+# check only ticket's transactions
+return $$skip = 0 unless $obj->isa( 'RT::Ticket' );
 
 # only check if it's an RTIR queue
 my $Queue = $obj->QueueObj->Name;
-unless ( $Queue =~ /^(?:Incidents|Incident Reports|Investigations|Blocks)$/i ) {
-    $$skip = 0;
-    return 0;
-}
+return $$skip = 0 unless $Queue =~ /^(?:Incidents|Incident Reports|Investigations|Blocks)$/i;
 
-if ($Transaction->Type eq 'Status' && $Transaction->Field eq 'Status' ||
-    $Transaction->Type eq 'Set' && $Transaction->Field eq 'Status')
-{
-    $$skip = 1;
-    return 1;
+if ( $Transaction->Field eq 'Status' && $Transaction->Type =~ /^(?:Status|Set)$/ ) {
+    return $$skip = 1;
 }
 
 return 0;

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	Thu Feb  9 09:14:19 2006
@@ -321,6 +321,9 @@
     $m->comp("/RTIR/Incident/Create.html", %ARGS);
     $m->abort;
 }
+if ($Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+    Abort(loc("Blocks queue is disabled via config file"));
+}
 
 my $Status;
 if ($Queue eq "Incident Reports") {

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Display.html	Thu Feb  9 09:14:19 2006
@@ -190,6 +190,10 @@
 my ($Type) = $m->comp('Elements/Type', Queue => $QueueObj->Name);
 return $m->comp( '/Ticket/Display.html', %ARGS ) unless $Type;
 
+if ($Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+    Abort(loc("Blocks queue is disabled via config file"));
+}
+
 if ( $m->comp_exists("/RTIR/$Type/Display.html") ) {
     return $m->comp("/RTIR/$Type/Display.html", %ARGS);
 }
@@ -198,11 +202,7 @@
     unless ($QueueObj->CurrentUserHasRight('CreateTicket')) {
         Abort('You have no permission to create tickets in that queue.');
     }
-    ($Ticket, @results) = CreateTicket( Attachments => $session{'Attachments'},
-                                        %ARGS
-                                      );
-    delete $session{'Attachments'};
-    
+    ($Ticket, @results) = CreateTicket( %ARGS, Attachments => delete $session{'Attachments'} );
 } elsif( $id ) {
     my $oldstate = $Ticket->FirstCustomFieldValue('_RTIR_State');
 

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Edit.html	Thu Feb  9 09:14:19 2006
@@ -187,7 +187,15 @@
 my @results;
 
 my $Ticket = LoadTicket($id);
-my ($Type) = $m->comp('Elements/Type', Ticket => $Ticket->Id);
+my ($Type) = $m->comp('/RTIR/Elements/Type', TicketObj => $Ticket);
+
+if ($Type eq 'Incident') {
+  return $m->comp("/RTIR/Incident/Edit.html", %ARGS);
+}
+
+if( $Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+    Abort(loc("Blocks queue is disabled via config file"));
+}
 
 my $name;
 if ($Type eq 'Report') {
@@ -196,11 +204,6 @@
   $name = $Type;
 }
 
-if ($Type eq 'Incident') {
-  $m->comp("/RTIR/Incident/Edit.html", %ARGS);
-  $m->abort;
-}
-
 my $CanRespond = 0;
 my $CanComment = 0;
 
@@ -248,4 +251,3 @@
 $UserString => undef
 $id => undef
 </%ARGS>
-

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ChildSummary
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ChildSummary	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ChildSummary	Thu Feb  9 09:14:19 2006
@@ -24,6 +24,7 @@
 %# END LICENSE BLOCK
 <table width="100%" border="0" cellpadding="2" cellspacing="0">
 <tr>
+%# XXX: why we don't use TicketList component here?
 <th><b><&|/l&>id<b></&></th>
 <th><b><&|/l&>Subject<b></&></th>
 <th><b><&|/l&>State<b></&></th>
@@ -63,9 +64,9 @@
 % if ($Queue) {
 [<a href="<%RT->Config->Get('WebPath')%>/RTIR/Incident/LinkChildren.html?Queue=<%$Queue%>&Query=Content LIKE '<%$q%>'&id=<%$ticket%>"><%loc("Bulk Link")%></a>]
 % }
-%   if ($Queue eq 'Investigations' and $lookuptype eq 'email') {
+%   if ($Queue eq 'Investigations' && $lookuptype eq 'email') {
 <br />[<a href="<%RT->Config->Get('WebPath')%>/RTIR/Create.html?Incident=<%$ticket%>&Requestors=<%$q%>&Queue=Investigations"><%loc("Launch new: [_1]", $q)%></a>]
-%   } elsif ($Queue eq 'Blocks' and $lookuptype eq 'ip') {
+%   } elsif ( $Queue eq 'Blocks' && $lookuptype eq 'ip' && !RT->Config->Get('RTIR_DisableBlocksQueue') ) {
 <br />[<a href="<%RT->Config->Get('WebPath')%>/RTIR/Create.html?Incident=<%$ticket%>&Queue=Blocks&IP-Value=<%$q%>"><%loc("New Block: [_1]", $q)%></a>]
 %   }
 % }
@@ -74,19 +75,18 @@
 </table>
 
 <%INIT>
-my $Query;
-if (!$Query) {
-    $Query = $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);
-    $Query .= " AND Content LIKE '$q'" if $q;
-}
+my $Query = $m->comp('/RTIR/Elements/NewQuery', Queue => $Queue);
+$Query = join ' AND ', $Query, "Content LIKE '$q'" if $q;
 
-my $QueryString = "&".$m->comp('/Elements/QueryString',
-                               Query => $Query,
-                               Format => $Format,
-                               Rows => $Rows,
-                               OrderBy => $OrderBy,
-                               Order => $Order,
-                               Page => $Page);
+my $QueryString = $m->comp(
+    '/Elements/QueryString',
+    Query   => $Query,
+    Format  => $Format,
+    Rows    => $Rows,
+    OrderBy => $OrderBy,
+    Order   => $Order,
+    Page    => $Page,
+);
 
 </%INIT>
 

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/IncidentSummary
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/IncidentSummary	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/IncidentSummary	Thu Feb  9 09:14:19 2006
@@ -71,7 +71,7 @@
 my $Queue = 'Incidents';
 my $incidents;
 
-while (my $Ticket = $session{'tickets'}->Next) {
+while ( my $Ticket = $session{'tickets'}->Next ) {
   if ($Ticket->QueueObj->Name eq "Incidents") {
     $incidents->{$Ticket->Id} = { Ticket => $Ticket };
   } elsif ($Ticket->QueueObj->Name eq "Incident Reports") {
@@ -92,7 +92,7 @@
     $Query .= " AND Content LIKE '$q'" if $q;
 }
 
-my $QueryString = "&".$m->comp('/Elements/QueryString',
+my $QueryString = $m->comp('/Elements/QueryString',
                                Query => $Query,
                                Format => $Format,
                                Rows => $Rows,

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/PickRestriction
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/PickRestriction	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/PickRestriction	Thu Feb  9 09:14:19 2006
@@ -99,7 +99,7 @@
 <li><& /RTIR/Elements/SearchRTIRField, QueueObj => $QueueObj, 
 	Name => 'State' &>
 
-% } elsif ($QueueObj->Name eq 'Blocks') {
+% } elsif ($QueueObj->Name eq 'Blocks' && !RT->Config->Get('RTIR_DisableBlocksQueue') ) {
 <li><& /RTIR/Elements/SearchRTIRField, QueueObj => $QueueObj, 
 	Name => 'State' &>
 

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowDates
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowDates	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/ShowDates	Thu Feb  9 09:14:19 2006
@@ -46,7 +46,7 @@
         <% $Ticket->DueObj->AsString %>
 % if (RT->Config->Get('OverdueAfter')) {
         <br />
-        [<a href="Display.html?Due_Date=now%20%2B%20<%RT->Config->Get('OverdueAfter')%>%20days&id=<%$Ticket->Id%>"><%loc("Set to [_1] days from now", RT->Config->Get('OverdueAfter'))%></a>]
+        [<a href="Display.html?Due_Date=now%20%2B%20<% RT->Config->Get('OverdueAfter') |u %>%20days&id=<% $Ticket->Id %>"><%loc("Set to [_1] days from now", RT->Config->Get('OverdueAfter'))%></a>]
 % }
     </td>
   </tr>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/States
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/States	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/States	Thu Feb  9 09:14:19 2006
@@ -3,7 +3,10 @@
     'Incidents'        => { Active => ['new', 'open', 'stalled'], Inactive => [] },
     'Incident Reports' => { Active => ['new', 'open'], Inactive => ['rejected', 'resolved'] },
     'Investigations'   => { Active => ['new', 'open'], Inactive => ['stalled'] },
-    'Blocks'        => { Active => ['pending activation', 'active', 'pending removal'], Inactive => [] },
+    'Blocks'           => {
+        Active => ['pending activation', 'active', 'pending removal'],
+        Inactive => ['removed'],
+    },
 );
 </%ONCE>
 <%INIT>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/Tabs
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/Tabs	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Elements/Tabs	Thu Feb  9 09:14:19 2006
@@ -49,14 +49,19 @@
            path => 'RTIR/Search/Results.html?Queue=Incident%20Reports' },
     E => { title => loc('Investigations'),
            path => 'RTIR/Search/Results.html?Queue=Investigations' },
-    F => { title => loc('Blocks'),
-           path => 'RTIR/Search/Results.html?Queue=Blocks' },
     G => { title => loc('Tools'),
            path => 'RTIR/Tools/Lookup.html' },
     H => { title => loc('Preferences'),
            path => 'RTIR/Prefs/Home.html' },
 };
 
+unless ( RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+    $toptabs->{'F'} = {
+        title => loc('Blocks'),
+        path => 'RTIR/Search/Results.html?Queue=Blocks',
+    };
+}
+
 my $topactions = {
     A => { html => $m->scomp('/RTIR/Elements/SimpleSearch') }
 };

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Incident/Display.html	Thu Feb  9 09:14:19 2006
@@ -148,10 +148,12 @@
 
 </td><td valign="top" width="50%">
 
-<& /Widgets/TitleBoxStart, title => loc('Blocks'), 
-    title_href => RT->Config->Get('WebPath') ."/RTIR/Incident/ShowChildren.html?Queue=Blocks&id=".$id, 
-    title_class=> 'inverse',  
-    titleright => '', color=> "#336633" &>
+% unless ( RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+<& /Widgets/TitleBoxStart, title => loc('Blocks'),
+    title_href => RT->Config->Get('WebPath') ."/RTIR/Incident/ShowChildren.html?Queue=Blocks&id=".$id,
+    title_class=> 'inverse',
+    titleright => '', color=> "#336633",
+&>
 
 % if ($TicketObj->CurrentUserHasRight('ModifyTicket')) {
     <table width="100%"><tr><td align="right"><font size="-1">
@@ -168,6 +170,7 @@
 &>
 
 <& /Widgets/TitleBoxEnd &>
+% }
 
 </td></tr><tr><td colspan="2">
 
@@ -249,9 +252,8 @@
         $m->comp('/RTIR/Display.html', %ARGS );
         return;
     }
-
     ($TicketObj, @results) = CreateTicket( %ARGS, Attachments => delete $session{'Attachments'} );
-    my $new_ticket = 1;
+    $new_ticket = 1;
 } else {
     $TicketObj = LoadTicket( $id );
 }

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Tools/Lookup.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Tools/Lookup.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/Tools/Lookup.html	Thu Feb  9 09:14:19 2006
@@ -29,78 +29,85 @@
     current_subtab => $current_subtab, 
     Title => $title &>
 
-% if ($ticket) {
+% if ( $ticket ) {
 <& /Widgets/TitleBoxStart, title => loc("Current [_1]: #[_2]", $TicketType, $ticket), color=> "#993333" &>
-
 <table width="100%" border="0" cellpadding="2" cellspacing="0">
 <& /Elements/TicketList, 
     Query  => "id = ".$TicketObj->id,
     Format => $Format,
-    &>
-</table>
+&>
+</table><hr />
 <& /Widgets/TitleBoxEnd &>
-<hr>
 % }
 
-% unless ( $ARGS{'HideResults'}) {
+% unless ( $ARGS{'HideResults'} ) {
 <table width="100%" border="0" cellpadding="2" cellspacing="0">
 <tr><td valign="top" width="50%">
 
-<& /Widgets/TitleBoxStart, 
-    title => loc('Incidents: [_1]', $q) &>
+<&| /Widgets/TitleBox, title => loc('Incidents: [_1]', $q) &>
 <& /RTIR/Elements/IncidentSummary, 
-    Type => $TicketType, 
+    Type   => $TicketType, 
     ticket => $ticket, 
-    q => $q &>
-<& /Widgets/TitleBoxEnd &>
+    q      => $q,
+&>
+</&>
 
 <br />
 
-<& /Widgets/TitleBoxStart, 
+<&| /Widgets/TitleBox,
     title => loc('Incident Reports: [_1]', $q), 
-    color=> "#336633"&>
+    color => "#336633",
+&>
 <& /RTIR/Elements/ChildSummary, 
-    Queue => 'Incident Reports', 
-    Type => $TicketType, 
-    ticket => $ticket, 
+    Queue      => 'Incident Reports', 
+    Type       => $TicketType, 
+    ticket     => $ticket, 
     lookuptype => $type, 
-    q => $q &>
-<& /Widgets/TitleBoxEnd&>
+    q          => $q,
+&>
+</&>
 
 </td><td width="50%" valign="top">
 
-<& /Widgets/TitleBoxStart, 
+<& /Widgets/TitleBox,
     title => loc('Investigations: [_1]', $q), 
-    color=> "#336633" &>
+    color=> "#336633",
+&>
 <& /RTIR/Elements/ChildSummary, 
-    Queue => 'Investigations', 
-    Type => $TicketType, 
-    ticket => $ticket, 
+    Queue      => 'Investigations', 
+    Type       => $TicketType, 
+    ticket     => $ticket, 
     lookuptype => $type, 
-    q => $q &>
-<& /Widgets/TitleBoxEnd &>
+    q          => $q,
+&>
+</&>
 
 <br />
 
-<& /Widgets/TitleBoxStart, 
+% unless ( RT->Config->Get('RTIR_DisableBlocksQueue') ) {
+<& /Widgets/TitleBox,
     title => loc('Blocks: [_1]', $q), 
-    color=> "#336633" &>
-<& /RTIR/Elements/ChildSummary, 
-    Queue => 'Blocks', 
-    Type => $TicketType, 
-    ticket => $ticket, 
-    lookuptype => $type, 
-    q => $q &>
-<& /Widgets/TitleBoxEnd &>
+    color => "#336633",
+&>
+<& /RTIR/Elements/ChildSummary,
+    Queue      => 'Blocks',
+    Type       => $TicketType,
+    ticket     => $ticket,
+    lookuptype => $type,
+    q          => $q,
+&>
+</&>
+% }
+
 </table>
 % }
 
 <hr>
 
 <h2>Look Up Information</h2>
-<table>
 <form action="Lookup.html" method="get">
-<input type="hidden" name="ticket" value="<%$ARGS{'ticket'}%>" />
+<input type="hidden" name="ticket" value="<% $ARGS{'ticket'} %>" />
+<table>
   <tr>
     <td class="label">WHOIS:</td>
     <td class="input">
@@ -119,9 +126,9 @@
 % next unless $srv;
 % my $selected = "";
 % if ($servers->{$s} eq $server) {
-%   $selected = " SELECTED";
+%   $selected = " selected";
 % }
-        <option value="<%$host%>"<%$selected%>><%$name || $host%></option>
+        <option value="<% $host %>"<% $selected %>><% $name || $host %></option>
 % }
       </select>
     </td>
@@ -132,7 +139,7 @@
 <form action="Traceroute.html" method="get" target="_blank">
   <tr>
     <td class="label">Traceroute to:</td>
-    <td class="input"><input size="30" name="q" value="<%$q%>" /></td>
+    <td class="input"><input size="30" name="q" value="<% $q %>" /></td>
     <td align="left"><input type="submit" value="Go" /></td>
   </tr>
 </form>
@@ -189,7 +196,7 @@
 
 </form>
 
-<%init>
+<%INIT>
 my $current_subtab;
 my $TicketType;
 my $TicketObj;
@@ -254,18 +261,18 @@
 }
 
 if ($ticket) {
-  ($TicketType, undef) = $m->comp("/RTIR/Elements/Type", Ticket => $ticket);
+  ($TicketType, undef) = $m->comp('/RTIR/Elements/Type', Ticket => $ticket);
   $TicketObj = LoadTicket($ticket);
 }
 
 my $Format = RT->Config->Get('RTIRSearchResultFormats')->{$TicketType . 'Default'};
 
-</%init>
-<%args>
+</%INIT>
+<%ARGS>
 $servers => RT->Config->Get('whois')
 $server => undef
 $handparse => 1
 $q => undef
 $type => undef
 $ticket => undef
-</%args>
+</%ARGS>

Modified: rtir/branches/1.9-EXPERIMENTAL/html/RTIR/index.html
==============================================================================
--- rtir/branches/1.9-EXPERIMENTAL/html/RTIR/index.html	(original)
+++ rtir/branches/1.9-EXPERIMENTAL/html/RTIR/index.html	Thu Feb  9 09:14:19 2006
@@ -23,39 +23,33 @@
 %# 
 %# END LICENSE BLOCK
 <& /RTIR/Elements/Header, Title => "RTIR at a glance", Refresh => $session{'home_refresh_interval'} &>
-<& /RTIR/Elements/Tabs, 
-    Title => "RT for Incident Response", 
-    current_toptab => 'RTIR/index.html' &>
+<& /RTIR/Elements/Tabs, Title => "RT for Incident Response", current_toptab => 'RTIR/index.html' &>
 
 <& /Elements/ListActions, actions => \@results &>
 <& /Elements/MyRT, Portlets => $portlets &>
 <%INIT>
 
 # XXX: this should be automated!!!
-unless (exists $session{'my_rtir_portlets'}) {
-    my ($d_portlets) = RT::System->new($session{'CurrentUser'})->Attributes->Named('RTIR_HomepageSettings');
-    $session{'my_rtir_portlets'} = $session{'CurrentUser'}->UserObj->Preferences('RTIR_HomepageSettings', $d_portlets->Content);
+unless ( exists $session{'my_rtir_portlets'} ) {
+    my ($d_portlets) = RT::System->new( $session{'CurrentUser'} )->Attributes->Named('RTIR_HomepageSettings');
+    $session{'my_rtir_portlets'} = $session{'CurrentUser'}->UserObj->Preferences(
+        'RTIR_HomepageSettings', $d_portlets->Content
+    );
 }
 my $portlets = $session{'my_rtir_portlets'};
 
-
 if ( $ARGS{'q'} ) {
     my $query = $ARGS{'q'};
 
     if ( $query =~ m/^\s*(\d+)\s*$/ ) {
-        $m->comp( '/RTIR/Display.html' , id=> $1 );
-        return();
+        return $m->comp( '/RTIR/Display.html', id => $1 );
     }
 
-    if ( $m->comp( '/Elements/Callback',
+    return if $m->comp( '/Elements/Callback',
+                   %ARGS,
                    _CallbackName => 'SearchPreFilter',
-                   query => $query,
-                   %ARGS
-                 )) {
-        return;
-    }
-
-    $session{'tickets'} = RT::Tickets->new( $session{'CurrentUser'} );
+                   query         => $query,
+                 );
 
     # Incidents don't have requestors, but children do
     if ( $query =~ m/\@/ ) {
@@ -66,29 +60,36 @@
                              ) AND Requestor LIKE '$query'"
                           );
         my $querystring;
-        while (my $child = $children->Next) {
+        while ( my $child = $children->Next ) {
             $querystring .= " OR " if $querystring;
             $querystring .= "HasMember = " . $child->Id;
         }
-        $m->comp("/RTIR/Search/Results.html", Queue => 'Incidents', Query => ($querystring));
-
-        return;
+        return $m->comp(
+            '/RTIR/Search/Results.html',
+            Queue => 'Incidents',
+            Query => $querystring,
+        );
     }
 
 
     # Any search on queue name or subject will be for new/open tickets only.
-    my $status = "'CF.Incidents.{_RTIR_State}' = 'new' OR 'CF.Incidents.{_RTIR_State}' = 'open'";
-    $m->comp("/RTIR/Search/Results.html", Queue => 'Incidents', Query => "Subject LIKE '$query' AND ($status)");
-
-    return;
+    $query = join ' AND ',
+             "Subject LIKE '$query'",
+             $m->comp( '/RTIR/Elements/NewQuery', Queue => 'Incidents' );
+    return $m->comp(
+        '/RTIR/Search/Results.html',
+        Queue => 'Incidents',
+        Query => $query,
+    );
 }
 
-if ( $ARGS{'HomeRefreshInterval'} ) {
-    $session{'home_refresh_interval'} = $ARGS{'HomeRefreshInterval'};
+if ( $HomeRefreshInterval ) {
+    $session{'home_refresh_interval'} = $HomeRefreshInterval;
     push @results, loc( 'Updated refresh interval.');
 }
 
 </%INIT>
 <%ARGS>
 @results => ()
+$HomeRefreshInterval => undef
 </%ARGS>


More information about the Rt-commit mailing list