%# BEGIN LICENSE BLOCK %# %# Copyright (c) 1996-2003 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 => $Title &> % if ($Split) { <& '/RTIR/'.$Type.'/Elements/Tabs', Ticket => $TicketObj, current_tab => "RTIR/Split.html?Ticket=".$TicketObj->Id, current_subtab => "RTIR/Split.html?Ticket=".$TicketObj->Id, Title => $Title &> % } elsif ($Incident) { <& "/RTIR/Incident/Elements/".$Type."Tabs", Ticket => $IncidentObj, current_toptab => "RTIR/Listing.html", current_tab => "RTIR/Create.html?Incident=".$Incident."&Queue=".$Queue, current_subtab => "RTIR/Create.html?Incident=".$Incident."&Queue=".$Queue, Title => $Title &> % } else { <& "/RTIR/".$Type."/Elements/Tabs", Ticket => $TicketObj, current_toptab => "RTIR/Listing.html", current_tab => "RTIR/Create.html?Queue=".$Queue, current_subtab => "RTIR/Create.html?Queue=".$Queue, Title => $Title &> % } <& /RTIR/Elements/ListActions, actions => \@results &> % if ($Split && !$TicketObj->CurrentUserHasRight('ModifyTicket')) { <%loc("You are not allowed to split this [_1].", $name)%> % $m->abort(); % }
% my $parentvalue; % if ($IncidentObj) { % $parentvalue = $IncidentObj->Id; % } elsif ($TicketObj) { % $parentvalue = $TicketObj->Id; % my $count = 0; % my $incidents = $TicketObj->MemberOf; % while (my $link = $incidents->Next) { % my $incident = $link->TargetObj; % if ($incident->QueueObj->Name eq 'Incidents') { % $count++; % $parentvalue = $parentvalue." ".$incident->Id; % } % } % } % if (defined $parentvalue) { % } <& /Elements/TitleBoxStart, contentbg => "#cccccc", title => $Title &> % if ($Incident) { % } elsif (defined $parentvalue) { % } % if ($QueueObj->Name eq 'Incident Reports') { % } elsif ($Type eq "Block") { % } % if (exists $session{'Attachments'}) { % } # end of if
<&|/l&>Incident: <% $Incident %>
<&|/l&>Split from: <% $parentvalue %>
<&|/l&>Owner: <& /Elements/SelectOwner, Name => "Owner", QueueObj => $QueueObj, Default => $ARGS{Owner}||$session{'CurrentUser'}->Id||undef &>
<&|/l&>Subject:
<&|/l&>Time Worked:
> <&|/l&>Time Left: >
<&|/l&>Correspondents:
<&|/l&>Cc: <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people will receive future updates.)
<&|/l&>Admin Cc: " SIZE=40> <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people will receive future updates.)
<&|/l&>SLA: <& /RTIR/Elements/EditRTIRField, QueueObj => $QueueObj, Name => 'SLA', Default => $sla &>
<%loc("How Reported")%>:
<& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'HowReported', Default => $ARGS{'HowReported-Value'} || $RT::_RTIR_HowReported_default &> <%loc("Reporter Type")%>: <& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'ReporterType', Default => $ARGS{'ReporterType-Value'} || $RT::_RTIR_ReporterType_default, &>
<%loc("IP address")%>: <& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'IP', Default => $ARGS{'IP-Value'} || $RT::_RTIR_IP_default, &>
<%loc("Netmask")%>: <& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'Netmask', Default => $ARGS{'Netmask-Value'} || $RT::_RTIR_Netmask_default, &>
<%loc("Port")%>: <& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'Port', Default => $ARGS{'Port-Value'} || $RT::_RTIR_Netmask_default, &>
<%loc("Where Blocked")%>: <& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'WhereBlocked', Default => $ARGS{'WhereBlocked-Value'} || $RT::_RTIR_WhereBlocked_default, &>
<& /Ticket/Elements/EditCustomFields, TicketObj => $TicketObj, QueueObj => $QueueObj &>
<&|/l&>Attached file: <&|/l&>Check box to delete
% foreach my $attach_name (keys %{$session{'Attachments'}}) { <%$attach_name%>
% } # end of foreach
<&|/l&>Attach file:
<&|/l&>Message: % if (!exists $ARGS{Content}) { % my $Transactions; % if ($TicketObj) { % $Transactions = $TicketObj->Transactions; % } elsif ($IncidentObj) { % $Transactions = $IncidentObj->Transactions; % } % % if ($Transactions) { % # Investigations should quote their included text % my $quote = 0; % if ($Type eq 'Investigation') { % $quote = 1; % } % $ARGS{Content} = $m->scomp("/RTIR/Elements/TransactionData", % Transactions => $Transactions, % Type => 'messages', % Include => {'Create', 'Correspond'}, % QuoteText => $quote); % $ARGS{Content} =~ s/\>/>/g; % } % } <& /Elements/MessageBox, Default => $ARGS{Content}, QuoteTransaction => $QuoteTransaction &>
<& /Elements/TitleBoxStart, title => loc("Dates"), title_class=> 'inverse', color => "#663366" &>
<&|/l&>Starts: >
<&|/l&>Due: >
<& /Elements/TitleBoxEnd &>
<& /Elements/TitleBoxEnd &> % if ($Type eq 'Investigation') { <& /Elements/Submit, Name => "Create", Label => loc("Launch")&> % } else { <& /Elements/Submit, Name => "Create", Label => loc("Create")&> % } <%INIT> my $QueueObj = new RT::Queue($session{'CurrentUser'}); $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded.")); my ($Type, $Status); if ($Queue eq "Incidents") { $Type = "Incident"; $Status = 'open'; } elsif ($Queue eq "Incident Reports") { $Type = "Report"; $Status = 'new'; } elsif ($Queue eq "Investigations") { $Type = "Investigation"; $Status = 'open'; } elsif ($Queue eq "Blocks") { $Type = "Block"; $Status = 'new'; } # Incidents have their own Create.html if ($Type eq 'Incident') { $m->comp("/RTIR/Incident/Create.html", %ARGS); $m->abort; } my ($Title, $IncidentObj); my $TicketObj = $ARGS{TicketObj}; if ($Incident) { $IncidentObj = new RT::Ticket($session{'CurrentUser'}); $IncidentObj = LoadTicket($Incident); } # if there isn't a subject, but there is an incident, use that one if ((!$Subject) and $IncidentObj) { $Subject = $IncidentObj->Subject; } my $name; if ($Type eq 'Report') { $name = "Incident Report"; } else { $name = $Type; } if ($Split) { $Title = loc("Split [_1] #[_2]: [_3]", $name, $TicketObj->id, $TicketObj->Subject); } else { if ($Type eq 'Investigation') { $Title = loc("Launch a new [_1]", $name); } else { $Title = loc("Create a new [_1]", $name); } } my $CFs = $QueueObj->CustomFields(); # {{{ deal with deleting uploaded attachments foreach my $key (keys %ARGS) { if ($key =~ m/^DeleteAttach-(.+)$/) { delete $session{'Attachments'}{$1}; } $session{'Attachments'} = { %{$session{'Attachments'} || {}} }; } # {{{ store the uploaded attachment in session if ($ARGS{'Attach'}) { # attachment? $session{'Attachments'} = {} unless defined $session{'Attachments'}; # strip leading directories $ARGS{'Attach'} =~ s#^.*[\\/]##; my $attachment = MakeMIMEEntity( Subject => "$ARGS{'Attach'}", Body => "", AttachmentFieldName => 'Attach' ); $session{'Attachments'} = { %{$session{'Attachments'} || {}}, $ARGS{'Attach'} => $attachment }; } # }}} # delete temporary storage entry to make WebUI clean unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') { delete $session{'Attachments'}; } # }}} my @results; if ((!exists $ARGS{'AddMoreAttach'}) && ($ARGS{'id'} eq 'new')) { # new ticket? if ($Type ne 'Investigation' || ($Type eq 'Investigation' && $ARGS{'Requestors'})) { $m->comp('Display.html', %ARGS); $m->abort(); } else { push @results, "Investigation launch failed: You must enter a correspondent."; } } my $sla; my $date = RT::Date->new($RT::SystemUser); $date->SetToNow; use Business::Hours; my $bizhours = new Business::Hours; if ($RT::BusinessHours) { $bizhours->business_hours(%$RT::BusinessHours); } # see if we're in business hours or not if ($bizhours->first_after($date->Unix) != $date->Unix) { $sla = $RT::_RTIR_SLA_outofhours_default; } else { $sla = $RT::_RTIR_SLA_inhours_default; } <%ARGS> $Queue => undef $Incident => undef $Split => 0 $Subject => undef $QuoteTransaction => undef