<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp   "&#160;">
<!ENTITY copy   "&#169;">
]>
<!--
Implementations v1 - 05/03/2018
IMPLEMENTATION VARIABLES
Define global implementation variables here, so that they may be accessed by all page types and in the info/debug tabs.
This also provides a convenient area for complicated logic to exist without clouding up the general xsl/html structure.
-
Contributors: Your Name Here
Last Updated: Enter Date Here
-->
<xsl:stylesheet version="3.0"
	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
	xmlns:xs="http://www.w3.org/2001/XMLSchema"
	xmlns:ou="http://omniupdate.com/XSL/Variables"
	xmlns:fn="http://omniupdate.com/XSL/Functions"
	xmlns:ouc="http://omniupdate.com/XSL/Variables"
	xmlns="http://www.w3.org/1999/xhtml"
	exclude-result-prefixes="ou xsl xs fn ouc">

	<!--

	OU CAMPUS SYSTEM PARAMETERS - don't edit

-->
<!-- Current Page Info -->
	<xsl:param name="ou:action"/>		<!-- Page 'state' in OU Campus
	(prv = Preview, pub = Publish, edt = Edit, cmp = Compare) -->
	<xsl:param name="ou:uuid"/>		<!-- Unique Page ID -->
	<xsl:param name="ou:path"/>		<!-- Root-relative path to page output -->
	<xsl:param name="ou:dirname"/>		<!-- Root-relative path to current folder (USE "dirname" BELOW INSTEAD) -->
	<xsl:param name="ou:filename"/>		<!-- Filename of output -->
	<xsl:param name="ou:created" as="xs:dateTime"/>		<!-- Page Creation date/time -->
	<xsl:param name="ou:modified" as="xs:dateTime"/> 	<!-- Last Page Modification date/time -->
	<xsl:param name="ou:feed"/>		<!-- Path (root-relative) to RSS Feed that's assigned to current page -->

	<!-- Staging Server Info -->
	<xsl:param name="ou:servername"/>	<!-- Staging Server's Domain Name -->
	<xsl:param name="ou:root"/>		<!-- Path from root of staging server -->
	<xsl:param name="ou:site"/>		<!-- Site Name (same as foldername on staging server) -->

	<!-- Production Server Info -->
	<xsl:param name="ou:target"/>		<!-- Name of Target Production Server -->
	<xsl:param name="ou:httproot"/>		<!-- Address of Target Production Server (from site settings) -->
	<xsl:param name="ou:ftproot"/>		<!-- Folder path to site root on Production Server (from site settings) -->
	<xsl:param name="ou:ftphome"/>		<!-- Initial subdirectory for site root on Production Server (from site settings) -->

	<!-- User Info -->
	<xsl:param name="ou:username"/>		<!-- Active user/publisher -->
	<xsl:param name="ou:lastname"/>		<!-- Active user/publisher -->
	<xsl:param name="ou:firstname"/> 	<!-- Active user/publisher -->
	<xsl:param name="ou:email"/>		<!-- Active user/publisher -->


	<!--

	DIRECTORY VARIABLES (add "ou:" before variable name - in XSL only)

		Example:
		<xsl:param name="ou:theme-color" />
		... Where "theme-color" is the actual Directory Variable name
	-->

	<!-- for the following, all are set with start and end slash: /folder/ -->
	<xsl:param name="ou:breadcrumb-start"/> <!-- top level breadcrumb -->

	<xsl:param name="ou:section-image-path" />
	<xsl:param name="ou:section-image-text" />
	<xsl:param name="ou:section-image-link" />
	<xsl:param name="ou:navigation-start" />
	<xsl:param name="ou:use-legacy-nav" />
	<xsl:param name="ou:props-path" />

	<xsl:param name="ou:analytics-include-path" />
	
	<xsl:param name="ou:tracking-code" />

	<!--

	GLOBAL VARIABLES - Implementation Specific

-->
<xsl:variable name="body-class" />
<!-- Stores a CSS class to be assigned to a wysiwyg region -->

<!-- pcf / props params -->
<xsl:variable name="display-page-header" select="if (ou:multiedit-field('header-type') = 'hide') then false() else true()" as="xs:boolean" />
<xsl:variable name="display-props-header" select="if (ou:multiedit-props-field('header-type') = 'hide') then false() else true()" as="xs:boolean" />

<xsl:variable name="display-header" as="xs:boolean">
	<xsl:choose>
		<xsl:when test="not($display-page-header)">
			<xsl:value-of select="false()" />
		</xsl:when>
		<xsl:when test="ou:multiedit-field('header-type') = 'section' and not($display-props-header)">
			<xsl:value-of select="false()" />
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="true()" />
		</xsl:otherwise>
	</xsl:choose>
</xsl:variable>

<xsl:variable name="contains-slideshow" as="xs:boolean">
	<xsl:choose>
		<xsl:when test="$display-header and ou:multiedit-field('header-type') = 'gallery' and ou:multiedit-field('header-gallery')">
			<xsl:value-of select="true()" />
		</xsl:when>
		<xsl:when test="$display-header and ou:multiedit-field('header-type') = 'section' and ou:multiedit-props-field('header-type') = 'gallery' and ou:multiedit-props-field('header-gallery')">
			<xsl:value-of select="true()" />
		</xsl:when>
		<xsl:otherwise>
			<xsl:value-of select="false()" />
		</xsl:otherwise>
	</xsl:choose>
</xsl:variable>

<xsl:variable name="column-class" select="concat(ou:pcf-param('columns'), 'col_layout', if ($display-header) then '' else '_nophoto')" />

<xsl:variable name="contains-pretty-photo" select="if (ou:pcf-param('gallery-type') = 'pretty-photo' and /document/ouc:div[@label = 'maincontent']//gallery) then true() else false()" as="xs:boolean" />
<xsl:variable name="contains-flex-slider" select="if (ou:pcf-param('gallery-type') = 'flex-slider' and /document/ouc:div[@label = 'maincontent']//gallery) then true() else false()" as="xs:boolean" />

<xsl:variable name="content-rows" select="if (ou:pcf-param('content-rows') = '') then 1 else ou:pcf-param('content-rows')" as="xs:integer" />

<!-- server information -->
<xsl:variable name="server-type" select="'asp'"/>
<xsl:variable name="index-file" select="'index'"/>
<xsl:variable name="extension" select="'aspx'"/>

<!-- for various concatenation purposes -->
<xsl:variable name="dirname" select="if(string-length($ou:dirname) = 1) then $ou:dirname else concat($ou:dirname,'/')" />
<xsl:variable name="domain" select="substring($ou:httproot,1,string-length($ou:httproot)-1)" />
<xsl:variable name="path" select="substring($ou:root,1,string-length($ou:httproot)-1)"/>

<!-- navigation info -->
<xsl:variable name="nav-file" select="'z-nav.inc'" />

<!-- section property files -->
<xsl:variable name="props-file" select="'z-props.pcf'"/>
<xsl:variable name="props-dir" select="if (not($ou:props-path = '')) then $ou:props-path else $dirname" />
<xsl:variable name="props-path" select="concat($ou:root, $ou:site, $props-dir, $props-file)"/>

<!-- page information -->
<xsl:variable name="page-type" select="ou:pcf-param('page-type')"/>
<xsl:variable name="page-title" select="/document/ouc:properties/title" />
<xsl:variable name="breadcrumb" select="ou:pcf-param('breadcrumb')" />

<!-- Miscellaneous -->
<xsl:variable name="nbsp"><xsl:text disable-output-escaping="yes">&nbsp;</xsl:text></xsl:variable>
<xsl:variable name="amp"><xsl:text disable-output-escaping="yes">&amp;</xsl:text></xsl:variable>
<xsl:variable name="copy"><xsl:text disable-output-escaping="yes">&copy;</xsl:text></xsl:variable>
	
<!-- 	determine where the image is coming from  -->
	<xsl:variable name="sidebar-image">
		<xsl:choose>
			<xsl:when test="doc-available($props-path) and doc($props-path)/document/ouc:div[@label='page-id-image']/img/@src != ''">
				<xsl:value-of select="doc($props-path)/document/ouc:div[@label='page-id-image']/img/@src"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$ou:section-image-path" />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>
	
<!-- 	determine where the image alt text is coming from -->
	<xsl:variable name="sidebar-image-text">
		<xsl:choose>
			<xsl:when test="doc-available($props-path) and doc($props-path)/document/ouc:div[@label='page-id-image']/img/@alt != ''">
				<xsl:value-of select="doc($props-path)/document/ouc:div[@label='page-id-image']/img/@alt"/>
			</xsl:when>
			<xsl:otherwise>
				<xsl:value-of select="$ou:section-image-text" />
			</xsl:otherwise>
		</xsl:choose>
	</xsl:variable>

</xsl:stylesheet>
