<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

<xsl:template match="SITES-LIST">
	<style>
		.sb-pagetitle { border-bottom: solid 1px #776655; }
	</style>
	<script type="text/javascript" src="/js/Admin/Sites.js?{$version}.{$build}"/>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td>&#160;</td>
		</tr>
		<tr>
			<td class="sb-toolbarpadding">
				<xsl:apply-templates/>
			</td>
		</tr>
	</table>
	
	<form name="publishSiteForm" id="publishSiteForm" method="post">
		<xsl:attribute name="action"><xsl:value-of select="$baseUrl"/>/Admin/Site/Publish</xsl:attribute>
		<input type="hidden" name="id" value=""/>
		<input type="hidden" name="backUrl" value=""/>
	</form>
</xsl:template>

<xsl:template match="PAGED-LIST/LIST/HEADER">
	<!--
	<xsl:variable name="headerStructure" select="document('d:/1.xml')"/>
	<xsl:for-each select="$headerStructure/root/item">
		<xsl:call-template name="LIST-HEADER-ITEM">
			<xsl:with-param name="field"><xsl:value-of select="field"/></xsl:with-param>
			<xsl:with-param name="title"><xsl:value-of select="title"/></xsl:with-param>
			<xsl:with-param name="width"><xsl:value-of select="width"/></xsl:with-param>
			<xsl:with-param name="align"><xsl:value-of select="align"/></xsl:with-param>
			<xsl:with-param name="currentSortField"><xsl:value-of select="../../LIST/@ORDER-BY"/></xsl:with-param>
			<xsl:with-param name="currentSortType"><xsl:value-of select="../../LIST/@ORDER-TYPE"/></xsl:with-param>
		</xsl:call-template>
	</xsl:for-each>
	-->
	
	<tr class="sb-gridview-header" align="left" style="white-space:nowrap; ">
		<th style="width:1%;text-align:center"   class="sb-gridview-header">
			<input type="checkbox" name="globalCheck" onclick="setCheckboxStatus(this.checked);"/>
		</th>
		
		<xsl:call-template name="LIST-HEADER-ITEM">
			<xsl:with-param name="field">publicationTime</xsl:with-param>
			<xsl:with-param name="title"><xsl:value-of select="PUBLICATION-TIME"/></xsl:with-param>
			<xsl:with-param name="width">1%</xsl:with-param>
			<xsl:with-param name="currentSortField"><xsl:value-of select="../../LIST/@ORDER-BY"/></xsl:with-param>
			<xsl:with-param name="currentSortType"><xsl:value-of select="../../LIST/@ORDER-TYPE"/></xsl:with-param>
			<xsl:with-param name="align">center</xsl:with-param>
		</xsl:call-template>
	
		<xsl:call-template name="LIST-HEADER-ITEM">
			<xsl:with-param name="field">alias</xsl:with-param>
			<xsl:with-param name="title"><xsl:value-of select="ALIAS"/></xsl:with-param>
			<xsl:with-param name="currentSortField"><xsl:value-of select="../../LIST/@ORDER-BY"/></xsl:with-param>
			<xsl:with-param name="currentSortType"><xsl:value-of select="../../LIST/@ORDER-TYPE"/></xsl:with-param>
		</xsl:call-template>
	
		<xsl:call-template name="LIST-HEADER-ITEM">
			<xsl:with-param name="field">owner</xsl:with-param>
			<xsl:with-param name="title"><xsl:value-of select="OWNER"/></xsl:with-param>
			<xsl:with-param name="currentSortField"><xsl:value-of select="../../LIST/@ORDER-BY"/></xsl:with-param>
			<xsl:with-param name="currentSortType"><xsl:value-of select="../../LIST/@ORDER-TYPE"/></xsl:with-param>
			<xsl:with-param name="align">right</xsl:with-param>
		</xsl:call-template>
		
		<xsl:call-template name="LIST-HEADER-ITEM">
			<xsl:with-param name="field">creationDate</xsl:with-param>
			<xsl:with-param name="title"><xsl:value-of select="CREATION-DATE"/></xsl:with-param>
			<xsl:with-param name="currentSortField"><xsl:value-of select="../../LIST/@ORDER-BY"/></xsl:with-param>
			<xsl:with-param name="currentSortType"><xsl:value-of select="../../LIST/@ORDER-TYPE"/></xsl:with-param>
			<xsl:with-param name="align">right</xsl:with-param>
		</xsl:call-template>

		<th style="width:1%; text-align:center; padding-left: 4px; padding-right: 4px;" scope="col"   class="sb-gridview-header">
			&#160;
		</th>

		<th style="width:1%; text-align:center; padding-left: 4px; padding-right: 4px;" scope="col"   class="sb-gridview-header">
			&#160;
		</th>

		<th style="width:1%;text-align:center; padding-left: 4px; padding-right: 4px;" scope="col"   class="sb-gridview-header">
			&#160;
		</th>
	</tr>
</xsl:template>

<xsl:template match="PAGED-LIST/LIST/ITEM">
	<xsl:variable name="class">
        <xsl:call-template name="LIST-ROW-CLASS">
        <xsl:with-param name="position"><xsl:value-of select="position()"/></xsl:with-param>
		</xsl:call-template>
    </xsl:variable>
	<tr class="{$class}">
		<td style="width:1%;text-align:center;">
			<input type="checkbox" name="objectIds[]">
				<xsl:attribute name="value"><xsl:value-of select="ID"/></xsl:attribute>
			</input>
		</td>
		
		<xsl:call-template name="LIST-ROW-ITEM">
			<xsl:with-param name="icon">
				<xsl:choose>
					<xsl:when test="PUBLICATION-TIME != ''">on.gif</xsl:when>
					<xsl:otherwise>off.gif</xsl:otherwise>
				</xsl:choose>
			</xsl:with-param>
			<xsl:with-param name="contextHelp">publicationTime</xsl:with-param>
			<xsl:with-param name="align">center</xsl:with-param>
		</xsl:call-template>

		<xsl:call-template name="LIST-ROW-ITEM">
			<xsl:with-param name="title"><xsl:value-of select="ALIAS"/></xsl:with-param>
			<xsl:with-param name="action"><xsl:value-of select="$baseUrl"/>/Admin/Site/Edit?siteId=<xsl:value-of select="SITE-ID"/></xsl:with-param>
			<xsl:with-param name="contextHelp">alias</xsl:with-param>
		</xsl:call-template>

		<xsl:call-template name="LIST-ROW-ITEM">
			<xsl:with-param name="title">				
				<xsl:choose>
					<xsl:when test="USER-ROLE-ID = 4">
						<xsl:value-of select="/SITEBUILDER-PAGE/LOCALE/ANONYMOUS-USER"/>
						<xsl:if test="PARENT-OWNER != ''">&#160;-&#160;<xsl:value-of select="PARENT-OWNER"/> (<xsl:value-of select="PARENT-OWNER-FIRST-NAME"/>&#160;<xsl:value-of select="PARENT-OWNER-LAST-NAME"/>)</xsl:if>
					</xsl:when>
					<xsl:otherwise>
						<xsl:if test="OWNER != ''">
							<xsl:value-of select="OWNER"/> 
							<xsl:if test="OWNER-FIRST-NAME != '' and OWNER-LAST-NAME != ''">
								(<xsl:value-of select="OWNER-FIRST-NAME"/>&#160;<xsl:value-of select="OWNER-LAST-NAME"/>)
							</xsl:if>
						</xsl:if>
					</xsl:otherwise>
				</xsl:choose>
			</xsl:with-param>
			<xsl:with-param name="align">right</xsl:with-param>
		</xsl:call-template>
	
		<xsl:call-template name="LIST-ROW-ITEM">
			<xsl:with-param name="title"><xsl:value-of select="CREATION-DATE"/></xsl:with-param>
			<xsl:with-param name="align">right</xsl:with-param>
		</xsl:call-template>
		
		<td class="{$class}" style="width:1%; text-align:center; padding-left: 4px; padding-right: 4px;">
			<a target="new">
				<xsl:attribute name="onmouseout">SetContextHelp();</xsl:attribute>
				<xsl:attribute name="onmouseover">SetContextHelp('CONTEXT-HELP-BUTTON-PREVIEW');</xsl:attribute>
			
				<xsl:attribute name="href"><xsl:value-of select="$baseUrl"/>/Preview?siteId=<xsl:value-of select="SITE-ID"/></xsl:attribute>
				<img style="border-width:0px;width:16px;height:16px" src="{$skinPath}/icons/prew.png"/>
			</a>
		</td>
		
		<td style="width:1%; text-align:center; padding-left: 4px; padding-right: 4px;">
			<!--xsl:choose>
				<xsl:when test="string(USER-ROLE-NAME) = 'Guest'">
					<img src="/images/blank.gif" width="16" height="16"/>
				</xsl:when>
				<xsl:otherwise-->
					<a href="#">
						<xsl:attribute name="onmouseout">SetContextHelp();</xsl:attribute>
						<xsl:attribute name="onmouseover">SetContextHelp('CONTEXT-HELP-BUTTON-PUBLISH');</xsl:attribute>
						
						<xsl:attribute name="onclick">javascript: publishSite('<xsl:value-of select="SITE-ID"/>', '/Admin/Site/List')</xsl:attribute>
						<img style="border-width:0px;width:16px;height:16px" src="{$skinPath}/icons/publ.png"/>
					</a>
				<!--/xsl:otherwise>
			</xsl:choose-->
			
		</td>
		
		<td style="width:1%; text-align:center; padding-left: 4px; padding-right: 4px;">
			<a>
				<xsl:attribute name="onmouseout">SetContextHelp();</xsl:attribute>
				<xsl:attribute name="onmouseover">SetContextHelp('CONTEXT-HELP-BUTTON-WIZARD-EDIT');</xsl:attribute>
				<xsl:attribute name="editWizardUrl"><xsl:value-of select="$baseUrl"/>/Wizard/Edit?siteId=<xsl:value-of select="SITE-ID"/>&amp;<xsl:value-of select="/SITEBUILDER-PAGE/PROPERTIES/SESSION/@NAME"/>=<xsl:value-of select="/SITEBUILDER-PAGE/PROPERTIES/SESSION/@VALUE"/></xsl:attribute>
				
				<xsl:attribute name="href">javascript:openWizard('<xsl:value-of select="$baseUrl"/>/Wizard/Edit?siteId=<xsl:value-of select="SITE-ID"/>&amp;<xsl:value-of select="/SITEBUILDER-PAGE/PROPERTIES/SESSION/@NAME"/>=<xsl:value-of select="/SITEBUILDER-PAGE/PROPERTIES/SESSION/@VALUE"/>');</xsl:attribute>
				<img style="border-width:0px;width:16px;height:16px" src="{$skinPath}/icons/editsiteinwizard.png"/>
			</a>
		</td>
	</tr>
</xsl:template>

</xsl:stylesheet>