﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="/">
        <xsl:variable name="Mode" select="NotificationVolumes/Mode"/>
        <xsl:variable name="RequestedDiv" select="NotificationVolumes/RequestedDiv"/>
        <xsl:variable name="ItemID" select="NotificationVolumes/ItemID"/>
        <xsl:variable name="Origin" select="NotificationVolumes/Origin"/>
        <xsl:variable name="VolumeLevel">
            <xsl:value-of select ="normalize-space(NotificationVolumes/VolumeLevel)"/>
        </xsl:variable>
        <div id="divHead" class="overlapLeft" style="display: table;">
            <span class="labelHeader overlapLeftText">Follow It</span>
        </div>
        <div id="divCommunitySearch" style="margin:5px;text-align:right;">
            <xsl:choose>
                <xsl:when test="$Mode = 'Community' and $RequestedDiv != 'divBrand_UserSettings'">
                    <span class="link" onclick='FlipDivs();'>[ X ]</span>
                </xsl:when>
                <xsl:otherwise>
                    <span>&#xa0;</span>
                </xsl:otherwise>
            </xsl:choose>
           
            <xsl:if test ="$Mode = 'Goal'">
                <span class="link" onclick='CloseGoalOperations();'>[ X ]</span>
            </xsl:if>
            <xsl:if test ="$Mode = 'DashBoard'">
                <span>&#xa0;</span>
            </xsl:if>
        </div>
        
        <div style="padding-top: 15px">
            <div ID="divLeft" style="padding-left: 50px; color: #17375E;">
                <xsl:if test="normalize-space(NotificationVolumes/ItemID) != 1">
                    <xsl:if test ="$VolumeLevel=3">
                        <input id="cbVolumeLevel" type="checkbox" checked="checked" onclick="UpdateNotificationVolume(this, {normalize-space(NotificationVolumes/ItemID)},'divLeft');">
                        </input>
                        <span class="label">
                            You are now following the <xsl:value-of select ="NotificationVolumes/Item"></xsl:value-of>
                        </span>
                    </xsl:if>

                    <xsl:if test ="$VolumeLevel=0">
                        <input id="cbVolumeLevel" type="checkbox" onclick="UpdateNotificationVolume(this, {normalize-space(NotificationVolumes/ItemID)},'divLeft');">
                        </input>
                        <span class="label">
                            You are now following the <xsl:value-of select ="NotificationVolumes/Item"></xsl:value-of>
                        </span>
                    </xsl:if>
                    <br />
                    <xsl:if test="count(NotificationVolumes/NotificationVolume) != 0">
                        <span class="label">&#xa0;&#xa0;Notification Levels are set for : </span>
                    </xsl:if>
                </xsl:if>
            </div>
            <br />
            <xsl:for-each select="NotificationVolumes/NotificationVolume[not(following::NotificationVolume/ItemType = ItemType)]">
                <xsl:variable name="PrimaryItemType" select="ItemType"/>
                <div id="div_{$PrimaryItemType}" style="margin-left: 30px; margin-right: 30px;">
                    <div id="div_{$PrimaryItemType}_Header" class="seperatorLine link">
                        <table cellspacing="0" cellpadding="0" width="100%">
                            <tr>
                                <td style="width: 40%; text-align: left;">
                                    <b>
                                        <span class="labelBoldItalic" onclick="FollowIt_headerDivExpandCollapse('div_{$PrimaryItemType}_Content');">
                                            <xsl:value-of select ="ItemType"/>
                                        </span>
                                    </b>
                                </td>
                                <td style="width: 30%; text-align: center">
                                    <b>
                                        <span class="labelBoldItalic">Track It Box</span>
                                    </b>
                                </td>
                                <td style="width: 30%; text-align: center">
                                    <b>
                                        <span class="labelBoldItalic">E-mail</span>
                                    </b>
                                </td>
                            </tr>
                        </table>
                    </div>
                    <div id="div_{$PrimaryItemType}_Content" style="display: block;">
                        <table cellspacing="0" cellpadding="0" width="100%">
                            <xsl:for-each select ="../NotificationVolume[normalize-space(ItemType)=$PrimaryItemType]">
                                <tr style="height: 30px">
                                    <td style="width: 40%; text-align: left;">
                                        <xsl:variable name ="NotificationTypeID">
                                            <xsl:value-of select ="normalize-space(NotificationTypeID/.)"/>
                                        </xsl:variable>
                                        <span id="span_{$NotificationTypeID}_FollowIt" class="label" style="color: #17375E;">
                                            <xsl:value-of select ="Description"/>
                                        </span>
                                    </td>
                                    <td style="width: 30%; text-align: center">
                                        <xsl:variable name ="NotificationYN">
                                            <xsl:value-of select ="normalize-space(NotificationYN)"/>
                                        </xsl:variable>
                                        <xsl:if test ="$NotificationYN = 1">
                                            <input id="cbNotificationVolume" type="checkbox" checked="checked" onclick="UpdateFollowItNotification(this, {normalize-space(NotificationTypeID)},'NotificationYN','{normalize-space($RequestedDiv)}','{normalize-space($ItemID)}');"/>
                                        </xsl:if>
                                        <xsl:if test ="$NotificationYN = 0">
                                            <input id="cbNotificationVolume" type="checkbox" onclick="UpdateFollowItNotification(this, {normalize-space(NotificationTypeID)},'NotificationYN','{normalize-space($RequestedDiv)}', '{normalize-space($ItemID)}');"/>
                                        </xsl:if>
                                    </td>
                                    <td style="width: 30%; text-align: center">
                                        <xsl:variable name ="NotificationEmailYN">
                                            <xsl:value-of select ="normalize-space(NotificationEmailYN)"/>
                                        </xsl:variable>
                                        <xsl:if test ="$NotificationEmailYN = 1">
                                            <input id="cbEmailVolume" type="checkbox" checked="checked" onclick="UpdateFollowItNotification(this, {normalize-space(NotificationTypeID)},'NotificationEmailYN','{normalize-space($RequestedDiv)}', '{normalize-space($ItemID)}');"/>
                                        </xsl:if>
                                        <xsl:if test ="$NotificationEmailYN = 0">
                                            <input id="cbEmailVolume" type="checkbox" onclick="UpdateFollowItNotification(this, {normalize-space(NotificationTypeID)},'NotificationEmailYN','{normalize-space($RequestedDiv)}', '{normalize-space($ItemID)}');"/>
                                        </xsl:if>
                                    </td>
                                </tr>
                            </xsl:for-each>
                        </table>
                    </div>
                </div>
            </xsl:for-each>
            <!--<table style="width: 100%;">
                <tr style="height: 30px">
                    <td style="width: 40%; text-align: left; padding-left: 50px">
                        <b>
                            <u>
                                <span class="label">Settings</span>
                            </u>
                        </b>
                    </td>
                    <td style="width: 30%; text-align: center">
                        <b>
                            <u>
                                <span class="label">What's New</span>
                            </u>
                        </b>
                    </td>
                    <td style="width: 30%; text-align: center">
                        <b>
                            <u>
                                <span class="label">E-mail Me</span>
                            </u>
                        </b>
                    </td>
                </tr>
                <xsl:for-each select ="NotificationVolumes/NotificationVolume">
                    <tr style="height: 30px">
                        <td style="width: 40%; text-align: left; padding-left: 50px">
                            <xsl:variable name ="NotificationTypeID">
                                <xsl:value-of select ="normalize-space(NotificationTypeID/.)"/>
                            </xsl:variable>
                            
                            -->
            <!--<xsl:if test ="$NotificationTypeID = 19">
                <span class="label">New Featured Post</span>
              </xsl:if>
              <xsl:if test ="$NotificationTypeID = 20">
                <span class="label">New User Post</span>
              </xsl:if>
              <xsl:if test ="$NotificationTypeID = 21">
                <span class="label">New Discussion</span>
              </xsl:if>
              <xsl:if test ="$NotificationTypeID = 22">
                <span class="label">Comments (My Discussion)</span>
              </xsl:if>
              <xsl:if test ="$NotificationTypeID = 23">
                <span class="label">Comments (My Posts)</span>
              </xsl:if>
              <xsl:if test ="$NotificationTypeID = 24">
                <span class="label">Comments (All Posts)</span>
              </xsl:if>-->
            <!--
                            -->
            <!--<xsl:if test ="$NotificationTypeID = 25">
                <span class="label">Daily Digest (Coming Soon)</span>
              </xsl:if>-->
            <!--
                            <span id="span_{$NotificationTypeID}_FollowIt" class="label">
                                <xsl:value-of select ="NotificationTypeCode"/>
                            </span>
                        </td>
                        <td style="width: 30%; text-align: center">
                            <xsl:variable name ="NotificationYN">
                                <xsl:value-of select ="normalize-space(NotificationYN)"/>
                            </xsl:variable>
                            
                            <xsl:if test ="$VolumeLevel=3">
                                <xsl:if test ="$NotificationYN = 1">
                                    <input id="cbNotificationVolume" type="checkbox" checked="checked" onclick="UpdateFollowItNotification(this, {normalize-space(NotificationTypeID)},'NotificationYN','{normalize-space($RequestedDiv)}','{normalize-space($ItemID)}');"/>
                                </xsl:if>
                                <xsl:if test ="$NotificationYN = 0">
                                    <input id="cbNotificationVolume" type="checkbox" onclick="UpdateFollowItNotification(this, {normalize-space(NotificationTypeID)},'NotificationYN','{normalize-space($RequestedDiv)}', '{normalize-space($ItemID)}');"/>
                                </xsl:if>
                            </xsl:if>
                            <xsl:if test ="$VolumeLevel=0">
                                <xsl:if test ="$NotificationYN = 1">
                                    <input id="cbNotificationVolume" type="checkbox" disabled="true" checked="checked" onclick="UpdateFollowItNotification(this, {normalize-space(NotificationTypeID)},'NotificationYN','{normalize-space($RequestedDiv)}','{normalize-space($ItemID)}');"/>
                                </xsl:if>
                                <xsl:if test ="$NotificationYN = 0">
                                    <input id="cbNotificationVolume" type="checkbox" disabled="true" onclick="UpdateFollowItNotification(this, {normalize-space(NotificationTypeID)},'NotificationYN','{normalize-space($RequestedDiv)}', '{normalize-space($ItemID)}');"/>
                                </xsl:if>
                            </xsl:if>
                        </td>
                        <td style="width: 30%; text-align: center">
                            <xsl:variable name ="NotificationEmailYN">
                                <xsl:value-of select ="normalize-space(NotificationEmailYN)"/>
                            </xsl:variable>
                            <xsl:if test ="$NotificationEmailYN = 1">
                                <input id="cbEmailVolume" type="checkbox" disabled="true" checked="checked" onclick="UpdateFollowItNotification(this, {normalize-space(NotificationTypeID)},'NotificationEmailYN','{normalize-space($RequestedDiv)}', '{normalize-space($ItemID)}');"/>
                            </xsl:if>
                            <xsl:if test ="$NotificationEmailYN = 0">
                                <input id="cbEmailVolume" type="checkbox" disabled="true" onclick="UpdateFollowItNotification(this, {normalize-space(NotificationTypeID)},'NotificationEmailYN','{normalize-space($RequestedDiv)}', '{normalize-space($ItemID)}');"/>
                            </xsl:if>
                        </td>
                    </tr>
                </xsl:for-each>
            </table>-->
            <br />
        </div>
    </xsl:template>
</xsl:stylesheet>
