# --
# AgentTicketEmail.dtl - provides HTML form for agent email
# Copyright (C) 2001-2010 OTRS AG, http://otrs.org/
# --
# $Id: AgentTicketEmail.dtl,v 1.142 2010/12/20 15:35:05 martin 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', ['NewUserID', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'ServiceID', 'SLAID', 'SignKeyID', 'CryptKeyID', 'TicketFreeText1', 'TicketFreeText2', 'TicketFreeText3', 'TicketFreeText4', 'TicketFreeText5', 'TicketFreeText6', 'TicketFreeText7', 'TicketFreeText8', 'TicketFreeText9', 'TicketFreeText10', 'TicketFreeText11', 'TicketFreeText12', 'TicketFreeText13', 'TicketFreeText14', 'TicketFreeText15', 'TicketFreeText16', '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', 'TicketFreeText1', 'TicketFreeText2', 'TicketFreeText3', 'TicketFreeText4', 'TicketFreeText5', 'TicketFreeText6', 'TicketFreeText7', 'TicketFreeText8', 'TicketFreeText9', 'TicketFreeText10', 'TicketFreeText11', 'TicketFreeText12', 'TicketFreeText13', 'TicketFreeText14', 'TicketFreeText15', 'TicketFreeText16', '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>

                    <label class="Mandatory" for="CustomerAutoComplete"><span class="Marker">*</span> $Text{"To"}:</label>
                    <div class="Field">
                        <input id="CustomerAutoComplete" type="text" name="To" value="$QData{"To"}" class="W75pc AutocompleteOff Validate_Required $QData{"ToInvalid"}" />
                        <div id="CustomerAutoCompleteError" class="TooltipErrorMessage" ><p>$Text{"This field is required."}</p></div>
                        <div id="CustomerAutoCompleteServerError" class="TooltipErrorMessage">
<!-- dtl:block:ToGenericServerErrorMsg -->
                            <p>$Text{"This field is required."}</p>
<!-- dtl:block:ToGenericServerErrorMsg -->
<!-- dtl:block:ToInvalidConfigServerErrorMsg -->
                            <p>$Text{"This email address is not allowed due to the system configuration."}</p>
<!-- dtl:block:ToInvalidConfigServerErrorMsg -->
<!-- dtl:block:ToInvalidMXServerErrorMsg -->
                            <p>$Text{"This email address failed MX check."}</p>
<!-- dtl:block:ToInvalidMXServerErrorMsg -->
<!-- dtl:block:ToInvalidSyntaxServerErrorMsg -->
                            <p>$Text{"The syntax of this email address is incorrect."}</p>
<!-- dtl:block:ToInvalidSyntaxServerErrorMsg -->
                        </div>
                    </div>
                    <div class="Clear"></div>

                    <label for="Cc">$Text{"Cc"}:</label>
                    <div class="Field">
                        <input type="text" name="Cc" id="Cc" value="$QData{"Cc"}"  class="W75pc $QData{"CcInvalid"}" />
                        <div id="CcServerError" class="TooltipErrorMessage">
<!-- 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:CcInvalidSyntaxServerErrorMsg -->
                            <p>$Text{"The syntax of this email address is incorrect."}</p>
<!-- dtl:block:CcInvalidSyntaxServerErrorMsg -->
                        </div>
                    </div>
                    <div class="Clear"></div>

                    <label for="Bcc">$Text{"Bcc"}:</label>
                    <div class="Field">
                        <input type="text" name="Bcc" id="Bcc" value="$QData{"Bcc"}" class="W75pc $QData{"BccInvalid"}" />
                        <div id="BccServerError" class="TooltipErrorMessage">
<!-- 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:BccInvalidSyntaxServerErrorMsg -->
                            <p>$Text{"The syntax of this email address is incorrect."}</p>
<!-- dtl:block:BccInvalidSyntaxServerErrorMsg -->
                        </div>
                    </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', ['NewUserID', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'SLAID', 'SignKeyID', 'CryptKeyID', 'TicketFreeText1', 'TicketFreeText2', 'TicketFreeText3', 'TicketFreeText4', 'TicketFreeText5', 'TicketFreeText6', 'TicketFreeText7', 'TicketFreeText8', 'TicketFreeText9', 'TicketFreeText10', 'TicketFreeText11', 'TicketFreeText12', 'TicketFreeText13', 'TicketFreeText14', 'TicketFreeText15', 'TicketFreeText16', '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', ['NewUserID', 'NewResponsibleID', 'NextStateID', 'PriorityID', 'SignKeyID', 'CryptKeyID', 'TicketFreeText1', 'TicketFreeText2', 'TicketFreeText3', 'TicketFreeText4', 'TicketFreeText5', 'TicketFreeText6', 'TicketFreeText7', 'TicketFreeText8', 'TicketFreeText9', 'TicketFreeText10', 'TicketFreeText11', 'TicketFreeText12', 'TicketFreeText13', 'TicketFreeText14', 'TicketFreeText15', 'TicketFreeText16', '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;
});
//]]></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;
});
//]]></script>
<!--dtl:js_on_document_complete-->
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:ResponsibleSelection -->

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

                    <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="submit" id="AttachmentDelete$QData{"FileID"}" name="AttachmentDelete$QData{"FileID"}" value="$Text{"Delete"}">$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="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"}
                    </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"}
                    </div>
                    <div class="Clear"></div>

<!-- dtl:block:TicketFreeText -->
                    $Data{"TicketFreeKeyField"}
                    <div class="Field">
                        $Data{"TicketFreeTextField"}
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:TicketFreeText -->

# example of how to use fixed ticket freetext blocks for customizations
#<!-- dtl:block:TicketFreeText1 -->
#                        <label>$Data{"TicketFreeKeyField1"}:</label>
#                        <div class="Field">
#                            $Data{"TicketFreeTextField1"}
#                        </div>
#                        <div class="Clear"></div>
#<!-- dtl:block:TicketFreeText1 -->
#<!-- dtl:block:TicketFreeText2 -->
#                        <label>$Data{"TicketFreeKeyField2"}:</label>
#                        <div class="Field">
#                            $Data{"TicketFreeTextField2"}
#                        </div>
#                        <div class="Clear"></div>
#<!-- dtl:block:TicketFreeText2 -->

<!-- dtl:block:TicketFreeTime -->
                    $Data{"TicketFreeTimeKey"}
                    <div class="Field">
                        $Data{"TicketFreeTime"}
                        <div id="TicketFreeTime$Data{"Count"}UsedError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:TicketFreeTime -->

# example of how to use fixed ticket freetime blocks for customizations
#<!-- dtl:block:TicketFreeTime1 -->
#                        <label>$Data{"TicketFreeTimeKey1"}:</label>
#                        <div class="Field">
#                            $Data{"TicketFreeTime1"}
#                        </div>
#                        <div class="Clear"></div>
#<!-- dtl:block:TicketFreeTime1 -->
#<!-- dtl:block:TicketFreeTime2 -->
#                        <label>$Data{"TicketFreeTimeKey2"}:</label>
#                        <div class="Field">
#                            $Data{"TicketFreeTime2"}
#                        </div>
#                        <div class="Clear"></div>
#<!-- dtl:block:TicketFreeTime2 -->

<!-- dtl:block:ArticleFreeText -->
                    $Data{"ArticleFreeKeyField"}
                    <div class="Field">
                        $Data{"ArticleFreeTextField"}
                    </div>
                    <div class="Clear"></div>
<!-- dtl:block:ArticleFreeText -->

# example of how to use fixed article freetext blocks for customizations
#<!-- dtl:block:ArticleFreeText1 -->
#                    $Data{"ArticleFreeKeyField1"}
#                    <div class="Field">
#                        $Data{"ArticleFreeKeyField1"}
#                    </div>
#                    <div class="Clear"></div>
#<!-- dtl:block:ArticleFreeText1 -->
#<!-- dtl:block:ArticleFreeText2 -->
#                    $Data{"ArticleFreeKeyField2"}
#                    <div class="Field">
#                        $Data{"ArticleFreeKeyField2"}
#                    </div>
#                    <div class="Clear"></div>
#<!-- dtl:block:ArticleFreeText2 -->

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