# --
# AgentTicketForward.dtl - provides HTML form for AgentTicketForward
# Copyright (C) 2001-2005 Martin Edenhofer <martin+code@otrs.org>
# --
# $Id: AgentTicketForward.dtl,v 1.10 2005/08/05 08:11:45 rk 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{"Ticket::Frontend::NeedSpellCheck"}) {
        alert('$Text{"A message must be spell checked!"}');
        document.compose.Body.focus();
        return false;
    }
    else if (isNaN(document.compose.Day.value) || isNaN(document.compose.Month.value) || isNaN(document.compose.Year.value) || isNaN(document.compose.Hour.value) || isNaN(document.compose.Minute.value)) {
        alert('$Text{"Invalid date!"}');
        return false;
    }
    else if (document.compose.Day.value < 1 || document.compose.Day.value > 31 || document.compose.Month.value < 1 || document.compose.Month.value > 31 || document.compose.Year.value < 999 || document.compose.Year.value > 10000 || document.compose.Hour.value < 0 || document.compose.Hour.value > 23 ||document.compose.Minute.value < 0 || document.compose.Minute.value > 59  ) {
        alert('$Text{"Invalid date!"}');
        return false;
    }
<!-- dtl:block:TimeUnitsJs -->
    else if (document.compose.TimeUnits.value != "") {
        var reg = /^-{0,1}\d+?((\.|,){0,1}\d+?){0,1}$/;
        if (reg.test(document.compose.TimeUnits.value) == false) {
            alert('$Text{"Invalid time!"}');
            document.compose.TimeUnits.focus();
            return false;
        }
    }
    else if (document.compose.TimeUnits.value == "" && $Config{"Ticket::Frontend::NeedAccountedTime"}) {
        alert('$Text{"You need to account time!"}');
        document.compose.Subject.focus();
        return false;
    }
<!-- dtl:block:TimeUnitsJs -->
    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>

<script language="JavaScript" type="text/javascript">
<!--
function FAQSubmit()
{
    window.open('', 'faq', 'toolbar=no,location=no,status=yes,scrollbars=yes,resizable=yes,width=700,height=550,left=100,top=100');
    document.faq.submit()
}
// -->
</script>

<table border="0" width="100%" cellspacing="0" cellpadding="3" cols="1">
<tr>
  <td class="mainhead2">
    $Env{"Box0"}$Text{"Forward"}: $Data{"TicketNumber"}$Env{"Box1"}
  </td>
</tr>
$Include{"AgentTicketLocked"}
<tr>
  <td class="mainbody">

  <form action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" name="compose">
  <input type="hidden" name="Action" value="$Env{"Action"}">
  <input type="hidden" name="Subaction" value="SendEmail">
  <input type="hidden" name="TicketID" value="$QData{"TicketID"}">
  <input type="hidden" name="Email" value="$QData{"Email"}">
  <input type="hidden" name="InReplyTo" value="$QData{"InReplyTo"}">
  <input type="hidden" name="FormID" value="$QData{"FormID"}">
  <table border="0" width="100%">
    <tr>
      <td class="contentkey" width="20%">$Text{"From"}:</td>
      <td class="contentvalue" width="80%">$QData{"From"} <input type="hidden" name="From" value="$Data{"From"}"> <font color="red" size="-2">$Data{"From invalid"}</font></td>
    </tr>
    <tr>
      <td class="contentkey">$Text{"To"}:</td>
      <td class="contentvalue"><input type="text" name="To" value="$QData{"To"}" size="80"> <font color="red" size="-2">$Data{"To invalid"}</font></td>
    </tr>
    <tr>
      <td class="contentkey">$Text{"Cc"}:</td>
      <td class="contentvalue"><input type="text" name="Cc" value="$QData{"Cc"}" size="80"> <font color="red" size="-2">$Data{"Cc invalid"}</font></td>
    </tr>
    <tr>
      <td class="contentkey">$Text{"Bcc"}:</td>
      <td class="contentvalue"><input type="text" name="Bcc" value="$QData{"Bcc"}" size="80"> <font color="red" size="-2">$Data{"Bcc invalid"}</font></td>
    </tr>
    <tr>
      <td class="contentkey">$Text{"Subject"}:</td>
      <td class="contentvalue"><input type="text" name="Subject" value="$QData{"Subject"}" size="80"></td>
    </tr>
<!-- dtl:block:Option -->
    <tr>
      <td class="contentkey">$Text{"$QData{"Key"}"}:</td>
      <td class="contentvalue">
      $Data{"Value"} <font color="red" size="-2">$Data{"Invalid"}</font>
      </td>
    </tr>
<!-- dtl:block:Option -->
    <tr>
      <td class="contentkey">$Text{"Options"}:</td>
      <td class="contentvalue">
<!-- dtl:block:SpellCheck -->
       $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"}
<!-- dtl:block:SpellCheck -->
       $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 class="contentkey">$Text{"Text"}:</td>
      <td class="contentvalue">
<pre>
<textarea name="Body" rows="25" cols="$Config{"Ticket::Frontend::TextAreaEmail"}">
$QData{"Body"}
</textarea>
</pre>
      </td>
    </tr>
    <tr>
      <td class="contentkey">$Text{"Attachment"}:</td>
      <td class="contentvalue">
       <table cellspacing="0" cellpadding="0" width="400">
<!-- dtl:block:Attachment -->
         <tr><td>$QData{"Filename"}</td><td>$QData{"Filesize"}</td><td align="right"><input type="submit" name="AttachmentDelete$QData{"FileID"}" value="$Text{"Delete"}"></td></tr>
<!-- dtl:block:Attachment -->
         <tr><td colspan="2">
         <input name="file_upload" type="file" size="40" class="fixed"></td><td align="right"><input type="submit" name="AttachmentUpload" value="$Text{"Attach"}"><a name="attachment">
       </td></tr>
       </table>
      </td>
    </tr>
    <tr>
      <td class="contentkey">$Text{"Next ticket state"}:</td>
      <td class="contentvalue">$Data{"NextStatesStrg"}</td>
    </tr>
    <tr>
      <td class="contentkey">$Text{"Pending Date"} ($Text{"for pending* states"}):</td>
      <td class="contentvalue">$Data{"PendingDateString"} <font color="red" size="-2">$Text{"$Data{"Date invalid"}"}</font> </td>
    </tr>
    <tr>
      <td class="contentkey">$Text{"Article type"}:</td>
      <td class="contentvalue">$Data{"ArticleTypesStrg"}</td>
    </tr>
#    <tr>
#      <td class="contentkey">$Data{"TicketFreeKeyField1"}:</td>
#      <td class="contentvalue">$Data{"TicketFreeTextField1"}</td>
#    </tr>
#   <tr>
#      <td class="contentkey">$Data{"TicketFreeKeyField2"}:</td>
#      <td class="contentvalue">$Data{"TicketFreeTextField2"}</td>
#   </tr>
#   <tr>
#      <td class="contentkey">$Data{"TicketFreeKeyField3"}:</td>
#      <td class="contentvalue">$Data{"TicketFreeTextField3"}</td>
#   </tr>
#   <tr>
#      <td class="contentkey">$Data{"TicketFreeKeyField4"}:</td>
#      <td class="contentvalue">$Data{"TicketFreeTextField4"}</td>
#   </tr>
#   <tr>
#      <td class="contentkey">$Data{"TicketFreeKeyField5"}:</td>
#      <td class="contentvalue">$Data{"TicketFreeTextField5"}</td>
#   </tr>
#   <tr>
#      <td class="contentkey">$Data{"TicketFreeKeyField6"}:</td>
#      <td class="contentvalue">$Data{"TicketFreeTextField6"}</td>
#   </tr>
#   <tr>
#      <td class="contentkey">$Data{"TicketFreeKeyField7"}:</td>
#      <td class="contentvalue">$Data{"TicketFreeTextField7"}</td>
#   </tr>
#   <tr>
#      <td class="contentkey">$Data{"TicketFreeKeyField8"}:</td>
#      <td class="contentvalue">$Data{"TicketFreeTextField8"}</td>
#   </tr>
<!-- dtl:block:TimeUnits -->
    <tr>
      <td class="contentkey">$Text{"Time units"}$Text{"$Config{"Ticket::Frontend::TimeUnits"}"}:</td>
      <td class="contentvalue"><input type="text" name="TimeUnits" value="$Data{"TimeUnits"}" size="3"></td>
    </tr>
<!-- dtl:block:TimeUnits -->
  </table>
  <br>
  <input class="button" accesskey="g" 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>

  <form action="$Env{"CGIHandle"}" method="post" name="faq" target="faq">
  <input type="hidden" name="Action" value="FAQ">
  <input type="hidden" name="Nav" value="None">
  <input type="hidden" name="Body" value="">
  <input type="hidden" name="Subject" value="">
  <input type="hidden" name="What" value="">
  </form>

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