<& /Elements/Header, Title=> $title  &>
<& /Ticket/Elements/Tabs, Ticket => $Ticket &>
<& /Elements/TitleBoxStart, title => "Update ticket" &>

<FORM ACTION="Display.html" NAME="TicketUpdate" 
	METHOD=POST enctype="multipart/form-data">

<TABLE>
<TR><TD>
<a href="ModifyPeople.html?id=<%$Ticket->Id%>">Ticket watchers</A></TD><TD align=right>
Requestor:
</TD><TD>
<b><% $Ticket->RequestorsAsString %></b>
</TD></TR>
<TR><TD>&nbsp;</TD><TD align=right>
Cc:
</TD><TD>
<b><% $Ticket->CcAsString %></b>
</TD></TR>
<TR><TD>&nbsp;</TD><TD align=right>
AdminCc:
</TD><TD>
<b><% $Ticket->AdminCcAsString %></b>
</TD></TR>
</TR>
</TABLE>
<hr>

<TABLE BORDER=0>

<tr><td align=right>Status:</td>
<td>
<& /Elements/SelectStatus, Name=>"Status", Default => $DefaultStatus &>
Owner:  
<& /Elements/SelectOwner, Name=>"Owner", Default => $Ticket->OwnerObj->Id(), QueueObj => $Ticket->QueueObj, TicketObj => $Ticket &>
Worked: <input size=4 name="UpdateTimeWorked"> minutes</td></tr>
<tr><td align=right>Update Type:</td>
<td><select name="UpdateType">
% if ($CanComment) {
  <option value="private" <%$CommentDefault%>>Comments (Not sent to requestors)</option>
% }
% if ($CanRespond) {
   <option value="response" <%$ResponseDefault%>>Response to requestors</option>
% }
</select> 
</td></tr>
<tr><td align=right>Subject:</td><td> <input name="UpdateSubject" size=60 value="<%$Ticket->Subject()%>"></td></tr>
<tr><td align=right>Cc:</td><td> <input name="UpdateCc" size=60><BR>
<i><font size=-2>(Sends a carbon-copy of this update to a comma-delimited list
of email addresses. Does <b>not</b> change who will receive future updates.)</font></i>
</td></tr>
<tr><td align=right>Bcc:</td><td> <input name="UpdateBcc" size=60><BR>
<i><font size=-2>(Sends a blind carbon-copy of this update to a comma-delimited list
of email addresses. Does <b>not</b> change who will receive future updates.)</font></i>
</td></tr>
<tr><td align=right>Attach:</td><td><input name="UpdateAttachment" type="file"></td></tr>
</table>
<& /Elements/MessageBox, Name=>"UpdateContent", QuoteTransaction=>$ARGS{QuoteTransaction} &>
		<INPUT TYPE=HIDDEN NAME=id VALUE="<%$Ticket->Id%>"><br>




<& /Elements/TitleBoxEnd &>
<& /Elements/Submit &>
  </FORM>



<%INIT>

my $CanRespond = 0;
my $CanComment = 0;
my $title;

my $Ticket = LoadTicket($id);


if ($DefaultStatus eq 'resolved') {
	$title = "Resolve";
} else {
	$title = "Update";
}

$title .= " ticket #" . $Ticket->id . " (" .$Ticket->Subject.")";

# Things needed in the template - we'll do the processing here, just
# for the convinience:
my $CommentDefault=$Action eq "Comment" ? "SELECTED" : "";
my $ResponseDefault=$Action eq "Respond" ? "SELECTED" : "";

$DefaultStatus = $Ticket->Status() unless ($DefaultStatus);

$CanRespond = 1 if ( $Ticket->CurrentUserHasRight('ReplyToTicket') or
                     $Ticket->CurrentUserHasRight('ModifyTicket') ); 

$CanComment = 1 if ( $Ticket->CurrentUserHasRight('CommentOnTicket') or
                     $Ticket->CurrentUserHasRight('ModifyTicket') ); 
	

     
     

</%INIT>

<%ARGS>
$id => undef
$Action => undef
$DefaultStatus => undef
</%ARGS>
