# --
# AgentStatsView.dtl - provides HTML form for view stat screen
# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id: AgentStatsView.dtl,v 1.38 2012/11/20 15:19:41 mh 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{"View"}: $Text{"$Config{"Stats::StatsHook"}"} $QData{"StatNumber"}</h1>

    <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"}$Env{"LastStatsOverview"}" class="CallForAction"><span>$Text{"Go to overview"}</span></a>
                    </li>
<!-- dtl:block:AdminLinks -->
                    <li>
                        <a href="$Env{"Baselink"}Action=AgentStats;Subaction=EditSpecification;StatID=$LQData{"StatID"}" class="CallForAction"><span>$Text{"Edit"}</span></a>
                    </li>
                    <li>
                        <a href="$Env{"Baselink"}Action=AgentStats;Subaction=Delete;StatID=$LQData{"StatID"}" class="CallForAction"><span>$Text{"Delete"}</span></a>
                    </li>
                    <li>
                        <a href="$Env{"Baselink"}Action=AgentStats;Subaction=Export;StatID=$LQData{"StatID"}" class="CallForAction"><span>$Text{"Export config"}</span></a>
                    </li>
<!-- dtl:block:AdminLinks -->
                </ul>
            </div>
        </div>

        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Hint"}</h2>
            </div>
            <div class="Content">
                <p>
                    $Text{"With the input and select fields you can influence the format and contents of the statistic."}
                    $Text{"Exactly what fields and formats you can influence is defined by the statistic administrator."}
                </p>
            </div>
        </div>
    </div>
    <div class="ContentColumn">
        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Stat Details"}</h2>
            </div>
            <div class="Content">

                <form action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" name="compose" id="compose">
                    <input type="hidden" name="Action"    value="$Env{"Action"}"/>
                    <input type="hidden" name="Subaction" value="Run"/>
                    <input type="hidden" name="StatID"    value="$QData{"StatID"}"/>
                    <input type="hidden" id="PDFUsable" name="PDFUsable" value="$QData{"PDFUsable"}"/>

                    <fieldset class="TableLike">
                        <label>$Text{"$Config{"Stats::StatsHook"}"}:</label>
                        <div class="Value">$QData{"StatNumber"}</div>
                        <div class="Clear"></div>

                        <label>$Text{"Title"}:</label>
                        <div class="Value">$QData{"Title"}</div>
                        <div class="Clear"></div>

                        <label>$Text{"Object"}:</label>
                        <div class="Value">$Text{"$Data{"ObjectName"}"}</div>
                        <div class="Clear"></div>

                        <label>$Text{"Description"}:</label>
                        <div class="Value">$Data{"Description"}</div>
                        <div class="Clear"></div>

#                       <label>$Text{"Type"}:</label>
#                       <div class="Value">$Text{"$Data{"StatType"}"}</div>
#                       <div class="Clear"></div>
#
<!-- dtl:block:Format -->
                        <label>$Text{"Format"}:</label>
                        <div class="Value">$Data{"SelectFormat"}</div>
                        <div class="Clear"></div>
<!-- dtl:block:Format -->
<!-- dtl:block:FormatFixed -->
                        <input type="hidden" id="Format" name="Format" value="$QData{"FormatKey"}"/>
                        <label>$Text{"Format"}:</label>
                        <div class="Value">$Text{"$Data{"Format"}"}</div>
                        <div class="Clear"></div>
<!-- dtl:block:FormatFixed -->
<!-- dtl:block:Graphsize -->
                        <label>$Text{"Graphsize"}:</label>
                        <div class="Value">$Data{"SelectGraphSize"}</div>
                        <div class="Clear"></div>
<!-- dtl:block:Graphsize -->
<!-- dtl:block:GraphsizeFixed -->
                        <input type="hidden" name="GraphSize" value="$QData{"GraphSizeKey"}"/>
                        <label>$Text{"Graphsize"}:</label>
                        <div class="Value">$Data{"GraphSize"}</div>
                        <div class="Clear"></div>
<!-- dtl:block:GraphsizeFixed -->
                        <label>$Text{"Sum rows"}:</label>
                        <div class="Value">$Text{"$Data{"SumRowValue"}"}</div>
                        <div class="Clear"></div>

                        <label>$Text{"Sum columns"}:</label>
                        <div class="Value">$Text{"$Data{"SumColValue"}"}</div>
                        <div class="Clear"></div>

                        <label>$Text{"Cache"}:</label>
                        <div class="Value">$Text{"$Data{"CacheValue"}"}</div>
                        <div class="Clear"></div>

                        <label>$Text{"Validity"}:</label>
                        <div class="Value">$Text{"$Data{"ValidValue"}"}</div>
                        <div class="Clear"></div>
<!-- dtl:block:ExchangeAxis -->
                        <label>$Text{"Exchange Axis"}:</label>
                        <div class="Value">$Data{"ExchangeAxis"}</div>
                        <div class="Clear"></div>
<!-- dtl:block:ExchangeAxis -->
                        <label>$Text{"Created"}:</label>
                        <div class="Value">$TimeLong{"$Data{"Created"}"}</div>
                        <div class="Clear"></div>

                        <label>$Text{"Created by"}:</label>
                        <div class="Value">$QData{"CreatedBy","20"}</div>
                        <div class="Clear"></div>

                        <label>$Text{"Changed"}:</label>
                        <div class="Value">$TimeLong{"$Data{"Changed"}"}</div>
                        <div class="Clear"></div>

                        <label>$Text{"Changed by"}:</label>
                        <div class="Value">$QData{"ChangedBy","20"}</div>
                        <div class="Clear"></div>
                    </fieldset>


<!--dtl:block:Static -->
                    <h2>
                        $Text{"Configurable params of static stat"}
                    </h2>
                    <fieldset class="TableLike">
<!--dtl:block:ItemParam -->
                        <label>$Text{"$Data{"Param"}"}:</label>
                        <div class="Value">$Data{"Field"}</div>
                        <div class="Clear"></div>
<!--dtl:block:ItemParam -->
                    </fieldset>
<!--dtl:block:Static -->


<!--dtl:block:Dynamic -->
                    <h2>$Text{"$Data{"Name"}"}</h2>
                    <fieldset class="TableLike">
<!--dtl:block:NoElement -->
                        <p>$Text{"No element selected."}</p>
<!--dtl:block:NoElement -->
<!--dtl:block:Element -->
                        <label>$Text{"$Data{"Name"}"}:</label>
                        <div class="Value">
                            <p>
<!--dtl:block:TimePeriodFixed -->
                                $Text{"Between"} $Data{"TimeStart"} $Text{"and"} $Data{"TimeStop"}<br/>
<!--dtl:block:TimePeriodFixed -->
<!--dtl:block:TimeRelativeFixed -->
                                $Text{"The last"} $Data{"TimeRelativeCount"} $Text{"$Data{"TimeRelativeUnit"}"}<br/>
<!--dtl:block:TimeRelativeFixed -->
<!--dtl:block:TimeScaleFixed -->
                                $Text{"Scale"}: $Data{"Count"} $Text{"$Data{"Scale"}"}
<!--dtl:block:TimeScaleFixed -->
<!--dtl:block:Fixed -->
                                $Data{"Value"}<br/>
<!--dtl:block:Fixed -->
<!--dtl:block:MultiSelectField -->
                                $Data{"SelectField"}
<!--dtl:block:MultiSelectField -->
<!--dtl:block:SelectField -->
                                $Data{"SelectField"}
<!--dtl:block:SelectField -->
<!--dtl:block:InputField -->
                                <input type="text" name="$QData{"Key"}" value="$QData{"Value"}" class="W25pc"/>
<!--dtl:block:InputField -->
                            </p>
                        </div>
                        <div class="Clear"></div>

<!--dtl:block:TimeScale -->
                        <label>$Text{"Scale"}:</label>
                        <div class="Value">
                            <p>
                                $Data{"TimeScaleCount"}
                                $Data{"TimeScaleUnit"}
<!--dtl:block:TimeScaleInfo -->
                                ($Text{"minimal scale"} $Data{"TimeScaleCountMax"} $Text{"$Data{"TimeScaleUnitMax"}"})
<!--dtl:block:TimeScaleInfo -->
                            </p>
                        </div>
                        <div class="Clear"></div>
<!--dtl:block:TimeScale -->

<!--dtl:block:TimePeriod -->
                        <label>$Text{"Between"}</label>
                        <div class="Value">
                            <p>
                                $Data{"TimeStart"} $Text{"and"} $Data{"TimeStop"}<br/>
                                ($Text{"maximal period from"} $TimeLong{"$Data{"TimeStartMax"}"} $Text{"to"} $TimeLong{"$Data{"TimeStopMax"}"})
                            </p>
                        </div>
                        <div class="Clear"></div>
<!--dtl:block:TimePeriod -->

<!--dtl:block:TimePeriodRelative -->
                        <label>$Text{"The last"}</label>
                        <div class="Value">
                            <p>
                                $Data{"TimeRelativeCount"}
                                $Data{"TimeRelativeUnit"} ($Text{"maximal period"} $Data{"TimeRelativeCountMax"} $Text{"$Data{"TimeRelativeUnitMax"}"})
                            </p>
                        </div>
                        <div class="Clear"></div>

<!--dtl:block:TimePeriodRelative -->

<!--dtl:block:Element -->
                    </fieldset>
<!--dtl:block:Dynamic -->

<!--dtl:block:FormSubmit -->
                    <fieldset class="TableLike">
                        <div class="Value">
                            <button class="Primary" type="submit" id="StartStatistic" name="Start" value="$Text{"Start"}">$Text{"Start"}</button>
                        </div>
                    </fieldset>

<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
$('#StartStatistic').bind('click', function (Event) {
    var Format = $('#Format').val(),
        PDFUsable = $('#PDFUsable').val() > 0,
        URL;

    if (Format === 'Print' && !PDFUsable) {
        var Data = Core.AJAX.SerializeForm($('#compose'));
        URL = '$Env{"Baselink"}' + Data;
        Core.UI.Popup.OpenPopup(URL, 'Statistic', 'Default');
        return false;
    }
});
//]]></script>
<!--dtl:js_on_document_complete-->

<!--dtl:block:FormSubmit -->
                </form>
            </div>
        </div>
    </div>
</div>
