﻿<?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="Footer.xslt"/>
	<xsl:import href="Header.xslt"/>

	<xsl:output method="xml" indent="yes"/>

	<xsl:template match="/">

		<xsl:variable name="Publication" select="/AjaxRequest/DisplayPublication/Publications/Publication"></xsl:variable>
		<xsl:variable name="IsCommunityPublished" select="/AjaxRequest/Settings/Community/SocialSharePublishedYN"></xsl:variable>
		<xsl:variable name="Author" select="/AjaxRequest/DisplayPublication/PublicationAuthorization/AuthorName"></xsl:variable>
		<xsl:variable name="ItemID" select="normalize-space(/AjaxRequest/DisplayPublication/Publications/Publication/ItemID)"></xsl:variable>
		<xsl:variable name="HostName" select="normalize-space(/AjaxRequest/DisplayPublication/HostName)"></xsl:variable>
		<xsl:variable name="LoggedInUserID" select="normalize-space(DisplayPublication/LoggedInUserID)"></xsl:variable>
		<xsl:variable name="smallcase" select="'abcdefghijklmnopqrstuvwxyz'" />
		<xsl:variable name="uppercase" select="'ABCDEFGHIJKLMNOPQRSTUVWXYZ'" />
		<xsl:variable name="UserID" select="normalize-space(/AjaxRequest/LoggedInUserID)"></xsl:variable>
		<xsl:variable name="UserPermissionID" select="normalize-space(/AjaxRequest/DisplayPublication/PublicationAuthorization/PermissionID)"></xsl:variable>
		<xsl:variable name="IsPublished" select="$Publication/PublishedYN"/>
		<xsl:variable name="LogOffURL" select="AjaxRequest/LogOffURL"></xsl:variable>
		<xsl:variable name="LoggedInUser" select="AjaxRequest/LoggedInUser/User/UserData"></xsl:variable>
		<xsl:variable name="LogoPath" select="/AjaxRequest/Settings/Logo/LogoURL"></xsl:variable>
		<xsl:variable name="CommunitiesXML" select="/AjaxRequest/Communities/."></xsl:variable>
		<xsl:variable name="DirectURL" select="/AjaxRequest/DirectURL"></xsl:variable>
		<xsl:variable name="TemplateURL" select="normalize-space(AjaxRequest/TemplateURL)"></xsl:variable>
		<xsl:variable name="IsSecureConnection" select="AjaxRequest/IsSecureConnection"></xsl:variable>
		<xsl:variable name="BetaVersion" select="AjaxRequest/Settings/BetaVersion"></xsl:variable>
		<xsl:variable name="Protocol">
			<xsl:choose>
				<xsl:when test="$IsSecureConnection = 1">
					<xsl:text>https://</xsl:text>
				</xsl:when>
				<xsl:otherwise>
					<xsl:text>http://</xsl:text>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>

		<xsl:variable name="fbURL">
			<xsl:value-of select="$Protocol"/>
			<xsl:text>www.facebook.com/share.php?u=</xsl:text>
			<xsl:value-of select="$HostName"></xsl:value-of>/
			<xsl:value-of select="$Publication/PromoteKey"/>
		</xsl:variable>
		<xsl:variable name="tweetURL">
			<xsl:value-of select="$Protocol"/>
			<xsl:text>twitter.com/intent/tweet?status=</xsl:text>
			<xsl:value-of select="$Publication/Title"/> +
			<xsl:value-of select="$HostName"></xsl:value-of>/
			<xsl:value-of select="$Publication/PromoteKey"/>
		</xsl:variable>
		<xsl:variable name="linkedinURL">
			<xsl:value-of select="$Protocol"/>
			<xsl:text>www.linkedin.com/shareArticle?mini=true&amp;url=</xsl:text>
			<xsl:value-of select="$HostName"></xsl:value-of>/
			<xsl:value-of select="$Publication/PromoteKey"/>
		</xsl:variable>

		<xsl:variable name="ClientSpecific">
			<xsl:choose>
				<xsl:when test="/AjaxRequest/Settings/IndexTemplate[text()] and /AjaxRequest/Settings/IndexTemplate = 'ClientSpecific'">
					<xsl:number value="1"/>
				</xsl:when>
				<xsl:otherwise>
					<xsl:number value="0"/>
				</xsl:otherwise>
			</xsl:choose>
		</xsl:variable>
		<!-- container -->
		<!-- header part -->



		<xsl:variable name="ClientPortalPath">
			<xsl:value-of select="/AjaxRequest/ClientPortalPath"/>
		</xsl:variable>

		<!-- container -->

		<!-- header part -->
		<xsl:choose>
			<xsl:when test="$UserID &lt;1 or count(AjaxRequest/DirectURL)&gt;0 ">
				<xsl:call-template name="Header">
					<xsl:with-param name="MenuPage">
						<xsl:text>SubPage</xsl:text>
					</xsl:with-param>
					<xsl:with-param name="source" >
						<xsl:text>Publication</xsl:text>
					</xsl:with-param>
					<xsl:with-param name="ClientPortalPath" select="$ClientPortalPath"></xsl:with-param>
					<xsl:with-param name="Logo">
						<xsl:choose>
							<xsl:when test="$ClientSpecific = 1">
								<xsl:value-of select="$ClientPortalPath"/>
								<xsl:text>web/images/logo.png</xsl:text>
							</xsl:when>
							<xsl:otherwise>
								<xsl:value-of select="$LogoPath"/>
							</xsl:otherwise>
						</xsl:choose>

					</xsl:with-param>
					<xsl:with-param name="FreeTrial">
						<xsl:number value="0"/>
					</xsl:with-param>
					<xsl:with-param name="Contact">
						<xsl:number value="1"/>
					</xsl:with-param>
					<xsl:with-param name="LoggedIn">
						<xsl:choose>
							<xsl:when test="$LoggedInUser/UserID[text()]">
								<xsl:number value="1"/>
							</xsl:when>
							<xsl:otherwise>
								<xsl:number value="0"/>
							</xsl:otherwise>
						</xsl:choose>
					</xsl:with-param>
					<xsl:with-param name="LogOffURL" select="$LogOffURL"></xsl:with-param>
					<xsl:with-param name="LoggedInUser" select="$LoggedInUser"></xsl:with-param>
				</xsl:call-template>
			</xsl:when>
		</xsl:choose>
		<!-- end -->
		<!-- content start -->



		<section class="content" style="text-align: left!important;">
			<style>
				.icon_margin a img{width:40px;float:left;}
				.icon_margin a img:hover{opacity:0.8;}
				.icon_margin {
				margin-left: -20px;
				font-size: 22px;
				}
			</style>
			<!--<div class="container blogpage">
				-->
			<!-- heading-->
			<section style="border-bottom: solid 1px #dedede;" class="section-title">
				<p class="mrgin-top" id="PostsHeader" style="
    font-size: 16px;padding-left:17px;"></p>
			</section>
			<div id="addPublication">
				<!-- heading end-->
				<!--
			</div>-->
				<div class="container">

					<div class="col-sm-12">
						<!--header content-->
						<div class="row" style="margin-top:30px">
							<div class="col-sm-2">
								<xsl:variable name="url">
									<xsl:choose>
										<xsl:when test="string-length($Publication/ImageURL) &gt; 0">
											<xsl:value-of select="$Publication/ImageURL"/>
										</xsl:when>
										<xsl:when test="string-length($Publication/commImageURL) &gt; 0">
											<xsl:value-of select="$Publication/commImageURL"/>
										</xsl:when>
										<xsl:otherwise>
											<xsl:value-of select="$Publication/ParentImage"/>
										</xsl:otherwise>
									</xsl:choose>
								</xsl:variable>
								<!--<xsl:variable name="url" select="$Publication/ImageURL"/>-->
								<span>
									<img src="{$url}" class="img-responsive"  style="width:100%"/>
								</span>
							</div>
							<div class="col-sm-10">

								<h2 class="product_text">
									<xsl:value-of select="$Publication/Title"/>
								</h2>

								<div class="row">
									<div class="col-sm-7 col-xs-12">
										<p style="float:left" >
											<xsl:value-of select="$Publication/StartDateFormatted"></xsl:value-of>
											<xsl:text>  |  BY </xsl:text>
											<span class="bud">
												<xsl:value-of  select="translate($Author, $smallcase, $uppercase)"/>
											</span>

										</p>

										<xsl:choose>
											<xsl:when test="($UserID &gt;0 and $UserPermissionID &gt;= 4) or count(AjaxRequest/DirectURL)= 0  and (count(AjaxRequest/DirectURL) &gt;0 and $BetaVersion='2.5') ">
												<span onclick="UpdatePublicationData('{$ItemID}')" class="bud" style="padding-left:4%;cursor: pointer;">EDIT</span>
											</xsl:when>
										</xsl:choose>
									</div>
									<div class="col-sm-5 col-xs-12 icon_margin">
										<xsl:choose>
											<xsl:when test="$IsPublished =1 and $IsCommunityPublished ='True'">
												<a id="linkFacebook" target="_blank" class="link" href="{$fbURL}">
													<img src="images/Facebook230.png" class=""></img>
												</a>
												<a id="linkTwitter" target="_blank" class="link" href="{$tweetURL}">
													<img src="images/twitter230.png" class=""></img>
												</a>
												<a id="linkTwitter" target="_blank" class="link" href="{$linkedinURL}">
													<img src="images/Linkedin.jpg" class=""></img>
												</a>
											</xsl:when>
										</xsl:choose>
									</div>
									<div class="col-sm-2 col-xs-12 icon_margin">
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="container">
					<div class="col-sm-12" style="padding:20px 10px;">
						<xsl:value-of select="$Publication/IntroHTML" disable-output-escaping="yes"/>
					</div>
				</div>


				<xsl:choose>
					<xsl:when test="$UserID &gt;0">
						<script type="text/javascript">
							GetItemNotes_ForVersion3_0(<xsl:value-of select ="$ItemID"/>, 'divPublication_Operations_Content', '22');
						</script>
						<div class="container">
							<div class="container" style="font-weight:bold;padding-left:21px;"  >Join the conversation. Please enter your comments below:</div>
							<div id="Publication3_0_periority">
								<div id ="divPublication_Operations_Content" style="padding:20px 10px;" class="container "></div>
							</div>

						</div>
					</xsl:when>
				</xsl:choose>



				<div class="container col-md-12">
					<div class="col-sm-12 col-xs-12 icon_margin" style="padding-left:10%;">

						<xsl:choose>
							<xsl:when test="$IsPublished =1 and $IsCommunityPublished ='True'">
								<a id="linkFacebook" target="_blank" class="link" href="{$fbURL}">
									<img src="images/Facebook230.png" class=""></img>
								</a>
								<a id="linkTwitter" target="_blank" class="link" href="{$tweetURL}">
									<img src="images/twitter230.png" class=""></img>
								</a>
								<a id="linkTwitter" target="_blank" class="link" href="{$linkedinURL}">
									<img src="images/Linkedin.jpg" class=""></img>
								</a>
							</xsl:when>
						</xsl:choose>
					</div>
				</div>
			</div>
		</section>

		<!-- content ends -->
		<!-- footer_bottom -->
		<!-- footer_bottom -->
		<xsl:choose>
			<xsl:when test="$UserID &lt;1">


				<xsl:call-template name="Footer">

				</xsl:call-template>
				<!-- end of footer_bottom -->
				<!-- footer -->
				<section class="footer_bottom">
					<p class="text-center text_c copy_text">
						Copyright 2016 CoachSimple. All Rights Reserved.
					</p>
				</section>
				<!-- footer -->
				<!-- end -->
			</xsl:when>
		</xsl:choose>
		<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
		<!-- Include all compiled plugins (below), or include individual files as needed -->
		<script src="js/bootstrap.min.js"></script>
		<script>
			$(document).ready(function () {
			$("#a,#b,#c").click(function () { $("#d,#e,#f").slideDown(2000); });

			});
		</script>
	</xsl:template>
</xsl:stylesheet>
