# --
# AdminGenericInterfaceWebserviceHistory.dtl - provides HTML form for AdminLog
# Copyright (C) 2001-2011 OTRS AG, http://otrs.org/
# --
# $Id: AdminGenericInterfaceWebserviceHistory.dtl,v 1.10 2011/07/08 21:40:29 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 AdminGenericInterfaceWebserviceHistory">
    <h1>$Text{"GenericInterface Configuration History for Web Service %s", "$Data{"WebserviceName"}"}</h1>
<!-- breadcrumb -->
    <div class="GenericInterfaceWebserviceConfigPath">
        <h3>
            $Config{"GenericInterface::Webservice::Path::Separator"}
            <a href="$Env{"Baselink"}Action=AdminGenericInterfaceWebservice">$Text{"Web Services"}</a>

            $Config{"GenericInterface::Webservice::Path::Separator"}
            <a href="$Env{"Baselink"}Action=AdminGenericInterfaceWebservice;Subaction=Change;WebserviceID=$QData{"WebserviceID"}">$QData{"WebserviceName"}</a>

            $Config{"GenericInterface::Webservice::Path::Separator"}
            $Text{"History"}
        </h3>
    </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=AdminGenericInterfaceWebservice;Subaction=Change;WebserviceID=$LQData{"WebserviceID"}" class="CallForAction">
                            <span>$Text{"Go back to Web Service"}</span>
                        </a>
                    </li>
                </ul>
            </div>
        </div>

        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Hint"}</h2>
            </div>
            <div class="Content">
                <p class="FieldExplanation">
                    $Text{"Here you can view older versions of the current web service's configuration, export or even restore them."}
                </p>
            </div>
        </div>
    </div>
    <div class="ContentColumn">

        <div class="WidgetSimple WebserviceListWidget">
            <div class="Header">
                <h2>
                    $Text{"Configuration History List"}
                </h2>
            </div>
            <div class="Content">
                <div class="ColumnsWithSpacing">
                    <div class="W75pc">
                        <div id="WebserviceListContainer" class="ListContainer">
                            <table class="DataTable" id="WebserviceList">
                                <thead>
                                    <tr>
                                        <th>$Text{"Version"}</th>
                                        <th>$Text{"Create time"}</th>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr>
                                        <td colspan="3">$Text{"Loading"}...</td>
                                    </tr>
                                </tbody>
                            </table>
                        </div>
                        <p class="FieldExplanation">$Text{"Select a single configuration version to see its details."}</p>
                    </div>
                    <div class="Clear"></div>
                </div>
            </div>
        </div>

        <div class="WidgetSimple Hidden" id="WebserviceHistoryDetails">
            <div class="ControlRow"></div>
            <div class="LightRow Bottom">
                <ul class="Actions">
                    <li id="ExportButton">
                        <span>$Text{"Export web service configuration"}</span>
                    </li>
                    <li id="RollbackButton">
                        <span>$Text{"Restore web service configuration"}</span>
                    </li>
                </ul>
                <div class="ClearLeft"></div>
            </div>
            <div class="Content ConfigCode">
                <pre></pre>
            </div>
        </div>

        <div class="Hidden" id="RollbackDialogContainer">
            <p id="RollbackDialog" class="Warning">
                $Text{"Do you really want to restore this version of the web service configuration?"}
                <br/>
                $Text{"Your current web service configuration will be overwritten."}
            </p>
        </div>
        <div class="Hidden">
            <form action="$Env{"CGIHandle"}" method="post" id="ActionForm">
                <input type="hidden" value="AdminGenericInterfaceWebserviceHistory" name="Action" />
                <input type="hidden" value="" name="Subaction" id="Subaction" />
                <input type="hidden" value="$QData{"WebserviceID"}" name="WebserviceID" />
                <input type="hidden" value="" name="WebserviceHistoryID" id="WebserviceHistoryID" />
            </form>
        </div>
    </div>
    <div class="Clear"></div>
</div>

<!-- dtl:js_on_document_complete -->
<script type="text/javascript">//<![CDATA[

Core.Agent.Admin.GenericInterfaceWebserviceHistory.Init({
    WebserviceID: $QData{"WebserviceID"},
    Localization: {
        WebserviceHistoryErrorMsg: '$JSText{"An error occurred during communication."}',
        NoDataFoundMsg: '$JSText{"No data found."}',
        ToggleContentMsg: '$JSText{"Show or hide the content."}',
        RollbackLogMsg: '$JSText{"Restore web service configuration"}',
        RollbackMsg: '$JSText{"Restore"}',
        CancelMsg: '$JSText{"Cancel"}'
    }
});

//Load Webservice list on startup without active filter
Core.Agent.Admin.GenericInterfaceWebserviceHistory.GetWebserviceList();

$('#ExportButton').bind('click', function(){
    $('#Subaction').attr('value','Export');
    $('#ActionForm').submit();
});

$('#RollbackButton').bind('click', Core.Agent.Admin.GenericInterfaceWebserviceHistory.ShowRollbackDialog);

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