﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template name="DiscussionControlsObselete">
        <xsl:param name="IsCommunityAdmin" select="'N/A'"></xsl:param>
        <xsl:param name="Origin" select="'N/A'"></xsl:param>
        <xsl:param name="ItemID" select="'N/A'"></xsl:param>
        <xsl:param name="ExcludeDiscussionItemID" select="'N/A'"></xsl:param>
        <xsl:param name="ParentType" select="'N/A'"></xsl:param>
        <xsl:param name="PrimaryItemID" select="'N/A'"></xsl:param>
        <xsl:param name="SourceItemTypeID" select="'N/A'"></xsl:param>
        <xsl:param name="DiscussionCount" select="'N/A'"></xsl:param>
        <xsl:param name="IsAdmin" select="'N/A'"></xsl:param>
        <xsl:param name="RoleName" select="'N/A'"></xsl:param>
        <xsl:param name="IsFollowing" select="'N/a'"></xsl:param>
        <xsl:param name="ShowViewAllDisc" select="'N/A'"></xsl:param>

        <xsl:variable name="displayStyle">
            <xsl:choose>
                <xsl:when test="$DiscussionCount &gt; 2">
                    <xsl:text>display: inline;</xsl:text>
                </xsl:when>
                <xsl:otherwise>
                    <xsl:text>display:none</xsl:text>
                </xsl:otherwise>
            </xsl:choose>
        </xsl:variable>

        <div align="center">
            <xsl:if test="$ShowViewAllDisc = 'yes'">
                <xsl:choose>
                    <xsl:when test="$Origin = 'ViewAllDiscussionAsync'">
                        <xsl:choose>
                            <xsl:when test="$ParentType ='17'">
                                <span id="span_ViewAllDiscussions" class="packageTitle onMouseOver" style="{$displayStyle}"
                                      onclick="viewAllDiscussionAsync('{$PrimaryItemID}', '{$ExcludeDiscussionItemID}', 'divListDiscussions_Data');">View All Discussions</span>
                            </xsl:when>
                            <xsl:otherwise>
                                <span id="span_ViewAllDiscussions" class="packageTitle onMouseOver" style="{$displayStyle} "
                                      onclick="viewAllDiscussionAsync('{$ItemID}', '{$ExcludeDiscussionItemID}', 'divListDiscussions_Data');">View All Discussions</span>
                            </xsl:otherwise>
                        </xsl:choose>
                    </xsl:when>
                    <xsl:otherwise>
                        <span id="span_ViewAllDiscussions" class="packageTitle onMouseOver" style="{$displayStyle}"
                              onclick="makeAllDiscussionsVisible();">View All Discussions</span>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:if>

            <xsl:if test="$IsAdmin = 1 
                    or $IsCommunityAdmin = 'True'
                    or $RoleName/Role[RoleName = 'Brand Admin']
                    or $IsFollowing = 1">
                <xsl:choose>
                    <xsl:when test="$SourceItemTypeID != 3">
                        <span class="packageTitle onMouseOver" style="margin-left: 10px; margin-right: 10px;"
                         onClick="return flipDiscussionBox('divListDiscussions', 'divAddDiscussions');">Start a Discussion</span>
                    </xsl:when>
                    <xsl:otherwise>
                        <span class="packageTitle onMouseOver" style="margin-left: 10px; margin-right: 10px;"
                         onClick="community_LoadFollowCommunitiesToSelect('{$ItemID}', '{$PrimaryItemID}', '{$ParentType}');">Start a Discussion</span>
                    </xsl:otherwise>
                </xsl:choose>
            </xsl:if>
        </div>
    </xsl:template>
</xsl:stylesheet>
