<?xml version="1.0" encoding="UTF-8"?>
<Report>
	<!-- $Id$ -->
	<Title><var var="i18n::translate('Individual Report')" /></Title>
	<Description>Prints an individual record report</Description>
	<Input name="pid" lookup="INDI" type="text" default=""><var var="i18n::translate('Enter Individual ID')" /></Input>
	<Input name="sources" type="checkbox" default="1"><var var="i18n::translate('Show sources?')" /></Input>
	<Input name="notes" type="checkbox" default="1"><var var="i18n::translate('Show notes?')" /></Input>
	<Input name="photos" type="select" default="highlighted" options="none=>i18n::translate('None')|all=>i18n::translate('All')|highlighted=>i18n::translate('Highlighted image')"><var var="i18n::translate('Show photos?')"/></Input>
	<Input name="pageSize" type="select" default="A4" options="letter=>i18n::translate_c('paper size','Letter')|A3=>i18n::translate_c('paper size', 'A3')|A4=>i18n::translate_c('paper size','A4')|legal=>i18n::translate_c('paper size','Legal')"><var var="i18n::translate('Page size')" /></Input>
	<Input name="fonts" type="select" default="dejavusans" options="arialunicid0=>i18n::translate_c('font name', 'Arial')|dejavusans=>i18n::translate_c('font name', 'DejaVu')|helvetica=>i18n::translate_c('font name', 'Helvetica')"><var var="i18n::translate('Font')"/></Input>

	<!-- Header -->
	<Style name="header" font="$fonts" size="18" />
	<!-- Generated by style - required style name by the generator -->
	<Style name="genby" font="$fonts" size="8" />
	<!-- Page numbers text -->
	<Style name="pagenum" font="$fonts" size="8" />
	<!-- Source text - FootnoteTexts - required style name by the generator -->
	<Style name="footnote" font="$fonts" size="8" />
	<!-- Links to sources - required style name by the generator -->
	<Style name="footnotenum" font="$fonts" size="6" />
	<!-- Date text -->
	<Style name="date" font="$fonts" size="8"/>
	<Style name="label1" font="$fonts" size="9" />
	<Style name="name" font="$fonts" size="10" />
	<Style name="name1" font="$fonts" size="14" />
	<Style name="text" font="$fonts" size="9" />

	<SetVar name="ignore" value="CHAN,NAME,SEX,SOUR,NOTE,OBJE,FAMC,FAMS,TITL,CHIL,HUSB,WIFE,_UID,_WT_OBJE_SORT" />
	<!-- Section title background color -->
	<SetVar name="stbgcolor" value="#AAAAAA"/>
	<!-- set the default widths -->
	<SetVar name="width" value="433" />
	<SetVar name="width1" value="418" />
	<SetVar name="width2" value="233" />
	<SetVar name="dwidth" value="200" />
	<SetVar name="pwidth" value="436" />
	<!-- change the widths for no pictures -->
	<if condition="$photos=='none'">
		<SetVar name="width" value="0"/>
		<SetVar name="width1" value="0"/>
		<SetVar name="width2" value="0"/>
	</if>
	<!-- New Page for Sources controller if SOUR exist -->
	<SetVar name="source_exist" value="0" />

	<Doc pageSize="$pageSize" >
		<Header>
			<Cell align="center" newline="1" style="header"><var var="i18n::translate('Individual Report')" /></Cell>
			<Cell align="rightrtl" newline="1" style="pagenum"><var var="i18n::translate('Page')" /> <PageNum /> <var var="i18n::translate('of')" /> <TotalPages /></Cell>
		</Header>
		<Body>
			<!-- set the gedcom context for this individual -->
			<Gedcom id="$pid">
				<Cell newline="1" style="name1"><GetPersonName id=""/></Cell>
				<!-- show the persons images -->
				<if condition="$photos=='all'">
					<!-- This is an image not a text, so don't use text padding
					Reset also the last height after all the images has been printed
					set pagecheck to 0, the image function check is too
					and "trick" the X-position back to the margin with a newline -->
					<TextBox left="$pwidth" newline="1" pagecheck="0" padding="0" reseth="1" width="80">
						<RepeatTag tag="OBJE">
							<Image file="@FILE" width="80" ln="N"/>
						</RepeatTag>
					</TextBox>
				</if>
				<!-- show the person's Highlighted Image -->
				<if condition="$photos=='highlighted'">
					<HighlightedImage left="$pwidth" width="80"/>
				</if>

				<!-- print the person's facts -->
				<TextBox bgcolor="$stbgcolor" border="1" height="16" newline="1" width="$width">
					<Text style="label1"><var var="i18n::translate('Personal Facts and Details')" /></Text>
				</TextBox>
				
				<!-- print level 1 sources -->
				<TextBox border="1" width="$width" height="16" newline="1">
					<Text style="name"><GetPersonName id=""/> </Text>
					<if condition="$sources==1">
						<RepeatTag tag="SOUR">
							<Footnote>
								<Gedcom id="@SOUR">
									<GedcomValue tag="TITL" />
								</Gedcom>
								<if condition="@PAGE!=''">: </if>
								<GedcomValue tag="SOUR:PAGE"/> <GedcomValue tag="SOUR:DATA:TEXT"/>	
							</Footnote>
							<SetVar name="source_exist" value="1"/>
						</RepeatTag>
					</if>
				</TextBox>
				<Facts ignore="$ignore" families="1">
					<TextBox border="1" width="$dwidth" height="16">
						<Text style="pagenum"><var var="@fact" />  </Text>
						<Text style="text"><GedcomValue tag="@fact:DATE" /> </Text>
						<!-- look for fact level 2 sources -->
						<if condition="$sources==1">
							<RepeatTag tag="@fact:SOUR">
								<Footnote>
									<Gedcom id="@SOUR">
										<GedcomValue tag="TITL" />
									</Gedcom>
									<if condition="@PAGE!=''">: </if>
									<GedcomValue tag="SOUR:PAGE"/> <GedcomValue tag="SOUR:DATA:TEXT"/>	
								</Footnote>
								<SetVar name="source_exist" value="1"/>
							</RepeatTag>
						</if>
					</TextBox>
					<!-- print a different layout for facts with descriptions -->
					<if condition="@desc!=''">
						<TextBox border="1" width="$width2" height="16" newline="1">
							<Text style="text"><GedcomValue tag="@desc" />
								<!-- Print this only when it's needed -->
								<if condition="@PLAC!=''"> </if>
								<GedcomValue tag="@fact:PLAC" />
							</Text>
							<Gedcom id="@_PGVS">
								<if condition="@SEX=='M'">
									<Text style="pagenum"> <var var="i18n::translate('Husband')" /></Text>
								</if>
								<if condition="@SEX=='F'">
									<Text style="pagenum"> <var var="i18n::translate('Wife')" /></Text>
								</if>
								<Text style="text"> <GetPersonName id="" /></Text>
							</Gedcom>
						</TextBox>
					</if>
					<!-- facts without descriptions -->
					<if condition="@desc==''">
						<TextBox border="1" width="$width2" height="16" newline="1">
							<if condition="@PLAC!=''">
								<Text style="pagenum"><var var="i18n::translate('Place')" />   </Text>
							</if>
							<Text style="text">
								<GedcomValue tag="@fact:PLAC" /> <GedcomValue tag="@fact:TEMP" />
							</Text>
							<Gedcom id="@_PGVS">
								<if condition="@SEX=='M'">
									<Text style="pagenum"> <var var="i18n::translate('Husband')" /></Text>
								</if>
								<if condition="@SEX=='F'">
									<Text style="pagenum"> <var var="i18n::translate('Wife')" /></Text>
								</if>
								<Text style="text"> <GetPersonName id="" /></Text>
							</Gedcom>
						</TextBox>
					</if>
				</Facts>

				<!-- print any level 1 notes -->
				<if condition="($notes==1) and (@NOTE!='')">
					<TextBox width="15" height="16" newline="1" padding="0"/>
					<TextBox border="1" width="$width" height="16" newline="1" bgcolor="$stbgcolor">
						<Text style="label1"><var var="i18n::translate('Notes')" /></Text>
					</TextBox>
					<RepeatTag tag="NOTE">
						<TextBox border="1" width="$width" height="16" newline="1">
							<Text style="pagenum"><GedcomValue tag="NOTE" /><br/></Text>
						</TextBox>
					</RepeatTag>
				</if>

				<!-- print family with parents and siblings -->
				<TextBox width="15" height="16" newline="1" padding="0"/>
				<TextBox border="1" width="$width" height="16" newline="1" bgcolor="$stbgcolor">
					<Text style="label1"><var var="i18n::translate('Family with parents')" /></Text>
				</TextBox>
				<RepeatTag tag="FAMC">
					<Gedcom id="@FAMC">
						<!-- father -->
						<Gedcom id="@HUSB">
							<TextBox border="1" width="$width" height="16" newline="1">
								<Text style="label1"><var var="i18n::translate('Father')" />  </Text>
								<Text style="name"> <GetPersonName id="" /> </Text>
								<if condition="$sources==1">
									<RepeatTag tag="SOUR">
										<Footnote>
											<Gedcom id="@SOUR">
												<GedcomValue tag="TITL" />
											</Gedcom>
											<if condition="@PAGE!=''">: </if>
											<GedcomValue tag="SOUR:PAGE"/> <GedcomValue tag="SOUR:DATA:TEXT"/>	
										</Footnote>
										<SetVar name="source_exist" value="1"/>
									</RepeatTag>
								</if>
								<Text style="text"> (<var var="i18n::translate('Birth')" />: <GedcomValue tag="BIRT:DATE" /> <GedcomValue tag="BIRT:PLAC" /> - <var var="i18n::translate('Death')" />: <GedcomValue tag="DEAT:DATE" /> <GedcomValue tag="DEAT:PLAC" />)</Text>
							</TextBox>
						</Gedcom>
						<!-- mother -->
						<Gedcom id="@WIFE">
							<TextBox border="1" width="$width" height="16" newline="1">
								<Text style="label1"><var var="i18n::translate('Mother')" />  </Text>
								<Text style="name"> <GetPersonName id="" /> </Text>
								<if condition="$sources==1">
									<RepeatTag tag="SOUR">
										<Footnote>
											<Gedcom id="@SOUR">
												<GedcomValue tag="TITL" />
											</Gedcom>
											<if condition="@PAGE!=''">: </if>
											<GedcomValue tag="SOUR:PAGE"/> <GedcomValue tag="SOUR:DATA:TEXT"/>	
										</Footnote>
										<SetVar name="source_exist" value="1"/>
									</RepeatTag>
								</if>
								<Text style="text"> (<var var="i18n::translate('Birth')" />: <GedcomValue tag="BIRT:DATE" /> <GedcomValue tag="BIRT:PLAC" /> - <var var="i18n::translate('Death')" />: <GedcomValue tag="DEAT:DATE" /> <GedcomValue tag="DEAT:PLAC" />)</Text>
							</TextBox>
						</Gedcom>
						<!-- siblings -->
						<RepeatTag tag="CHIL">
							<if condition="@CHIL!=$pid">
								<Gedcom id="@CHIL">
								<TextBox border="1" left="15" width="$width1" height="16" newline="1">
									<!-- Brother -->
									<if condition="@SEX=='M'">
										<Text style="label1"><var var="i18n::translate('Brother')" />  </Text>
									</if>
									<!-- Sister -->
									<if condition="@SEX=='F'">
										<Text style="label1"><var var="i18n::translate('Sister')" />  </Text>
									</if>
									<!-- Unknown gender -->
									<if condition="(@SEX=='U') or (@SEX=='')">
										<Text style="label1"><var var="i18n::translate('Gender')" /> <var var="i18n::translate_c('unknown gender', 'Unknown')"/>  </Text>
									</if>
									<Text style="name"> <GetPersonName id="" /> </Text>
									<if condition="$sources==1">
										<RepeatTag tag="SOUR">
											<Footnote>
												<Gedcom id="@SOUR">
													<GedcomValue tag="TITL" />
												</Gedcom>
												<if condition="@PAGE!=''">: </if>
												<GedcomValue tag="SOUR:PAGE"/> <GedcomValue tag="SOUR:DATA:TEXT"/>	
											</Footnote>
											<SetVar name="source_exist" value="1"/>
										</RepeatTag>
									</if>
									<Text style="text"> (<var var="i18n::translate('Birth')" />: <GedcomValue tag="BIRT:DATE" /> <GedcomValue tag="BIRT:PLAC" /> - <var var="i18n::translate('Death')" />: <GedcomValue tag="DEAT:DATE" /> <GedcomValue tag="DEAT:PLAC" />)</Text>
								</TextBox>
							</Gedcom>
						  </if>
						</RepeatTag>
					</Gedcom>
				</RepeatTag>

				<!-- print family with spouse and children -->
				<RepeatTag tag="FAMS">
					<Gedcom id="@FAMS">
						<!-- print wife if person is husband -->
						<if condition="$pid==@HUSB">
							<TextBox width="15" height="16" newline="1" padding="0"/>
							<TextBox border="1" width="$width" height="16" newline="1" bgcolor="$stbgcolor">
								<Text style="label1"><var var="i18n::translate('Family with wife')" /></Text>
							</TextBox>
							<SetVar name="spid" value="@WIFE" />
						</if>
						<!-- print husband if person is wife -->
						<if condition="$pid==@WIFE">
							<TextBox width="15" height="16" newline="1" padding="0"/>
							<TextBox border="1" width="$width" height="16" newline="1" bgcolor="$stbgcolor">
								<Text style="label1"><var var="i18n::translate('Family with husband')" /></Text>
							</TextBox>
							<SetVar name="spid" value="@HUSB" />
						</if>

						<!-- print information for spouse -->
						<Gedcom id="$spid">
							<TextBox border="1" width="$width" height="16" newline="1">
								<if condition="@SEX=='M'">
									<Text style="label1"><var var="i18n::translate('Husband')" />  </Text>
								</if>
								<if condition="@SEX=='F'">
									<Text style="label1"><var var="i18n::translate('Wife')" />  </Text>
								</if>
								<Text style="name"> <GetPersonName id="" /> </Text>
								<if condition="$sources==1">
									<RepeatTag tag="SOUR">
										<Footnote>
											<Gedcom id="@SOUR">
												<GedcomValue tag="TITL" />
											</Gedcom>
											<if condition="@PAGE!=''">: </if>
											<GedcomValue tag="SOUR:PAGE"/> <GedcomValue tag="SOUR:DATA:TEXT"/>	
										</Footnote>
										<SetVar name="source_exist" value="1"/>
									</RepeatTag>
								</if>
							<Text style="text"> (<var var="i18n::translate('Birth')" />: <GedcomValue tag="BIRT:DATE" /> <GedcomValue tag="BIRT:PLAC" /> - <var var="i18n::translate('Death')" />: <GedcomValue tag="DEAT:DATE" /> <GedcomValue tag="DEAT:PLAC" />)</Text>
							</TextBox>
						</Gedcom>
						<!-- print children -->
						<RepeatTag tag="CHIL">
						  <if condition="@CHIL!=$pid">
							<Gedcom id="@CHIL">
								<TextBox border="1" left="15" width="$width1" height="16" newline="1">
									<!-- Son -->
									<if condition="@SEX=='M'">
										<Text style="label1"><var var="i18n::translate('Son')" />  </Text>
									</if>
									<!-- Daughter -->
									<if condition="@SEX=='F'">
										<Text style="label1"><var var="i18n::translate('Daughter')" />  </Text>
									</if>
									<!-- Unknown gender -->
									<if condition="(@SEX=='U') or (@SEX=='')">
										<Text style="label1"><var var="i18n::translate('Gender')"/> <var var="i18n::translate_c('unknown gender', 'Unknown')"/>  </Text>
									</if>
									<Text style="name"> <GetPersonName id="" /> </Text>
									<if condition="$sources==1">
										<RepeatTag tag="SOUR">
											<Footnote>
												<Gedcom id="@SOUR">
													<GedcomValue tag="TITL" />
												</Gedcom>
												<if condition="@PAGE!=''">: </if>
												<GedcomValue tag="SOUR:PAGE"/> <GedcomValue tag="SOUR:DATA:TEXT"/>	
											</Footnote>
											<SetVar name="source_exist" value="1"/>
										</RepeatTag>
									</if>
									<Text style="text"> (<var var="i18n::translate('Birth')" />: <GedcomValue tag="BIRT:DATE" /> <GedcomValue tag="BIRT:PLAC" /> - <var var="i18n::translate('Death')" />: <GedcomValue tag="DEAT:DATE" /> <GedcomValue tag="DEAT:PLAC" />)</Text>
								</TextBox>
							</Gedcom>
						  </if>
						</RepeatTag>
					</Gedcom>
				</RepeatTag>
			</Gedcom>

			<!-- print the sources -->
			<if condition="($sources==1) and ($source_exist==1)">
				<TextBox width="$width" newline="1">
					<Text style="name1"><var var="i18n::translate('Sources')" /><br /><br /></Text>
					<FootnoteTexts />
				</TextBox>
			</if>
		</Body>
		<Footer>
			<Cell align="rightrtl" newline="1" style="date"><Now /></Cell>
		</Footer>
	</Doc>
</Report>
