# --
# AdminDynamicFieldDateTime.dtl - provides HTML form for AdminDynamicFieldsDateTime
# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id: AdminDynamicFieldDateTime.dtl,v 1.12 2012-01-12 13:06:55 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.
# --

<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
    <h1>$Text{"Dynamic Fields"} - $Text{"$Data{"ObjectTypeName"}"}: $Text{"$Data{"Mode"}"} $Text{"$Data{"FieldTypeName"}"} $Text{"Field"}</h1>

    <div class="Clear"></div>

    <div class="SidebarColumn">
        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Actions"}</h2>
            </div>
            <div class="Content">
                <ul class="ActionList">
                    <li>
                        <a href="$Env{"Baselink"}Action=AdminDynamicField" class="CallForAction"><span>$Text{"Go back to overview"}</span></a>
                    </li>
                </ul>
            </div>
        </div>
    </div>

    <div class="ContentColumn">
        <form action="$Env{"CGIHandle"}" method="post" class="Validate PreventMultipleSubmits">
            <input type="hidden" name="Action" value="AdminDynamicFieldDateTime" />
            <input type="hidden" name="Subaction" value="$QData{"Mode"}Action" />
            <input type="hidden" name="ObjectType" value="$QData{"ObjectType"}" />
            <input type="hidden" name="FieldType" value="$QData{"FieldType"}" />
            <input type="hidden" name="ID" value="$QData{"ID"}" />

            <div class="WidgetSimple">
                <div class="Header">
                    <h2>$Text{"General"}</h2>
                </div>
                <div class="Content">
                    <div class="LayoutGrid ColumnsWithSpacing">
                        <div class="Size1of2">
                            <fieldset class="TableLike">
                                <label class="Mandatory" for="Name"><span class="Marker">*</span> $Text{"Name"}:</label>
                                <div class="Field">
                                    <input id="Name" class="W50pc $QData{"NameServerError"} $QData{"ShowWarning"}  Validate_Alphanumeric" type="text" maxlength="200" value="$QData{"Name"}" name="Name"/>
                                    <div id="NameError" class="TooltipErrorMessage"><p>$Text{"This field is required, and the value should be alphabetic and numeric characters only."}</p></div>
                                    <div id="NameServerError" class="TooltipErrorMessage"><p>$Text{"$Data{"NameServerErrorMessage"}"}</p></div>
                                    <p class="FieldExplanation">$Text{"Must be unique and only accept alphabetic and numeric characters."}</p>
                                    <p class="Warning Hidden">$Text{"Changing this value will require manual changes in the system."}</p>
                                </div>
                                <div class="Clear"></div>

                                <label class="Mandatory" for="Label"><span class="Marker">*</span> $Text{"Label"}:</label>
                                <div class="Field">
                                    <input id="Label" class="W50pc $QData{"LabelServerError"} Validate_Required" type="text" maxlength="200" value="$QData{"Label"}" name="Label"/>
                                    <div id="LabelError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                                    <div id="LabelServerError" class="TooltipErrorMessage"><p>$Text{"$Data{"LabelServerErrorMessage"}"}</p></div>
                                    <p class="FieldExplanation">$Text{"This is the name to be shown on the screens where the field is active."}</p>
                                </div>
                                <div class="Clear"></div>

                                <label class="Mandatory" for="FieldOrder"><span class="Marker">*</span> $Text{"Field order"}:</label>
                                <div class="Field">
                                    $Data{"DynamicFieldOrderSrtg"}
                                    <div id="FieldOrderError" class="TooltipErrorMessage"><p>$Text{"This field is required and must be numeric."}</p></div>
                                    <div id="FieldOrderServerError" class="TooltipErrorMessage"><p>$Text{"$Data{"FieldOrderServerErrorMessage"}"}</p></div>
                                    <p class="FieldExplanation">$Text{"This is the order in which this field will be shown on the screens where is active."}</p>
                                </div>
                                <div class="Clear"></div>
                            </fieldset>
                        </div>
                        <div class="Size1of2">
                            <fieldset class="TableLike">
                                <label for="ValidID">$Text{"Validity"}:</label>
                                <div class="Field">
                                    $Data{"ValidityStrg"}
                                </div>
                                <div class="Clear"></div>

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

                                <div class="SpacingTop"></div>
                                <label for="ObjectTypeName">$Text{"Object type"}:</label>
                                <div class="Field">
                                    <input id="ObjectTypeName" readonly="readonly" class="W50pc" type="text" maxlength="200" value="$QData{"ObjectTypeName"}" name="ObjectTypeName"/>
                                    <div class="Clear"></div>
                                </div>
                            </fieldset>
                        </div>
                    </div>
                </div>
            </div>
            <div class="WidgetSimple">
                <div class="Header">
                    <h2>$Text{"$Data{"FieldTypeName"}"} $Text{"Field Settings"}</h2>
                </div>
                <div class="Content">
                    <fieldset class="TableLike">
                        <label for="DefaultValue">$Text{"Default date difference"}:</label>
                        <div class="Field">
                            <input id="DefaultValue" class="W50pc Validate_PositiveNegativeNumbers $QData{"DefaultValueServerError"}" type="text" maxlength="200" value="$QData{"DefaultValue"}" name="DefaultValue"/>
                            <div id="DefaultValueError" class="TooltipErrorMessage"><p>$Text{"This field must be numeric."}</p></div>
                            <div id="DefaultValueServerError" class="TooltipErrorMessage"><p>$Text{"This field must be numeric."}</p></div>
                            <p class="FieldExplanation">$Text{"The difference from NOW (in seconds) to calculate the field default value (e.g. 3600 or -60)."}</p>
                        </div>
                        <div class="Clear"></div>

                        <label for="YearsPeriod">$Text{"Define years period"}:</label>
                        <div class="Field">
                            $Data{"YearsPeriodStrg"}
                            <p class="FieldExplanation">$Text{"Activate this feature to define a fixed range of years (in the future and in the past) to be displayed on the year part of the field."}</p>
                        </div>
                        <div class="Clear"></div>

                        <fieldset id="YearsPeriodOption" class="TableLike $QData{"ClassYearsPeriod"}">
                            <label for="YearsInPast">$Text{"Years in the past"}:</label>
                            <div class="Field">
                                <input id="YearsInPast" class="W50pc Validate_PositiveNegativeNumbers $QData{"YearsInPastServerError"}" type="text" maxlength="200" value="$QData{"YearsInPast"}" name="YearsInPast"/>
                                <p class="FieldExplanation">$Text{"Years in the past to display (default: 5 years)."}</p>
                                <div id="YearsInPastError" class="TooltipErrorMessage"><p>$Text{"This field must be numeric."}</p></div>
                                <div id="YearsInPastServerError" class="TooltipErrorMessage"><p>$Text{"This field must be numeric."}</p></div>
                            </div>
                            <div class="Clear"></div>

                            <label for="YearsInFuture">$Text{"Years in the future"}:</label>
                            <div class="Field">
                                <input id="YearsInFuture" class="W50pc Validate_PositiveNegativeNumbers $QData{"YearsInFutureServerError"}" type="text" maxlength="200" value="$QData{"YearsInFuture"}" name="YearsInFuture"/>
                                <div id="YearsInFutureError" class="TooltipErrorMessage"><p>$Text{"This field must be numeric."}</p></div>
                                <div id="YearsInFutureServerError" class="TooltipErrorMessage"><p>$Text{"This field must be numeric."}</p></div>
                                <p class="FieldExplanation">$Text{"Years in the future to display (default: 5 years)."}</p>
                            </div>
                            <div class="Clear"></div>
                        </fieldset>
                        <label for="Link">$Text{"Show link"}:</label>
                        <div class="Field">
                            <input id="Link" class="W50pc" type="text" maxlength="500" value="$QData{"Link"}" name="Link"/>
                            <p class="FieldExplanation">
                                $Text{"Here you can specify an optional HTTP link for the field value in Overviews and Zoom screens."}
                                <br/>
                                $Text{"Example"}: http://some.example.com/handle?query=<span>$</span>LQData{"Field1"}
                            </p>
                        </div>
                        <div class="Clear"></div>
                    </fieldset>
                </div>
            </div>
            <fieldset class="TableLike">
                <div class="Field SpacingTop">
                    <button type="submit" class="Primary" value="$Text{"Save"}">$Text{"Save"}</button>
                    $Text{"or"}
                    <a href="$Env{"Baselink"}Action=AdminDynamicField">$Text{"Cancel"}</a>
                </div>
                <div class="Clear"></div>
            </fieldset>
        </form>
    </div>
</div>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('.ShowWarning').bind('change keyup', function (Event) {
    $('p.Warning').removeClass('Hidden');
});

$('#YearsPeriod').bind('change', function (Event) {
    Core.Agent.Admin.DynamicFieldDateTime.ToogleYearsPeriod($(this).val());
});

Core.Agent.Admin.DynamicField.ValidationInit();
//]]></script>
<!--dtl:js_on_document_complete-->
