﻿<?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:output method="xml" indent="yes"/>

	<xsl:template name="LatestPost">
		<xsl:param name="PublicationDate" select="'N/A'"></xsl:param>
		<xsl:param name="ImageURL" select="'N/A'"></xsl:param>
		<xsl:param name="ParentImage" select="'N/A'"></xsl:param>
		<xsl:param name="commImageURL" select="'N/A'"></xsl:param>
		<xsl:param name="TargetPubURL" select="'N/A'"></xsl:param>
		<xsl:param name="AuthorName" select="'N/A'"></xsl:param>
		<xsl:param name="Summary" select="'N/A'"></xsl:param>
		<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
		<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />

		<div class="white_bg">
			<div class="">
				<div class="row width_first flex_align ">
					<div class="col-sm-3">
						<xsl:variable name="PubImage">
							<xsl:choose>
								<xsl:when test="string-length($ImageURL) &gt; 0">
									<xsl:value-of select="$ImageURL"/>
								</xsl:when>
								<xsl:when test="string-length($commImageURL) &gt; 0">
									<xsl:value-of select="$commImageURL"/>
								</xsl:when>
								<xsl:otherwise>
									<xsl:value-of select="$ParentImage"/>
								</xsl:otherwise>
							</xsl:choose>
						</xsl:variable>
						<a href="javascript:void(0)"  onclick="{$TargetPubURL}">
							<img src="{$PubImage}" class="img-responsive  image_auto"></img>
						</a>
					</div>
					<div class="col-sm-9">
						<p class="real_head">
							<a href="javascript:void(0)" onclick="{$TargetPubURL}">
								<xsl:value-of select="Title"/>
							</a>
						</p>
						<p class="date">
							<xsl:value-of select="$PublicationDate"></xsl:value-of>
							<xsl:text>  |  BY </xsl:text>
							<span class="bud">
								<xsl:value-of select="translate($AuthorName, $smallcase, $uppercase)"/>
							</span>
						</p>
						<p class="real_txt">
							<xsl:value-of select="$Summary"/>
						</p>

					</div>
				</div>
			</div>
		</div>
	</xsl:template>
	<xsl:template name="PopularPost">
		<xsl:param name="Title" select="'N/A'"></xsl:param>
		<xsl:param name="PublicationDate" select="'N/A'"></xsl:param>
		<xsl:param name="ImageURL" select="'N/A'"></xsl:param>
		<xsl:param name="ParentImage" select="'N/A'"></xsl:param>
		<xsl:param name="commImageURL" select="'N/A'"></xsl:param>
		<xsl:param name="TargetPubURL" select="'N/A'"></xsl:param>
		<xsl:param name="AuthorName" select="'N/A'"></xsl:param>
		<xsl:param name="Summary" select="'N/A'"></xsl:param>
		<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
		<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
		<xsl:choose>
			<xsl:when test="(string-length($ImageURL) &gt; 0 ) or (string-length($commImageURL) &gt; 0) or string-length($ParentImage) &gt; 0">
				<xsl:variable name="PubImage">
					<xsl:choose>
						<xsl:when test="string-length($ImageURL) &gt; 0">
							<xsl:value-of select="$ImageURL"/>
						</xsl:when>
						<xsl:when test="string-length($commImageURL) &gt; 0">
							<xsl:value-of select="$commImageURL"/>
						</xsl:when>
						
						<xsl:otherwise>
							<xsl:value-of select="$ParentImage"/>
						</xsl:otherwise>
					</xsl:choose>
				</xsl:variable>
				<a href="javascript:void(0)"  onclick="{$TargetPubURL}">
					<img src="{$PubImage}" class="img-responsive  image_auto"></img>
				</a>
			</xsl:when>
			<xsl:otherwise>
				<p class="sub_txt">
					<xsl:value-of select="$Summary"/>
				</p>
			</xsl:otherwise>
		</xsl:choose>
		<span>
			<p class="coach_com text-center">
				<a href="javascript:void(0)"  onclick="{$TargetPubURL}">
					<xsl:value-of select="$Title"/>
				</a>
			</p>
		</span>
	</xsl:template>

	<xsl:template name="CommunityHeader">
		<xsl:param name="CommunitiesXML" select="'N/A'"></xsl:param>
		<xsl:param name="Community" select="'N/A'"></xsl:param>
		<xsl:param name="VolumeLevel" select="'N/A'"></xsl:param>
		<xsl:param name="userID" select="'N/A'"></xsl:param>
		<xsl:param name="MasterPortalalItemId" select="'N/A'"></xsl:param>
		<xsl:param name="ItemId" select="'N/A'"></xsl:param>
		<xsl:param name="Origin" select="'N/A'"></xsl:param>
		<xsl:param name="BrandID" select="'N/A'"></xsl:param>
		<xsl:param name="CommunityPermissionID">
			<xsl:number value="-1"/>
		</xsl:param>
		<xsl:param name="UserRoles" select="'N/A'"></xsl:param>

		<xsl:variable name="IsCommunityAdmin">
			<xsl:choose>
				<xsl:when test="$UserRoles/Role[RoleName = 'Community Admin']">
					<xsl:number value="1"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:number value="0"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<xsl:variable name="ImageUrl">
			<xsl:choose>
				<xsl:when test="string-length($Community/ImageURL) &gt; 0">
					<xsl:value-of select="$Community/ImageURL"/>
				</xsl:when>
				
				<xsl:otherwise>
					<xsl:value-of select="$Community/ParentImage"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		
		<div class="container section-title CommHead" style="float:left">
			<span class="imgcomunity"><img src="{$ImageUrl}" class="img-responsive  image_auto" ></img>
			</span>
			<span class="pull-left TopLeftTitle fulsmal">
				<span class="onMouseOver pull-left comView"
					  id="spanSelectedPortal"
					  onclick="$('#spanSelectedPortal').css('display','none');
									  $('#ddlSelectedDashboardCommunity').css('display','inline');$('#communityddlsign').css('display','none');">
					<xsl:value-of select="$Community/Community"/>
					<span id="communityddlsign" style="width:auto;height: 46px;margin-left: 10px;">
						<b class="caret">
						</b>
					</span>
				</span>
				<select class="form-control-dashboard pull-left comView" style="display:none"
						id="ddlSelectedDashboardCommunity" onchange="LoadCommunityItem_3_0({$MasterPortalalItemId},'ddlSelectedDashboardCommunity',{$userID})">
					<option value="0">All</option>
					<xsl:for-each select="$CommunitiesXML/Community">
						<xsl:choose>
							<xsl:when test="normalize-space($ItemId) = ItemID">
								<option value="{ItemID}" selected="selected">
									<xsl:value-of select="CommunityName"/>
								</option>
							</xsl:when>
							<xsl:otherwise>
								<option value="{ItemID}">
									<xsl:value-of select="CommunityName"/>
								</option>
							</xsl:otherwise>

						</xsl:choose>
					</xsl:for-each>
				</select>


			</span>
			<span  class="pull-right TopLeftTitle comView compara fulsmal" style="padding:0px!important;">
				<ul class="Mortageicon pull-right">
					<li class="pull-right">

						<xsl:choose>
							<xsl:when test="$VolumeLevel ='3'">
								<input type="button" class="btn btn-info smalbtn" id="followComunity" value="Following" onclick="followCommunity3_0('{$Community/ItemID}', 'followComunity', 'Community', 0)"></input>
							</xsl:when>
							<xsl:otherwise>
								<input type="button" class="btn btn-warning smalbtn" id="followComunity" value="Follow Community" onclick="followCommunity3_0('{$Community/ItemID}', 'followComunity', 'Community', 3)"></input>
							</xsl:otherwise>
						</xsl:choose>
					</li>

					<xsl:if test="$CommunityPermissionID &gt;= 4 or $IsCommunityAdmin = 1">
						<li class="pull-right" onclick="AddAdminToCommunity_Base('{$Community/ItemID}','{$MasterPortalalItemId}',0);" style="cursor: pointer;">
							<i class="glyphicon glyphicon-cog glypcolor fontsize30"></i>
						</li>
						<li class="pull-right " onclick="loadCommunityFollowersPopup_3_0('{$Community/ItemID}');" style="cursor: pointer;">
							<i class="icon-group icon-large glypcolor icon-large fontsize14"></i>
						</li>
						<li class="pull-right" onclick="AddPublicationData3_0('{$MasterPortalalItemId}','{$Community/ItemID}','{$BrandID}','{$Origin}')" style="cursor: pointer;">
							<i class="glyphicon glyphicon-plus-sign glypcolor fontsize30"></i>
						</li>
					</xsl:if>
				</ul>
			</span>


		</div>
	</xsl:template>
</xsl:stylesheet>
