%# 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 &> % my $EscapedQueue = $m->comp('/Elements/QueryString', Queue => $Queue ); % if ( $Split ) { <& '/RTIR/'.$Type.'/Elements/Tabs', Title => $Title, Ticket => $TicketObj, current_tab => "RTIR/Split.html?Ticket=".$TicketObj->Id, current_subtab => "RTIR/Split.html?Ticket=".$TicketObj->Id, &> % } elsif ( $Incident ) { <& "/RTIR/Search/Elements/RefineTabs", Title => $Title, Ticket => $IncidentObj, Queue => $Queue, current_tab => "RTIR/Create.html?Incident=$Incident&$EscapedQueue", &> % } else { <& "/RTIR/".$Type."/Elements/Tabs", Title => $Title, Ticket => $TicketObj, current_tab => "RTIR/Create.html?$EscapedQueue", current_subtab => "RTIR/Create.html?$EscapedQueue", &> % } % $m->callback(CallbackName => 'BeforeActionList', %ARGS, Actions => \@results, ARGSRef => \%ARGS, Ticket => $TicketObj); <& /Elements/ListActions, actions => \@results &> % if ( $Split && !$TicketObj->CurrentUserHasRight('ModifyTicket') ) { <% loc("You are not allowed to split this [_1].", $name) %> % $m->abort(); % } % unless ( $Split ) {
% } else { % } % if ( $Split ) { % } % if ($cannot_sign) { <& /Elements/GnuPGSignIssues &> % } <& /Elements/GnuPGKeyIssues, Issues => \@gnupg_keys_issues &> <&| /Widgets/TitleBox, contentbg => "#cccccc", title => $Title &> % if ( $Incident ) { % } elsif ( $TicketObj ) { % if ( $parentvalue ) { % } % } else { % } % if ( $Type eq 'Report' ) { % } elsif ($Type eq "Block") { % } elsif ($Type eq "Investigation") { % } % if ( RT->Config->Get('GnuPG')->{'Enable'} ) { % }
<&|/l&>Incident: <% $Incident %>
<&|/l&>Split from: <% $TicketObj->id %>
<&|/l&>Will be linked to Incident(s): <% $parentvalue %>
<&|/l&>Incident<% $Type eq 'Block'? loc('(required)'): '' %>:
<&|/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&>Don't send any emails to 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: <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people will receive future updates.)
<&|/l&>Constituency: % if ( !$Incident || RT->Config->Get('_RTIR_Constituency_Propagation') eq 'no' ) { % my $default; % $default = $IncidentObj->FirstCustomFieldValue('_RTIR_Constituency') if $Incident; % $default ||= scalar RT->Config->Get('_RTIR_Constituency_default'); <& /RTIR/Elements/EditRTIRField, QueueObj => $QueueObj, Name => 'Constituency', Default => $default &> % } else { % #TODO: hacks, we need way to define CF value on Create, but don't allow user to change it % my $cf = RT::CustomField->new( $RT::SystemUser ); % $cf->LoadByNameAndQueue( Name => '_RTIR_Constituency', Queue => $Queue ); <& /RTIR/Elements/ShowRTIRField, Ticket => $IncidentObj, Name => 'Constituency' &> % }
<&|/l&>SLA: <& /RTIR/Elements/EditRTIRField, QueueObj => $QueueObj, Name => 'SLA', Default => RT::IR::DefaultSLA() &>
<&|/l&>Customer: <& /RTIR/Elements/EditRTIRField, QueueObj => $QueueObj, Name => 'Customer' &>
<%loc("How Reported")%>:
<& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'HowReported', Default => $ARGS{'HowReported-Value'} || RT->Config->Get('_RTIR_HowReported_default') &> <%loc("Reporter Type")%>: <& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'ReporterType', Default => $ARGS{'ReporterType-Value'} || RT->Config->Get('_RTIR_ReporterType_default'), &>
<%loc("Netmask")%>: <& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'Netmask', Default => $ARGS{'Netmask-Value'} || RT->Config->Get('_RTIR_Netmask_default'), &>
<%loc("Port")%>: <& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'Port', Default => $ARGS{'Port-Value'} || RT->Config->Get('_RTIR_Port_default') &>
<%loc("Where Blocked")%>: <& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'WhereBlocked', Default => $ARGS{'WhereBlocked-Value'} || RT->Config->Get('_RTIR_WhereBlocked_default'), &>
<&|/l&>Customer: <& /RTIR/Elements/EditRTIRField, QueueObj => $QueueObj, Name => 'Customer' &>
<%loc("IP address")%>: <& /RTIR/Elements/EditRTIRField, TicketObj => $TicketObj, QueueObj => $QueueObj, Name => 'IP', Cols => 40, Rows => 5, Default => $ARGS{'IP-Value'} || RT->Config->Get('_RTIR_IP_default') || '', &>
<& /Ticket/Elements/EditCustomFields, TicketObj => $TicketObj, QueueObj => $QueueObj &>
<& SELF:AttachmentsForm &>
  <% loc('Sign')%> <& /Widgets/Form/Boolean:InputOnly, Name => 'Sign', CurrentValue => $ARGS{'Sign'} &>     <% loc('Encrypt')%> <& /Widgets/Form/Boolean:InputOnly, Name => 'Encrypt', CurrentValue => $ARGS{'Encrypt'} &>
<&|/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 &>
<&| /Widgets/TitleBox, title => loc("Dates"), title_class=> 'inverse', color => "#663366", &>
<&|/l&>Starts:
<&|/l&>Due:
<& /Elements/Submit, Name => "Create", Label => $SubmitCaption &>
<%INIT> my $QueueObj = new RT::Queue( $session{'CurrentUser'} ); $QueueObj->Load( $Queue ) || Abort( loc("Queue could not be loaded.") ); my $Type = RT::IR::TicketType( Queue => $Queue ); if ($Type eq 'Block' && RT->Config->Get('RTIR_DisableBlocksQueue') ) { Abort(loc("Blocks queue is disabled via config file")); } if ( $m->comp_exists("/RTIR/$Type/Create.html") ) { return $m->comp( "/RTIR/$Type/Create.html", %ARGS ); } if ( RT->Config->Get('GnuPG')->{'Enable'} ) { foreach ( qw(Sign Encrypt) ) { $ARGS{ $_ } = $m->comp( '/Widgets/Form/Boolean:Process', Name => $_, DefaultValue => $QueueObj->$_, Arguments => \%ARGS, ); } } my ($Status, $name); if ( $Type eq 'Report' ) { $name = 'Incident Report'; $Status = 'new'; } elsif ( $Type eq 'Investigation' ) { $Status = 'open'; } elsif ( $Type eq 'Block' ) { $Status = 'new'; } $name ||= $Type; my (@results, $checks_failure); my $IncidentObj; if ( $Incident ) { $IncidentObj = RT::Ticket->new( $session{'CurrentUser'} ); $IncidentObj->Load( $Incident ); unless ( $IncidentObj->id ) { push @results, loc("Couldn't load incident #[_1]", $Incident ); ($checks_failure, $IncidentObj, $Incident) = (1, undef, undef); } elsif ( $IncidentObj->QueueObj->Name ne 'Incidents' ) { push @results, loc('Ticket #[_1] is not an Incident', $Incident ); ($checks_failure, $IncidentObj, $Incident) = (1, undef, undef); } elsif ( RT->Config->Get('_RTIR_Constituency_Propagation') eq 'reject' && $ARGS{$ARGS{'Constituency'}} ne $IncidentObj->FirstCustomFieldValue('_RTIR_Constituency') ) { push @results, loc('Incident #[_1] has constituency [_1], choose the same value for a new ticket or use another Incident', $Incident, $IncidentObj->FirstCustomFieldValue('_RTIR_Constituency') ); $checks_failure = 1; } else { $Subject ||= $IncidentObj->Subject; } } $Incident = $ARGS{'Incident'} = $IncidentObj->id if $IncidentObj; my $parentvalue = ''; if ( $IncidentObj ) { $parentvalue = $IncidentObj->Id; } elsif ( $TicketObj ) { my $incidents = RT::Tickets->new( $session{'CurrentUser'} ); $incidents->FromSQL( "Queue = 'Incidents' AND HasMember = " . $TicketObj->Id ); while ( my $incident = $incidents->Next ) { $parentvalue .= ' ' if $parentvalue; $parentvalue .= $incident->Id; } } push @results, $m->comp( 'SELF:ProcessAttachments', %ARGS ); # check to see if we have a good passphrase my $cannot_sign = 0; if ( $ARGS{'Create'} && $ARGS{'Sign'} ) { if (!RT::Crypt::GnuPG::DrySign($QueueObj->CorrespondAddress, "x")) { $cannot_sign = 1; $checks_failure = 1; } } my @gnupg_keys_issues; if ( $ARGS{'Create'} && $ARGS{'Encrypt'} ) { my @recipients = $m->comp( '/Ticket/Elements/PreviewScrips:GetRecipientsOnCreate', %ARGS ); RT::Crypt::GnuPG::UseKeyForEncryption( map { (/^UseKey-(.*)$/)[0] => $ARGS{ $_ } } grep $ARGS{$_} && /^UseKey-/, keys %ARGS ); my $status; ($status, @gnupg_keys_issues) = RT::Crypt::GnuPG::CheckRecipients( @recipients ); $checks_failure = 1 unless $status; } # checks if ( $ARGS{'Create'} ) { if ( $Type eq 'Investigation' && !$ARGS{'Requestors'} ) { push @results, loc( "You must enter a correspondent" ); $checks_failure = 1; } elsif ( $Type eq 'Block' and not $IncidentObj ) { push @results, loc( "You must enter an Incident ID" ); $checks_failure = 1; } my ($status, @msg) = $m->comp('/Elements/ValidateCustomFields', CustomFields => $QueueObj->TicketCustomFields, ARGSRef => \%ARGS, ); unless ( $status ) { push @results, loc( "Invalid value(s) of the custom fields:" ), @msg; $checks_failure = 1; } unless ( $checks_failure ) { $ARGS{'new-MemberOf'} = $parentvalue if $parentvalue; $m->callback(CallbackName => 'BeforeDisplay', Ticket => $TicketObj, ARGSRef => \%ARGS); return $m->comp( 'Display.html', %ARGS, SkipNotification => \@SkipNotification, results => \@results ); } unshift @results, loc("Creation failed:") if @results; } my ($Title, $SubmitCaption); if ( $Split ) { $Title = loc("Split [_1] #[_2]: [_3]", $name, $TicketObj->id, $TicketObj->Subject); $SubmitCaption = loc("Split"); } else { if ( $Type eq 'Investigation' ) { $Title = loc("Launch a new [_1]", $name); $SubmitCaption = loc("Launch"); } else { $Title = loc("Create a new [_1]", $name); $SubmitCaption = loc("Create"); } } <%ARGS> $Queue => undef @SkipNotification => () $Subject => undef $QuoteTransaction => undef # Parent Incident $Incident => undef $Split => 0 # Split source $TicketObj => undef <%METHOD ProcessAttachments> <%ARGS> @DeleteAttachments => () $Attachment => ''; <%INIT> my @results; $session{'Attachments'} ||= {}; # deal with deleting uploaded attachments foreach ( grep $_ && exists $session{'Attachments'}{ $_ }, @DeleteAttachments ) { delete $session{'Attachments'}{ $_ }; push @results, loc("Deleted attachment '[_1]'", $_ ); $session{'i'}++; } # store the uploaded attachment in session if ( $Attachment ) { my $filename = "$Attachment"; $filename =~ s{^.*[\\/]}{}; my $entity = MakeMIMEEntity( Subject => $filename, Body => '', AttachmentFieldName => 'Attachment' ); $session{'Attachments'}{ $filename } = $entity; push @results, loc("Added attachment '[_1]'", $filename ); $session{'i'}++; } return @results; <%METHOD AttachmentsForm> % my $has_files = exists $session{'Attachments'} && keys %{ $session{'Attachments'} }; % if ( $has_files ) { % }
<&|/l&>Attached file: <&|/l&>Check box to delete
    % foreach my $name ( keys %{$session{'Attachments'}} ) {
  • <% $name %>
  • % }
<&|/l&>Attach file: