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

	<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>

<!--|| TEMPLATE : traffic report items ||-->
	<xsl:template match="data[starts-with(@name, 'report_item_traffic_')]">
		<table width="100%" border="0" cellpadding="0" cellspacing="0" class="border">
			<thead>
				<tr>
					<td class="tableheader" colspan="2"><xsl:value-of select="$localization[@name=current()/@name]"/></td>
				</tr>
				<tr>
					<td class="grey" width="50%">
						<xsl:choose>
							<xsl:when test="@name='report_item_traffic_by_hour'"><xsl:value-of select="$localization[@name='traffic_hour']"/></xsl:when>
							<xsl:when test="@name='report_item_traffic_by_day'" ><xsl:value-of select="$localization[@name='traffic_day']"/></xsl:when>
							<xsl:when test="@name='report_item_traffic_by_week'"><xsl:value-of select="$localization[@name='traffic_week']"/></xsl:when>
							<xsl:otherwise></xsl:otherwise>
						</xsl:choose>
					</td>
					<td class="grey-end" width="50%" align="right"><xsl:value-of select="$localization[@name='total_message_count']"/></td>
				</tr>
			</thead>
			<tbody>
				<xsl:for-each select="datarow">
					<xsl:variable name="col-style">
						<xsl:if test="position() mod 2 = 1">data1</xsl:if>
						<xsl:if test="position() mod 2 = 0">data2</xsl:if>
					</xsl:variable>
					<tr>
						<td width="50%">
							<xsl:attribute name="class"><xsl:value-of select="$col-style"/>b</xsl:attribute>
							<xsl:choose>
								<xsl:when test="../@name='report_item_traffic_by_hour'">
									<xsl:call-template name="format_datehour_string">
										<xsl:with-param name="datetime_string" select="@datetime_first"/>
									</xsl:call-template>
								</xsl:when>
								<xsl:when test="../@name='report_item_traffic_by_day'" >
									<xsl:call-template name="format_date_string">
										<xsl:with-param name="datetime_string" select="@datetime_first"/>
									</xsl:call-template>
								</xsl:when>
								<xsl:when test="../@name='report_item_traffic_by_week'">
									<xsl:call-template name="format_date_string">
										<xsl:with-param name="datetime_string" select="@datetime_first"/>
									</xsl:call-template>
									<xsl:text> - </xsl:text>
									<xsl:call-template name="format_date_string">
										<xsl:with-param name="datetime_string" select="@datetime_last"/>
									</xsl:call-template>
								</xsl:when>
								<xsl:otherwise></xsl:otherwise>
							</xsl:choose>
						</td>
						<td width="50%" align="right">
							<xsl:attribute name="class"><xsl:value-of select="$col-style"/></xsl:attribute>
							<xsl:call-template name="format_int_number">
								<xsl:with-param name="num" select="@total_message_count_by_hour"/>
							</xsl:call-template>
							<xsl:text disable-output-escaping="yes">&amp;nbsp;&amp;nbsp;</xsl:text>
						</td>
					</tr>
				</xsl:for-each>
			</tbody>
		</table>
	</xsl:template>

</xsl:stylesheet>
