%# BEGIN LICENSE BLOCK %# %# Copyright (c) 1996-2002 Jesse Vincent %# %# (Except where explictly superceded by other copyright notices) %# %# 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. %# %# %# Unless otherwise specified, all modifications, corrections or %# extensions to this work which alter its source code become the %# property of Best Practical Solutions, LLC when submitted for %# inclusion in the work. %# %# %# END LICENSE BLOCK <& /RTIR/Elements/Header, Title => loc("Incident #[_1]: [_2]", $id, $TicketObj->Subject) &> <& /RTIR/Incident/Elements/Tabs, Ticket => $TicketObj, current_tab => 'RTIR/Display.html?id='.$id, current_subtab => 'RTIR/Display.html?id='.$id, Title => loc("Incident #[_1]: [_2]", $id, $TicketObj->Subject) &> <& /Elements/ListActions, actions => \@results &>
<&| /Widgets/TitleBox, title => loc('Incident #[_1]', $id), title_href => RT->Config->Get('WebPath') ."/RTIR/Edit.html?id=".$id, title_class=> 'inverse' &>
<&|/l&>Owner: <%$TicketObj->OwnerObj->Name%>
<&|/l&>State: <& /RTIR/Elements/ShowRTIRField, Name => 'State', Ticket => $TicketObj &>
<&|/l&>Subject: <%$TicketObj->Subject %>
<&|/l&>Description: <& /RTIR/Elements/ShowRTIRField, Ticket => $TicketObj, Name => 'Description', Cols => 60 &>
<&|/l&>Priority: <%$TicketObj->Priority %>
<&|/l&>Time Worked: <%loc('[_1] min', $TimeWorked)%>
<&|/l&>Constituency: <& /RTIR/Elements/ShowRTIRField, Ticket => $TicketObj, Name => 'Constituency' &>
<&|/l&>Function: <& /RTIR/Elements/ShowRTIRField, Ticket => $TicketObj, Name => 'Function' &>
<&|/l&>Classification: <& /RTIR/Elements/ShowRTIRField, Ticket => $TicketObj, Name => 'Classification' &>
<&|/l&>Resolution: <& /RTIR/Elements/ShowRTIRField, Ticket => $TicketObj, Name => 'Resolution' &>
<&|/l&>IP Address: <& /RTIR/Elements/ShowRTIRField, Ticket => $TicketObj, Name => 'IP' &>
<&| /Widgets/TitleBox, title => loc('Incident Reports'), title_href => RT->Config->Get('WebPath') ."/RTIR/Incident/ShowChildren.html?Queue=Incident%20Reports&id=".$id, titleright => '', title_class=> 'inverse', color=> "#336633", &> % if ($TicketObj->CurrentUserHasRight('ModifyTicket')) {
| <%loc('New')%> | <%loc("Link")%> |
% } <& /RTIR/Elements/ShowChildren, Ticket => $TicketObj, Queue => 'Incident Reports', Rows => 8, FullList => RT->Config->Get('WebPath')."/RTIR/Incident/ShowChildren.html?Queue=Incident%20Reports&id=".$id, &>
<&| /Widgets/TitleBox, title => loc('Investigations'), title_href => RT->Config->Get('WebPath') ."/RTIR/Incident/ShowChildren.html?Queue=Investigations&id=".$id, title_class=> 'inverse', titleright => '', color=> "#336633" &> % if ($TicketObj->CurrentUserHasRight('ModifyTicket')) {
| <%loc('Launch')%> | <%loc("Link")%> |
% } <& /RTIR/Elements/ShowChildren, Ticket => $TicketObj, Queue => 'Investigations', Rows => 8, FullList => RT->Config->Get('WebPath')."/RTIR/Incident/ShowChildren.html?Queue=Investigations&id=".$id, &>
% unless ( RT->Config->Get('RTIR_DisableBlocksQueue') ) { <&| /Widgets/TitleBox, 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')) {
| <%loc('New')%> | <%loc("Link")%> |
% } <& /RTIR/Elements/ShowChildren, Ticket => $TicketObj, Queue => 'Blocks', Rows => 8, FullList => RT->Config->Get('WebPath')."/RTIR/Incident/ShowChildren.html?Queue=Blocks&id=".$id, &> % }
<&| /Widgets/TitleBox, title => loc("Dates"), title_href => RT->Config->Get('WebPath') ."/RTIR/Edit.html?id=".$id, title_class=> 'inverse', color => "#663366" &> <& /RTIR/Elements/ShowDates, Ticket => $TicketObj &>
<& /Ticket/Elements/ShowAttachments, Ticket => $TicketObj, Attachments => $attachments &> <& /Ticket/Elements/ShowRequestor, Ticket => $TicketObj, DisplayPath => "/RTIR/Display.html" &>
% if ($RT::FM::VERSION) { <&| /Widgets/TitleBox, title => loc("Articles"), title_href => RT->Config->Get('WebPath') ."/RTIR/Advanced.html?id=".$id, title_class=> 'inverse', color => "#663366" &> % if ($TicketObj->CurrentUserHasRight('ModifyTicket')) { % my $qs = $m->comp("/Elements/QueryString", "RefersTo-new" => "t:$id", next => "/RTIR/Display.html?id=$id");
| <%loc('New')%> | <%loc("Link")%> |
% } % }
<& /Ticket/Elements/ShowHistory , Ticket => $TicketObj, Collapsed => $ARGS{'Collapsed'}, ShowHeaders => $ARGS{'ShowHeaders'}, UpdatePath => RT->Config->Get('WebPath') ."/RTIR/Update.html", &> <%INIT> if ($SelectedTicket) { $id = $SelectedTicket; $ARGS{'Status'} = "open"; } Abort('No incident specified') unless $id; my $take_or_steal = sub { my $owner = $_[0]->Owner; return () if $owner == $session{'CurrentUser'}->id; my $action = 'Steal'; $action = 'Take' if $owner == $RT::Nobody->id; my ($res, $msg) = $_[0]->$action(); return $msg || (); }; my $deleted_links = 0; my $DoLinks = sub { my ($child, $parent) = @_; my %args = (); # Blocks or Incedent Reports can have multiple incidents my $Type = RT::IR::TicketType( Ticket => $child ); unless( $Type eq 'Block' || $Type eq 'Report' ) { my $query = "Queue = 'Incidents' AND HasMember = ". $child->Id ." AND id != ". $parent->id; my $incidents = RT::Tickets->new( $session{'CurrentUser'} ); $incidents->FromSQL( $query ); while ( my $incident = $incidents->Next ) { $deleted_links = 1; $args{'DeleteLink-'. $child->id .'-MemberOf-'. $incident->id } = ''; } } my @results; # if we don't own any of ends, take or steal parent unless ( $parent->Owner == $session{'CurrentUser'}->id || $child->Owner == $session{'CurrentUser'}->id ) { push @results, $take_or_steal->( $parent ); } # turn off strict check localy my $strict_acl = RT->Config->Set( StrictLinkACL => 0 ); $args{ $child->Id .'-MemberOf' } = $parent->Id; push @results, ProcessTicketLinks( TicketObj => $child, ARGSRef => \%args ); RT->Config->Set( StrictLinkACL => $strict_acl ); return map { loc("Ticket [_1]: [_2]", $child->Id, $_) } @results; }; my $TicketObj; my $new_ticket = 0; if ( $id eq 'new' ) { my $QueueObj = RT::Queue->new( $session{'CurrentUser'} ); $QueueObj->Load( $Queue ) || Abort(loc("Couldn't load queue.")); unless( $QueueObj->Name eq 'Incidents' ) { return $m->comp('/RTIR/Display.html', %ARGS ); } ($TicketObj, @results) = CreateTicket( %ARGS, Attachments => delete $session{'Attachments'} ); $new_ticket = 1; } else { $TicketObj = LoadTicket( $id ); } unless( $TicketObj->QueueObj->Name eq 'Incidents' ) { return $m->comp('/RTIR/Display.html', %ARGS ); } $ARGS{'id'} = $id = $TicketObj->Id; if( 1 ) { my $oldstate = RT::IR::Ticket::FirstCustomFieldValue( $TicketObj, '_RTIR_State' ); if ( $ARGS{'Action'} && $ARGS{'Action'} =~ /^(Steal|Kill|Take|SetTold)$/ ) { my ($res, $msg) = $TicketObj->$1(); push @results, $msg; } unless( $new_ticket ) { push @results, ProcessTicketBasics( ARGSRef => \%ARGS, TicketObj => $TicketObj ); } if ( $ARGS{'BulkLink'} || $Child ) { my @link; push @link, @SelectedTickets if $ARGS{'BulkLink'}; push @link, $Child if $Child; foreach my $id ( grep $_, @link ) { my $child = RT::Ticket->new( $session{'CurrentUser'} ); $child->Load( $id ); unless( $child->id ) { push @results, loc("Couldn't load ticket #[_1] for linking.", $id); next; } push @results, $DoLinks->( $child, $TicketObj ); } } if ( $ARGS{'BulkArticles'} && @SelectedTickets ) { my $ref = join " ", map "a:$_", @SelectedTickets; push @results, ProcessTicketLinks( TicketObj => $TicketObj, ARGSRef => {$TicketObj->Id."-RefersTo" => $ref} ); } unless( $new_ticket ) { $ARGS{UpdateAttachments} = delete $session{'Attachments'}; push @results, ProcessUpdateMessage( ARGSRef => \%ARGS, TicketObj => $TicketObj ); } my $newstate = RT::IR::Ticket::FirstCustomFieldValue( $TicketObj, '_RTIR_State' ); if ($newstate ne $oldstate) { push @results, loc("State changed from [_1] to [_2]", $oldstate, $newstate ); } } # XXX: need the way to show @results when aborting unless ( $TicketObj->CurrentUserHasRight('ShowTicket') ) { Abort("No permission to view ticket #$id."); } my $TimeWorked = $TicketObj->TimeWorked; if ( $TicketObj->TimeLeft > 0 ) { $TimeWorked .= '/'. $TicketObj->TimeLeft; } # If we deleted any links, check if what we deleted from still has children if ( $deleted_links ) { # XXX: Can we ever get here? my $children = new RT::Tickets( $session{'CurrentUser'} ); $children->LimitQueue( VALUE => 'Incident Reports' ); $children->LimitQueue( VALUE => 'Investigations' ); $children->LimitQueue( VALUE => 'Blocks' ); $children->LimitMemberOf( $id ); unless ( $children->Count ) { push @results, loc("WARNING: Incident [_1] has no children.", $id); } } my $attachments = $m->comp('/Ticket/Elements/FindAttachments', Ticket => $TicketObj); <%ARGS> @results => () $id => undef $Queue => 'Incidents' $Child => undef $SelectedTicket => undef @SelectedTickets => ()