﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">
        <div id="divListDiscussions_Data">
            <xsl:call-template name="AddNewDiscussionObselete">
                <xsl:with-param name="ParentType" select="AjaxRequest/Params/ParentType"></xsl:with-param>
                <xsl:with-param name="ItemID" select="AjaxRequest/Params/ItemID"></xsl:with-param>
                <xsl:with-param name="PrimaryItemID" select="AjaxRequest/Params/PrimaryItemID"></xsl:with-param>
            </xsl:call-template>
        </div>
    </xsl:template>
    
    <xsl:template name="AddNewDiscussionObselete">
        <xsl:param name="ParentType" select="'N/A'"></xsl:param>
        <xsl:param name="ItemID" select="'N/A'"></xsl:param>
        <xsl:param name="PrimaryItemID" select="'N/A'"></xsl:param>
         

        <div id="divAddDiscussions" style="display: none;">
            <table class="tableMaster">
                <tr>
                    <td colspan="2" style="padding-bottom: 10px;">
                        <span class="packageTitle">Add a New Discussion</span>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="publicationSummary">Topic:</span>
                    </td>
                    <td>
                        <input id="txt_Topic" type="text" class="text" value ="" maxlength="50" style="border: 2px solid #D2D3D4;"/>
                        <span id ="span_ErrorMessage" class="labelError" style="display:none;">*</span>
                    </td>
                </tr>
                <tr>
                    <td>
                        <span class="publicationSummary">Comments:</span>
                    </td>
                    <td>
                        <textarea id="txt_Comment" rows="2" class="textArea" style="border: 2px solid #D2D3D4">
                        </textarea>
                    </td>
                </tr>
                <tr>
                    <td></td>
                    <td style="padding-top: 10px;">
                        <xsl:choose>
                            <xsl:when test="$ParentType ='17'">
                                <input type="button" class="button" value="Save" style="margin-right: 10px;"
                                        onClick='return discussion_Save("txt_Topic", 
                                                                               "txt_Comment", 
                                                                               "{$PrimaryItemID}", 
                                                                               "span_ErrorMessage",
                                                                               "divListDiscussions", 
                                                                               "divAddDiscussions",
                                                                               "divListDiscussions_Data");'>
                                </input>
                            </xsl:when>
                            <xsl:otherwise>
                                 <input type="button" class="button" value="Save" style="margin-right: 10px;"
                                           onClick='return discussion_Save("txt_Topic", 
                                                                               "txt_Comment", 
                                                                               "{$ItemID}", 
                                                                               "span_ErrorMessage",
                                                                               "divListDiscussions", 
                                                                               "divAddDiscussions",
                                                                               "divListDiscussions_Data");'>
                                    </input>
                            </xsl:otherwise>
                        </xsl:choose>
   
                        <input type="button" class="button" value="Cancel"
                               onClick="return showAllDiscussions('divListDiscussions', 'divAddDiscussions');">
                        </input>
                    </td>
                </tr>
            </table>
        </div>
    </xsl:template>
</xsl:stylesheet>
