<!--                                                                  -->
<!--  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:output method="html" indent="no" doctype-system="" encoding="utf-8" />

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

    <xsl:template name="pickLayout">
        <xsl:call-template name="searchResults" />
        <xsl:call-template name="buttons" />
    </xsl:template>

    <xsl:template name="searchResults">
        <xsl:if test="count(ReportConfigList/ReportConfig) != 0">
            <script>
                function reportConfigDelete(id) {
                    jsInlinePop('Continue with deleting this saved report configuration?','Delete','location.href=\'admin?c=update_report_config&amp;rid=' + id + '&amp;mode=delete\'','Cancel','','Delete Configuration');
                }
            </script>
            <table class="Table Table-with-highlight">
                <thead>
                    <tr class="Table-row Table-row-header">
                        <th class="Table-col">Name</th>
                        <th class="Table-col Table-col-icon">Default</th>
                        <th class="Table-col Table-col-icon">Edit</th>
                        <th class="Table-col Table-col-icon">Delete</th>
                    </tr>
                </thead>
                <tbody>
                    <xsl:for-each select="ReportConfigList/ReportConfig">
                        <tr class="Table-row Table-row-data">
                            <td class="Table-col">
                                <xsl:value-of select="Name" />
                            </td>
                            <td class="Table-col Table-col-icon">
                                <xsl:choose>
                                    <xsl:when test="IsDefault = 'N'">
                                        <a href="admin?c=update_report_config&amp;rid={ReportConfigID}&amp;mode=default">Make&#160;Default</a>
                                    </xsl:when>
                                    <xsl:otherwise>+</xsl:otherwise>
                                </xsl:choose>
                            </td>
                            <td class="Table-col Table-col-icon">
                                <a href="admin?c=edit_report_config&amp;rid={ReportConfigID}">
                                    <xsl:call-template name="icon">
                                        <xsl:with-param name="type" select="'edit'" />
                                        <xsl:with-param name="role" select="'action'" />
                                    </xsl:call-template>
                                </a>
                            </td>
                            <td class="Table-col Table-col-icon">
                                <a href="#" onclick="reportConfigDelete({ReportConfigID}); return false;">
                                    <xsl:call-template name="icon">
                                        <xsl:with-param name="type" select="'delete'" />
                                        <xsl:with-param name="role" select="'action'" />
                                    </xsl:call-template>
                                </a>
                            </td>
                        </tr>
                    </xsl:for-each>
                </tbody>
            </table>
        </xsl:if>
    </xsl:template>

	<xsl:template name="submitButton">
        <xsl:call-template name="uiButton">
            <xsl:with-param name="content" select="'Add New Report Configuration'"/>
            <xsl:with-param name="type" select="'primary'"/>
            <xsl:with-param name="className" select="'Form-button'"/>
            <xsl:with-param name="onClick">javascript:location.href='admin?c=edit_report_config'</xsl:with-param>
        </xsl:call-template>
	</xsl:template>

	<xsl:template name="cancelButton">
		<xsl:call-template name="uiButton">
			<xsl:with-param name="content" select="'Back to Admin'" />
			<xsl:with-param name="type" select="'default'"/>
			<xsl:with-param name="className" select="'Form-button'"/>
			<xsl:with-param name="onClick">javascript:location.href='/bookpub/admin'</xsl:with-param>
		</xsl:call-template>
	</xsl:template>

</xsl:stylesheet>
