<!--                                                                  -->
<!--  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 />', true);
                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">
        <section class="TrackEditModal-section">
            <h4>Song</h4>
            <fieldset class="section" id="songView">
                <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>
        </section>
    </xsl:template>

    <xsl:template name="mastersView">
        <section class="TrackEditModal-section">
            <h4>Masters</h4>
            <fieldset class="Form-section" id="mastersView">
                <table class="Table">
                    <thead>
                        <tr class="Table-row Table-row-header">
                            <xsl:if test="not(Form/MasterList/Master)">
                                <xsl:attribute name="class">textChartEmpty</xsl:attribute>
                            </xsl:if>
                            <th class="Table-col">Title</th>
                            <th class="Table-col" id="isrcCol">ISRC</th>
                            <th class="Table-col">Artist</th>
                            <th class="Table-col" id="lengthCol">Length</th>
                            <th class="Table-col" id="dateCol">Recording Date</th>
                        </tr>
                    </thead>
                    <tbody>
                        <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>
        </section>
    </xsl:template>

    <xsl:template name="masterViewRow">
        <tr class="Table-row Table-row-data">
            <td class="Table-col"><xsl:value-of select="Title" /></td>
            <td class="Table-col"><xsl:value-of select="ISRC" /></td>
            <td class="Table-col"><xsl:value-of select="ArtistName" /></td>
            <td class="Table-col"><xsl:value-of select="Duration" /></td>
            <td class="Table-col"><xsl:value-of select="DateRecorded" /></td>
        </tr>
    </xsl:template>

</xsl:stylesheet>

