<?xml version="1.0" encoding="UTF-8"?>
<Report>
	<Title><var var="I18N::translate('Changes')" /></Title>
	<Description><var var="I18N::translate('A report of recent and pending changes.')" /></Description>
	<Input name="changeRangeStart" lookup="DATE" type="text" default="NOW-30"><var var="I18N::translate('Starting range of change dates')" /></Input>
	<Input name="changeRangeEnd" lookup="DATE" type="text" default="NOW"><var var="I18N::translate('Ending range of change dates')" /></Input>
	<Input name="sortby" type="select" default="CHAN" options="CHAN=>I18N::translate('sort by date')|NAME=>I18N::translate('sort by name')|BIRT:DATE=>I18N::translate('sort by date of birth')"><var var="I18N::translate('Sort order')" /></Input>
	<Input name="pending" type="select" options="yes=>I18N::translate('yes')|no=>I18N::translate('no')"><var var="I18N::translate('Show pending changes')" /></Input>
	<Input name="pageSize" type="select" default="A4" options="letter=>I18N::translateContext('paper size','Letter')|A3=>I18N::translateContext('paper size', 'A3')|A4=>I18N::translateContext('paper size','A4')|legal=>I18N::translateContext('paper size','Legal')"><var var="I18N::translate('Page size')" /></Input>
	<Input name="pageorient" type="select" default="landscape" options="landscape=>I18N::translate('Landscape')|portrait=>I18N::translate('Portrait')"><var var="I18N::translate('Orientation')" /></Input>
	<!--
	<Input name="fonts" type="select" default="dejavusans" options="arialunicid0=>I18N::translateContext('font name', 'Arial')|dejavusans=>I18N::translateContext('font name', 'DejaVu')|helvetica=>I18N::translateContext('font name', 'Helvetica')"><var var="I18N::translate('Font')"/></Input>
	-->
	<SetVar name="fonts" value="dejavusans" />

	<!-- Header -->
	<Style name="header" font="$fonts" size="16" style="b" />
	<!-- Page numbers text -->
	<Style name="pagenum" font="$fonts" size="8"/>
	<!-- Standard text -->
	<Style name="text" font="$fonts" size="9"/>
	<!-- Column labels -->
	<Style name="label" font="$fonts" size="10" style="b"/>
	<!-- Generated by style - required style name by the generator -->
	<Style name="genby" font="$fonts" size="8" />
	<!-- Date text -->
	<Style name="date" font="$fonts" size="8"/>
	<Style name="header2" font="$fonts" size="12" style="b" />

	<if condition="$pageorient=='landscape'">
		<!-- landscape orientation -->
		<SetVar name="namewidth" value="270"/>
		<SetVar name="datewidth" value="300"/>
	</if>
	
	<if condition="$pageorient=='portrait'">
		<!-- portrait orientation -->
		<SetVar name="namewidth" value="210"/>
		<SetVar name="datewidth" value="190"/>
	</if>

	<Doc pageSize="$pageSize" orientation="$pageorient" >
		<Header>
			<Cell align="center" height="20" newline="1" style="header"><var var="I18N::translate('Changes')" /></Cell>
			<Cell align="rightrtl" newline="1" style="pagenum"><var var="I18N::translate('Page')" /> <PageNum /> <var var="I18N::translate('of')" /> <TotalPages /></Cell>
		</Header>

		<Body>

			<!-- Pending changes section Header -->
			<if condition="$pending=='yes'">
				<Cell align="center" height="20" newline="1" style="header2"><var var="I18N::translate('Pending changes')" /></Cell>
				<SetVar name="fill" value="" />
				<if condition="$sortby=='NAME'"><SetVar name="fill" value="#AAAAAA" /></if>
				<TextBox bgcolor="$fill" border="1" height="12" width="$namewidth">
					<Text style="label"><var var="I18N::translate('Name')" /></Text>
				</TextBox>

				<TextBox border="1" height="12" width="$datewidth">
					<Text style="label"><var var="I18N::translate('Differences')" /></Text>
				</TextBox>

				<SetVar name="fill" value="" />
				<if condition="$sortby=='CHAN'"><SetVar name="fill" value="#AAAAAA" /></if>
				<TextBox bgcolor="$fill" border="1" height="12" newline="1">
					<Text style="label"><var var="I18N::translate('Last change')" /></Text>
				</TextBox>

				<!-- Pending Changes Section Data -->
				<List list="pending" sortby="$sortby">
					<TextBox height="12" width="$namewidth">
						<Text style="text"><GetPersonName id="" /></Text>
					</TextBox>
					<TextBox height="12" width="$datewidth">
						<Facts ignore="CHAN" families="0" diff="true">
							<Text style="text">
								<var var="@fact" /> <GedcomValue tag="@fact:DATE" /><br />
							</Text>
						</Facts>
					</TextBox>
					<TextBox height="12" newline="1">
						<Text style="text"><GedcomValue tag="CHAN:DATE" /> <GedcomValue tag="CHAN:DATE:TIME" /> - <GedcomValue tag="CHAN:_WT_USER" /></Text>
					</TextBox>

				</List>
				<Cell align="rightrtl" height="25" newline="1" style="label">
					<var var="I18N::translate('Total pending changes: ')" /><ListTotal /><br />
				</Cell>
			</if>

			<!-- Recent Changes Section Header -->
			<Cell align="center" height="20" newline="1" style="header2"><var var="I18N::translate('Recent changes')" /> <var var="changeRangeStart" date="1" /> - <var var="changeRangeEnd" date="1" /></Cell>
			<SetVar name="fill" value="" />
			<if condition="$sortby=='NAME'"><SetVar name="fill" value="#AAAAAA" /></if>
			<TextBox bgcolor="$fill" border="1" height="12" width="$namewidth">
				<Text style="label"><var var="I18N::translate('Name')" /></Text>
			</TextBox>

			<SetVar name="fill" value="" />
			<if condition="$sortby=='BIRT:DATE'"><SetVar name="fill" value="#AAAAAA" /></if>
			<TextBox bgcolor="$fill" border="1" height="12" width="$datewidth">
				<Text style="label"><var var="I18N::translate('Birth')" /> - <var var="I18N::translate('Death')" /></Text>
			</TextBox>

			<SetVar name="fill" value="" />
			<if condition="$sortby=='CHAN'"><SetVar name="fill" value="#AAAAAA" /></if>
			<TextBox bgcolor="$fill" border="1" height="12" newline="1">
				<Text style="label"><var var="I18N::translate('Last change')" /></Text>
			</TextBox>

			<!-- Recent Changes Section Data -->
			<List list="individual" filter1="CHAN:DATE LTE $changeRangeEnd" filter2="CHAN:DATE GTE $changeRangeStart" sortby="$sortby">
				<TextBox height="12" width="$namewidth">
					<Text style="text"><GetPersonName id="" /></Text>
				</TextBox>

				<TextBox height="12" width="$datewidth">
					<Text style="text"><var var="I18N::translate('Birth')" />: <GedcomValue tag="BIRT:DATE" /><br /><var var="I18N::translate('Death')" />: <GedcomValue tag="DEAT:DATE" /></Text>
				</TextBox>

				<TextBox height="12" newline="1">
					<Text style="text"><GedcomValue tag="CHAN:DATE" /> <GedcomValue tag="CHAN:DATE:TIME" /> - <GedcomValue tag="CHAN:_WT_USER" /></Text>
				</TextBox>
			</List>

			<Cell align="rightrtl" height="25" newline="1" style="label">
				<var var="I18N::translate('Total accepted changes: ')" /><ListTotal />
			</Cell>
		</Body>
		<Footer>
			<Cell align="rightrtl" newline="1" style="date"><Now /></Cell>
		</Footer>
	</Doc>
</Report>
