diff options
Diffstat (limited to 'rt/share/html/Ticket/Create.html')
-rwxr-xr-x | rt/share/html/Ticket/Create.html | 240 |
1 files changed, 122 insertions, 118 deletions
diff --git a/rt/share/html/Ticket/Create.html b/rt/share/html/Ticket/Create.html index 6ea2c9f39..0419126c6 100755 --- a/rt/share/html/Ticket/Create.html +++ b/rt/share/html/Ticket/Create.html @@ -2,7 +2,7 @@ %# %# COPYRIGHT: %# -%# This software is Copyright (c) 1996-2011 Best Practical Solutions, LLC +%# This software is Copyright (c) 1996-2012 Best Practical Solutions, LLC %# <sales@bestpractical.com> %# %# (Except where explicitly superseded by other copyright notices) @@ -47,51 +47,80 @@ %# END BPS TAGGED BLOCK }}} <& /Elements/Header, Title => $title, - onload => "function () { hide(document.getElementById('Ticket-Create-details')) }" &> -<& /Elements/Tabs, - current_toptab => "Ticket/Create.html", - Title => $title, - actions => $actions &> + onload => "function () { hide('Ticket-Create-details') }" &> +<& /Elements/Tabs &> + <& /Elements/ListActions, actions => \@results &> + <form action="<% RT->Config->Get('WebPath') %>/Ticket/Create.html" method="post" enctype="multipart/form-data" name="TicketCreate"> -<input type="hidden" class="hidden" name="id" value="new" /> + <input type="hidden" class="hidden" name="id" value="new" /> + % $m->callback( CallbackName => 'FormStart', QueueObj => $QueueObj, ARGSRef => \%ARGS ); + % if ($gnupg_widget) { -<& /Elements/GnuPG/SignEncryptWidget:ShowIssues, self => $gnupg_widget &> + <& /Elements/GnuPG/SignEncryptWidget:ShowIssues, self => $gnupg_widget &> % } + <div id="Ticket-Create-basics"> <a name="basics"></a> -<&| /Widgets/TitleBox, title => $title &> -<table border="0" cellpadding="0" cellspacing="0"> -<tr><td class="label"><&|/l&>Queue</&>:</td> -%#<td class="value"><& Elements/ShowQueue, QueueObj => $QueueObj &> -%#<input type="hidden" class="hidden" name="Queue" value="<% $QueueObj->Name %>" /> -<td class="value"><& /Elements/SelectQueue, - Name => 'Queue', - Default => $QueueObj->Name, - ShowNullOption => 0, - ShowAllQueues => 0, - OnChange => "document.getElementsByName('id')[0].value = ''; form.submit()" &> -</td> -<td class="label"><&|/l&>Status</&>: -</td> -<td class="value"> -<& /Elements/SelectStatus, Name => "Status", Default => $ARGS{Status}||'new', DefaultValue => 0, SkipDeleted => 1 &> -</td> -<td class="label"> -<&|/l&>Owner</&>: -</td> -<td class="value"> -<& /Elements/SelectOwner, Name => "Owner", QueueObj => $QueueObj, Default => $ARGS{Owner}||$RT::Nobody->Id, DefaultValue => 0 &> -</td> + +<div id="ticket-create-metadata"> + <&| /Widgets/TitleBox, title => loc("Basics"), class=>'ticket-info-basics' &> + <table width="100%" border="0"> + <& /Ticket/Elements/EditBasics, + InTable => 1, + fields => [ + { name => 'Queue', + comp => '/Elements/SelectQueue', + args => { + Name => 'Queue', + Default => $QueueObj->Name, + QueueObj => $QueueObj, + ShowNullOption => 0, + ShowAllQueues => 0, + OnChange => "document.getElementsByName('id')[0].value = 'refresh'; form.submit()", + }, + }, + { name => 'Status', + comp => '/Elements/SelectStatus', + args => { + Name => "Status", + Default => $ARGS{Status} || $QueueObj->Lifecycle->DefaultOnCreate, + DefaultValue => 0, + SkipDeleted => 1, + QueueObj => $QueueObj, + }, + }, + { name => 'Owner', + comp => '/Elements/SelectOwner', + args => { + Name => "Owner", + Default => $ARGS{Owner} || RT->Nobody->Id, + DefaultValue => 0, + QueueObj => $QueueObj, + }, + } + ] + &> + % $m->callback( CallbackName => 'AfterOwner', ARGSRef => \%ARGS ); -</tr> + + <& /Ticket/Elements/EditCustomFields, %ARGS, QueueObj => $QueueObj, InTable => 1 &> + <& /Ticket/Elements/EditTransactionCustomFields, %ARGS, QueueObj => $QueueObj, InTable => 1 &> + </table> + </&> +% $m->callback( CallbackName => 'AfterBasics', QueueObj => $QueueObj, ARGSRef => \%ARGS ); +</div> + +<div id="ticket-create-message"> + <&| /Widgets/TitleBox, title => $title, class => 'messagedetails' &> +<table border="0" cellpadding="0" cellspacing="0"> <tr> <td class="label"> <&|/l&>Requestors</&>: </td> <td class="value" colspan="5"> -<& /Elements/EmailInput, Name => 'Requestors', Size => '40', Default => $ARGS{Requestors} || $session{CurrentUser}->EmailAddress &> +<& /Elements/EmailInput, Name => 'Requestors', Size => undef, Default => exists($ARGS{Requestors}) ? $ARGS{Requestors} : $session{CurrentUser}->EmailAddress &> % $m->callback( CallbackName => 'AfterRequestors', QueueObj => $QueueObj, ARGSRef => \%ARGS ); </td> </tr> @@ -99,55 +128,41 @@ <td class="label"> <&|/l&>Cc</&>: </td> -<td class="value" colspan="3"><& /Elements/EmailInput, Name => 'Cc', Size => '40', Default => $ARGS{Cc} &></td> -<td class="comment" colspan="2"><i><font size="-2"> -<&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people <strong>will</strong> receive future updates.)</&></font></i> -</td> +<td class="value" colspan="5"><& /Elements/EmailInput, Name => 'Cc', Size => undef, Default => $ARGS{Cc} &></td> </tr> + <tr> -<td class="label"> -<&|/l&>Admin Cc</&>: -</td> -<td class="value" colspan="3"><& /Elements/EmailInput, Name => 'AdminCc', Size => '40', Default => $ARGS{AdminCc} &></td> -<td class="comment" colspan="2"><i><font size="-2"> -<&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people <strong>will</strong> receive future updates.)</&></font></i> -</td> + <td class="label"> </td> + <td class="comment" colspan="5"> + <i><font size="-2"> + <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people <strong>will</strong> receive future updates.)</&> + </font></i> + </td> </tr> + <tr> <td class="label"> -<&|/l&>Subject</&>: -</td> -<td class="value" colspan="5"> -<input name="Subject" size="60" maxsize="200" value="<%$ARGS{Subject} || ''%>" /> -% $m->callback( %ARGS, CallbackName => 'AfterSubject' ); -</td> -</tr> -<tr> -<td colspan="6"> -<& /Ticket/Elements/EditCustomFields, %ARGS, QueueObj => $QueueObj &> +<&|/l&>Admin Cc</&>: </td> +<td class="value" colspan="5"><& /Elements/EmailInput, Name => 'AdminCc', Size => undef, Default => $ARGS{AdminCc} &></td> </tr> -<& /Ticket/Elements/EditTransactionCustomFields, %ARGS, QueueObj => $QueueObj &> + <tr> -% if (exists $session{'Attachments'}) { -<td class="label"> -<&|/l&>Attached file</&>: -</td> -<td colspan="5"> -<&|/l&>Check box to delete</&><br /> -% foreach my $attach_name (keys %{$session{'Attachments'}}) { -<input type="checkbox" class="checkbox" name="DeleteAttach-<%$attach_name%>" value="1" /><%$attach_name%><br /> -% } # end of foreach -</td> + <td class="label"> </td> + <td class="comment" colspan="5"> + <i><font size="-2"> + <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people <strong>will</strong> receive future updates.)</&> + </font></i> + </td> </tr> + <tr> -% } # end of if <td class="label"> -<&|/l&>Attach file</&>: +<&|/l&>Subject</&>: </td> <td class="value" colspan="5"> -<input type="file" name="Attach" /> -<input type="submit" class="button" name="AddMoreAttach" value="<&|/l&>Add More Files</&>" /> +<input type="text" name="Subject" maxsize="200" value="<%$ARGS{Subject} || ''%>" /> +% $m->callback( %ARGS, CallbackName => 'AfterSubject' ); </td> </tr> @@ -160,6 +175,9 @@ <tr> <td colspan="6"> <&|/l&>Describe the issue below</&>:<br /> +% if ( RT->Config->Get('ArticleOnTicketCreate')) { +<& /Articles/Elements/BeforeMessageBox, %ARGS, QueueObj => $QueueObj &> +% } % $m->callback( %ARGS, QueueObj => $QueueObj, CallbackName => 'BeforeMessageBox' ); % if (exists $ARGS{Content}) { <& /Elements/MessageBox, Default => $ARGS{Content}, IncludeSignature => 0 &> @@ -171,9 +189,12 @@ <br /> </td> </tr> -</table> -</&> -<& /Elements/Submit, Label => loc("Create")&> + + <& /Ticket/Elements/AddAttachments, %ARGS, QueueObj => $QueueObj &> + </table> + </&> + <& /Elements/Submit, Label => loc("Create"), id => 'SubmitTicket' &> + </div> </div> <div id="Ticket-Create-details"> @@ -242,7 +263,6 @@ <tr><td class="label"><&|/l&>Referred to by</&></td><td><input size="10" name="RefersTo-new" value="<% $ARGS{'RefersTo-new'} || '' %>" /></td></tr> <tr><td class="label">Customer ID</td><td><input size="10" name="new-Customer" value="<% $ARGS{'new-Customer'} || '' %>" /></td></tr> - </table> </&> </div> @@ -258,10 +278,10 @@ <%INIT> $m->callback( CallbackName => "Init", ARGSRef => \%ARGS ); my $Queue = $ARGS{Queue}; +$session{DefaultQueue} = $Queue; -my $CloneTicketObj; if ($CloneTicket) { - $CloneTicketObj = RT::Ticket->new( $session{CurrentUser} ); + my $CloneTicketObj = RT::Ticket->new( $session{CurrentUser} ); $CloneTicketObj->Load($CloneTicket) or Abort( loc("Ticket could not be loaded") ); @@ -283,41 +303,30 @@ if ($CloneTicket) { my $members = $CloneTicketObj->Members; my ( @members, @members_of, @refers, @refers_by, @depends, @depends_by ); my $refers = $CloneTicketObj->RefersTo; + my $get_link_value = sub { + my ($link, $type) = @_; + my $uri_method = $type . 'URI'; + my $local_method = 'Local' . $type; + my $uri = $link->$uri_method; + return if $uri->IsLocal and + $uri->Object and + $uri->Object->isa('RT::Ticket') and + $uri->Object->Type eq 'reminder'; + + return $link->$local_method || $uri->URI; + }; while ( my $refer = $refers->Next ) { - push @refers, $refer->LocalTarget; + my $refer_value = $get_link_value->($refer, 'Target'); + push @refers, $refer_value if defined $refer_value; } $clone->{'new-RefersTo'} = join ' ', @refers; my $refers_by = $CloneTicketObj->ReferredToBy; while ( my $refer_by = $refers_by->Next ) { - push @refers_by, $refer_by->LocalBase; + my $refer_by_value = $get_link_value->($refer_by, 'Base'); + push @refers_by, $refer_by_value if defined $refer_by_value; } $clone->{'RefersTo-new'} = join ' ', @refers_by; - if (0) { # Temporarily disabled - my $depends = $CloneTicketObj->DependsOn; - while ( my $depend = $depends->Next ) { - push @depends, $depend->LocalTarget; - } - $clone->{'new-DependsOn'} = join ' ', @depends; - - my $depends_by = $CloneTicketObj->DependedOnBy; - while ( my $depend_by = $depends_by->Next ) { - push @depends_by, $depend_by->LocalBase; - } - $clone->{'DependsOn-new'} = join ' ', @depends_by; - - while ( my $member = $members->Next ) { - push @members, $member->LocalBase; - } - $clone->{'MemberOf-new'} = join ' ', @members; - - my $members_of = $CloneTicketObj->MemberOf; - while ( my $member_of = $members_of->Next ) { - push @members_of, $member_of->LocalTarget; - } - $clone->{'new-MemberOf'} = join ' ', @members_of; - - } my $cfs = $CloneTicketObj->QueueObj->TicketCustomFields(); while ( my $cf = $cfs->Next ) { @@ -351,7 +360,7 @@ my @results; my $title = loc("Create a new ticket"); -my $QueueObj = new RT::Queue($session{'CurrentUser'}); +my $QueueObj = RT::Queue->new($session{'CurrentUser'}); $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded.")); $m->callback( QueueObj => $QueueObj, title => \$title, results => \@results, ARGSRef => \%ARGS ); @@ -366,17 +375,16 @@ my $ValidCFs = $m->comp( ARGSRef => \%ARGS ); -# {{{ deal with deleting uploaded attachments +# 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? +# store the uploaded attachment in session +if ( defined $ARGS{'Attach'} && length $ARGS{'Attach'} ) { # attachment? my $attachment = MakeMIMEEntity( AttachmentFieldName => 'Attach' ); @@ -387,10 +395,10 @@ if ($ARGS{'Attach'}) { # attachment? $file_path => $attachment, }; } -# }}} # delete temporary storage entry to make WebUI clean -unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') { +unless (keys %{$session{'Attachments'}} and + ($ARGS{'id'} eq 'new' or $ARGS{'id'} eq 'refresh')) { delete $session{'Attachments'}; } @@ -432,6 +440,9 @@ my $skip_create = 0; $m->callback( CallbackName => 'BeforeCreate', ARGSRef => \%ARGS, skip_create => \$skip_create, checks_failure => $checks_failure, results => \@results ); +$m->comp( '/Articles/Elements/CheckSkipCreate', ARGSRef => \%ARGS, skip_create => \$skip_create, + checks_failure => $checks_failure, results => \@results ); + if ((!exists $ARGS{'AddMoreAttach'}) and (defined($ARGS{'id'}) and $ARGS{'id'} eq 'new')) { # new ticket? if ( $ValidCFs && !$checks_failure && !$skip_create ) { # CREATE THE TICKET. @@ -457,15 +468,8 @@ if ((!exists $ARGS{'AddMoreAttach'}) and (defined($ARGS{'id'}) and $ARGS{'id'} e } } } - -my $actions = { - A => { - html => q[<a href="#basics" onclick="return switchVisibility('Ticket-Create-basics','Ticket-Create-details');">] . loc('Show basics') . q[</a>], - }, - B => { - html => q[<a href="#details" onclick="return switchVisibility('Ticket-Create-details','Ticket-Create-basics');">] . loc('Show details') . q[</a>], - }, -}; +PageMenu->child( basics => raw_html => q[<a href="#basics" onclick="return switchVisibility('Ticket-Create-basics','Ticket-Create-details');">] . loc('Basics') . q[</a>]); +PageMenu->child( details => raw_html => q[<a href="#details" onclick="return switchVisibility('Ticket-Create-details','Ticket-Create-basics');">] . loc('Details') . q[</a>]); </%INIT> <%ARGS> |