# --
# AdminGenericInterfaceWebservice.dtl - provides HTML form for AdminGenericInterfaceWebservice
# Copyright (C) 2001-2012 OTRS AG, http://otrs.org/
# --
# $Id: AdminGenericInterfaceWebservice.dtl,v 1.41 2012/01/09 09:50:41 mg 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:Main -->
<div class="MainBox ARIARoleMain LayoutFixedSidebar SidebarFirst">
    <h1>$Text{"GenericInterface Web Service Management"} - $Text{"$Data{"Action"}"}</h1>
    <div class="GenericInterfaceWebserviceConfigPath">
        <h3>
<!-- dtl:block:WebservicePathElement -->
            $Config{"GenericInterface::Webservice::Path::Separator"}
            <a href="$Env{"Baselink"}$Data{"Link"};Nav=$LQData{"Nav"}">
                $QData{"Name"}
            </a>
<!-- dtl:block:WebservicePathElement -->
<!-- dtl:block:WebservicePathElementNoLink -->
            $Config{"GenericInterface::Webservice::Path::Separator"}
            $QData{"Name"}
<!-- dtl:block:WebservicePathElementNoLink -->
        </h3>
    </div>

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

    <div class="SidebarColumn">
<!-- dtl:block:ActionList -->
        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Actions"}</h2>
            </div>
            <div class="Content">
                <ul class="ActionList">
<!-- dtl:block:ActionOverview -->
                    <li>
                        <a href="$Env{"Baselink"}Action=$Env{"Action"};Nav=$LQData{"Nav"}" class="CallForAction"><span>$Text{"Go to overview"}</span></a>
                    </li>
<!-- dtl:block:ActionOverview -->
<!-- dtl:block:ActionAdd -->
                    <li>
                        <form action="$Env{"CGIHandle"}" method="post">
                            <input type="hidden" name="Action" value="$Env{"Action"}"/>
                            <input type="hidden" name="Subaction" value="Add"/>
                            <input type="hidden" name="Nav" value="$QData{"Nav"}"/>

                            <button class="CallForAction Plus W75pc" type="submit"><span>$Text{"Add web service"}</span></button>
                            <br/>
                        </form>
                    </li>
<!-- dtl:block:ActionAdd -->
<!-- dtl:block:ActionClone -->
                    <li>
                        <button id="CloneButton" class="CallForAction Clone W75pc HideActionOnChange" type="submit"><span>$Text{"Clone web service"}</span></button>
                        <div class="Hidden" id="CloneDialogContainer">
                            <div id="CloneDialog" class="InnerContent GenericInterfaceDialog">
                                <form id="CloneForm" action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" name="CloneForm" class="Validate PreventMultipleSubmits">
                                    <input type="hidden" name="Action" value="$Env{"Action"}"/>
                                    <input type="hidden" name="Subaction" value="Clone"/>
                                    <input type="hidden" name="WebserviceID" value="$QData{"WebserviceID"}"/>
                                    <fieldset class="TableLike">
                                        <div class="SpacingTop"></div>
                                        <label class="Mandatory" for="CloneName"><span class="Marker">*</span>$Text{"Name"}:</label>
                                        <div class="Field">
                                            <input id="CloneName" class="CloneName W75pc Validate_Required" type="text" maxlength="250" value="" name="CloneName"/>
                                            <div id="CloneNameError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                                            <div class="FieldExplanation">$Text{"The name must be unique."}</div>
                                        </div>
                                        <div class="Clear"></div>
                                    </fieldset>
                                </form>
                            </div>
                            <div class="ContentFooter Center">
                                <button class="Primary" type="button" id="CloneButtonAction">$Text{"Clone"}</button>
                                <button type="button" id="CancelCloneButtonAction">$Text{"Cancel"}</button>
                            </div>
                        </div>
                        <br/>
                    </li>
<!-- dtl:block:ActionClone -->
<!-- dtl:block:ActionExport -->
                    <li>
                        <form action="$Env{"CGIHandle"}" method="post">
                            <input type="hidden" name="Action" value="$Env{"Action"}"/>
                            <input type="hidden" name="Subaction" value="Export"/>
                            <input type="hidden" name="WebserviceID" value="$QData{"WebserviceID"}"/>
                            <input type="hidden" name="Nav" value="$QData{"Nav"}"/>

                            <button class="CallForAction Download W75pc HideActionOnChange" type="submit"><span>$Text{"Export web service"}</span></button>
                            <br/>
                        </form>
                    </li>
<!-- dtl:block:ActionExport -->
<!-- dtl:block:ActionImport -->
                    <li>
                        <button id="ImportButton" class="CallForAction Upload W75pc " type="button"><span>$Text{"Import web service"}</span></button>
                        <div class="Hidden" id="ImportDialogContainer">
                            <div id="ImportDialog" class="InnerContent GenericInterfaceDialog">
                                <form id="ImportForm" action="$Env{"CGIHandle"}" method="post" enctype="multipart/form-data" name="ImportForm" class="Validate PreventMultipleSubmits">
                                    <input type="hidden" name="Action" value="$Env{"Action"}"/>
                                    <input type="hidden" name="Subaction" value="Import"/>
                                    <fieldset class="TableLike">
                                        <div class="SpacingTop"></div>
                                        <label class="Mandatory" for="ConfigFile"><span class="Marker">*</span>$Text{"Configuration File"}:</label>
                                        <div class="Field">
                                            <input id="ConfigFile" class=" W75pc Validate_Required" type="file" maxlength="250" value="" name="ConfigFile"/>
                                            <div id="ConfigFileError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                                            <div class="FieldExplanation">$Text{"The file must be a valid web service configuration YAML file."}</div>
                                        </div>
                                        <div class="Clear"></div>
                                    </fieldset>
                                </form>
                            </div>
                            <div class="ContentFooter Center">
                                <button class="Primary" type="submit" id="ImportButtonAction">$Text{"Import"}</button>
                                <button type="button" id="CancelImportButtonAction">$Text{"Cancel"}</button>
                            </div>
                        </div>
                        <br/>
                    </li>
<!-- dtl:block:ActionImport -->
<!-- dtl:block:ActionHistory -->
                    <li>
                        <form action="$Env{"CGIHandle"}" method="post">
                            <input type="hidden" name="Action" value="AdminGenericInterfaceWebserviceHistory"/>
                            <input type="hidden" name="WebserviceID" value="$QData{"WebserviceID"}"/>
                            <input type="hidden" name="Nav" value="$QData{"Nav"}"/>

                            <button class="CallForAction History W75pc HideActionOnChange" type="submit"><span>$Text{"Configuration history"}</span></button>
                            <br/>
                        </form>
                    </li>
<!-- dtl:block:ActionHistory -->
<!-- dtl:block:ActionDelete -->
                    <li>
                        <button id="DeleteButton" class="CallForAction Trash W75pc" type="button"><span>$Text{"Delete web service"}</span></button>
                        <div class="Hidden" id="DeleteDialogContainer">
                            <div id ="DeleteDialog" class="InnerContent GenericInterfaceDialog">
                                <span class="WarningDialog ">&nbsp;</span>
                                <p class="Center Warning">$Text{"Do you really want to delete this web service?"}</p>
                                <div class="SpacingTop"></div>
                            </div>
                        </div>
                        <br/>
                    </li>
<!-- dtl:block:ActionDelete -->
<!-- dtl:block:ActionDebugger -->
                    <li>
                        <form action="$Env{"CGIHandle"}" method="post">
                            <input type="hidden" name="Action" value="AdminGenericInterfaceDebugger"/>
                            <input type="hidden" name="WebserviceID" value="$QData{"WebserviceID"}"/>
                            <input type="hidden" name="Nav" value="$QData{"Nav"}"/>

                            <button class="CallForAction Debug W75pc HideActionOnChange" type="submit"><span>$Text{"Debugger"}</span></button>
                            <br/>
                        </form>
                    </li>
<!-- dtl:block:ActionDebugger -->
                </ul>

            </div>
        </div>
<!-- dtl:block:ActionList -->
<!-- dtl:block:Hint -->
        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Hint"}</h2>
            </div>
            <div class="Content">
                <p class="FieldExplanation">
                    $Text{"After you save the configuration you will be redirected again to the edit screen."}
                </p>
                <p class="FieldExplanation">
                    $Text{"If you want to return to overview please click the "Go to overview" button."}
                </p>
            </div>
        </div>
<!-- dtl:block:Hint -->
    </div>
    <div class="ContentColumn">
<!-- dtl:block:OverviewHeader -->
        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Web Service List"}</h2>
            </div>
<!-- dtl:block:OverviewHeader -->
<!-- dtl:block:OverviewResult -->
            <div class="Content ">
                <table class="DataTable" id="WebserviceTable" summary="List of all registered Webservices">
                    <thead>
                        <tr>
                            <th>$Text{"Name"}</th>
                            <th>$Text{"Description"}</th>
                            <th>$Text{"Remote system"}</th>
                            <th>$Text{"Provider transport"}</th>
                            <th>$Text{"Requester transport"}</th>
                            <th>$Text{"Validity"}</th>
                        </tr>
                    </thead>
                    <tbody>
<!-- dtl:block:NoDataFoundMsg -->
                        <tr>
                            <td colspan="5">
                                $Text{"No data found."}
                            </td>
                        </tr>
<!-- dtl:block:NoDataFoundMsg -->

<!-- dtl:block:OverviewResultRow -->
                        <tr>
                            <td>
                                <a class="AsBlock" href="$Env{"Baselink"}Action=$Env{"Action"};Subaction=Change;WebserviceID=$LQData{"ID"};Nav=$LQData{"Nav"}">$QData{"Name"}</a>
                            </td>
                            <td>$Text{"$Data{"Description"}"}</td>
                            <td>$Text{"$Data{"RemoteSystem"}"}</td>
                            <td>$Text{"$Data{"ProviderTransport"}"}</td>
                            <td>$Text{"$Data{"RequesterTransport"}"}</td>
                            <td>$Text{"$Data{"Valid"}"}</td>
                        </tr>
<!-- dtl:block:OverviewResultRow -->

                    </tbody>
                </table>
            </div>
        </div>
<!-- dtl:block:OverviewResult -->
<!-- dtl:block:Details -->
        <div class="WidgetSimple">
            <div class="Header">
                <h2>$Text{"Details"}</h2>
            </div>
            <div class="Content">
                <h3>$Text{"General"}</h3>
                <form action="$Env{"CGIHandle"}" method="post" class="Validate PreventMultipleSubmits">
                    <input type="hidden" name="Action" value="$Env{"Action"}"/>
                    <input type="hidden" name="Subaction" value="$QData{"Action"}Action"/>
                    <input type="hidden" name="WebserviceID" value="$QData{"WebserviceID"}" id="WebserviceID"/>
                    <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"} Validate_Required HideTrigger" type="text" maxlength="250" value="$QData{"Name"}" name="Name"/>
                                    <div id="NameError" class="TooltipErrorMessage"><p>$Text{"This field is required."}</p></div>
                                    <div id="NameServerError" class="TooltipErrorMessage"><p>$Text{"$Data{"NameServerErrorMessage"}"}</p></div>
                                </div>
                                <div class="Clear"></div>

                                <label for="Description">$Text{"Description"}:</label>
                                <div class="Field">
                                    <input id="Description" class="W50pc HideTrigger" type="text" maxlength="250" value="$QData{"Description"}" name="Description"/>
                                </div>
                                <div class="Clear"></div>

                                <label for="RemoteSystem">$Text{"Remote system"}:</label>
                                <div class="Field">
                                    <input id="RemoteSystem" class="W50pc HideTrigger" type="text" maxlength="250" value="$QData{"RemoteSystem"}" name="RemoteSystem"/>
                                </div>
                                <div class="Clear"></div>
                            </fieldset>
                        </div>
                        <div class="Size1of2">
                            <fieldset class="TableLike">
                                <label for="DebugThreshold">$Text{"Debug threshold"}:</label>
                                <div class="Field">
                                    $Data{"DebugThresholdStrg"}
                                </div>
                                <div class="Clear"></div>

                                <label for="ValidID">$Text{"Validity"}:</label>
                                <div class="Field">
                                    $Data{"ValidtyStrg"}
                                </div>
                                <div class="Clear"></div>
                            </fieldset>
                        </div>
                    </div>

<!-- dtl:block:ConfigSet -->
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    Core.Config.Set('Webservice.Transport', $Data{"TransportConfig"} );
    Core.Config.Set('Webservice.Operation', $Data{"OperationConfig"} );
    Core.Config.Set('Webservice.Invoker', $Data{"InvokerConfig"} );
//]]></script>
<!--dtl:js_on_document_complete-->
<!-- dtl:block:ConfigSet -->

<!-- dtl:block:DetailsCommunicationType -->
                    <div class="WidgetSimple Expanded">
                        <div class="Header">
                            <div class="WidgetAction Toggle">
                                <a href="#" title="$JSText{"Show or hide the content"}"></a>
                            </div>
                            <h3>$Text{"$Data{"Title"}"}</h3>
                        </div>
                        <div class="Content">
<!-- dtl:block:DetailsCommunicationTypeExplanationProvider -->
                            <p class="FieldExplanation">
                                $Text{"In provider mode, OTRS offers web services which are used by remote systems."}
                            </p>
<!-- dtl:block:DetailsCommunicationTypeExplanationProvider -->
<!-- dtl:block:DetailsCommunicationTypeExplanationRequester -->
                            <p class="FieldExplanation">
                                $Text{"In requester mode, OTRS uses web services of remote systems."}
                            </p>
<!-- dtl:block:DetailsCommunicationTypeExplanationRequester -->
                            <h4 class="SpacingTop SpacingBottom">$Text{"Settings"}</h4>
                            <fieldset class="TableLike">
                                <label for="$QData{"CommunicationType"}TransportList">$Text{"Network transport"}:</label>
                                <div class="Field">
                                    $Data{"TransportsStrg"}
<!-- dtl:block:DetailsTransportPropertiesButton -->
                                    <button type="button" id="$QData{"CommunicationType"}TransportProperties" class="HideOnChange GenericInterfaceSpacing" value="Configure">$Text{"Configure"}</button>
<!-- dtl:block:DetailsTransportPropertiesButton -->
                                </div>
                            </fieldset>
                            <h4 class="SpacingTop SpacingBottom">$Text{"$Data{"ActionsTitle"}"}</h4>

<!-- dtl:block:DetailsCommunicationTypeActionsExplanationProvider -->
                            <p class="FieldExplanation">
                                $Text{"Operations are individual system functions which remote systems can request."}
                            </p>
<!-- dtl:block:DetailsCommunicationTypeActionsExplanationProvider -->
<!-- dtl:block:DetailsCommunicationTypeActionsExplanationRequester -->
                            <p class="FieldExplanation">
                                $Text{"Invokers prepare data for a request to a remote web service, and process its response data."}
                            </p>
<!-- dtl:block:DetailsCommunicationTypeActionsExplanationRequester -->

                            <table class="DataTable" id="$QData{"ActionsTitle"}Table" summary="list of $QData{"ActionsTitle"}">
                                <thead>
                                    <tr>
                                        <th>$Text{"Name"}</th>
                                        <th>$Text{"Description"}</th>
                                        <th>$Text{"Controller"}</th>
                                        <th>$Text{"Inbound mapping"}</th>
                                        <th>$Text{"Outbound mapping"}</th>
                                    </tr>
                                </thead>
                                <tbody>
<!-- dtl:block:DetailsActionsRow -->
                                    <tr>
                                        <td>
<!-- dtl:block:DetailsActionsRowLink -->
                                            <a class="AsBlock HideLinkOnChange" href="$Env{"Baselink"}Action=$LQData{"Module"};$LQData{"ActionType"}=$LQData{"Name"};Subaction=Change;WebserviceID=$LQData{"WebserviceID"};Nav=$LQData{"Nav"}">
                                                $QData{"Name"}
                                            </a>
<!-- dtl:block:DetailsActionsRowLink -->
<!-- dtl:block:DetailsActionsRowDelete -->
                                            <a id="Delete$QData{"ActionType"}$QData{"Name"}" class="TrashCan Delete$QData{"ActionType"}" href="#" title="$Text{"Delete this action"}">
                                                $Text{"Delete this action"}
                                            </a>
                                            <span>
                                                $QData{"Name"}
                                            </span>
<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
    Core.Agent.Admin.GenericInterfaceWebservice.BindDeleteActionDialog({
        ElementID:                  'Delete$QData{"ActionType"}$QData{"Name"}',
        ActionName:                 '$QData{"Name"}',
        ActionType:                 '$QData{"ActionType"}',
        ElementSelector:            '#Delete$QData{"ActionType"}$QData{"Name"}'
    });
//]]></script>
<!--dtl:js_on_document_complete-->
<!-- dtl:block:DetailsActionsRowDelete -->
                                        </td>
                                        <td>$Text{"$Data{"Description"}"}</td>
                                        <td class="$QData{"ControllerClass"}">$QData{"Controller"}</td>
                                        <td>$Text{"$Data{"MappingInbound"}"}</td>
                                        <td>$Text{"$Data{"MappingOutbound"}"}</td>
                                    </tr>
<!-- dtl:block:DetailsActionsRow -->
<!-- dtl:block:DetailsActionsNoDataFoundMsg -->
                                    <tr>
                                        <td colspan="4">
                                            $Text{"No data found."}
                                        </td>
                                    </tr>
<!-- dtl:block:DetailsActionsNoDataFoundMsg -->
                                </tbody>
                            </table>
<!-- dtl:block:DetailsActionsNoControllerFoundMsg -->
                            <div class="SpacingTop"></div>
                            <p class="Error">
                                $Text{"At least one %s has a controller that is either not active or not present, please check the controller registration or delete the %s", "$Data{"ActionType"}", "$Data{"ActionType"}"}
                            </p>
<!-- dtl:block:DetailsActionsNoControllerFoundMsg -->
                            <div class="SpacingTop"></div>
                            <fieldset class="TableLike">
                                <label class="HideOnChange" for="$QData{"ActionType"}List">$Text{"Add"} $Text{"$Data{"ActionType"}"}:</label>
                                <div class="Field">
                                    $Data{"ControllersStrg"}
                                </div>
                                <div class="Clear"></div>
                            </fieldset>
                        </div>
                    </div>

<!-- dtl:block:DetailsCommunicationType -->
                    <fieldset class="TableLike">
                        <div class="Field SpacingTop">
                            <button type="submit" class="Primary" value="$Text{"Save and continue"}">$Text{"Save"}</button>
<!-- dtl:block:SaveAndFinishButton -->
                            <button type="submit" id="SaveAndFinishButton" value="$Text{"Save and finish"}">$Text{"Save and finish"}</button>
                            <input type="hidden" name="ReturnToWebservice" id="ReturnToWebservice" value="" />
<!-- dtl:js_on_document_complete -->
<script type="text/javascript">//<![CDATA[
$('#SaveAndFinishButton').bind('click', function(){
    $('#ReturnToWebservice').val(1);
});
//]]></script>
<!-- dtl:js_on_document_complete -->
<!-- dtl:block:SaveAndFinishButton -->
                            $Text{"or"}
                            <a href="$Env{"Baselink"}Action=AdminGenericInterfaceWebservice;Subaction=Change;WebserviceID=$QData{"WebserviceID"}">$Text{"Cancel"}</a>
                        </div>
                        <div class="Clear"></div>
                    </fieldset>
                </form>
            </div>
        </div>

        <div class="Hidden" id="DeleteOperationDialogContainer">
            <div id ="DeleteOperationDialog" class="InnerContent GenericInterfaceDialog">
                <span class="WarningDialog ">&nbsp;</span>
                <p class="Center Warning">$Text{"Do you really want to delete this operation?"}</p>
                <div class="SpacingTop"></div>
            </div>
        </div>

        <div class="Hidden" id="DeleteInvokerDialogContainer">
            <div id ="DeleteInvokerDialog" class="InnerContent GenericInterfaceDialog">
                <span class="WarningDialog ">&nbsp;</span>
                <p class="Center Warning">$Text{"Do you really want to delete this invoker?"}</p>
                <div class="SpacingTop"></div>
            </div>
        </div>

<!-- dtl:block:Details -->
    </div>
    <div class="Clear"></div>
</div>
<!-- dtl:block:Main -->

<!--dtl:js_on_document_complete-->
<script type="text/javascript">//<![CDATA[
Core.Agent.Admin.GenericInterfaceWebservice.Init({
    WebserviceID: $('#WebserviceID').val(),
    Localization: {
        CommunicationErrorMsg: '$JSText{"An error occurred during communication."}',
        DeleteWebserviceMsg: '$JSText{"Delete webservice"}',
        DeleteOperationMsg: '$JSText{"Delete operation"}',
        DeleteInvokerMsg: '$JSText{"Delete invoker"}',
        CloneWebserviceMsg: '$JSText{"Clone webservice"}',
        ImportWebserviceMsg: '$JSText{"Import webservice"}',
        DeleteMsg: '$JSText{"Delete"}',
        CloneMsg: '$JSText{"Clone"}',
        ImportMsg: '$JSText{"Import"}',
        CancelMsg: '$JSText{"Cancel"}'
    },
    Action: "$QData{"Action"}"
});
//]]></script>
<!--dtl:js_on_document_complete-->
