# --
# AgentTicketEmail.dtl - provides HTML form for agent email
# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id: AgentTicketEmail.dtl,v 1.158.2.3 2012-05-25 13:32:30 mg Exp $
# --
# This software comes with ABSOLUTELY NO WARRANTY. For details, see
# the enclosed file COPYING for license information (AGPL). If you
# did not receive this file, see http://www.gnu.org/licenses/agpl.txt.
# --

$Include{"AgentCustomerSearch"}
<div class="MainBox ARIARoleMain">

    <h1>$Text{"Create New Email Ticket"}</h1>

    <div class="LayoutFixedSidebar SidebarLast">

# show customer info table
<!-- dtl:block:CustomerTable -->
        <div id="CustomerInfo" class="SidebarColumn WidgetSimple">
            <div class="Header">
                <h2>$Text{"Customer Information"}</h2>
            </div>
            <div class="Content">
                $Data{"CustomerTable"}
            </div>
        </div>
<!-- dtl:block:CustomerTable -->

        <div class="ContentColumn">
            <form action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" name="compose" id="NewEmailTicket" class="Validate PreventMultipleSubmits">
                <input type="hidden" name="Action" value="$Env{"Action"}"/>
                <input type="hidden" name="Subaction" value="StoreNew"/>
                <input type="hidden" name="FormID" value="$QData{"FormID"}"/>
                <input type="hidden" name="ExpandCustomerName" id="ExpandCustomerName" value="0"/>
                <input type="hidden" name="OwnerAll" id="OwnerAll" value="$QData{"OwnerAll"}"/>
                <input type="hidden" name="ResponsibleAll" id="ResponsibleAll" value="$QData{"ResponsibleAll"}"/>
                <input type="hidden" name="PreSelectedCustomerUser" id="PreSelectedCustomerUser" value=""/>
                <input type="hidden" name="SelectedCustomerUser" id="SelectedCustomerUser" value="$QData{"CustomerUser"}"/>
                <input type="hidden" name="TicketID" value="$QData{"TicketID"}"/>
                <fieldset class="TableLike">

# example template for customizations, see hidden form at the end of the file
#                    <label>$Text{"Templates"}:</label>
#                    <div class="Field">
#                        <button type="button" onclick="$('#Template1').submit()" value="$Text{"Example Template"}">$Text{"Example Template"}</button>
#                    </div>
#                    <div class="Clear"></div>

<!-- dtl:block:TicketType -->
                    <label class="Mandatory" for="TypeID"><span class="Marker">*</span> $Text{"Type"}:</label>
                    <div class="Field">
                        $Data{"TypeStrg"}
                        <div id="TypeIDError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                        <div id="TypeIDServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#TypeID').bind('change', function (Event) {
    Core.AJAX.FormUpdate($('#NewEmailTicket'), 'AJAXUpdate', 'TypeID', [ 'Dest', 'NewUserID', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
});
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:TicketType -->

                    <label class="Mandatory" for="Dest"><span class="Marker">*</span> $Text{"From queue"}:</label>
                    <div class="Field">
                        $Data{"FromStrg"}
                        <div id="DestError" class="TooltipErrorMessage" ><p>$Text{"This field is required."}</p></div>
                        <div id="DestServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#Dest').bind('change', function (Event) {
    var SignatureURL = '$Env{"Baselink"}Action=$Env{"Action"};Subaction=Signature;Dest=' + $(this).val();
    Core.AJAX.FormUpdate($('#NewEmailTicket'), 'AJAXUpdate', 'Dest', ['Signature', 'NewUserID', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
    if (!Core.Config.Get('SessionIDCookie')) {
        SignatureURL += ';' + Core.Config.Get('SessionName') + '=' + Core.Config.Get('SessionID');
    }
    $('#Signature').attr('src', SignatureURL);
});
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>


                    <div class="Field $QData{"CustomerHiddenContainer"}">
                        <div class="CustomerTicketTemplateToCustomer SpacingTopSmall Hidden">
                            <input name="CustomerSelected" id="CustomerSelected" class="CustomerTicketRadio" type="radio" value=""/>
                            <input name="CustomerKey" id="CustomerKey" class="CustomerKey" type="hidden" value=""/>
                            <input class="CustomerTicketText W75pc" name="CustomerTicketText" id="CustomerTicketText" type="text" value="" readonly="readonly" />
                            <button type="button" id="RemoveCustomerTicket" class="Remove CustomerTicketRemove" value="$Text{"Remove Ticket Customer"}">$Text{"Remove Ticket Customer"}</button>
                        </div>

                        <div id="TicketCustomerContentToCustomer" class="CustomerContainer">
<!-- dtl:block:MultipleCustomer -->
                            <div class="SpacingTopSmall ">
                                <input name="CustomerSelected" id="CustomerSelected" class="CustomerTicketRadio" type="radio" value="$QData{"Count"}" $QData{"CustomerSelected"}  $QData{"CustomerDisabled"} />
                                <input name="CustomerKey_$QData{"Count"}" id="CustomerKey_$QData{"Count"}" class="CustomerKey" type="hidden" value="$QData{"CustomerKey"}"/>
                                <input class="CustomerTicketText W75pc $QData{"CustomerError"}" name="CustomerTicketText_$Data{"Count"}" id="CustomerTicketText_$Data{"Count"}" type="text" value="$QData{"CustomerElement"}" readonly="readonly" />
                                <button type="button" id="RemoveCustomerTicket_$Data{"Count"}" class="Remove CustomerTicketRemove" value="$Text{"Remove Ticket Customer"}">$Text{"Remove Ticket Customer"}</button>

<!-- dtl:block:CustomerErrorExplantion -->
                                <p class="Explanation Error">$Text{"Please remove this entry and enter a new one with the correct value."}</p>
<!-- dtl:block:CustomerErrorExplantion -->

                                <div id="CustomerTicketText_$Data{"Count"}ServerError" class="TooltipErrorMessage">
<!-- dtl:block:CustomerGenericServerErrorMsg -->
                                    <p>$Text{"This field is required."}</p>
<!-- dtl:block:CustomerGenericServerErrorMsg -->
<!-- dtl:block:InvalidConfigServerErrorMsg -->
                                    <p>$Text{"This email address is not allowed due to the system configuration."}</p>
<!-- dtl:block:InvalidConfigServerErrorMsg -->
<!-- dtl:block:InvalidMXServerErrorMsg -->
                                    <p>$Text{"This email address failed MX check."}</p>
<!-- dtl:block:InvalidMXServerErrorMsg -->
<!-- dtl:block:InvalidDNSServerErrorMsg -->
                                    <p>$Text{"DNS problem, please check your configuration and the error log."}</p>
<!-- dtl:block:InvalidDNSServerErrorMsg -->
<!-- dtl:block:InvalidSyntaxServerErrorMsg -->
                                    <p>$Text{"The syntax of this email address is incorrect."}</p>
<!-- dtl:block:InvalidSyntaxServerErrorMsg -->
<!-- dtl:block:IsDuplicatedServerErrorMsg -->
                                    <p>$Text{"This address already exists on the address list."}</p>
<!-- dtl:block:IsDuplicatedServerErrorMsg -->
                                </div>
                            </div>
<!-- dtl:block:MultipleCustomer -->

                        </div>
<!-- dtl:block:MultipleCustomerCounter -->
                        <input name="CustomerTicketCounterToCustomer" id="CustomerTicketCounterToCustomer" type="hidden" value="$QData{"CustomerCounter"}"/>
<!-- dtl:block:MultipleCustomerCounter -->
                    </div>
                    <div class="Clear"></div>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('.CustomerTicketRadio').bind('change', function () {
        var CustomerKey;
        if ( $(this).attr('checked') ){

            CustomerKey = $( '#CustomerKey_' +$(this).val() ).val();
            // get customer tickets
            Core.Agent.CustomerSearch.ReloadCustomerInfo(CustomerKey);
        }
        return false;
    });

    $('.CustomerTicketRemove').bind('click', function () {
        Core.Agent.CustomerSearch.RemoveCustomerTicket( $(this) );
        return false;
    });
//]]></script>
<!--dtl:js_on_document_complete-->

<!-- dtl:block:FromExternalCustomer -->
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    Core.Agent.CustomerSearch.AddTicketCustomer( 'ToCustomer', "$QData{"Email"}", "$QData{"Customer"}", true );
//]]></script>
<!--dtl:js_on_document_complete-->
<!-- dtl:block:FromExternalCustomer -->

                    <label for="ToCustomer" class="Mandatory"><span class="Marker">*</span>$Text{"To customer"}:</label>
                    <div class="Field">
                        <input id="ToCustomer" type="text" name="ToCustomer" value="" class="CustomerAutoComplete W75pc AutocompleteOff $QData{"ToInvalid"}"/>
                        <div id="ToCustomerServerError" class="TooltipErrorMessage">
<!-- dtl:block:ToServerErrorMsg -->
                            <p>$Text{"Please include at least one customer for the ticket."}</p>
<!-- dtl:block:ToServerErrorMsg -->
                        </div>
                    </div>
                    <div class="Clear"></div>

                    <div class="Field $QData{"CcCustomerHiddenContainer"}">
                        <div class="CustomerTicketTemplateCcCustomer SpacingTopSmall Hidden">
                            <input name="CcCustomerKey" id="CcCustomerKey" class="CustomerKey" type="hidden" value=""/>
                            <input class="CcCustomerTicketText W75pc" name="CcCustomerTicketText" id="CcCustomerTicketText" type="text" value="" readonly="readonly" />
                            <button type="button" id="CcRemoveCustomerTicket" class="Remove CustomerTicketRemove" value="$Text{"Remove Cc"}">$Text{"Remove Cc"}</button>
                        </div>

                        <div id="TicketCustomerContentCcCustomer">
<!-- dtl:block:CcMultipleCustomer -->
                            <div class="SpacingTopSmall ">
                                <input name="CcCustomerKey_$QData{"Count"}" id="CcCustomerKey_$QData{"Count"}" class="CustomerKey" type="hidden" value="$QData{"CustomerKey"}"/>
                                <input class="CcCustomerTicketText W75pc $QData{"CustomerError"}" name="CcCustomerTicketText_$Data{"Count"}" id="CcCustomerTicketText_$Data{"Count"}" type="text" value="$QData{"CustomerElement"}" readonly="readonly" />
                                <button type="button" id="CcRemoveCustomerTicket_$Data{"Count"}" class="Remove CustomerTicketRemove" value="$Text{"Remove Cc"}">$Text{"Remove Cc"}</button>

<!-- dtl:block:CcCustomerErrorExplantion -->
                                <p class="Explanation Error">$Text{"Please remove this entry and enter a new one with the correct value."}</p>
<!-- dtl:block:CcCustomerErrorExplantion -->

                                <div id="CcCustomerTicketText_$Data{"Count"}ServerError" class="TooltipErrorMessage">
<!-- dtl:block:CcCustomerGenericServerErrorMsg -->
                                    <p>$Text{"This field is required."}</p>
<!-- dtl:block:CcCustomerGenericServerErrorMsg -->
<!-- dtl:block:CcInvalidConfigServerErrorMsg -->
                                    <p>$Text{"This email address is not allowed due to the system configuration."}</p>
<!-- dtl:block:CcInvalidConfigServerErrorMsg -->
<!-- dtl:block:CcInvalidMXServerErrorMsg -->
                                    <p>$Text{"This email address failed MX check."}</p>
<!-- dtl:block:CcInvalidMXServerErrorMsg -->
<!-- dtl:block:CcInvalidDNSServerErrorMsg -->
                                    <p>$Text{"DNS problem, please check your configuration and the error log."}</p>
<!-- dtl:block:CcInvalidDNSServerErrorMsg -->
<!-- dtl:block:CcInvalidSyntaxServerErrorMsg -->
                                    <p>$Text{"The syntax of this email address is incorrect."}</p>
<!-- dtl:block:CcInvalidSyntaxServerErrorMsg -->
<!-- dtl:block:CcIsDuplicatedServerErrorMsg -->
                                    <p>$Text{"This address already exists on the address list."}</p>
<!-- dtl:block:CcIsDuplicatedServerErrorMsg -->
                                </div>
                            </div>
<!-- dtl:block:CcMultipleCustomer -->

                        </div>
<!-- dtl:block:CcMultipleCustomerCounter -->
                        <input name="CustomerTicketCounterCcCustomer" id="CustomerTicketCounterCcCustomer" type="hidden" value="$QData{"CustomerCounter"}"/>
<!-- dtl:block:CcMultipleCustomerCounter -->
                    </div>
                    <div class="Clear"></div>

                    <label for="CcCustomer">$Text{"Cc"}:</label>
                    <div class="Field">
                        <input id="CcCustomer" type="text" name="CcCustomer" value="" class="CustomerAutoComplete W75pc AutocompleteOff $QData{"CcInvalid"}"/>
                    </div>
                    <div class="Clear"></div>

                    <div class="Field $QData{"BccCustomerHiddenContainer"}">
                        <div class="CustomerTicketTemplateBccCustomer SpacingTopSmall Hidden">
                            <input name="BccCustomerKey" id="BccCustomerKey" class="CustomerKey" type="hidden" value=""/>
                            <input class="BccCustomerTicketText W75pc" name="BccCustomerTicketText" id="BccCustomerTicketText" type="text" value="" readonly="readonly" />
                            <button type="button" id="BccRemoveCustomerTicket" class="Remove CustomerTicketRemove" value="$Text{"Remove Bcc"}">$Text{"Remove Bcc"}</button>
                        </div>

                        <div id="TicketCustomerContentBccCustomer">
<!-- dtl:block:BccMultipleCustomer -->
                            <div class="SpacingTopSmall ">
                                <input name="BccCustomerKey_$QData{"Count"}" id="BccCustomerKey_$QData{"Count"}" class="CustomerKey" type="hidden" value="$QData{"CustomerKey"}"/>
                                <input class="BccCustomerTicketText W75pc $QData{"CustomerError"}" name="BccCustomerTicketText_$Data{"Count"}" id="BccCustomerTicketText_$Data{"Count"}" type="text" value="$QData{"CustomerElement"}" readonly="readonly" />
                                <button type="button" id="BccRemoveCustomerTicket_$Data{"Count"}" class="Remove CustomerTicketRemove" value="$Text{"Remove Bcc"}">$Text{"Remove Bcc"}</button>

<!-- dtl:block:BccCustomerErrorExplantion -->
                                <p class="Explanation Error">$Text{"Please remove this entry and enter a new one with the correct value."}</p>
<!-- dtl:block:BccCustomerErrorExplantion -->

                                <div id="BccCustomerTicketText_$Data{"Count"}ServerError" class="TooltipErrorMessage">
<!-- dtl:block:BccCustomerGenericServerErrorMsg -->
                                    <p>$Text{"This field is required."}</p>
<!-- dtl:block:BccCustomerGenericServerErrorMsg -->
<!-- dtl:block:BccInvalidConfigServerErrorMsg -->
                                    <p>$Text{"This email address is not allowed due to the system configuration."}</p>
<!-- dtl:block:BccInvalidConfigServerErrorMsg -->
<!-- dtl:block:BccInvalidMXServerErrorMsg -->
                                    <p>$Text{"This email address failed MX check."}</p>
<!-- dtl:block:BccInvalidMXServerErrorMsg -->
<!-- dtl:block:BccInvalidDNSServerErrorMsg -->
                                    <p>$Text{"DNS problem, please check your configuration and the error log."}</p>
<!-- dtl:block:BccInvalidDNSServerErrorMsg -->
<!-- dtl:block:BccInvalidSyntaxServerErrorMsg -->
                                    <p>$Text{"The syntax of this email address is incorrect."}</p>
<!-- dtl:block:BccInvalidSyntaxServerErrorMsg -->
<!-- dtl:block:BccIsDuplicatedServerErrorMsg -->
                                    <p>$Text{"This address already exists on the address list."}</p>
<!-- dtl:block:BccIsDuplicatedServerErrorMsg -->
                                </div>
                            </div>
<!-- dtl:block:BccMultipleCustomer -->

                        </div>
<!-- dtl:block:BccMultipleCustomerCounter -->
                        <input name="CustomerTicketCounterBccCustomer" id="CustomerTicketCounterBccCustomer" type="hidden" value="$QData{"CustomerCounter"}"/>
<!-- dtl:block:BccMultipleCustomerCounter -->
                    </div>
                    <div class="Clear"></div>

                    <label for="BccCustomer">$Text{"Bcc"}:</label>
                    <div class="Field">
                        <input id="BccCustomer" type="text" name="BccCustomer" value="" class="CustomerAutoComplete W75pc AutocompleteOff $QData{"BccInvalid"}"/>
                    </div>
                    <div class="Clear"></div>

<!-- dtl:block:TicketService -->
                    <label for="ServiceID">$Text{"Service"}:</label>
                    <div class="Field">
                        $Data{"ServiceStrg"}
                        <div id="ServiceIDServerError" class="TooltipErrorMessage"><p>$Text{"Service invalid."}</p></div>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#ServiceID').bind('change', function (Event) {
    Core.AJAX.FormUpdate($('#NewEmailTicket'), 'AJAXUpdate', 'ServiceID', ['TypeID', 'Dest', 'NewUserID', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
});
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:TicketService -->

<!-- dtl:block:TicketSLA -->
                    <label for="SLAID">$Text{"Service Level Agreement"}:</label>
                    <div class="Field">
                        $Data{"SLAStrg"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#SLAID').bind('change', function (Event) {
    Core.AJAX.FormUpdate($('#NewEmailTicket'), 'AJAXUpdate', 'SLAID', ['TypeID', 'Dest', 'NewUserID', 'NewResponsibleID', 'ServiceID', 'NextStateID', 'PriorityID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
});
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:TicketSLA -->

<!-- dtl:block:OwnerSelection -->
                    <label for="NewUserID">$Text{"Owner"}:</label>
                    <div class="Field">
                        $Data{"OptionStrg"}
                        <a href="#" id="OwnerSelectionGetAll" class="GetAllAJAX" title="$Text{"Get all"}">$Text{"Get all"}</a>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#OwnerSelectionGetAll').bind('click', function (Event) {
    $('#OwnerAll').val('1'); // Needed? Why?
    Core.AJAX.FormUpdate($('#NewEmailTicket'), 'AJAXUpdate', 'OwnerAll', ['NewUserID'], function() {
        $('#NewUserID').focus();
    });
    return false;
});

$('#NewUserID').bind('change', function (Event) {
    Core.AJAX.FormUpdate($('#NewEmailTicket'), 'AJAXUpdate', 'NewUserID', [ 'TypeID', 'Dest', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
});
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:OwnerSelection -->

<!-- dtl:block:ResponsibleSelection -->
                    <label for="NewResponsibleID">$Text{"Responsible"}:</label>
                    <div class="Field">
                        $Data{"ResponsibleOptionStrg"}
                        <a href="#" id="ResponsibleSelectionGetAll" class="GetAllAJAX" title="$Text{"Get all"}">$Text{"Get all"}</a>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#ResponsibleSelectionGetAll').bind('click', function (Event) {
    $('#ResponsibleAll').val('1'); // Needed? Why?
    Core.AJAX.FormUpdate($('#NewEmailTicket'), 'AJAXUpdate', 'ResponsibleAll', ['NewResponsibleID'], function() {
        $('#NewResponsibleID').focus();
    });
    return false;
});

$('#NewResponsibleID').bind('change', function (Event) {
    Core.AJAX.FormUpdate($('#NewEmailTicket'), 'AJAXUpdate', 'NewResponsibleID', [ 'TypeID', 'Dest', 'NewUserID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
});
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:ResponsibleSelection -->

<!-- dtl:block:Option -->
                    <label for="$QData{"Name"}">$Text{"$Data{"Key"}"}:</label>
                    <div class="Field">
                        $Data{"Value"}
                        <div id="$QData{"Name"}ServerError" class="TooltipErrorMessage"><p>$QData{"Invalid"}</p></div>
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:Option -->

                    <label class="Mandatory" for="Subject"><span class="Marker">*</span> $Text{"Subject"}:</label>
                    <div class="Field">
                        <input type="text" class="Validate_Required $QData{"SubjectInvalid"} W75pc " name="Subject" id="Subject" value="$QData{"Subject"}"/>
                        <div id="SubjectError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                        <div id="SubjectServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                    </div>
                    <div class="Clear"></div>

<!-- dtl:block:TicketOptions -->
                    <label>$Text{"Options"}:</label>
                    <div class="Field">

<!-- OutputFilterHook_TicketOptionsBegin -->

<!-- dtl:block:SpellCheck -->
                        <a href="#" id="OptionSpellCheck">[ $Text{"Spell check"} ]</a>
<!-- dtl:block:SpellCheck -->
<!-- dtl:block:AddressBook -->
                        <a href="#" id="OptionAddressBook">[ $Text{"Address book"} ]</a>
<!-- dtl:block:AddressBook -->
<!-- dtl:block:OptionCustomer -->
                        <a href="#" id="OptionCustomer">[ $Text{"Customer"} ]</a>
<!-- dtl:block:OptionCustomer -->

<!-- OutputFilterHook_TicketOptionsEnd -->

                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:TicketOptions -->

<!-- OutputFilterHook_NoTicketOptionsFallback -->

                    <label class="Mandatory" for="RichText"><span class="Marker">*</span> $Text{"Text"}:</label>
                    <div class="RichTextField">

<!-- dtl:block:RichText -->
$Include{"RichTextEditor"}
<!-- dtl:block:RichText -->

                        <textarea id="RichText" class="RichText Validate_Required $QData{"BodyInvalid"}" name="Body" title="Message body" rows="15" cols="$Config{"Ticket::Frontend::TextAreaEmail"}">$QData{"Body"}</textarea>
                        <div id="RichTextError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                        <div id="RichTextServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                    </div>
                    <div class="Clear"></div>

                    <label for="Signature">$Text{"Signature"}:</label>
                    <div class="RichTextField">
                        <input type="hidden" name="Signature" value="$QData{"Signature"}"/>
                        <iframe height="140" width="620" frameborder="0" id="Signature" class="Signature" src="$Env{"Baselink"}Action=$Env{"Action"};Subaction=Signature;QueueID=$QData{"QueueID"}"></iframe>
                    </div>
                    <div class="Clear"></div>

                    <label>$Text{"Attachment"}:</label>
                    <div class="Field">
                        <ul>

<!-- dtl:block:Attachment -->
                            <li>
                                $QData{"Filename"} ($QData{"Filesize"})
                                <button type="button" id="AttachmentDeleteButton$QData{"FileID"}" name="AttachmentDeleteButton$QData{"FileID"}" value="$Text{"Delete"}" class="SpacingLeft">$Text{"Delete"}</button>
                                <input type="hidden" id="AttachmentDelete$QData{"FileID"}" name="AttachmentDelete$QData{"FileID"}" />
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#AttachmentDeleteButton$QData{"FileID"}').bind('click', function () {
        var $Form = $('#AttachmentDeleteButton$QData{"FileID"}').closest('form');
        $('#AttachmentDelete$QData{"FileID"}').val(1);
        Core.Form.Validate.DisableValidation($Form);
        $Form.trigger('submit');
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                            </li>
<!-- dtl:block:Attachment -->

                            <li>
                                <input id="FileUpload" name="FileUpload" type="file" size="40" />
                                <input type="hidden" id="AttachmentUpload" name="AttachmentUpload" value="0" />
                            </li>
                        </ul>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#FileUpload').bind('change', function () {
    var $Form = $('#FileUpload').closest('form');
    Core.Form.Validate.DisableValidation($Form);
    $Form.find('#AttachmentUpload').val('1').end().submit();
});
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>

                    <label for="CustomerID">$Text{"CustomerID"}:</label>
                    <div class="Field">
                        <input type="text" name="CustomerID" id="CustomerID" value="$QData{"CustomerID"}" class="W50pc"/>
                    </div>
                    <div class="Clear"></div>

                    <label for="NextStateID">$Text{"Next ticket state"}:</label>
                    <div class="Field">
                        $Data{"NextStatesStrg"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#NextStateID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#NewEmailTicket'), 'AJAXUpdate', 'NextStateID', [ 'TypeID', 'Dest', 'NewUserID','NewResponsibleID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>

                    <label>$Text{"Pending Date"} ($Text{"for pending* states"}):</label>
                    <div class="Field">
                        $Data{"PendingDateString"}
                        <div id="DayServerError" class="TooltipErrorMessage"><p>$Text{"Date invalid!"}</p></div>
                        <div id="HourServerError" class="TooltipErrorMessage"><p>$Text{"Date invalid!"}</p></div>
                    </div>
                    <div class="Clear"></div>

                    <label for="PriorityID">$Text{"Priority"}:</label>
                    <div class="Field">
                        $Data{"PriorityStrg"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#PriorityID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#NewEmailTicket'), 'AJAXUpdate', 'PriorityID', [ 'TypeID', 'Dest', 'NewUserID','NewResponsibleID', 'NextStateID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', $Data{"DynamicFieldNamesStrg"}, 'To', 'Cc', 'Bcc']);
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>

<!-- dtl:block:DynamicField -->
                    <div class="Row Row_DynamicField_$QData{"Name"}">
                        $Data{"Label"}
                        <div class="Field">
                            $Data{"Field"}
                        </div>
                        <div class="Clear"></div>
                    </div>
<!-- dtl:block:DynamicField -->

# example of how to use fixed dynamic field blocks for customizations
# Note: Field1 and Field2 are the names of the fields and had to be replaced with the actual
# field names
#<!-- dtl:block:DynamicField_Field1 -->
#                    <div class="Row Row_DynamicField_$QData{"Name"}">
#                        $Data{"Label"}
#                        <div class="Field">
#                            $Data{"Field"}
#                        </div>
#                        <div class="Clear"></div>
#                    </div>
#<!-- dtl:block:DynamicField_Field1 -->
#<!-- dtl:block:DynamicField_Field2 -->
#                    <div class="Row Row_DynamicField_$QData{"Name"}">
#                        $Data{"Label"}
#                        <div class="Field">
#                            $Data{"Field"}
#                        </div>
#                        <div class="Clear"></div>
#                    </div>
#<!-- dtl:block:DynamicField_Field2 -->

<!-- dtl:block:TimeUnitsLabel -->
                    <label for="TimeUnits">$Text{"Time units"}$Text{"$Config{"Ticket::Frontend::TimeUnits"}"}:</label>
<!-- dtl:block:TimeUnitsLabel -->
<!-- dtl:block:TimeUnitsLabelMandatory -->
                    <label class="Mandatory" for="TimeUnits"><span class="Marker">*</span> $Text{"Time units"}$Text{"$Config{"Ticket::Frontend::TimeUnits"}"}:</label>
<!-- dtl:block:TimeUnitsLabelMandatory -->
<!-- dtl:block:TimeUnits -->
                    <div class="Field">
                        <input type="text" class="W25pc Validate_TimeUnits $QData{"TimeUnitsRequired"} $QData{"TimeUnitsInvalid"}" name="TimeUnits" id="TimeUnits" value="$QData{"TimeUnits"}"/>
                        <div id="TimeUnitsError" class="TooltipErrorMessage"><p>$Text{"Invalid time!"}</p></div>
                        <div id="TimeUnitsServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:TimeUnits -->

                    <div class="Field SpacingTop">
                        <button class="Primary" id="submitRichText" accesskey="g" title="$Text{"Send mail!"} (g)" type="submit" value="$Text{"Send mail!"}" >$Text{"Send mail!"}</button>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
    <div id="CustomerTickets"></div>
</div>

<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
Core.Agent.TicketAction.Init();
//]]></script>
<!--dtl:js_on_document_complete-->

# example template form for customizations
#<form action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" id="Template1">
#    <input type="hidden" name="Action" value="$Env{"Action"}"/>
#    <input type="hidden" name="Subaction" value="StoreNew"/>
#    <input type="hidden" name="FormID" value="$QData{"FormID"}"/>
#    <input type="hidden" name="ExpandCustomerName" value="2"/>
#    <input type="hidden" name="Subject" value="Example Subject"/>
#    <input type="hidden" name="Body" value="Name:
#Product:
#Comment:"/>
#</form>
