<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">

  <xsl:include href="/app/tools/support/templates/layout.xsl" />

  <xsl:template name="mainBody" >
    <xsl:call-template name="bodyTitle" >
      <xsl:with-param name="title">Distribution Service Detail</xsl:with-param>
    </xsl:call-template>
    <xsl:call-template name="bodyMessage" />
    <xsl:call-template name="displayForm" />
  </xsl:template>

  <xsl:template name="displayForm" >
    <div name="body_form">
    <form method="post" action="{$moduleURL}" >
      <input type="hidden" name="c"><xsl:attribute name="value"><xsl:value-of select="/Root/Cmd" /></xsl:attribute></input>
      <input type="hidden" name="ServiceCredentialID"><xsl:attribute name="value"><xsl:value-of select="Form/ServiceCredentialID" /></xsl:attribute></input>
      <input type="hidden" name="ServiceAccountID"><xsl:attribute name="value"><xsl:value-of select="/Root/Params/ServiceAccountID" /></xsl:attribute></input>
      <input type="hidden" name="ClientID"><xsl:attribute name="value"><xsl:value-of select="/Root/Params/ClientID" /></xsl:attribute></input>
      <input type="hidden" name="action"><xsl:attribute name="value"><xsl:value-of select="Params/action" /></xsl:attribute></input>
      <xsl:choose>
        <xsl:when test="Form/ServiceCredentialID &gt; 0">
          <xsl:call-template name="displayDetail" />
          <xsl:call-template name="displayButtons" />
        </xsl:when>
        <xsl:when test="/Root/Params/action = 'new'">
          <xsl:call-template name="displayDetail" />
          <xsl:call-template name="displayButtons" />
        </xsl:when>
        <xsl:otherwise>
          Service Credential not found
        </xsl:otherwise>
      </xsl:choose>
    </form>
    </div>
  </xsl:template>

  <xsl:template name="displayDetail" >
    <fieldset>
      <legend>Service Credential</legend>
      <table>

        <tr>
          <xsl:call-template name="textField" >
            <xsl:with-param name="label">Service Credential ID</xsl:with-param>
            <xsl:with-param name="value" select = "Form/ServiceCredentialID" />
          </xsl:call-template>
        </tr>

        <tr>
          <xsl:call-template name="textField" >
            <xsl:with-param name="label">Description</xsl:with-param>
            <xsl:with-param name="name">Form_Description</xsl:with-param>
            <xsl:with-param name="value" select = "Form/Description" />
            <xsl:with-param name="width" >50</xsl:with-param>
          </xsl:call-template>
        </tr>

        <tr>
          <xsl:call-template name="textField" >
            <xsl:with-param name="label">Hostname</xsl:with-param>
            <xsl:with-param name="name">Form_Hostname</xsl:with-param>
            <xsl:with-param name="value" select = "Form/Hostname" />
            <xsl:with-param name="width" >50</xsl:with-param>
          </xsl:call-template>
        </tr>

        <tr>
          <xsl:call-template name="textField" >
            <xsl:with-param name="label">Port</xsl:with-param>
            <xsl:with-param name="name">Form_Port</xsl:with-param>
            <xsl:with-param name="value" select = "Form/Port" />
            <xsl:with-param name="width" >10</xsl:with-param>
          </xsl:call-template>
        </tr>

        <tr>
          <xsl:call-template name="listField" >
            <xsl:with-param name="label">Protocol</xsl:with-param>
            <xsl:with-param name="name">Form_Protocol</xsl:with-param>
            <xsl:with-param name="value" select = "Form/Protocol" />
            <xsl:with-param name="options" >
              <option name="itms">iTunes</option>
              <option name="ftp">FTP</option>
              <option name="sftp">SFTP</option>
            </xsl:with-param>
          </xsl:call-template>
        </tr>

        <tr>
          <xsl:call-template name="textField" >
            <xsl:with-param name="label">SFX Account</xsl:with-param>
            <xsl:with-param name="name">Form_SfxAcctName</xsl:with-param>
            <xsl:with-param name="value" select = "Form/SfxAcctName" />
          </xsl:call-template>
        </tr>

        <tr>
          <xsl:call-template name="textField" >
            <xsl:with-param name="label">Username</xsl:with-param>
            <xsl:with-param name="name">Form_Username</xsl:with-param>
            <xsl:with-param name="value" select = "Form/Username" />
          </xsl:call-template>
        </tr>

        <tr>
          <xsl:call-template name="textField" >
            <xsl:with-param name="label">Password</xsl:with-param>
            <xsl:with-param name="name">Form_Password</xsl:with-param>
            <xsl:with-param name="value" select = "Form/Password" />
          </xsl:call-template>
        </tr>

        <tr>
          <xsl:call-template name="textField" >
            <xsl:with-param name="label">Authfile</xsl:with-param>
            <xsl:with-param name="name">Form_Authfile</xsl:with-param>
            <xsl:with-param name="value" select = "Form/Authfile" />
          </xsl:call-template>
        </tr>


      </table>
    </fieldset>
  </xsl:template>

  <xsl:template name="displayButtons" >
    <xsl:if test="/Root/Params/ServiceAccountID" >
      <xsl:call-template name="backButton" >
        <xsl:with-param name="buttonText">Return to Service Account</xsl:with-param>
        <xsl:with-param name="command" >service_account_detail</xsl:with-param>
        <xsl:with-param name="args" >
          <ServiceAccountID><xsl:value-of select="/Root/Params/ServiceAccountID" /></ServiceAccountID>
          <ClientID><xsl:value-of select="/Root/Params/ClientID" /></ClientID>
        </xsl:with-param>
      </xsl:call-template>
    </xsl:if>
    <xsl:call-template name="submitButton" />
  </xsl:template>

</xsl:stylesheet>
