1 %# BEGIN BPS TAGGED BLOCK {{{
5 %# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
6 %# <jesse@bestpractical.com>
8 %# (Except where explicitly superseded by other copyright notices)
13 %# This work is made available to you under the terms of Version 2 of
14 %# the GNU General Public License. A copy of that license should have
15 %# been provided with this software, but in any event can be snarfed
18 %# This work is distributed in the hope that it will be useful, but
19 %# WITHOUT ANY WARRANTY; without even the implied warranty of
20 %# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 %# General Public License for more details.
23 %# You should have received a copy of the GNU General Public License
24 %# along with this program; if not, write to the Free Software
25 %# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 %# CONTRIBUTION SUBMISSION POLICY:
30 %# (The following paragraph is not intended to limit the rights granted
31 %# to you to modify and distribute this software under the terms of
32 %# the GNU General Public License and is only of importance to you if
33 %# you choose to contribute your changes and enhancements to the
34 %# community by submitting them to Best Practical Solutions, LLC.)
36 %# By intentionally submitting any modifications, corrections or
37 %# derivatives to this work, or any other work intended for use with
38 %# Request Tracker, to Best Practical Solutions, LLC, you confirm that
39 %# you are the copyright holder for those contributions and you grant
40 %# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
41 %# royalty-free, perpetual, license to use, copy, create derivative
42 %# works based on those contributions, and sublicense and distribute
43 %# those contributions and any derivatives thereof.
45 %# END BPS TAGGED BLOCK }}}
46 <& /Elements/Header, Title => loc("Create a new ticket") &>
48 current_toptab => "Ticket/Create.html",
49 Title => loc("Create a new ticket") &>
50 <FORM ACTION="<%$RT::WebPath%>/Ticket/Create.html" METHOD="POST" ENCTYPE="multipart/form-data" NAME="TicketCreate">
51 <INPUT TYPE=HIDDEN Name="id" VALUE="new">
55 [<a class="currenttab"><&|/l&>Show basics</&></a>] [<A HREF="#detail"><&|/l&>Show details</&></a>]
57 <& /Elements/TitleBoxStart, contentbg => "#cccccc", title => loc("Create a new ticket") &>
58 <TABLE border=0 cellpadding=0 cellspacing=0>
59 <TR><TD class=label><&|/l&>Queue</&>:</TD>
60 <TD class=value><% $QueueObj->Name %>
61 <INPUT TYPE=HIDDEN NAME=Queue Value="<%$QueueObj->Name%>">
63 <TD class=label><&|/l&>Status</&>:
66 <& /Elements/SelectStatus, Name => "Status", Default => $ARGS{Status}||'new', DefaultValue => 0 &>
72 <& /Elements/SelectOwner, Name => "Owner", QueueObj => $QueueObj, Default => $ARGS{Owner}||$RT::Nobody->Id, DefaultValue => 0 &>
77 <&|/l&>Requestors</&>:
79 <TD class=value COLSPAN=5>
80 <INPUT Name="Requestors" Value="<% ($ARGS{Requestors}) || $session{CurrentUser}->EmailAddress %>" SIZE=40>
87 <TD class=value COLSPAN=5>
88 <INPUT NAME="Cc" SIZE=40 VALUE="<% $ARGS{Cc} %>"><BR>
90 <&|/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>
97 <TD class=value COLSPAN=5>
98 <INPUT NAME="AdminCc" SIZE=40 VALUE="<% $ARGS{AdminCc} %>"><BR>
100 <&|/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>
107 <TD class=value COLSPAN=5>
108 <INPUT Name="Subject" SIZE=60 MAXSIZE=100 value="<%$ARGS{Subject} || ''%>">
113 <& /Ticket/Elements/EditCustomFields, QueueObj => $QueueObj &>
116 % if ($TxnCFs->Count) {
117 % while (my $CF = $TxnCFs->Next()) {
119 <TD ALIGN=RIGHT><% $CF->Name %>:</TD>
120 <TD><& /Elements/EditCustomField, CustomField => $CF, NamePrefix =>
121 "Object-RT::Transaction--CustomField-" &><em><% $CF->FriendlyType %></em></TD>
126 % if (exists $session{'Attachments'}) {
128 <&|/l&>Attached file</&>:
131 <&|/l&>Check box to delete</&><BR>
132 % foreach my $attach_name (keys %{$session{'Attachments'}}) {
133 <input type="checkbox" name="DeleteAttach-<%$attach_name%>" value="1"><%$attach_name%><BR>
140 <&|/l&>Attach file</&>:
142 <TD class=value COLSPAN=5>
143 <INPUT TYPE=FILE NAME="Attach">
144 <INPUT TYPE=SUBMIT NAME="AddMoreAttach" VALUE="<&|/l&>Add More Files</&>">
149 <&|/l&>Describe the issue below</&>:<br>
150 % if (exists $ARGS{Content}) {
151 <& /Elements/MessageBox, Default => $ARGS{Content}, IncludeSignature => 0 &>
153 <& /Elements/MessageBox, QuoteTransaction => $QuoteTransaction &>
160 <TD ALIGN=RIGHT COLSPAN=2>
164 <& /Elements/TitleBoxEnd &>
165 <& /Elements/Submit, Label => loc("Create")&>
167 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
168 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
169 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
170 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
171 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
174 [<A HREF="#top"><&|/l&>Show basics</&></a>] [<a class="currenttab"><&|/l&>Show details</&></a>]
176 <TABLE WIDTH="100%" BORDER=0>
178 <TD WIDTH="50%" VALIGN=TOP>
180 <& /Elements/TitleBoxStart, title => loc('The Basics'),
181 title_class=> 'inverse',
182 color => "#993333" &>
184 <TR><TD ALIGN=RIGHT><&|/l&>Priority</&>:</TD><TD><input size=3 name="InitialPriority" value="<% $ARGS{InitialPriority} ? $ARGS{InitialPriority} : $QueueObj->InitialPriority %>"></TD></TR>
185 <TR><TD ALIGN=RIGHT><&|/l&>Final Priority</&>:</TD><TD><input size=3 name="FinalPriority" value="<% $ARGS{FinalPriority} ? $ARGS{FinalPriority} : $QueueObj->FinalPriority %>"></TD></TR>
186 <TR><TD ALIGN=RIGHT><&|/l&>Time Worked</&>:</TD><TD><&|/l,'<input size=3 name="TimeWorked" value="'.$ARGS{TimeWorked}.'">'&>[_1] min</&></TD></TR>
187 <TR><TD ALIGN=RIGHT><&|/l&>Time Left</&>:</TD><TD><&|/l,'<input size=3 name="TimeLeft" value="'.$ARGS{TimeLeft}.'">'&>[_1] min</&></TD></TR>
189 <& /Elements/TitleBoxEnd &>
191 <& /Elements/TitleBoxStart, title => loc("Dates"),
192 title_class=> 'inverse',
193 color => "#663366" &>
196 <TR><TD ALIGN=RIGHT><&|/l&>Starts</&>:</TD><TD><input size=10 name="Starts" value="<% $ARGS{Starts} %>"></TD></TR>
197 <TR><TD ALIGN=RIGHT><&|/l&>Due</&>:</TD><TD><input size=10 name="Due" value="<%
198 $ARGS{Due}%>"></TD></TR>
200 <& /Elements/TitleBoxEnd &>
205 <& /Elements/TitleBoxStart, title => loc('Links'),
206 title_class=> 'inverse',
207 titleright => '', color=> "#336633" &>
209 <i><&|/l&>(Enter ticket ids or URLs, separated with spaces)</&></i>
211 <TR><TD ALIGN=RIGHT><&|/l&>Depends on</&></TD><TD><input size=10 name="new-DependsOn" value="<% $ARGS{'new-DependsOn'} %>"></TD></TR>
212 <TR><TD ALIGN=RIGHT><&|/l&>Depended on by</&></TD><TD><input size=10 name="DependsOn-new" value="<% $ARGS{'DependsOn-new'} %>"></TD></TR>
213 <TR><TD ALIGN=RIGHT><&|/l&>Parents</&></TD><TD><input size=10 name="new-MemberOf" value="<% $ARGS{'new-MemberOf'} %>"></TD></TR>
214 <TR><TD ALIGN=RIGHT><&|/l&>Children</&></TD><TD><input size=10 name="MemberOf-new" value="<% $ARGS{'MemberOf-new'} %>"></TD></TR>
215 <TR><TD ALIGN=RIGHT><&|/l&>Refers to</&></TD><TD><input size=10 name="new-RefersTo" value="<% $ARGS{'new-RefersTo'} %>"></TD></TR>
216 <TR><TD ALIGN=RIGHT><&|/l&>Referred to by</&></TD><TD><input size=10 name="RefersTo-new" value="<% $ARGS{'RefersTo-new'} %>"></TD></TR>
220 <& /Elements/TitleBoxEnd &>
226 <& /Elements/Submit, Label => loc("Create") &>
228 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
229 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
230 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
231 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
232 <BR><BR><BR><BR><BR><BR><BR><BR><BR><BR><BR>
238 my $QueueObj = new RT::Queue($session{'CurrentUser'});
239 $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded."));
240 my $CFs = $QueueObj->TicketCustomFields();
241 my $TxnCFs = $QueueObj->TicketTransactionCustomFields();
243 # if no due date has been set explicitly, then use the
244 # queue's default if it exists
245 if ($QueueObj->DefaultDueIn && !$ARGS{'Due'}) {
246 my $default_due = RT::Date->new($session{'CurrentUser'});
247 $default_due->SetToNow();
248 $default_due->AddDays($QueueObj->DefaultDueIn);
249 $ARGS{'Due'} = $default_due->ISO();
252 # {{{ deal with deleting uploaded attachments
253 foreach my $key (keys %ARGS) {
254 if ($key =~ m/^DeleteAttach-(.+)$/) {
255 delete $session{'Attachments'}{$1};
257 $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
260 # {{{ store the uploaded attachment in session
261 if ($ARGS{'Attach'}) { # attachment?
262 $session{'Attachments'} = {} unless defined $session{'Attachments'};
264 my $subject = "$ARGS{'Attach'}";
266 # strip leading directories
267 $subject =~ s#^.*[\\/]##;
269 my $attachment = MakeMIMEEntity(
272 AttachmentFieldName => 'Attach'
275 $session{'Attachments'} = { %{$session{'Attachments'} || {}},
276 $ARGS{'Attach'} => $attachment };
280 # delete temporary storage entry to make WebUI clean
281 unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') {
282 delete $session{'Attachments'};
288 if ((!exists $ARGS{'AddMoreAttach'}) && ($ARGS{'id'} eq 'new')) { # new ticket?
289 $m->comp('Display.html', %ARGS);
296 $DependedOnBy => undef
298 $QuoteTransaction => undef