diff options
Diffstat (limited to 'rt/share/html/Ticket/Create.html')
-rwxr-xr-x | rt/share/html/Ticket/Create.html | 196 |
1 files changed, 105 insertions, 91 deletions
diff --git a/rt/share/html/Ticket/Create.html b/rt/share/html/Ticket/Create.html index 57e3bd476..9fb2b2bc5 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) @@ -45,54 +45,83 @@ %# those contributions and any derivatives thereof. %# %# END BPS TAGGED BLOCK }}} -%# use Data::Dumper; warn Dumper \%ARGS; #DEBUG <& /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 = 'refresh'; 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' &> + <input type="hidden" class="hidden" name="Queue" value="<% $QueueObj->Id %>" /> + <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 ); +</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 => exists($ARGS{Requestors}) ? $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> @@ -100,55 +129,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> @@ -161,6 +176,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 &> @@ -172,9 +190,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"> @@ -243,7 +264,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> @@ -259,10 +279,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") ); @@ -352,7 +372,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 ); @@ -367,17 +387,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' ); @@ -388,7 +407,6 @@ if ($ARGS{'Attach'}) { # attachment? $file_path => $attachment, }; } -# }}} # delete temporary storage entry to make WebUI clean unless (keys %{$session{'Attachments'}} and @@ -434,6 +452,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. @@ -459,15 +480,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> |