﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:import href="Version_2_0/Notifications.xslt"/>
    <xsl:import href="Version_2_0/Notifications.xslt"/>
    <xsl:include href="Version_2_0/PopUpHeader.xslt"/>
    <xsl:include href="Obsolete/CommunityFollowIT.xslt"/>

    <xsl:template match="/">
        <xsl:variable name="GoalID" select="AjaxRequest/Params/GoalItemID"></xsl:variable>
        <xsl:variable name="TemplateURL" select="AjaxRequest/TemplateURL"></xsl:variable>
        <xsl:variable name="PermissionID" select="AjaxRequest/PermissionID"></xsl:variable>

        <xsl:choose>
            <xsl:when test="not(AjaxRequest/Params/GoalItemID)">
                <xsl:call-template name="ObsoleteCommunityFollowIT">
                    <xsl:with-param name="NotificationVolumes" select="NotificationVolumes/."></xsl:with-param>
                </xsl:call-template>
            </xsl:when>
            <xsl:otherwise>
                <div id="divNotificationAlerts_{$GoalID}">
                    <xsl:call-template name="PopUpHeader">
                        <xsl:with-param name="ItemID" select="$GoalID"></xsl:with-param>
                        <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                        <xsl:with-param name="HeaderText">
                            <xsl:text>Set Notifications and Alerts</xsl:text>
                        </xsl:with-param>
                    </xsl:call-template>
                    <div style="padding:20px;border-bottom:1px solid gray;" id="divNotification_{$GoalID}">
                        <xsl:call-template name="Notifications">
                            <xsl:with-param name="ItemID" select="$GoalID"></xsl:with-param>
                            <xsl:with-param name="NotificationXml" select="AjaxRequest/Notifications"></xsl:with-param>
                        </xsl:call-template>
                    </div>

                    <xsl:if test="$PermissionID &gt;= 4">
                        <div style="padding:20px;" id="divDeleteGoalContent_{$GoalID}">
                            <xsl:call-template name="PauseGoal">
                                <xsl:with-param name="GoalID" select="$GoalID"></xsl:with-param>
                                <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                            </xsl:call-template>
                        </div>
                    </xsl:if>

                    <xsl:if test="$PermissionID &gt;= 4">
                        <div style="padding:20px;" id="divDeleteGoalContent_{$GoalID}">
                            <xsl:call-template name="DeleteGoal">
                                <xsl:with-param name="GoalID" select="$GoalID"></xsl:with-param>
                                <xsl:with-param name="TemplateURL" select="$TemplateURL"></xsl:with-param>
                            </xsl:call-template>
                        </div>
                    </xsl:if>
                </div>
            </xsl:otherwise>
        </xsl:choose>


    </xsl:template>

    <xsl:template name="PauseGoal">
        <xsl:param name="GoalID" select="'N/A'"></xsl:param>
        <xsl:param name="TemplateURL" select="'N/A'"></xsl:param>

        <div class="visionContent" id="divHeaderContent_{$GoalID}">
            Pause this Goal?
        </div>
        <div class="labelGoalTopicsText paddingTop5" id="divContent_{$GoalID}">
            Pausing this goal will move the goal to the bottom of the list and place all progress on hold. Simply press Play on the paused goal to re-activate.
        </div>
        <div align="right" class="paddingTop10">
            <table cellpadding="0" cellspacing="0">
                <tr>
                    <td class="textCenter onMouseOver divBrowseGradient spanBrowseGradientTextGray verticallyMiddle" style="width:95px;height:30px;"
                       onclick="closePopupWhiteLayerContainer();"
							  onmouseover="document.getElementById('img_Cancel').src='{$TemplateURL}Web/Images/Ver_2_0/BT_x_hover.png';"
							  onmouseout="document.getElementById('img_Cancel').src='{$TemplateURL}Web/Images/Ver_2_0/BT_x.png';">
                        <img id="img_Cancel" class="marginRight5" src="{$TemplateURL}Web/Images/Ver_2_0/BT_x.png" align="absmiddle"></img>
                        <span id="span_Cancel" class="capitalFont">CANCEL</span>
                    </td>
                    <td width="10px"></td>
                    <td class="textCenter onMouseOver divBrowseGradient spanBrowseGradientTextGray verticallyMiddle" style="width:95px;height:30px;" onclick='pauseGoal("{$GoalID}","3");'
                        onmouseover="document.getElementById('img_Pause').src='{$TemplateURL}Web/Images/Ver_2_0/icon_add_over.png';"
							  onmouseout="document.getElementById('img_Pause').src='{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png';">
                        <img id="img_Pause" class="marginRight5" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" align="absmiddle"></img>
                        <span id="span_Pause" class="capitalFont">pause</span>
                    </td>
                </tr>
            </table>
        </div>

    </xsl:template>

    <xsl:template name="DeleteGoal">
        <xsl:param name="GoalID" select="'N/A'"></xsl:param>
        <xsl:param name="TemplateURL" select="'N/A'"></xsl:param>

        <div class="visionContent" id="divHeaderContent_{$GoalID}">
            Delete this Goal?
        </div>
        <div class="labelGoalTopicsText paddingTop5" id="divContent_{$GoalID}">
            Deleting this goal will permanently remove the goal and any progress you have
            tracked from your Superpage.
        </div>
        <div align="right" class="paddingTop10" id="divOperationButton_{$GoalID}">
            <table>
                <tr>
                    <td style="height:30px;width:95px;" class="textCenter verticallyMiddle divBrowseGradient onMouseOver spanBrowseGradientTextGray" onclick="closePopupWhiteLayerContainer();"
							  onmouseover="document.getElementById('img_CancelDel').src='{$TemplateURL}Web/Images/Ver_2_0/BT_x_hover.png';"
							  onmouseout="document.getElementById('img_CancelDel').src='{$TemplateURL}Web/Images/Ver_2_0/BT_x.png';">
                        <img id="img_CancelDel" class="marginRight5" src="{$TemplateURL}Web/Images/Ver_2_0/BT_x.png" align="absmiddle"></img>
                        <span id="span_Cancel" class="capitalFont">CANCEL</span>
                    </td>
                    <td width="5px"></td>
                    <td style="height:30px;width:95px;" class="textCenter verticallyMiddle divBrowseGradient onMouseOver spanBrowseGradientTextGray" onclick="if(confirm('Are you sure you want to PERMANENTLY delete your goal.  You cannot reverse this once confirmed'))deleteGoal('{$GoalID}');"
                              onmouseover="document.getElementById('img_Delete').src='{$TemplateURL}Web/Images/Ver_2_0/icon_add_over.png';"
                              onmouseout="document.getElementById('img_Delete').src='{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png';">
                        <img id="img_Delete" class="marginRight5" src="{$TemplateURL}Web/Images/Ver_2_0/icon_Add.png" align="absmiddle"></img>
                        <span id="span_Pause" class="capitalFont">delete</span>
                    </td>
                </tr>
            </table>
        </div>

    </xsl:template>
</xsl:stylesheet>
