<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE document SYSTEM "http://commons.omniupdate.com/dtd/standard.dtd"> 
<!-- 
INTERIOR CONTENT PAGES for UAEX 2013 Implementation
A simple page type that toggles between different layouts for the Main Site Content and 4H Content Page templates.

To-do: Also the base stylesheet for Templates 17-23.
To-do: Layout 0, displays no side columns.

  Page Type		Layout No.		 Template Name			Template No.	Sample No.	 Status		Wizard?		New Page Wizards
======================================================================================================================================================
content_main	0			Counties Map Page			3				-			to-do(VV)	no			-
counties_programs 2-1		County Programs				5				-			to-do(CS)	yes			New County Programs Page
division_lower	1-3			Division Lower Level Page	7				-			complete	yes			New Divison Section, New Divison Lower Level Page
content_main	0			Advanced Search				9				-			to-do		no			-
content_main	1			Form						10				-			to-do(VV)	no			-
content_main	1-1			Main Site Content Page 1	11				-			complete	yes			New MSCP #1, New Main Site Content Section
content_main	2-1			Main Site Content Page 2	12				1 			complete	yes			New MSCP #2-1
content_main	2-2			Main Site Content Page 2	12				2			complete	yes			New MSCP #2-2
content_main	2-3			Main Site Content Page 2	12 				3			complete	yes			New MSCP #2-3
content_main	3			Main Site Content Page 3	13				-			complete	yes			New MSCP #3
content_4h		1-1			4H Content Page 1			14				-			complete	yes			New 4H #1, New 4H Content Section
content_4h		2-1			4H Content Page 2			15				-			complete	yes			New 4H #2
content_4h		3			4H Content Page 3			16				-			complete	yes			New 4H #3
content_main	1-2			Accordion					17				-			complete	yes			New Accordion Page
content_main	2-1			Executive Team				18				-			complete	yes			New Executive Page
content_main	2-?			A-Z Index					19				-			to-do(VV)	yes??		New A-Z Index Page
content_main	2-?			Table Listing				20				-			complete	yes			New Table Listing
content_main	0			Personnel Direcotry			21				-			TBD 		no			-
content_main	0			~ Search Results			22				-			TBD 		no			-
content_main	0			~ Search Profile			23				-			TBD			no??		-

Other templates outisde of this XSL's scope: 1,2,4-6.

Contributors: Vinit Varghese, Caroline Spooner
Last Updated 6/21/2013
-->
<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"
				exclude-result-prefixes="ou xsl xs fn ouc">
	
<xsl:import href="common.xsl"/>
<xsl:import href="special-templates.xsl"/>
<xsl:import href="table-transformations2.xsl"/>

<!--<xsl:variable name="pageLayout" select="ou:assignVariable('layout','2')"/>-->
<xsl:variable name="pageOptions" select="string-join(ou:pcfparam('pageOptions'))"/>


	<xsl:template name="page-content">
	
		<xsl:comment> main </xsl:comment>
		<div id="main">

			<xsl:comment> container</xsl:comment>		
			<div class="container">
			
				<xsl:comment> breadcrumbs </xsl:comment>			
				<xsl:call-template name="breadcrumb">
					<xsl:with-param name="path" select="$ou:dirname"/>								
				</xsl:call-template>

				<!-- on page #1 the social icons are displayed in the right column under the address -->
				<xsl:if test="contains($pageOptions,'displaySocialMedia') and $pageLayout != '1'">
					<div class="connection">
					
					<!--<xsl:copy-of select="ou:standardInclude($socialPath)"/>-->
					
					<xsl:apply-templates select="content/social" mode="copy"/>
						
					</div>
				</xsl:if>
								
				<xsl:choose><!-- 0 or not 0 -->
					<xsl:when test="$pageLayout!='0'"><!-- two/3 column content -->							
						<xsl:comment> two-columns </xsl:comment>								
						<div id="two-columns" class="g3">									
						<!-- BEGIN LEFT COLUMN -->
							<xsl:comment> sidebar </xsl:comment>			
							<aside id="sidebar">															
								<xsl:choose>
									<!-- if divisions, main, or 4h -->
									<xsl:when test="not(contains($pageType,'counties'))">									
										<xsl:comment> accordion-holder </xsl:comment>
										<nav class="accordion-holder">
											<h1><xsl:value-of select="$navigationTitle"/></h1>
											<xsl:comment> left navigation </xsl:comment>
											<xsl:call-template name="nav-builder">
												<xsl:with-param name="top-level" select="substring($navigationStart,1,string-length($navigationStart)-1)"/>
												<xsl:with-param name="path" select="$ou:dirname" />
												<xsl:with-param name="last_crumb" select="$ou:dirname" />
						             		</xsl:call-template>
										</nav>	
									</xsl:when>
									<xsl:otherwise>
										<section class="address-block">
											<div class="address-holder">
												<xsl:apply-templates select="content/contact/node()" mode="copy"/>	
											</div>
											<div class="map-block">			
												<xsl:apply-templates select="content/county/node()" mode="tt-imgtxtblck"/>	
											</div>													
										</section>
									</xsl:otherwise>
												
								</xsl:choose>								
							</aside>
						<!-- END LEFT COLUMN -->
						
						<!-- BEGIN RIGHT COLUMN -->
							<!-- display right column if page layout is #1 -->
							<xsl:if test="$pageLayout='1-1' or $pageLayout='1-2' or $pageLayout='1-3'">
							
							<xsl:comment> aside </xsl:comment>
							<aside class="aside">
							
								<xsl:comment> contact-block </xsl:comment>
								<section class="contact-block">
									<xsl:apply-templates select="content/contact/node()" mode="copy"/>
									
									<xsl:if test="contains($pageOptions,'displaySocialMedia')">
										<div class="social-block">
											<!-- see template match below for social/ouc:div/ul below, that sets correct class to the social list in this region -->
											<xsl:apply-templates select="content/social" mode="copy"/>
										</div>
									</xsl:if>
									
								</section>
								
								<!-- RELATED LINKS FOR 1-1 AND 1-2 -->
								<!-- Division Lower Level does not display Related Links -->
								<xsl:if test="$pageLayout != '1-3'">
								<xsl:comment> related-links </xsl:comment>
								<nav class="related-links">
									<xsl:apply-templates select="content/relatedlinks/node()" mode="copy"/>
								</nav>
								</xsl:if>
								
							</aside>
							</xsl:if>
						<!-- END RIGHT COLUMN -->
						
						<!-- MIDDLE CONTENT -->
							<xsl:comment> content </xsl:comment>
							<section id="content"><!-- BEGIN CONTENT -->
						
								
							<!-- wrap content in different div structures depending on page layout -->
							<!-- SEE TEMPLATE MATCHES BELOW, FOR ANY APPLY-TEMPLATES THAT DOES NOT END IN NODE() -->
							<!-- IE: (special match #1) maincontent and (special match #2) social -->
							<xsl:choose>
															
								<!-- BEGIN LAYOUT 3 -->
								<xsl:when test="$pageLayout='3' and $pageType='content_main'">														
									<!-- LAYOUT #3 MAIN CONTENT -->					
									<xsl:apply-templates select="content/maincontent" mode="copy"/>										
									<xsl:comment> cattle-block </xsl:comment>
									<section class="about-block cattle-block">
										<div class="container cf">									
											<div class="column">
												<!-- left column image blocks (re-used as a full-width coulmn in layout 1) -->
												<xsl:apply-templates select="content/imageblocks/column[1]/node()" mode="copy"/>
											</div>										
											<div class="column">
												<!-- right coulmn image blocks -->
												<xsl:apply-templates select="content/imageblocks/column[2]/node()" mode="copy"/>
											</div>									
										</div>
									</section>																														
									<xsl:comment> content-section </xsl:comment>
									<div class="content-section">	
										<!-- two column conent/publication links -->							
										<xsl:apply-templates select="content/contentlinks/node()" mode="copy"/>								
									</div>												
									<xsl:comment> media-list-column </xsl:comment>
									<div class="content-section">
										<!-- two column media/additional links (re-used in layout 1) -->					
										<xsl:apply-templates select="content/additional-links/node()" mode="copy"/>								
									</div>																									
								</xsl:when>
								
								<xsl:when test="$pageLayout='3' and $pageType='content_4h'">
									<!-- LAYOUT #3 MAIN CONTENT -->					
									<xsl:apply-templates select="content/maincontent" mode="copy"/>										
									
									<xsl:comment> cattle-block </xsl:comment>
									<section class="about-block cattle-block">
										<div class="container cf">									
											<div class="column">
												<!-- left column image blocks (re-used as a full-width coulmn in layout 1) -->
												<xsl:apply-templates select="content/imageblocks/column[1]/node()" mode="copy"/>
											</div>										
											<div class="column">
												<!-- right coulmn image blocks -->
												<xsl:apply-templates select="content/imageblocks/column[2]/node()" mode="copy"/>
											</div>									
										</div>
									</section>																														
																			
									<xsl:apply-templates select="content/bottomcontent/node()" mode="copy"/>										
												
								</xsl:when>
								
								<!-- END LAYOUT 3 -->
											
								<!-- BEGIN LAYOUT 2 AND LAYOUT 0-->										
								<xsl:when test="$pageLayout='2-2'"><!-- same as 2-3  -->
										<!-- LAYOUT #2-2 and 2-3 MAIN CONTENT -->
										<xsl:apply-templates select="content/maincontent" mode="copy"/>
										<xsl:apply-templates select="content/contentlinks/node()" mode="copy"/>									
										<div class="content-section">
											<xsl:apply-templates select="content/additional-links/node()" mode="copy"/>
										</div>												
								</xsl:when>			
								<xsl:when test="$pageLayout='2-1'">
									<xsl:comment> content-holder </xsl:comment>
									<div class="content-holder">
										<!-- LAYOUT #2-1 MAIN CONTENT -->
										<xsl:apply-templates select="content/maincontent" mode="copy"/>														
									</div>	
																																
								</xsl:when>	
																	
								<!-- END LAYOUT 2 -->
								
								<!-- BEGIN LAYOUT 1 AND LAYOUT 0 -->	
								<xsl:when test="$pageLayout='1-2' or $pageLayout='1-3' or $pageLayout='0'">							
									<!-- LAYOUT #1-2, #1-3, #0 MAIN CONTENT -->							
									<xsl:apply-templates select="content/maincontent" mode="copy"/>																			
								</xsl:when>	
									
								<xsl:when test="$pageLayout='1-1'">							
									<!-- LAYOUT #1-1 MAIN CONTENT -->							
									<xsl:apply-templates select="content/maincontent" mode="copy"/>							
									<section class="about-block">
										<div class="container cf">
											<!-- re-use one of the columns from page #2 as a full-width area -->							
											<xsl:apply-templates select="content/imageblocks/column[1]/node()" mode="copy"/>								
										</div>
									</section>								
									<xsl:comment> content-section </xsl:comment>
									<div class="content-section">								
										<!-- re-use page #2 additional links -->
										<xsl:apply-templates select="content/additional-links/node()" mode="copy"/>												
									</div>													
								</xsl:when>		
								<!-- END LAYOUT 1 -->										
													
								<!-- LAYOUT 0 IS GROUPED WITH LAYOUT 1-2/1-3 -->
																
								<xsl:otherwise>							
									<xsl:if test="$ou:action!='pub'">
										<span class="omniupdate warning"> WARNING: No layout found for <xsl:value-of select="$pageLayout"/> </span>
									</xsl:if>	
									<xsl:apply-templates select="content/maincontent" mode="copy"/>									
								</xsl:otherwise>
															
							</xsl:choose>
																	
							
						</section><!-- END CONTENT -->
	
						<!-- END MIDDLE CONTENT -->
						</div>
					
						<div class="cf"><!--clearfix--></div>
					</xsl:when>
					<xsl:otherwise> <!-- one column content -->
					    <xsl:choose>
					        <xsl:when test="$pageType='counties_home'">
					            <div id="two-columns" class="g3">
<!--					            <xsl:apply-templates select="content/maincontent/node()" mode="copy"/>-->
					                <div id="counties-list">
					                   <xsl:variable name="vNodes" select="content/districts/ouc:div/li[position() > 1]/node()"/>
					                   <xsl:variable name="vNumParts" select="4"/>
					                   <xsl:variable name="vNumCols" select="ceiling(count($vNodes) div $vNumParts)"/>
					                    <xsl:for-each select="$vNodes[position() mod $vNumCols = 1]">
					                        <xsl:sort select="."/>
					                        <xsl:variable name="vCurPos" select="(position()-1)*$vNumCols +1"/>
					                        <div class="col1">
					                            <xsl:for-each select="$vNodes[position() >= $vCurPos and not(position() > $vCurPos + $vNumCols -1)]">
					                                
					                                <a href="pulaski-county-home.html"><xsl:value-of select="."/></a><br/>
					                            </xsl:for-each>
					                        </div>
					                    </xsl:for-each>
					                    
					                 </div> <!--counties-list -->
					                <div id="counties-map">
					                  <xsl:apply-templates select="content/map/node()" mode="copy"/>
					                 </div> <!--counties-map -->
					                
					                <div id="counties-dropdown">
					                    <h1>Districts:</h1>
					                    <!-- counties-form -->
					                    <form action="#" class="counties-form">
					                        <fieldset>
					                            <legend class="hidden">Delta Counties</legend>
					                            <div class="select-holder">
					                                <label class="hidden" for="delta-counties">Delta Counties</label>
					                                <select id="delta-counties" class="newsletter">
					                                    <option value="" selected="">DELTA</option>
					                                    <option value="pulaski-county-home.html">Arkansas</option>
					                                    <option value="pulaski-county-home.html">Ashley</option>
					                                    <option value="pulaski-county-home.html">Chicot</option>
					                                    <option value="pulaski-county-home.html">Clay</option>
					                                    <option value="pulaski-county-home.html">Craighead</option>
					                                    <option value="pulaski-county-home.html">Crittenden</option>
					                                    <option value="pulaski-county-home.html">Cross</option>
					                                    <option value="pulaski-county-home.html">Desha</option>
					                                    <option value="pulaski-county-home.html">Drew</option>
					                                    <option value="pulaski-county-home.html">Greene</option>
					                                    <option value="pulaski-county-home.html">Jackson</option>
					                                    <option value="pulaski-county-home.html">Jefferson</option>
					                                    <option value="pulaski-county-home.html">Lawrence</option>
					                                    <option value="pulaski-county-home.html">Lee</option>
					                                    <option value="pulaski-county-home.html">Lincoln</option>
					                                    <option value="pulaski-county-home.html">Lonoke</option>
					                                    <option value="pulaski-county-home.html">Mississippi</option>
					                                    <option value="pulaski-county-home.html">Monroe</option>
					                                    <option value="pulaski-county-home.html">Phillips</option>
					                                    <option value="pulaski-county-home.html">Poinsett</option>
					                                    <option value="pulaski-county-home.html">Prairie</option>
					                                    <option value="pulaski-county-home.html">Randolph</option>
					                                    <option value="pulaski-county-home.html">St. Francis</option>
					                                    <option value="pulaski-county-home.html">White</option>
					                                    <option value="pulaski-county-home.html">Woodruff</option>
					                                </select>
					                            </div>
					                            
					                        </fieldset>
					                        
					                        <fieldset>
					                            <legend class="hidden">Ouachita Counties</legend>
					                            <div class="select-holder">
					                                <label class="hidden" for="ouachita-counties">Ouachita Counties</label>
					                                <select id="ouachita-counties" class="newsletter">
					                                    <option value="" selected="">OUACHITA</option>
					                                    <option value="pulaski-county-home.html">Bradley</option>
					                                    <option value="pulaski-county-home.html">Calhoun</option>
					                                    <option value="pulaski-county-home.html">Clark</option>
					                                    <option value="pulaski-county-home.html">Cleveland</option>
					                                    <option value="pulaski-county-home.html">Columbia</option>
					                                    <option value="pulaski-county-home.html">Dallas</option>
					                                    <option value="pulaski-county-home.html">Garland</option>
					                                    <option value="pulaski-county-home.html">Grant</option>
					                                    <option value="pulaski-county-home.html">Hempstead</option>
					                                    <option value="pulaski-county-home.html">Hot Spring</option>
					                                    <option value="pulaski-county-home.html">Howard</option>
					                                    <option value="pulaski-county-home.html">Lafayette</option>
					                                    <option value="pulaski-county-home.html">Little River</option>
					                                    <option value="pulaski-county-home.html">Miller</option>
					                                    <option value="pulaski-county-home.html">Montgomery</option>
					                                    <option value="pulaski-county-home.html">Nevada</option>
					                                    <option value="pulaski-county-home.html">Ouachita</option>
					                                    <option value="pulaski-county-home.html">Perry</option>
					                                    <option value="pulaski-county-home.html">Pike</option>
					                                    <option value="pulaski-county-home.html">Polk</option>
					                                    <option value="pulaski-county-home.html">Pulaski</option>
					                                    <option value="pulaski-county-home.html">Saline</option>
					                                    <option value="pulaski-county-home.html">Scott</option>
					                                    <option value="pulaski-county-home.html">Sevier</option>
					                                    <option value="pulaski-county-home.html">Union</option>
					                                </select>
					                            </div>
					                            
					                        </fieldset>
					                        
					                        <fieldset>
					                            <legend class="hidden">Ozark Counties</legend>
					                            <div class="select-holder">
					                                <label class="hidden" for="ozark-counties">Ouachita Counties</label>
					                                <select id="ozark-counties" class="newsletter">
					                                    <option value="" selected="">OZARK</option>
					                                    <option value="pulaski-county-home.html">Bradley</option>
					                                    <option value="pulaski-county-home.html">Calhoun</option>
					                                    <option value="pulaski-county-home.html">Clark</option>
					                                    <option value="pulaski-county-home.html">Cleveland</option>
					                                    <option value="pulaski-county-home.html">Columbia</option>
					                                    <option value="pulaski-county-home.html">Dallas</option>
					                                    <option value="pulaski-county-home.html">Garland</option>
					                                    <option value="pulaski-county-home.html">Grant</option>
					                                    <option value="pulaski-county-home.html">Hempstead</option>
					                                    <option value="pulaski-county-home.html">Hot Spring</option>
					                                    <option value="pulaski-county-home.html">Howard</option>
					                                    <option value="pulaski-county-home.html">Lafayette</option>
					                                    <option value="pulaski-county-home.html">Little River</option>
					                                    <option value="pulaski-county-home.html">Miller</option>
					                                    <option value="pulaski-county-home.html">Montgomery</option>
					                                    <option value="pulaski-county-home.html">Nevada</option>
					                                    <option value="pulaski-county-home.html">Ouachita</option>
					                                    <option value="pulaski-county-home.html">Perry</option>
					                                    <option value="pulaski-county-home.html">Pike</option>
					                                    <option value="pulaski-county-home.html">Polk</option>
					                                    <option value="pulaski-county-home.html">Pulaski</option>
					                                    <option value="pulaski-county-home.html">Saline</option>
					                                    <option value="pulaski-county-home.html">Scott</option>
					                                    <option value="pulaski-county-home.html">Sevier</option>
					                                    <option value="pulaski-county-home.html">Union</option>
					                                </select>
					                            </div>
					                        </fieldset>
					                        <input class="hidden" type="submit" value="Submit" />
					                    </form>
					                    
					                </div>
					                
					                
					            </div>
					            <div class="cf"></div>
					        </xsl:when>
					        <xsl:otherwise>
					            <div id="two-columns" class="g3">
					                <xsl:apply-templates select="content/maincontent/node()" mode="copy"/>
					            </div>
					        </xsl:otherwise>
					    </xsl:choose>
					    
					</xsl:otherwise>
				</xsl:choose> <!-- end 0 or not 0 -->
				
			</div><!-- end container -->
		</div><!-- end main -->

	</xsl:template>
	
	<!-- BEGIN SPECIAL MATCH #1 MAINCONTENT -->
	<!-- if any special options are activated for copying misc content, they are applied in this match -->
	<xsl:template match="maincontent" mode="copy">	
		
		<xsl:if test="$pageType = 'counties_programs' and ($ou:action = 'prv' or $ou:action = 'edt')">
			<div class="omniupdate message success">
			<p>
			The following groups are in place for the Main Content region on this page. To configure user groups for a new page, a level 10 Admin may set each region to a different group via Directory Variable.
			To configure user groups for an already existing page such as this one, a user with Source Code access must change the group attribute for each ouc:div node.
			</p>
			<p>Note: Additionally, Group #1 is the default access group on new pages for all other editable regions and page properties.</p>
			<ul class="counter">
				<xsl:for-each select="ouc:div">
					<li style="list-style-position:inside;"><xsl:value-of select="@group"/></li>
				</xsl:for-each>
			</ul>
			</div>
		</xsl:if>
		
		<xsl:apply-templates mode="copy"/> <!-- copy everything normally -->		
			
		<!-- add special content -->
		
		<xsl:if test="$pageType='counties_programs'">
			<xsl:apply-templates select="/*:document/content/bottomcontent/node()" mode="copy"/>										
		</xsl:if>
		
		<xsl:if test="contains($pageOptions,'displayExternalWordpress')">
			<xsl:call-template name="WordPress"/>
		</xsl:if>	
					
	</xsl:template>
	<!-- END SPECIAL MATCH #1 MAINCONTENT -->
	
	<!-- BEGIN SPECIAL MATCH(ES) #2 SOCIAL ICONS -->
		
	<xsl:template match="social" mode="copy">
		<!-- edit buttons -->
		<ouc:div><xsl:attribute name="wysiwyg-class" select="$bodyClasses"/> <!-- dynamic 3rd -->
		<xsl:apply-templates select="ouc:div/attribute()" mode="copy"/> 
		<ouc:editor><xsl:apply-templates select="ouc:div/ouc:editor/attribute()" mode="copy"/></ouc:editor>
			
			<xsl:choose>		
				<xsl:when test="$pageLayout='1'"><!-- copy everthing and give lists special class -->
						<xsl:apply-templates select="ouc:div/node()" mode="social1"/>	
				</xsl:when>			
				<xsl:otherwise> <!-- copy links only -->
					<xsl:apply-templates select="ouc:div//a" mode="social2"/>	
				</xsl:otherwise>					
			</xsl:choose>	
					
		</ouc:div>
	</xsl:template>
	
	<xsl:template match="ul" mode="social1"><!-- give links special class -->
			<ul class="social-networks">		
				<xsl:apply-templates select="li" mode="copy"/>		
			</ul>	
	</xsl:template>
	
	<xsl:template match="node()[name()!='ul']" mode="social1"><!-- copy everything not a list normally -->
		<xsl:apply-templates mode="copy"/>
	</xsl:template>
		
	<xsl:template match="a" mode="social2"><!-- copy links only , without the link text -->
		<a>
			<xsl:apply-templates select="attribute()" mode="copy"/>
		</a>
	</xsl:template>
	

	<!-- END SPECIAL MATCH(ES) #2 SOCIAL ICONS -->
	

	

</xsl:stylesheet>
