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><&|/l&>Queue</&></TD>
38 <TD><% $QueueObj->Name %>
39 <INPUT TYPE=HIDDEN NAME=Queue Value="<%$QueueObj->Name%>">
41 <TD><&|/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</&>:
58 <INPUT Name="Requestors" Value="<% ($ARGS{Requestors}) || $session{CurrentUser}->EmailAddress %>" SIZE=40>
66 <INPUT NAME="Cc" SIZE=40<% $ARGS{Cc} && " 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>
76 <INPUT NAME="AdminCc" SIZE=40<% $ARGS{AdminCc} && " 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>
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</&>:
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"<% $ARGS{TimeWorked} && " VALUE=\"$ARGS{TimeWorked}\"" %>></TD></TR>
156 <TR><TD ALIGN=RIGHT><&|/l&>Time Left</&>:</TD><TD><input size=3 name="TimeLeft"<% $ARGS{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"<% $ARGS{Starts} && " VALUE=\"$ARGS{Starts}\"" %>></TD></TR>
166 <TR><TD ALIGN=RIGHT><&|/l&>Due</&>:</TD><TD><input size=10 name="Due"<% $ARGS{Due} && " VALUE=\"$ARGS{Due}\"" %>></TD></TR>
168 <& /Elements/TitleBoxEnd &>
173 <& /Elements/TitleBoxStart, title => loc('Relationships'),
174 title_class=> 'inverse',
175 titleright => '', color=> "#336633" &>
177 <i><&|/l&>(Enter ticket ids or URLs, seperated with spaces)</&></i>
179 <TR><TD ALIGN=RIGHT><&|/l&>Depends on</&></TD><TD><input size=10 name="new-DependsOn"<% $ARGS{'new-DependsOn'} && " VALUE=\"$ARGS{'new-DependsOn'}\""%>></TD></TR>
180 <TR><TD ALIGN=RIGHT><&|/l&>Depended on by</&></TD><TD><input size=10 name="DependsOn-new"<% $ARGS{'DependsOn-new'} && " VALUE=\"$ARGS{'DependsOn-new'}\"" %>></TD></TR>
181 <TR><TD ALIGN=RIGHT><&|/l&>Parents</&></TD><TD><input size=10 name="new-MemberOf"<% $ARGS{'new-MemberOf'} && " VALUE=\"$ARGS{'new-MemberOf'}\"" %>></TD></TR>
182 <TR><TD ALIGN=RIGHT><&|/l&>Children</&></TD><TD><input size=10 name="MemberOf-new" <% $ARGS{'MemberOf-new'} && " VALUE=\"$ARGS{'MemberOf-new'}\"" %>></TD></TR>
183 <TR><TD ALIGN=RIGHT><&|/l&>Refers to</&></TD><TD><input size=10 name="new-RefersTo"<% $ARGS{'new-RefersTo'} && " VALUE=\"$ARGS{'new-MemberOf'}\"" %>></TD></TR>
184 <TR><TD ALIGN=RIGHT><&|/l&>Referred to by</&></TD><TD><input size=10 name="RefersTo-new"<% $ARGS{'RefersTo-new'} && " VALUE=\"$ARGS{'RefersTo-new'}\"" %>></TD></TR>
188 <& /Elements/TitleBoxEnd &>
194 <& /Elements/Submit, Label => loc("Create") &>
196 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
197 <BR><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>
203 my $QueueObj = new RT::Queue($session{'CurrentUser'});
204 $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded."));
205 my $CFs = $QueueObj->CustomFields();
207 # {{{ deal with deleting uploaded attachments
208 foreach my $key (keys %ARGS) {
209 if ($key =~ m/^DeleteAttach-(.+)$/) {
210 delete $session{'Attachments'}{$1};
212 $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
215 # {{{ store the uploaded attachment in session
216 if ($ARGS{'Attach'}) { # attachment?
217 $session{'Attachments'} = {} unless defined $session{'Attachments'};
219 my $subject = "$ARGS{'Attach'}";
221 # since CGI.pm deutf8izes the magic field, we need to add it back.
222 Encode::_utf8_on($subject);
223 # strip leading directories
224 $subject =~ s#^.*[\\/]##;
226 my $attachment = MakeMIMEEntity(
229 AttachmentFieldName => 'Attach'
232 $session{'Attachments'} = { %{$session{'Attachments'} || {}},
233 $ARGS{'Attach'} => $attachment };
237 # delete temporary storage entry to make WebUI clean
238 unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') {
239 delete $session{'Attachments'};
245 if ((!exists $ARGS{'AddMoreAttach'}) && ($ARGS{'id'} eq 'new')) { # new ticket?
246 $m->comp('Display.html', %ARGS);
253 $DependedOnBy => undef
255 $QuoteTransaction => undef