﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template name="ObsoleteCommunityFollowIT">
        <xsl:param name="NotificationVolumes" select="'N/A'"></xsl:param>
        <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="moduleBoxGradient verticallyMiddle" style="height:36px;padding-top:5px;">
            <span class="moduleBoxHeaderRightSide marginLeft5" style="color:#FFFFFF;">Notifications</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="publicationSummary">
                            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="publicationSummary">
                            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="publicationSummary">&#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"/>
              <xsl:if test="$PrimaryItemType!='Relationships' and $PrimaryItemType!='Workout'">
                <div id="div_{$PrimaryItemType}" style="margin-left: 20px; margin-right: 20px;">
                    <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="packageTitle" style="font-style:italic;" 
                                              onclick="FollowIt_headerDivExpandCollapse('div_{$PrimaryItemType}_Content');">
                                            <xsl:value-of select ="ItemType"/>
                                        </span>
                                    </b>
                                </td>
                                <td style="width: 30%; text-align: center">
                                    <b>
                                        <span class="packageTitle" style="font-style:italic;">Browser/App</span>
                                    </b>
                                </td>
                                <td style="width: 30%; text-align: center">
                                    <b>
                                        <span class="packageTitle" style="font-style:italic;">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="publicationSummary">
                                            <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:if>
            </xsl:for-each>
            <br />
        </div>
    </xsl:template>
</xsl:stylesheet>
