import rt 3.4.6
[freeside.git] / rt / html / Ticket / Create.html
1 %# BEGIN BPS TAGGED BLOCK {{{
2 %# 
3 %# COPYRIGHT:
4 %#  
5 %# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC 
6 %#                                          <jesse@bestpractical.com>
7 %# 
8 %# (Except where explicitly superseded by other copyright notices)
9 %# 
10 %# 
11 %# LICENSE:
12 %# 
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
16 %# from www.gnu.org.
17 %# 
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.
22 %# 
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.
26 %# 
27 %# 
28 %# CONTRIBUTION SUBMISSION POLICY:
29 %# 
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.)
35 %# 
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.
44 %# 
45 %# END BPS TAGGED BLOCK }}}
46 <& /Elements/Header, Title => loc("Create a new ticket") &>
47 <& /Elements/Tabs, 
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">
52 <A NAME="top">
53         
54         
55 [<a class="currenttab"><&|/l&>Show basics</&></a>] [<A HREF="#detail"><&|/l&>Show details</&></a>]
56 <BR>
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%>">
62 </TD>
63 <TD class=label><&|/l&>Status</&>:
64 </TD>
65 <TD class=value>
66 <& /Elements/SelectStatus, Name => "Status", Default => $ARGS{Status}||'new', DefaultValue => 0 &>
67 </TD>
68 <TD class=label>
69 <&|/l&>Owner</&>:
70 </TD>
71 <TD class=value>
72 <& /Elements/SelectOwner, Name => "Owner", QueueObj => $QueueObj, Default => $ARGS{Owner}||$RT::Nobody->Id, DefaultValue => 0 &>
73 </TD>
74 </TR>
75 <TR>
76 <TD class=label>
77 <&|/l&>Requestors</&>:
78 </TD>
79 <TD class=value COLSPAN=5>
80 <INPUT Name="Requestors" Value="<% ($ARGS{Requestors}) || $session{CurrentUser}->EmailAddress %>" SIZE=40>
81 </TD>
82 </TR>
83 <TR>
84 <TD class=labeltop>
85 <&|/l&>Cc</&>:
86 </TD>
87 <TD class=value COLSPAN=5>
88 <INPUT NAME="Cc" SIZE=40 VALUE="<% $ARGS{Cc} %>"><BR>
89 <i><font size=-2>
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>
91 </TD>
92 </TR>
93 <TR>
94 <TD class=labeltop>
95 <&|/l&>Admin Cc</&>:
96 </TD>
97 <TD class=value COLSPAN=5>
98 <INPUT NAME="AdminCc" SIZE=40 VALUE="<% $ARGS{AdminCc} %>"><BR>
99 <i><font size=-2>
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>
101 </TD>
102 </TR>
103 <TR>
104 <TD class=label>
105 <&|/l&>Subject</&>:
106 </TD>
107 <TD class=value COLSPAN=5>
108 <INPUT Name="Subject" SIZE=60 MAXSIZE=200 value="<%$ARGS{Subject} || ''%>">
109 </TD>
110 </TR>
111 <TR>
112 <TD COLSPAN=6>
113 <& /Ticket/Elements/EditCustomFields, QueueObj => $QueueObj &>
114 </TD>
115 </TR>
116 % if ($TxnCFs->Count) {
117 % while (my $CF = $TxnCFs->Next()) {
118 <TR>
119 <TD ALIGN=RIGHT><% $CF->Name %>:</TD>
120 <TD><& /Elements/EditCustomField, CustomField => $CF, NamePrefix =>
121     "Object-RT::Transaction--CustomField-" &><em><% $CF->FriendlyType %></em></TD>
122 </TD></TR>
123 % }
124 % }
125 <TR>
126 % if (exists $session{'Attachments'}) {
127 <TD class=label>
128 <&|/l&>Attached file</&>:
129 </TD>
130 <TD COLSPAN=5>
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>
134 % } # end of foreach
135 </TD>
136 </TR>
137 <TR>
138 % } # end of if
139 <TD>
140 <&|/l&>Attach file</&>:
141 </TD>
142 <TD class=value COLSPAN=5>
143 <INPUT TYPE=FILE NAME="Attach">
144 <INPUT TYPE=SUBMIT NAME="AddMoreAttach" VALUE="<&|/l&>Add More Files</&>">
145 </TD>
146 </TR>
147 <TR>
148 <TD COLSPAN=6>
149 <&|/l&>Describe the issue below</&>:<br>
150 % if (exists $ARGS{Content}) {
151 <& /Elements/MessageBox, Default => $ARGS{Content}, IncludeSignature => 0 &>
152 % } else {
153 <& /Elements/MessageBox, QuoteTransaction => $QuoteTransaction &>
154 %}
155
156 <BR>
157 </TD>
158 </TR>
159 <TR>
160 <TD ALIGN=RIGHT COLSPAN=2>
161 </TD>
162 </TR>
163 </TABLE>
164 <& /Elements/TitleBoxEnd &>
165 <& /Elements/Submit, Label => loc("Create")&>
166
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>
172
173 <A NAME="detail">
174         [<A HREF="#top"><&|/l&>Show basics</&></a>] [<a class="currenttab"><&|/l&>Show details</&></a>]
175 <BR>
176 <TABLE WIDTH="100%" BORDER=0>
177 <TR>
178 <TD WIDTH="50%" VALIGN=TOP>
179
180           <& /Elements/TitleBoxStart, title => loc('The Basics'), 
181                 title_class=> 'inverse',  
182                 color => "#993333" &>
183 <TABLE BORDER=0>
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>
188 </TABLE>
189 <& /Elements/TitleBoxEnd &>
190 <br>
191 <& /Elements/TitleBoxStart, title => loc("Dates"),
192                 title_class=> 'inverse',  
193                  color => "#663366" &>
194
195 <TABLE BORDER=0>
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>
199 </TABLE>
200 <& /Elements/TitleBoxEnd &>
201 <BR>
202 </TD>
203
204 <TD VALIGN="TOP">
205 <& /Elements/TitleBoxStart, title => loc('Links'), 
206         title_class=> 'inverse',  
207         titleright => '', color=> "#336633" &>
208
209 <i><&|/l&>(Enter ticket ids or URLs, separated with spaces)</&></i>
210 <TABLE BORDER=0>
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>
217
218
219 </TABLE>
220 <& /Elements/TitleBoxEnd &>
221 <BR>
222
223 </TD>
224 </TR>
225 </TABLE>
226 <& /Elements/Submit, Label => loc("Create") &>
227 </FORM>
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>
233
234 <%INIT>
235
236
237
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();
242
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();
250 }
251
252 # {{{ deal with deleting uploaded attachments
253 foreach my $key (keys %ARGS) {
254     if ($key =~ m/^DeleteAttach-(.+)$/) {
255         delete $session{'Attachments'}{$1};
256     }
257     $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
258 }
259
260 # {{{ store the uploaded attachment in session
261 if ($ARGS{'Attach'}) {                  # attachment?
262     $session{'Attachments'} = {} unless defined $session{'Attachments'};
263
264     my $subject = "$ARGS{'Attach'}";
265
266     # strip leading directories
267     $subject =~ s#^.*[\\/]##;
268
269     my $attachment = MakeMIMEEntity(
270         Subject             => $subject,
271         Body                => "",
272         AttachmentFieldName => 'Attach'
273     );
274
275     $session{'Attachments'} = { %{$session{'Attachments'} || {}},
276                                 $ARGS{'Attach'} => $attachment };
277 }
278 # }}}
279
280 # delete temporary storage entry to make WebUI clean
281 unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') {
282     delete $session{'Attachments'};
283 }
284
285
286 # }}}
287
288 if ((!exists $ARGS{'AddMoreAttach'}) && ($ARGS{'id'} eq 'new')) { # new ticket?
289     $m->comp('Display.html', %ARGS);
290     return();
291 }
292 </%INIT>
293
294 <%ARGS>
295 $DependsOn => undef
296 $DependedOnBy => undef
297 $MemberOf => undef
298 $QuoteTransaction => undef
299 $Queue => undef
300 </%ARGS>