<!--                                                                  -->
<!--  Copyright (C) 2009 RoyaltyShare, Inc.   All Rights Reserved     -->
<!--                                                                  -->
<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" />

    [% FOREACH module = Form.Modules.Module %]
        <xsl:include href="[% module.Stylesheet %]" />
    [% END %]

    <xsl:template name="pickLayout">
        <link href="/production/css/bookpub/dashboard.css?v=1" media="screen" rel="stylesheet" type="text/css" />
        <xsl:call-template name="displayAlert" />
        <xsl:call-template name="displayDashboardBody" />
    </xsl:template>

    <xsl:template name="displayAlert">
        <xsl:if test="Form/Alert">
            <xsl:call-template name="uiWarning">
                <xsl:with-param name="type" select="'error'" />
                <xsl:with-param name="title"><xsl:value-of select="Form/Alert/Title" /></xsl:with-param>
                <xsl:with-param name="description"><xsl:value-of select="Form/Alert/Synopsis" /></xsl:with-param>
            </xsl:call-template>
        </xsl:if>
    </xsl:template>

    <xsl:template name="displayDashboardBody">
        <div class="Bookdashboard">
            <section class="Bookdashboard-main">

                <xsl:if test="/Root/Access/bookpub/tracker/main = 1">
                    <section class="Bookdashboard-section Bookdashboard-dashboardSalesTrends">
                        <xsl:call-template name="dashboardSalesTrends" >
                            <xsl:with-param name="module" select="Form/Modules/Module[Template = 'dashboardSalesTrends' ]" />
                            <xsl:with-param name="title" select="'Digital Sales Trends'" />
                        </xsl:call-template>
                    </section>
                </xsl:if>

                <xsl:if test="/Root/Access/bookpub/analytics/b = 1">
                    <section class="Bookdashboard-section">
                        <xsl:call-template name="dashboardBookSummary" >
                            <xsl:with-param name="module" select="Form/Modules/Module[Template = 'dashboardBookSummary']" />
                            <xsl:with-param name="title" select="'Top Books'" />
                        </xsl:call-template>
                    </section>
                </xsl:if>

            </section>
            <aside class="Bookdashboard-aside">

                <xsl:if test="/Root/Access/bookpub/tracker/main = 1">
                    <section class="Bookdashboard-section">
                        <xsl:call-template name="dashboardTasks" >
                            <xsl:with-param name="module" select="Form/Modules/Module[Template = 'dashboardTasks' ]" />
                            <xsl:with-param name="title" select="'Tasks'" />
                        </xsl:call-template>
                    </section>
                </xsl:if>

                <xsl:if test="/Root/Access/bookpub/analytics/bs = 1">
                    <section class="Bookdashboard-section">
                        <xsl:call-template name="dashboardCatalogSummary" >
                            <xsl:with-param name="module" select="Form/Modules/Module[Template = 'dashboardCatalogSummary' ]" />
                            <xsl:with-param name="title" select="'Catalog Summary'" />
                        </xsl:call-template>
                    </section>
                </xsl:if>

                <xsl:if test="/Root/Access/bookpub/tracker/main = 1">
                    <section class="Bookdashboard-section">
                        <xsl:call-template name="dashboardFileSummary" >
                            <xsl:with-param name="module" select="Form/Modules/Module[Template = 'dashboardFileSummary' ]" />
                            <xsl:with-param name="title" select="'Sales Feed Updates'" />
                        </xsl:call-template>
                    </section>
                </xsl:if>

            </aside>
        </div>
    </xsl:template>

</xsl:stylesheet>


