<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY nbsp   "&#160;">
<!ENTITY lsaquo   "&#8249;">
<!ENTITY rsaquo   "&#8250;">
<!ENTITY laquo  "&#171;">
<!ENTITY raquo  "&#187;">
<!ENTITY copy   "&#169;">
<!ENTITY times	"&#215;">
]>
<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:ouc="http://omniupdate.com/XSL/Variables"
				exclude-result-prefixes="xs ou ouc"
				expand-text="yes">

	<!-- common implementation xsl -->
	<xsl:import href="../common.xsl"/>
	<!-- faculty directory specific variables -->
	<xsl:import href="variables.xsl" />
	<!-- faculty directory specific functions -->
	<xsl:import href="functions.xsl" />

	<xsl:template name="page-content">
		<xsl:variable name="col-med" select="if (ou:pcf-param('aside') = 'display') then 'col-md-10 col-sm-push-2' else 'col-md-12'" />

		<section class="page-header background-color-secondary custom-text-color-white">
			<div class="container">
				<div class="row">
					<div class="col-md-12">

						<xsl:call-template name="breadcrumb" />

					</div>
				</div>
			</div>
		</section>
		<div class="container">
			<div class="row">

				<div class="{$col-med} interior-content match-height">

					<xsl:if test="ou:pcf-param('heading') != ''">

						<div class="heading heading-border heading-middle-border">

							<h1>{ou:pcf-param('heading')}</h1>

						</div>

					</xsl:if>

					<xsl:apply-templates select="ouc:div[@label = 'maincontent']" />

					<xsl:call-template name="faculty-listing" />

				</div>

				<xsl:if test="ou:pcf-param('aside') = 'display'">

					<div class="col-md-2 interior-navigation match-height col-sm-pull-10">
						<aside class="sidebar">

							<xsl:if test="doc-available($props-path)">

								<span class="heading-primary">{ou:pcf-param('breadcrumb', doc($props-path))}</span>

							</xsl:if>

							<xsl:if test="ou:pcf-param('nested-navigation') = 'display'">

								<xsl:call-template name="nested-navigation" />

							</xsl:if>

							<xsl:if test="ou:pcf-param('region-aside') = 'display'">

								<xsl:apply-templates select="ouc:div[@label = 'region-aside']" />

							</xsl:if>

						</aside>
					</div>

				</xsl:if>

			</div>
		</div>

	</xsl:template>

	<!-- ************* begin profile listing *************** -->
	<xsl:template name="faculty-listing">
		<xsl:if test="$is-edt">
			<div class="alert alert-warning">Directory listing will only be updated upon publish. It is recommended that you set this page to 'Schedule Publish' on a recurring basis.</div>
			<div class="alert alert-info">Only published profile pages will be displayed.</div>
		</xsl:if>

		<table class="display" id="directory">
			<thead>
				<tr>
					<th>Name</th>
					<th>Title</th>
<!-- 				<th>Department</th> -->
					<!-- <th>Office</th> -->
					<th>Phone</th>
					<th>Email</th>
					<!-- <th>Website</th> -->
				</tr>
			</thead>
			<tbody>
				<xsl:apply-templates select="$all-profiles/profiles/profile" mode="listing" />
			</tbody>
		</table>
	</xsl:template>

	<xsl:template match="profile" mode="listing">
		<tr>
			<td><a href="{@href}"><xsl:value-of select="concat(lastname, ', ', firstname)"/></a></td>
			<td><xsl:value-of select="title"/></td>
<!-- 			<td><xsl:value-of select="department"/></td> -->
			<!-- <td><xsl:value-of select="office"/></td> -->
			<td><xsl:value-of select="phone"/></td>
			<td><a href="mailto:{email/text()}"><xsl:value-of select="email"/></a></td>
			<!-- <td><a href="{website}" title="View {concat(firstname, ' ', lastname)} website">website</a></td> -->
		</tr>
	</xsl:template>

	<xsl:template name="template-footcode" expand-text="no">
		<script src="/_resources/directory/js/jquery.dataTables.min.js"></script>
		
		<link rel="stylesheet" href="https://cdn.datatables.net/1.10.16/css/jquery.dataTables.min.css" />

		 <script>
			 
			 
			 
		    $(function() {
		        $("#directory").dataTable({
		            info: false,
		            language: { lengthMenu: "Show: _MENU_", search: "Search: ", paginate: {
      next: '&#8594;', // or '→'
      previous: '&#8592;' // or '←' 
    } },
		            lengthMenu: [
		                [15, 30, 60, -1],
		                [15, 30, 60, "All"]
		            ],
		            pagingType: "full_numbers",
		            paging: true,
		            stripeClasses: false,
		            ordering: true
		        });
		    });
		    </script>
	</xsl:template>

</xsl:stylesheet>
