# --
# AgentCompose.dtl - provides HTML form for AgentCompose 
# Copyright (C) 2001-2004 Martin Edenhofer <martin+code@otrs.org>
# --
# $Id: AgentCompose.dtl,v 1.28 2004/01/27 09:26:06 martin Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (GPL). If you
# did not receive this file, see http://www.gnu.org/licenses/gpl.txt.
# --
<!-- start compose form -->

<!-- This java script is just for nice to have funktions! -->
<script language="JavaScript" type="text/javascript">
<!--
function submit_compose()
{
    if (document.compose.To.value == "") {
        alert('$Text{"A message should have a To: recipient!"}');
        document.compose.To.focus();
        return false;
    } 
    else if (document.compose.Subject.value == "") {
        alert('$Text{"A message should have a subject!"}');
        document.compose.Subject.focus();
        return false;
    } 
    else if (document.spelling.was_spell_checked != true && $Config{"FrontendNeedSpellCheck"}) {
        alert('$Text{"A message must be spell checked!"}');
        document.compose.Body.focus();
        return false;
    }
    else if (document.compose.TimeUnits.value == "" && $Config{"FrontendNeedAccountedTime"}) {
        alert('$Text{"You need to account time!"}');
        document.compose.Subject.focus();
        return false;
    } 
    else {
        return true;
    }
}
//-->
</script>
<script language="JavaScript" type="text/javascript">
<!--
function SpellCheckSubmit()
{
    document.spelling.Body.value = document.compose.Body.value;
    window.open('', 'spelling', 'toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=700,height=550,left=100,top=100');
    document.spelling.submit()
    document.spelling.was_spell_checked=true;
}
// -->
</script>

<script language="JavaScript" type="text/javascript">
<!--
function BookCheckSubmit()
{
    document.book.To.value = document.compose.To.value;
    document.book.Cc.value = document.compose.Cc.value;
    document.book.Bcc.value = document.compose.Bcc.value;
    window.open('', 'book', 'toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=700,height=550,left=100,top=100');
    document.book.submit()
    document.book.was_spell_checked=true;
} 
// -->
</script>

<table border="0" width="100%" cellspacing="0" cellpadding="3" cols="1">
<tr>
  <td align="left" class="table2"> 
    <b>$Env{"Box0"}$Text{"Compose answer for ticket"}: $Data{"TicketNumber"}$Env{"Box1"}</b>
  </td>
</tr>
<tr>
  <td align="left" valign="top" class="table1">

  <form action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" name="compose">
  <input type="hidden" name="Action" value="AgentCompose">
  <input type="hidden" name="Subaction" value="SendEmail">
  <input type="hidden" name="QueueID" value="$Data{"QueueID"}">
  <input type="hidden" name="TicketID" value="$Data{"TicketID"}">
  <input type="hidden" name="NextScreen" value="$Data{"NextScreen"}">
  <input type="hidden" name="Email" value="$Data{"Email"}">
  <input type="hidden" name="InReplyTo" value="$Data{"InReplyTo"}">
  <table border="0" width="100%">
    <tr>
      <td width="20%">$Text{"From"}:</td>
      <td width="80%">$Data{"From"} <input type="hidden" name="From" value="$Data{"From"}"> <font color="red" size="-2">$Data{"From invalid"}</font></td>
    </tr>
    <tr>
      <td>$Text{"To"}:</td>
      <td><input type="text" name="To" value="$Data{"To"}" size="80"> <font color="red" size="-2">$Data{"To invalid"}</font></td>
    </tr>
    <tr>
      <td>$Text{"Cc"}:</td>
      <td><input type="text" name="Cc" value="$Data{"Cc"}" size="80"> <font color="red" size="-2">$Data{"Cc invalid"}</font></td>
    </tr>
    <tr>
      <td>$Text{"Bcc"}:</td>
      <td><input type="text" name="Bcc" value="$Data{"Bcc"}" size="80"> <font color="red" size="-2">$Data{"Bcc invalid"}</font></td>
    </tr>
    <tr>
      <td>$Text{"Subject"}:</td>
      <td><input type="text" name="Subject" value="$Data{"Subject"}" size="80"></td>
    </tr>
    <tr>
      <td>$Text{"Options"}:</td>
      <td>
       $Env{"Box0"}<a href="" onclick="SpellCheckSubmit(); return false;" onmouseover="window.status='$Text{"Spell Check"}'; return true;" onmouseout="window.status='';"><img border="0" src="$Env{"Images"}spell.png">$Text{"Spell Check"}</a>$Env{"Box1"}
       $Env{"Box0"}<a href="" onclick="BookCheckSubmit(); return false;" onmouseover="window.status='$Text{"Address Book"}'; return true;" onmouseout="window.status='';"><img border="0" src="$Env{"Images"}contents.png">$Text{"Address Book"}</a>$Env{"Box1"}
       $Env{"Box0"}<a href="#attachment" onmouseover="window.status='$Text{"Attachments"}'; return true;" onmouseout="window.status='';"><img border="0" src="$Env{"Images"}attach.png">$Text{"Attachments"}</a>$Env{"Box1"}
      </td>
    </tr>
    <tr>
      <td valign="top">$Text{"Text"}:</td>
      <td>
<pre>
<textarea name="Body" rows="25" cols="$Config{"TextAreaEmailWindow"}" wrap="$Env{"BrowserWrap"}">
$Data{"ResponseFormat"}
</textarea>
</pre>
      </td>
    </tr>
# --
# use there are std. attachments for this response 
# --
<dtl if ($Data{"StdAttachmentsStrg"} ne "") { $Data{"StdAttachmentsTable"} = "<tr><td>$Text{"Std. Attachment"}:</td><td>$Data{"StdAttachmentsStrg"}</td></tr>"; }>
    $Data{"StdAttachmentsTable"}
#
    <tr>
      <td>$Text{"Attachment"}:</td><td><input name="file_upload" type="file" size="40" class="fixed">&nbsp;<!--<input type="button" class="button" onclick="attach()" value="$Text{"Attach"}">--><a name="attachment"></td>
    </tr>
    <tr>
      <td>$Text{"Next ticket state"}:</td>
      <td>$Data{"NextStatesStrg"}</td>
    </tr>
    <tr>
      <td>$Text{"Pending Date"} ($Text{"for pending* states"}):</td>
      <td>$Data{"PendingDateString"}</td>
    </tr>
    <tr>
      <td>$Text{"Is the ticket answered"}:</td>
      <td>$Data{"AnsweredYesNoOption"}</td>
    </tr>
    <tr>
      <td>$Text{"Time units"}$Text{"$Config{"TimeUnits"}"}:</td>
      <td><input type="text" name="TimeUnits" value="$Data{"TimeUnits"}" size="3"></td>
    </tr>
  </table>
  <br>
  <input class="button" type="submit" value="$Text{"Send mail!"}" onclick="return submit_compose();">
  </form>

  <form action="$Env{"CGIHandle"}" method="post" name="spelling" target="spelling">
  <input type="hidden" name="Action" value="AgentSpelling">
  <input type="hidden" name="Body" value="">
  <input type="hidden" name="spell_lang" value="">
  </form>

  <form action="$Env{"CGIHandle"}" method="post" name="book" target="book">
  <input type="hidden" name="Action" value="AgentBook">
  <input type="hidden" name="To" value="">
  <input type="hidden" name="Cc" value="">
  <input type="hidden" name="Bcc" value="">
  </form>

  </td> 
</tr>
</table>
<!-- end compose form -->
