import of rt 3.0.9
[freeside.git] / rt / html / Ticket / Create.html
1 %# BEGIN LICENSE BLOCK
2 %# 
3 %# Copyright (c) 1996-2003 Jesse Vincent <jesse@bestpractical.com>
4 %# 
5 %# (Except where explictly superceded by other copyright notices)
6 %# 
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
10 %# from www.gnu.org.
11 %# 
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.
16 %# 
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.
21 %# 
22 %# 
23 %# END LICENSE BLOCK
24 <& /Elements/Header, Title => loc("Create a new ticket") &>
25 <& /Elements/Tabs, 
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">
30 <A NAME="top">
31         
32         
33 [<a class="currenttab"><&|/l&>Show basics</&></a>] [<A HREF="#detail"><&|/l&>Show details</&></a>]
34 <BR>
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%>">
40 </TD>
41 <TD class=label><&|/l&>Status</&>:
42 </TD>
43 <TD class=value>
44 <& /Elements/SelectStatus, Name => "Status", Default => $ARGS{Status}||'new' &>
45 </TD>
46 <TD class=label>
47 <&|/l&>Owner</&>:
48 </TD>
49 <TD class=value>
50 <& /Elements/SelectOwner, Name => "Owner", QueueObj => $QueueObj, Default => $ARGS{Owner}||undef &>
51 </TD>
52 </TR>
53 <TR>
54 <TD class=label>
55 <&|/l&>Requestors</&>:
56 </TD>
57 <TD class=value COLSPAN=5>
58 <INPUT Name="Requestors" Value="<% ($ARGS{Requestors}) || $session{CurrentUser}->EmailAddress %>" SIZE=40>
59 </TD>
60 </TR>
61 <TR>
62 <TD class=labeltop>
63 <&|/l&>Cc</&>:
64 </TD>
65 <TD class=value COLSPAN=5>
66 <INPUT NAME="Cc" SIZE=40 VALUE="<% $ARGS{Cc} %>"><BR>
67 <i><font size=-2>
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>
69 </TD>
70 </TR>
71 <TR>
72 <TD class=labeltop>
73 <&|/l&>Admin Cc</&>:
74 </TD>
75 <TD class=value COLSPAN=5>
76 <INPUT NAME="AdminCc" SIZE=40 VALUE="<% $ARGS{AdminCc} %>"><BR>
77 <i><font size=-2>
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>
79 </TD>
80 </TR>
81 <TR>
82 <TD class=label>
83 <&|/l&>Subject</&>:
84 </TD>
85 <TD class=value COLSPAN=5>
86 <INPUT Name="Subject" SIZE=60 MAXSIZE=100 value="<%$ARGS{Subject} || ''%>">
87 </TD>
88 </TR>
89 <TR>
90 <TD COLSPAN=6>
91 <& /Ticket/Elements/EditCustomFields, QueueObj => $QueueObj &>
92 </TD>
93 </TR>
94 <TR>
95 % if (exists $session{'Attachments'}) {
96 <TD class=label>
97 <&|/l&>Attached file</&>:
98 </TD>
99 <TD COLSPAN=5>
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>
103 % } # end of foreach
104 </TD>
105 </TR>
106 <TR>
107 % } # end of if
108 <TD>
109 <&|/l&>Attach file</&>:
110 </TD>
111 <TD class=value COLSPAN=5>
112 <INPUT TYPE=FILE NAME="Attach">
113 <INPUT TYPE=SUBMIT NAME="AddMoreAttach" VALUE="<&|/l&>Add More Files</&>">
114 </TD>
115 </TR>
116 <TR>
117 <TD COLSPAN=6>
118 <&|/l&>Describe the issue below</&>:<br>
119 % if (exists $ARGS{Content}) {
120 <& /Elements/MessageBox, Default => $ARGS{Content} &>
121 % } else {
122 <& /Elements/MessageBox, QuoteTransaction => $QuoteTransaction &>
123 %}
124
125 <BR>
126 </TD>
127 </TR>
128 <TR>
129 <TD ALIGN=RIGHT COLSPAN=2>
130 </TD>
131 </TR>
132 </TABLE>
133 <& /Elements/TitleBoxEnd &>
134 <& /Elements/Submit, Label => loc("Create")&>
135
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>
141
142 <A NAME="detail">
143         [<A HREF="#top"><&|/l&>Show basics</&></a>] [<a class="currenttab"><&|/l&>Show details</&></a>]
144 <BR>
145 <TABLE WIDTH="100%" BORDER=0>
146 <TR>
147 <TD WIDTH="50%" VALIGN=TOP>
148
149           <& /Elements/TitleBoxStart, title => loc('The Basics'), 
150                 title_class=> 'inverse',  
151                 color => "#993333" &>
152 <TABLE BORDER=0>
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>
157 </TABLE>
158 <& /Elements/TitleBoxEnd &>
159 <br>
160 <& /Elements/TitleBoxStart, title => loc("Dates"),
161                 title_class=> 'inverse',  
162                  color => "#663366" &>
163
164 <TABLE BORDER=0>
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>
168 </TABLE>
169 <& /Elements/TitleBoxEnd &>
170 <BR>
171 </TD>
172
173 <TD VALIGN="TOP">
174 <& /Elements/TitleBoxStart, title => loc('Relationships'), 
175         title_class=> 'inverse',  
176         titleright => '', color=> "#336633" &>
177
178 <i><&|/l&>(Enter ticket ids or URLs, seperated with spaces)</&></i>
179 <TABLE BORDER=0>
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>
186
187
188 </TABLE>
189 <& /Elements/TitleBoxEnd &>
190 <BR>
191
192 </TD>
193 </TR>
194 </TABLE>
195 <& /Elements/Submit, Label => loc("Create") &>
196 </FORM>
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>
202
203 <%INIT>
204
205
206
207 my $QueueObj = new RT::Queue($session{'CurrentUser'});
208 $QueueObj->Load($Queue) || Abort(loc("Queue could not be loaded."));
209 my $CFs = $QueueObj->CustomFields();
210
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();
216 }
217
218 # {{{ deal with deleting uploaded attachments
219 foreach my $key (keys %ARGS) {
220     if ($key =~ m/^DeleteAttach-(.+)$/) {
221         delete $session{'Attachments'}{$1};
222     }
223     $session{'Attachments'} = { %{$session{'Attachments'} || {}} };
224 }
225
226 # {{{ store the uploaded attachment in session
227 if ($ARGS{'Attach'}) {                  # attachment?
228     $session{'Attachments'} = {} unless defined $session{'Attachments'};
229
230     my $subject = "$ARGS{'Attach'}";
231
232     # strip leading directories
233     $subject =~ s#^.*[\\/]##;
234
235     my $attachment = MakeMIMEEntity(
236         Subject             => $subject,
237         Body                => "",
238         AttachmentFieldName => 'Attach'
239     );
240
241     $session{'Attachments'} = { %{$session{'Attachments'} || {}},
242                                 $ARGS{'Attach'} => $attachment };
243 }
244 # }}}
245
246 # delete temporary storage entry to make WebUI clean
247 unless (keys %{$session{'Attachments'}} and $ARGS{'id'} eq 'new') {
248     delete $session{'Attachments'};
249 }
250
251
252 # }}}
253
254 if ((!exists $ARGS{'AddMoreAttach'}) && ($ARGS{'id'} eq 'new')) { # new ticket?
255     $m->comp('Display.html', %ARGS);
256     $m->abort();
257 }
258 </%INIT>
259
260 <%ARGS>
261 $DependsOn => undef
262 $DependedOnBy => undef
263 $MemberOf => undef
264 $QuoteTransaction => undef
265 $Queue => undef
266 </%ARGS>