<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--  $Id$  -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" xmlns:dyn="http://exslt.org/dynamic" extension-element-prefixes="dyn">

  <xsl:template name="songViewLayout">
   <xsl:if test="Params/_inline">
      <script type="text/javascript">
        addMessage('Form_Track_Master_Song_Success','Song successfully updated!<br />');
        updateField('Form_Track_Master_Song_Title','<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="Form/Song/Title" /></xsl:call-template>');
        updateField('Form_Track_Master_Song_ISWC','<xsl:value-of select="Form/Song/ISWC" />');
        updateField('Form_Track_Master_Song_ComposerName','<xsl:call-template name="escapeJavascript"><xsl:with-param name="string" select="Form/Song/ComposerName" /></xsl:call-template>');
        updateField('Form_Track_Master_Song_ComposerID','<xsl:value-of select="Form/Song/ComposerID" />');
        hidePop = 1;
      </script>
    </xsl:if>
    <xsl:if test="not(Params/_inline)">
      <xsl:call-template name="buttons" />
      <div class="section">
        <xsl:call-template name="songView" />
        <xsl:call-template name="mastersView" />
      </div>
      <xsl:call-template name="buttons" />
      </xsl:if>
  </xsl:template>


  <xsl:template name="songView">
    <fieldset class="section" id="songView">
      <legend>Song</legend>
      <table class="twoRowChart">
            <tbody>
        <xsl:if test="normalize-space(Messages/Message/Code)">
          <tr>
            <td colspan="3">
              <p class="success">Song successfully updated!</p>
            </td>
          </tr>
        </xsl:if>
        <tr>
          <th class="rowLeft">Title</th>
          <th>ISWC</th>
          <th>Composer</th>
        </tr>
        <tr>
          <td class="rowLeft"><xsl:value-of select="Form/Song/Title" /></td>
          <td><xsl:value-of select="Form/Song/ISWC" /></td>
          <td><xsl:value-of select="Form/Song/ComposerName" /></td>
                </tr>
                <tr>
          <td colspan="3" class="bottomRowNoBorder">
            Last modified&#160;<xsl:value-of select="Form/Song/ModifiedDate" />&#160;by&#160;<xsl:value-of select="Form/Song/ModifiedBy" />
          </td>
        </tr>
                </tbody>
      </table>
    </fieldset>
  </xsl:template>

  <xsl:template name="mastersView">
    <fieldset class="section" id="mastersView">
      <legend>Masters</legend>
      <table class="textChart">
        <tbody>
          <tr>
            <xsl:if test="not(Form/MasterList/Master)">
              <xsl:attribute name="class">textChartEmpty</xsl:attribute>
            </xsl:if>
            <th class="rowLeft">Title</th>
            <th id="isrcCol">ISRC</th>
            <th>Artist</th>
            <th id="lengthCol">Length</th>
            <th id="dateCol">Recording Date</th>
          </tr>
          <xsl:for-each select="Form/MasterList/Master">
            <xsl:call-template name="masterViewRow" />
          </xsl:for-each>
        </tbody>
      </table>
      <xsl:if test="not(Form/MasterList/Master)">
        <p>No masters are associated with this song.</p>
      </xsl:if>
    </fieldset>
  </xsl:template>

  <xsl:template name="masterViewRow">
      <tr class="row{position() mod 2}">
        <td class="rowLeft"><xsl:value-of select="Title" /></td>
        <td><xsl:value-of select="ISRC" /></td>
        <td><xsl:value-of select="ArtistName" /></td>
        <td><xsl:value-of select="Duration" /></td>
        <td><xsl:value-of select="DateRecorded" /></td>
      </tr>
  </xsl:template>

</xsl:stylesheet>

