# --
# AgentSpelling.dtl - provides HTML form for AgentSpelling
# Copyright (C) 2002-2003 Martin Edenhofer <martin+code@otrs.org>
# --
# $Id: AgentSpelling.dtl,v 1.7 2004/01/08 22:08:11 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 Spelling form -->
<script language="JavaScript" type="text/javascript">
<!--

function updateMessage()
{
    if (parent.opener.closed) {
        alert('$Text{"The message being composed has been closed.  Exiting."}');
        this.close();
        return;
    }

    if (!parent.opener.document.compose) {
        alert('$Text{"This window must be called from compose window"}');
        this.close();
        return;
    }

    parent.opener.document.compose.Body.value = document.spelling.Body.value 

    this.close();
}

function change_selected(sel) 
{
   start_elements = (4 * sel) - 1;
   if (document.spelling.elements[0].name == "$Config{"SessionName"}") {
       start_elements = start_elements + 1;
   }
   if (!document.spelling.elements[start_elements].checked) {
        document.spelling.elements[start_elements].checked = true;
   }
# just for debug!
#alert(start_elements);
#alert(document.spelling.elements[start_elements].name)
#alert(document.spelling.elements[start_elements].checked)
}

//-->
</script>

<table border="0" width="100%" cellspacing="0" cellpadding="3" cols="1">
<tr>
  <td align="left" class="table2"> 
    <b>$Env{"Box0"}$Text{"Spell Checker"} - $Data{"SpellCounter"} $Text{"spelling error(s)"} $Env{"Box1"}</b>
  </td>
</tr>
<tr>
  <td align="left" valign="top" class="table1">

  <form action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" name="spelling">
  <input type="hidden" name="Action" value="AgentSpelling">

$Data{"SpellCheckString"}

<hr>
<table border="0" width="580" cellspacing="0" cellpadding="1">
<tr>
  <td>
    <input class="button" type="submit" value="$Text{"Apply these changes"}"> 
    <input class="button" type="reset" value="$Text{"Reset"}"> 
  </td>
  <td>
    $Text{"Language"}: $Data{"SpellLanguageString"}
  </td>
</tr>
</table>

<pre>
<textarea name="Body" rows="22" cols="$Config{"TextAreaEmailWindow"}" wrap="$Env{"BrowserWrap"}">$Data{"Body"}</textarea>
</pre>

<input class="button" type="button" onclick="updateMessage();" value="$Text{"Done"}"> 
<i>($Text{"Return to the compose screen"})</i>

<input class="button" type="button" onclick="window.close();" value="$Text{"Cancel"}"> 
<i>($Text{"Discard all changes and return to the compose screen"})</i>

<hr>
  </td> 
</tr>
</table>
<!-- end Spelling form -->
