﻿<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:msxsl="urn:schemas-microsoft-com:xslt" exclude-result-prefixes="msxsl">

	<xsl:import href="GoalTopicItem.xslt"/>

	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">
		<xsl:variable name="itemID" select="AjaxRequest/Params/GoalItemID"></xsl:variable>
		<xsl:variable name="ItemDetailColumn" select="AjaxRequest/ItemDetail/Columns"></xsl:variable>
		<xsl:variable name="ItemData" select="AjaxRequest/ItemDetail/ItemData"></xsl:variable>
		<xsl:variable name="GoalIsLand" select="AjaxRequest/ItemDetail/IsLand"></xsl:variable>
		<xsl:variable name="SortColName" select="AjaxRequest/Params/sortColName"/>
		<xsl:variable name="SortOrder" select="AjaxRequest/Params/sortOrder"/>
		<xsl:variable name="TaskDivID" select="AjaxRequest/TaskDivID"/>
		<xsl:variable name="List" select="AjaxRequest/ItemDetail/List"/>
		<xsl:variable name="ResponsibleList" select="AjaxRequest/ItemDetail/ResponsibleList/Responsible"/>
		<xsl:variable name="LoggedInUserID" select="AjaxRequest/LoggedInUserID"></xsl:variable>
		<xsl:variable name="PermissionID" select="AjaxRequest/ItemDetail/PermissionID"></xsl:variable>

		<xsl:variable name="callBack">
			'<xsl:value-of select="AjaxRequest/CallBackSignature"/>'
		</xsl:variable>
		<xsl:variable name="DataToggle">
			<xsl:choose>
				<xsl:when test="$PermissionID = 3 or $PermissionID &gt;= 4">
					<xsl:text>dropdown</xsl:text>
				</xsl:when>
			</xsl:choose>
		</xsl:variable>
		<!--full width table grid-->

		<table class="table table-striped table-responsive full_screen VerMid" id="tblTopic_FullGrid">
			<tr class="ExpandRow">
				<xsl:for-each select="$ItemDetailColumn/Cols[Visibility=1]">
					<xsl:variable name="SortType">
						<xsl:choose>
							<xsl:when test="ColName = $SortColName">
								<xsl:choose>
									<xsl:when test="$SortOrder= 'asc'">
										<xsl:text>desc</xsl:text>
									</xsl:when>
									<xsl:otherwise>
										<xsl:text>asc</xsl:text>
									</xsl:otherwise>
								</xsl:choose>
							</xsl:when>
							<xsl:otherwise>
								<xsl:text>asc</xsl:text>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:variable>
					<th class="onMouseOver" onClick="Grid_3_0_Sort('{ColName}','{$SortType}',{$callBack})">
						<xsl:value-of select="ColDisplayName" />
					</th>
				</xsl:for-each>
			</tr>
			<xsl:for-each select="$ItemData">
				<xsl:call-template name="TopicItemDetailed">
					<xsl:with-param name="CurrentRecordRow" select="."></xsl:with-param>
					<xsl:with-param name="PermissionID" select="$PermissionID"></xsl:with-param>
					<xsl:with-param name="ItemDetailColumn" select="$ItemDetailColumn"></xsl:with-param>
					<xsl:with-param name="itemID" select="$itemID"></xsl:with-param>
					<xsl:with-param name="TaskDivID" select="$TaskDivID"></xsl:with-param>
					<xsl:with-param name="List" select="$List"></xsl:with-param>
					<xsl:with-param name="ResponsibleList" select="$ResponsibleList"></xsl:with-param>
					<xsl:with-param name="LoggedInUserID" select="$LoggedInUserID"></xsl:with-param>
				</xsl:call-template>
			</xsl:for-each>
		</table>
		<!--full width table grid end-->
		<!--Tab width table grid-->
		<div class="tab_screen">
			<div class="tab_grid" id="divIsLandTopic">
				<xsl:for-each select="$ItemData">
					<xsl:call-template name="TopicItemIsland">
						<xsl:with-param name="CurrentBriefRecordRow" select="."></xsl:with-param>
						<xsl:with-param name="GoalIsLand" select="$GoalIsLand"></xsl:with-param>
						<xsl:with-param name="itemID" select="$itemID"></xsl:with-param>
						<xsl:with-param name="TaskDivID" select="$TaskDivID"></xsl:with-param>
						<xsl:with-param name="PermissionID" select="$PermissionID"></xsl:with-param>
						<xsl:with-param name="List" select="$List"></xsl:with-param>
					</xsl:call-template>
				</xsl:for-each>
			</div>
		</div>
		<div>
			<input type="text" class="SearchTask TopicAdd" maxlength="75"
				   onkeyup="lsAddAgileTopic('{$itemID}',event);"
				   style="float:left" id="txtAgileTopic_{$itemID}" Placeholder="Add Topic ..."></input>
		</div>
		<!--Tab width table grid end -->
		<!--<div style="float:left">
			<input type="text" id="txtTopicName_{$itemID}"></input>
			<input type="button" value="Add Topic" onClick="InsertTopic_3_0('{$itemID}')"></input>
		</div>-->
		<div id="divTemp" style="display:none"></div>
	</xsl:template>
	
</xsl:stylesheet>
