<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--  $Id$  -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:include href="/app/tools/common/production/templates/list_nav.xsl" />

  <xsl:template name="catalogListLayout">
    <div class="section">
			<xsl:if test="LabelList/Label">
				<xsl:call-template name="labelSelectForm" />
			</xsl:if>
<!--			<xsl:call-template name="listNav" /> -->
			<xsl:choose>
				<xsl:when test="count(AlbumList/Album) = 0">
					<p>No albums are available under this heading.</p>
				</xsl:when>
				<xsl:otherwise>
                    <xsl:call-template name="numericListNavSetup" />
					<xsl:call-template name="catalogList" />
                    <xsl:call-template name="numericListNavSetup" />
<!--					<xsl:call-template name="listNav" />  -->
				</xsl:otherwise>
			</xsl:choose>
		</div>
	</xsl:template>

    <xsl:template name="numericListNavSetup">
        <xsl:call-template name="alphaListNav">
            <xsl:with-param name="pagination">/Root/AlbumList/Pagination</xsl:with-param>
            <xsl:with-param name="extraParams">
                <xsl:if test="/Root/Params/label">&amp;label=<xsl:value-of select="/Root/Params/label" /></xsl:if>
            </xsl:with-param>
        </xsl:call-template>
        <xsl:call-template name="numericListNav">
            <xsl:with-param name="pagination">/Root/AlbumList/Pagination</xsl:with-param>
            <xsl:with-param name="extraParams">
                <xsl:if test="/Root/Params/label">&amp;label=<xsl:value-of select="/Root/Params/label" /></xsl:if>
            </xsl:with-param>
        </xsl:call-template>    
    </xsl:template>
	

	<xsl:template name="labelSelectForm">
    <div class="listSelect">
      <form action="/rps/catalog" method="get">
				<input type="hidden" name="page" value="{Params/page}" />
        <input type="hidden" name="c" value="list" />
        Now Viewing:
        <select name="label">
          <option value="">All Labels</option>
          <xsl:for-each select="LabelList/Label">
            <option value="{LabelID}">
							<xsl:if test="LabelID = /Root/Params/label">
								<xsl:attribute name="selected">selected</xsl:attribute>
							</xsl:if>
							<xsl:value-of select="LabelName" />
						</option>
          </xsl:for-each>
        </select>
        <input type="submit" name="go" value="Go" />
      </form>
    </div>
  </xsl:template>

	<xsl:template name="catalogList">
      <table class="textChart hiOn">
        <tr>
          <th class="rowLeft">Title</th>
          <th>Catalog&#160;#</th>
					<th>Artist</th>
          <xsl:if test="LabelList/Label">
            <th>Label</th>
          </xsl:if>
          <th class="status">Status</th>

          <xsl:if test="Access/rps/catalog/edit or Access/rps/catalog/da_edit">
            <th class="editCol">Edit</th>
          </xsl:if>

        </tr>
        <xsl:for-each select="AlbumList/Album">
          <tr class="row{position() mod 2}">
            <td class="rowLeft"><a href="catalog?AlbumID={AlbumID}&amp;c={$daTest}show"><xsl:value-of select="Title" /><xsl:if test="TitleVersion != ''"> (<xsl:value-of select="TitleVersion" />)</xsl:if></a></td>
            <td><xsl:value-of select="CatalogNumber" /></td>
						<td><xsl:value-of select="ArtistName" /></td>
            <xsl:if test="/Root/LabelList/Label">
              <xsl:variable name="albumLabelID"><xsl:value-of select="LabelID" /></xsl:variable>
              <td><xsl:value-of select="/Root/LabelList/Label[LabelID = $albumLabelID]/LabelName" /></td>
            </xsl:if>
            <td class="status">
							<xsl:call-template name="albumStatus">
								<xsl:with-param name="status" select="Status" />
							</xsl:call-template>
            </td>

            <xsl:if test="/Root/Access/rps/catalog/edit or /Root/Access/rps/catalog/da_edit">
            <td class="icon">
							<a href="catalog?c={$daTest}edit&amp;AlbumID={AlbumID}" title="Edit">
								<img src="/production/images/icons/office/Edit-(16x16).gif" height="16" width="16" />
							</a>
						</td>
            </xsl:if>

          </tr>
        </xsl:for-each>
      </table>
  </xsl:template>

</xsl:stylesheet>
