# --
# AgentTicketCompose.dtl - provides HTML form for AgentTicketCompose
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# $Id: AgentTicketCompose.dtl,v 1.101 2011/12/15 19:37:48 cg 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"}
<!-- dtl:block:Content -->
<form action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" name="compose" id="ComposeTicket" class="Validate PreventMultipleSubmits">
    <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="References" value="$QData{"References"}"/>
    <input type="hidden" name="FormID" value="$QData{"FormID"}"/>
    <input type="hidden" name="ResponseID" value="$QData{"ResponseID"}"/>
    <input type="hidden" name="ReplyArticleID" value="$QData{"ReplyArticleID"}"/>
    <div class="LayoutPopup ARIARoleMain">
        <div class="Header">
            <h1>$Text{"Compose answer for ticket"}: $QData{"TicketNumber"} - $QData{"Title","60"}</h1>
<!-- dtl:block:TicketBack -->
            <p>
                <a class="CancelClosePopup" href="#">$Text{"Cancel & close window"}</a>
            </p>
<!-- dtl:block:TicketBack -->
<!-- dtl:block:TicketBackUndo -->
            <p>
                $Text{"The ticket has been locked"}.
                <a class="UndoClosePopup" href="$Env{"Baselink"}Action=AgentTicketLock;Subaction=Unlock;TicketID=$Data{"TicketID"}">
                    $Text{"Undo & close window"}
                </a>
            </p>
<!-- dtl:block:TicketBackUndo -->
        </div>
        <div class="Content">
            <div class="ContentColumn">
                <fieldset class="TableLike FixedLabel">

                    <label>$Text{"From"}:</label>
                    <div class="Field">
                        $QData{"From"}
                        <input type="hidden" name="From" value="$QData{"From"}"/>
                    </div>
                    <div class="Clear"></div>

                    <div class="Field">
                        <div class="CustomerTicketTemplateToCustomer SpacingTopSmall Hidden">
                            <input name="CustomerInitialValue" id="CustomerInitialValue" type="hidden" value="$QData{"To"}" />
                            <input name="CustomerKey" id="CustomerKey" class="CustomerKey" type="hidden" value=""/>
                            <input name="CustomerQueue" id="CustomerQueue" class="CustomerQueue" 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="CustomerKey_$QData{"Count"}" id="CustomerKey_$QData{"Count"}" class="CustomerKey" type="hidden" value="$QData{"CustomerKey"}"/>
                                <input name="CustomerQueue_$QData{"Count"}" id="CustomerQueue_$QData{"Count"}" class="CustomerQueue" type="hidden" value="$QData{"CustomerQueue"}"/>
                                <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[
    $('.CustomerTicketRemove').bind('click', function () {
        Core.Agent.CustomerSearch.RemoveCustomerTicket( $(this) );
        return false;
    });
//]]></script>
<!--dtl:js_on_document_complete-->


                    <label for="ToCustomer">$Text{"To"}:</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 recipient"}</p>
<!-- dtl:block:ToServerErrorMsg -->
                        </div>
                    </div>
                    <div class="Clear"></div>

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

                    <div class="Field">
                        <div class="CustomerTicketTemplateCcCustomer SpacingTopSmall Hidden">
                            <input name="CcCustomerInitialValue" id="CcCustomerInitialValue" type="hidden" value="$QData{"Cc"}" />
                            <input name="CcCustomerKey" id="CcCustomerKey" class="CustomerKey" type="hidden" value=""/>
                            <input name="CcCustomerQueue" id="CcCustomerQueue" class="CustomerQueue" 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 name="CcCustomerQueue_$QData{"Count"}" id="CcCustomerQueue_$QData{"Count"}" class="CustomerQueue" type="hidden" value="$QData{"CustomerQueue"}"/>
                                <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>

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

                    <div class="Field">
                        <div class="CustomerTicketTemplateBccCustomer SpacingTopSmall Hidden">
                            <input name="BccCustomerInitialValue" id="BccCustomerInitialValue" type="hidden" value="$QData{"Bcc"}" />
                            <input name="BccCustomerKey" id="BccCustomerKey" class="CustomerKey" type="hidden" value=""/>
                            <input name="BccCustomerQueue" id="BccCustomerQueue" class="CustomerQueue" 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 name="BccCustomerQueue_$QData{"Count"}" id="BccCustomerQueue_$QData{"Count"}" class="CustomerQueue" type="hidden" value="$QData{"CustomerQueue"}"/>
                                <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>

                    <label class="Mandatory" for="Subject"><span class="Marker">*</span>$Text{"Subject"}:</label>
                    <div class="Field">
                        <input type="text" name="Subject" id="Subject" value="$QData{"Subject"}" class="Validate_Required $Data{"SubjectInvalid"} W75pc"/>
                        <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:Option -->
                    <label>$Text{"$Data{"Key"}"}:</label>
                    <div class="Field">
                        $Data{"Value"}
                        <p class="Error">$QData{"Invalid"}</p>
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:Option -->

<!-- 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 -->

<!-- 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" name="Body" rows="15" cols="$Config{"Ticket::Frontend::TextAreaEmail"}" class="RichText Validate_Required $QData{"BodyInvalid"}">$Data{"ResponseFormat"}</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>$Text{"Attachment"}:</label>
                    <div class="Field">
                        <ul>
<!-- dtl:block:Attachment -->
                            <li>
                                $QData{"Filename"} ($QData{"Filesize"})
                                <button type="submit" id="AttachmentDelete$QData{"FileID"}" name="AttachmentDelete$QData{"FileID"}" value="$Text{"Delete"}" class="SpacingLeft">$Text{"Delete"}</button>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#AttachmentDelete$QData{"FileID"}').bind('click', function () {
        Core.Form.Validate.DisableValidation($('#AttachmentDelete$QData{"FileID"}').closest('form'));
    });
//]]></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="StateID">$Text{"Next ticket state"}:</label>
                    <div class="Field">
                        $Data{"NextStatesStrg"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#StateID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#ComposeTicket'), 'AJAXUpdate', 'StateID', [ $Data{"DynamicFieldNamesStrg"} ]);
    });
//]]></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>

<!-- 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" name="TimeUnits" id="TimeUnits" value="$QData{"TimeUnits"}" class="W25pc Validate_TimeUnits $QData{"TimeUnitsRequired"} $QData{"TimeUnitsInvalid"} " />
                        <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 -->
                </fieldset>
            </div>
        </div>
        <div class="Footer">
            <button class="Primary" id="submitRichText" accesskey="g" title="$Text{"Submit"} (g)" type="submit" value="$Text{"Submit"}">$Text{"Submit"}</button>
        </div>
    </div>
</form>

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

    //]]></script>
<!--dtl:js_on_document_complete-->
<!-- dtl:block:Content -->
