3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
5 %# (Except where explictly superceded by other copyright notices)
7 %# This work is made available to you under the terms of Version 2 of
8 %# the GNU General Public License. A copy of that license should have
9 %# been provided with this software, but in any event can be snarfed
12 %# This work is distributed in the hope that it will be useful, but
13 %# WITHOUT ANY WARRANTY; without even the implied warranty of
14 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 %# General Public License for more details.
17 %# Unless otherwise specified, all modifications, corrections or
18 %# extensions to this work which alter its source code become the
19 %# property of Best Practical Solutions, LLC when submitted for
20 %# inclusion in the work.
24 <& /Elements/Header, Title => loc("Create a new ticket") &>
26 current_toptab => "Ticket/Create.html",
27 Title => loc("Create a new ticket") &>
28 <FORM ACTION="<%$RT::WebPath%>/Ticket/Create.html" METHOD="POST" ENCTYPE="multipart/form-data">
29 <INPUT TYPE=HIDDEN Name="id" VALUE="new">
33 [<a class="currenttab"><&|/l&>Show basics</&></a>] [<A HREF="#detail"><&|/l&>Show details</&></a>]
35 <& /Elements/TitleBoxStart, contentbg => "#cccccc", title => loc("Create a new ticket") &>
36 <TABLE border=0 cellpadding=0 cellspacing=0>
37 <TR><TD class=label><&|/l&>Queue</&>:</TD>
38 <TD class=value><% $QueueObj->Name %>
39 <INPUT TYPE=HIDDEN NAME=Queue Value="<%$QueueObj->Name%>">
41 <TD class=label><&|/l&>Status</&>:
44 <& /Elements/SelectStatus, Name => "Status", Default => $ARGS{Status}||'new' &>
50 <& /Elements/SelectOwner, Name => "Owner", QueueObj => $QueueObj, Default => $ARGS{Owner}||undef &>
55 <&|/l&>Requestors</&>:
57 <TD class=value COLSPAN=5>
58 <INPUT Name="Requestors" Value="<% ($ARGS{Requestors}) || $session{CurrentUser}->EmailAddress %>" SIZE=40>
65 <TD class=value COLSPAN=5>
66 <INPUT NAME="Cc" SIZE=40 VALUE="<% $ARGS{Cc} %>"><BR>
68 <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of email addresses. These people <b>will</b> receive future updates.)</&></font></i>
75 <TD class=value COLSPAN=5>
76 <INPUT NAME="AdminCc" SIZE=40 VALUE="<% $ARGS{AdminCc} %>"><BR>
78 <&|/l&>(Sends a carbon-copy of this update to a comma-delimited list of administrative email addresses. These people <b>will</b> receive future updates.)</&></font></i>
85 <TD class=value COLSPAN=5>
86 <INPUT Name="Subject" SIZE=60 MAXSIZE=100 value="<%$ARGS{Subject} || ''%>">
91 <& /Ticket/Elements/EditCustomFields, QueueObj => $QueueObj &>
95 % if (exists $session{'Attachments'}) {
97 <&|/l&>Attached file</&>:
100 <&|/l&>Check box to delete</&><BR>
101 % foreach my $attach_name (keys %{$session{'Attachments'}}) {
102 <input type="checkbox" name="DeleteAttach-<%$attach_name%>"><%$attach_name%><BR>
109 <&|/l&>Attach file</&>:
111 <TD class=value COLSPAN=5>
112 <INPUT TYPE=FILE NAME="Attach">
113 <INPUT TYPE=SUBMIT NAME="AddMoreAttach" VALUE="<&|/l&>Add More Files</&>">
118 <&|/l&>Describe the issue below</&>:<br>
119 % if (exists $ARGS{Content}) {
120 <& /Elements/MessageBox, Default => $ARGS{Content} &>
122 <& /Elements/MessageBox, QuoteTransaction => $QuoteTransaction &>
129 <TD ALIGN=RIGHT COLSPAN=2>
133 <& /Elements/TitleBoxEnd &>
134 <& /Elements/Submit, Label => loc("Create")&>
136 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
137 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
138 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
139 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
140 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
143 [<A HREF="#top"><&|/l&>Show basics</&></a>] [<a class="currenttab"><&|/l&>Show details</&></a>]
145 <TABLE WIDTH="100%" BORDER=0>
147 <TD WIDTH="50%" VALIGN=TOP>
149 <& /Elements/TitleBoxStart, title => loc('The Basics'),
150 title_class=> 'inverse',
151 color => "#993333" &>
153 <TR><TD ALIGN=RIGHT><&|/l&>Priority</&>:</TD><TD><input size=3 name="InitialPriority" value="<% $ARGS{InitialPriority} ? $ARGS{InitialPriority} : $QueueObj->InitialPriority %>"></TD></TR>
154 <TR><TD ALIGN=RIGHT><&|/l&>Final Priority</&>:</TD><TD><input size=3 name="FinalPriority" value="<% $ARGS{FinalPriority} ? $ARGS{FinalPriority} : $QueueObj->FinalPriority %>"></TD></TR>
155 <TR><TD ALIGN=RIGHT><&|/l&>Time Worked</&>:</TD><TD><input size=3 name="TimeWorked" value="<% $ARGS{TimeWorked} %>"></TD></TR>
156 <TR><TD ALIGN=RIGHT><&|/l&>Time Left</&>:</TD><TD><input size=3 name="TimeLeft" value="<% $ARGS{TimeLeft} %>"></TD></TR>
158 <& /Elements/TitleBoxEnd &>
160 <& /Elements/TitleBoxStart, title => loc("Dates"),
161 title_class=> 'inverse',
162 color => "#663366" &>
165 <TR><TD ALIGN=RIGHT><&|/l&>Starts</&>:</TD><TD><input size=10 name="Starts" value="<% $ARGS{Starts} %>"></TD></TR>
166 <TR><TD ALIGN=RIGHT><&|/l&>Due</&>:</TD><TD><input size=10 name="Due" value="<%
167 $ARGS{Due}%>"></TD></TR>
169 <& /Elements/TitleBoxEnd &>
174 <& /Elements/TitleBoxStart, title => loc('Relationships'),
175 title_class=> 'inverse',
176 titleright => '', color=> "#336633" &>
178 <i><&|/l&>(Enter ticket ids or URLs, seperated with spaces)</&></i>
180 <TR><TD ALIGN=RIGHT><&|/l&>Depends on</&></TD><TD><input size=10 name="new-DependsOn" value="<% $ARGS{'new-DependsOn'} %>"></TD></TR>
181 <TR><TD ALIGN=RIGHT><&|/l&>Depended on by</&></TD><TD><input size=10 name="DependsOn-new" value="<% $ARGS{'DependsOn-new'} %>"></TD></TR>
182 <TR><TD ALIGN=RIGHT><&|/l&>Parents</&></TD><TD><input size=10 name="new-MemberOf" value="<% $ARGS{'new-MemberOf'} %>"></TD></TR>
183 <TR><TD ALIGN=RIGHT><&|/l&>Children</&></TD><TD><input size=10 name="MemberOf-new" value="<% $ARGS{'MemberOf-new'} %>"></TD></TR>
184 <TR><TD ALIGN=RIGHT><&|/l&>Refers to</&></TD><TD><input size=10 name="new-RefersTo" value="<% $ARGS{'new-RefersTo'} %>"></TD></TR>
185 <TR><TD ALIGN=RIGHT><&|/l&>Referred to by</&></TD><TD><input size=10 name="RefersTo-new" value="<% $ARGS{'RefersTo-new'} %>"></TD></TR>
189 <& /Elements/TitleBoxEnd &>
195 <& /Elements/Submit, Label => loc("Create") &>
197 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
198 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
199 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
200 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
201 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
207 my $QueueObj = new RT::Queue($session{'CurrentUser'});
208 $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded."));
209 my $CFs = $QueueObj->CustomFields();
211 if ($QueueObj->DefaultDueIn) {
212 my $default_due = RT::Date->new($session{'CurrentUser'});
213 $default_due->SetToNow();
214 $default_due->AddDays($QueueObj->DefaultDueIn);
215 $ARGS{'Due'} = $default_due->ISO();
218 # {{{ deal with deleting uploaded attachments
219 foreach my $key (keys %ARGS) {
220 if ($key =~ m/^DeleteAttach-(.+)$/) {
221 delete $session{'Attachments'}{$1};
223 $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
226 # {{{ store the uploaded attachment in session
227 if ($ARGS{'Attach'}) { # attachment?
228 $session{'Attachments'} = {} unless defined $session{'Attachments'};
230 my $subject = "$ARGS{'Attach'}";
232 # strip leading directories
233 $subject =~ s#^.*[\\/]##;
235 my $attachment = MakeMIMEEntity(
238 AttachmentFieldName => 'Attach'
241 $session{'Attachments'} = { %{$session{'Attachments'} || {}},
242 $ARGS{'Attach'} => $attachment };
246 # delete temporary storage entry to make WebUI clean
247 unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') {
248 delete $session{'Attachments'};
254 if ((!exists $ARGS{'AddMoreAttach'}) && ($ARGS{'id'} eq 'new')) { # new ticket?
255 $m->comp('Display.html', %ARGS);
262 $DependedOnBy => undef
264 $QuoteTransaction => undef