<!--                                                                  -->
<!--  Copyright (C) 2006 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--  $Id$  -->
<!--                                                                  -->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html" indent="no" doctype-system="http://www.w3.org/TR/html4/strict.dtd" doctype-public="-//W3C//DTD HTML 4.01//EN" encoding="utf-8" />

    <xsl:include href="/app/tools/rps/templates/global.xsl" />
    <xsl:include href="shared.xsl" />

    <xsl:template name="pickLayout">
        <div class="section">
			<xsl:call-template name="publisherTypeSelectForm" />
			<xsl:call-template name="listNav" />
			<xsl:choose>
				<xsl:when test="count(Publisher) = 0">
					<p>No publishers are available under this heading.</p>
				</xsl:when>
				<xsl:otherwise>
					<xsl:call-template name="publisherListTable" />
					<xsl:call-template name="listNav" />
				</xsl:otherwise>
			</xsl:choose>
		</div>
	</xsl:template>

	<xsl:template name="publisherListTable">
        <table class="textChart hiOn">
            <tr>
                <th class="rowLeft">Name</th>
                <th>Type</th>
				<th>Admin</th>
				<th>Agent</th>
                <th class="editCol">Edit</th>
            </tr>
            <xsl:for-each select="Publisher">
                <tr class="row{position() mod 2}">
                    <td>
				        <a href="?PublisherID={PublisherID}&amp;c=show"><xsl:value-of select="PublisherName" /></a>
				    </td>
				    <td>
                        <xsl:choose>
                            <xsl:when test="IsAgency = 1">Agency</xsl:when>
                            <xsl:when test="IsAdmin = 1">Administrator</xsl:when>
                            <xsl:otherwise>Standard</xsl:otherwise>
                        </xsl:choose>
					</td>
					<td><xsl:value-of select="AdminName" /></td>
                    <td><xsl:value-of select="AgentName" /></td>
                    <td class="icon">
                        <a href="?c=edit&amp;PublisherID={PublisherID}" title="Edit">
                            <img src="/production/images/icons/office/Edit-(16x16).gif" />
                        </a>
					</td>
                </tr>
            </xsl:for-each>
        </table>
    </xsl:template>
    

    <xsl:template name="publisherTypeSelectForm">
        <div class="listSelect">
            <form action="{$area}" method="get" id="publisherFilter">
                <input type="hidden" name="page" value="{Params/page}" />
                <input type="hidden" name="c" value="list" />
                Now Viewing:
                <select name="filter">
                    <option value="">All Publisher</option>
                    <option value="direct">
                        <xsl:if test="Params/filter = 'direct'">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
                        Direct Publishers
                    </option>
                    <option value="hasAdmin">
                        <xsl:if test="Params/filter = 'hasAdmin'">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
                        Publishers with Admin Only
                    </option>
                    <option value="hasAgent">
                        <xsl:if test="Params/filter = 'hasAgent'">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
                        Publishers with Agent
                    </option>
                    <option value="admin">
                        <xsl:if test="Params/filter = 'admin'">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
                        Administrators
                    </option>
                    <option value="agent">
                        <xsl:if test="Params/filter = 'agent'">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
                        Agents
                    </option>
                </select>
                <select name="publisherType" onChange="updateFormAction(this.value, 'publisherFilter')">
                    <option value="ca_publisher">Canadian</option>
                    <option value="publisher">
                        <xsl:if test="$area = 'publisher'">
                            <xsl:attribute name="selected">selected</xsl:attribute>
                        </xsl:if>
                        United States
                    </option>
                </select>
                <input type="submit" name="go" value="Go" />
            </form>
        </div>
    </xsl:template>

</xsl:stylesheet>
