# --
# AgentTicketActionCommon.dtl - provides common HTML form for several masks
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# $Id: AgentTicketActionCommon.dtl,v 1.64 2011/11/24 12:45:07 cr 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.
# --

<!-- dtl:block:Properties -->

<form action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" name="compose" id="Compose" class="Validate PreventMultipleSubmits">
    <input type="hidden" name="Action" value="$Env{"Action"}"/>
    <input type="hidden" name="Subaction" value="Store"/>
    <input type="hidden" name="TicketID" value="$QData{"TicketID"}"/>
    <input type="hidden" name="Expand" id="Expand" value=""/>
    <input type="hidden" name="FormID" value="$QData{"FormID"}"/>

    <div class="LayoutPopup ARIARoleMain">
        <div class="Header">
            <h1>

<!-- dtl:block:HeaderAgentTicketFreeText -->
                $Text{"Change Free Text of Ticket"}
<!-- dtl:block:HeaderAgentTicketFreeText -->

<!-- dtl:block:HeaderAgentTicketOwner -->
                $Text{"Change Owner of Ticket"}
<!-- dtl:block:HeaderAgentTicketOwner -->

<!-- dtl:block:HeaderAgentTicketClose -->
                $Text{"Close Ticket"}
<!-- dtl:block:HeaderAgentTicketClose -->

<!-- dtl:block:HeaderAgentTicketNote -->
                $Text{"Add Note to Ticket"}
<!-- dtl:block:HeaderAgentTicketNote -->

<!-- dtl:block:HeaderAgentTicketPending -->
                $Text{"Set Pending"}
<!-- dtl:block:HeaderAgentTicketPending -->

<!-- dtl:block:HeaderAgentTicketPriority -->
                $Text{"Change Priority of Ticket"}
<!-- dtl:block:HeaderAgentTicketPriority -->

<!-- dtl:block:HeaderAgentTicketResponsible -->
                $Text{"Change Responsible of Ticket"}
<!-- dtl:block:HeaderAgentTicketResponsible -->

                : $Data{"TicketNumber"} - $QData{"Title","60"}
            </h1>

<!-- dtl:block:TicketBack -->
            <p>
                <a class="CancelClosePopup" href="#">$Text{"Cancel & close window"}</a>
            </p>
<!-- dtl:block:TicketBack -->
<!-- dtl:block:PropertiesLock -->
            <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:PropertiesLock -->

        </div>
        <div class="Content">

            <h2>$Text{"Options"}</h2>

            <fieldset class="TableLike FixedLabel">

<!-- dtl:block:Title -->
                <label class="Mandatory" for="Title"><span class="Marker">*</span>$Text{"Title"}:</label>
                <div class="Field">
                    <input type="text" id="Title" name="Title" value="$QData{"Title"}" class="W75pc Validate_Required $QData{"TitleInvalid"}" />
                    <div id="TitleError" class="TooltipErrorMessage" ><p>$Text{"This field is required."}</p></div>
                    <div id="TitleServerError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                </div>
                <div class="Clear"></div>
<!-- dtl:block:Title -->

<!-- dtl:block:Type -->
                <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($('#Compose'), 'AJAXUpdate', 'TypeID', [ 'ServiceID', 'SLAID', 'NewOwnerID', 'OldOwnerID', 'NewResponsibleID', 'NewStateID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"} ]);
});
//]]></script>
<!--dtl:js_on_document_complete-->
                </div>
                <div class="Clear"></div>
<!-- dtl:block:Type -->

<!-- dtl:block:Service -->
                <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($('#Compose'), 'AJAXUpdate', 'ServiceID', [ 'TypeID', 'SLAID', 'NewOwnerID', 'OldOwnerID', 'NewResponsibleID', 'NewStateID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"} ]);
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                </div>
                <div class="Clear"></div>
<!-- dtl:block:Service -->

<!-- dtl:block:SLA -->
                <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($('#Compose'), 'AJAXUpdate', 'SLAID', [ 'TypeID', 'ServiceID', 'NewOwnerID', 'OldOwnerID', 'NewResponsibleID', 'NewStateID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"} ]);
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                </div>
                <div class="Clear"></div>
<!-- dtl:block:SLA -->

<!-- dtl:block:Owner -->
                <label for="NewOwnerID">$Text{"New Owner"}:</label>
                <div class="Field">
                    <input type="radio" name="NewOwnerType" value="New" title="Select new owner" $Data{"NewOwnerType::New"} />
                    $Data{"OwnerStrg"}
                    <div id="NewOwnerIDServerError" class="TooltipErrorMessage"><p>$Text{"Please set a new owner!"}</p></div>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#NewOwnerID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#Compose'), 'AJAXUpdate', 'NewOwnerID', [ 'TypeID', 'ServiceID', 'SLAID', 'OldOwnerID', 'NewResponsibleID', 'NewStateID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"} ]);
    });
    $('#NewOwnerID').bind('click', function () {
        Core.Agent.TicketAction.SelectRadioButton('New','NewOwnerType');
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                </div>
                <div class="Clear"></div>

                <label for="OldOwnerID">$Text{"Previous Owner"}:</label>
                <div class="Field">
                    <input type="radio" name="NewOwnerType" value="Old" title="Select old owner" $Data{"NewOwnerType::Old"} />
                    $Data{"OldOwnerStrg"}
                    <div id="OldOwnerIDServerError" class="TooltipErrorMessage"><p>$Text{"Please set a new owner!"}</p></div>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#OldOwnerID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#Compose'), 'AJAXUpdate', 'OldOwnerID', [ 'TypeID', 'ServiceID', 'SLAID', 'NewOwnerID', 'NewResponsibleID', 'NewStateID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"} ]);
    });
    $('#OldOwnerID').bind('click', function () {
        Core.Agent.TicketAction.SelectRadioButton('Old','NewOwnerType');
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                </div>
                <div class="Clear"></div>
<!-- dtl:block:Owner -->

<!-- dtl:block:Responsible -->
                <label for="NewResponsibleID">$Text{"Responsible"}:</label>
                <div class="Field">
                    $Data{"ResponsibleStrg"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#NewResponsibleID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#Compose'), 'AJAXUpdate', 'NewResponsibleID', [ 'TypeID', 'ServiceID', 'SLAID', 'NewOwnerID', 'OldOwnerID', 'NewStateID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"} ]);
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                </div>
                <div class="Clear"></div>
<!-- dtl:block:Responsible -->

<!-- dtl:block:Note -->
<!-- dtl:block:InformAgent -->
                <label for="InformUserID">$Text{"Inform Agent"}: ($Text{"Optional"})</label>
                <div class="Field">
                    $Data{"OptionStrg"}
                </div>
                <div class="Clear"></div>
<!-- dtl:block:InformAgent -->

<!-- dtl:block:InvolvedAgent -->
                <label for="InvolvedUserID">$Text{"Inform involved Agents"}:</label>
                <div class="Field">
                    $Data{"InvolvedAgentStrg"}
                </div>
                <div class="Clear"></div>
<!-- dtl:block:InvolvedAgent -->

                <label class="Mandatory" for="Subject"><span class="Marker">*</span>$Text{"Subject"}:</label>
                <div class="Field">
                    <input type="text" id="Subject" name="Subject" value="$QData{"Subject"}" class="W75pc Validate_Required $Data{"SubjectInvalid"}"/>
                    <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 -->

<!-- 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 $Data{"BodyInvalid"}" name="Body" rows="15" cols="$Config{"Ticket::Frontend::TextAreaNote"}">$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>$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 name="FileUpload" id="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 (Event) {
        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>

<!-- dtl:block:ArticleType -->
                <label for="ArticleTypeID">$Text{"Note type"}:</label>
                <div class="Field">
                    $Data{"ArticleTypeStrg"}
                </div>
                <div class="Clear"></div>
<!-- dtl:block:ArticleType -->
<!-- dtl:block:Note -->

<!-- dtl:block:State -->
                <label for="NewStateID">$Text{"Next state"}:</label>
                <div class="Field">
                    $Data{"StateStrg"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#NewStateID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#Compose'), 'AJAXUpdate', 'NewStateID', ['TypeID', 'ServiceID', 'SLAID', 'NewOwnerID', 'OldOwnerID', 'NewResponsibleID', 'NewPriorityID', $Data{"DynamicFieldNamesStrg"} ]);
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                </div>
                <div class="Clear"></div>

<!-- dtl:block:StatePending -->
                <label>$Text{"Pending date"}:</label>
                <div class="Field">
                    $Data{"DateString"}
                    <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:StatePending -->
<!-- dtl:block:State -->

<!-- dtl:block:Priority -->
                <label for="NewPriorityID">$Text{"Priority"}:</label>
                <div class="Field">
                    $Data{"PriorityStrg"}
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    $('#NewPriorityID').bind('change', function (Event) {
        Core.AJAX.FormUpdate($('#Compose'), 'AJAXUpdate', 'NewPriorityID', ['TypeID', 'ServiceID', 'SLAID', 'NewOwnerID', 'OldOwnerID', 'NewResponsibleID', 'NewStateID', $Data{"DynamicFieldNamesStrg"} ]);
    });
//]]></script>
<!--dtl:js_on_document_complete-->
                </div>
                <div class="Clear"></div>
<!-- dtl:block:Priority -->

<!-- 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="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 class="Footer">
            <button class="Primary" id="submitRichText" accesskey="g" title="$Text{"Submit"} (g)" type="submit" value="$Text{"Submit"}">$Text{"Submit"}</button>
        </div>
    </div>
</form>
<!-- dtl:block:Properties -->

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