%doctype;
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
  <!-- $Id: anclist.txt,v 5.5 2007-07-25 13:15:18 ddr Exp $ -->
  <!-- Copyright (c) 1998-2007 INRIA -->
  <title>%nn;
    %if;(evar.t = "F")- [*surnames branch] -%nn;
    %else
      %apply;a_of_b%with;
        %if;(evar.t = "M")[*missing ancestors]%else;[*ancestors]%end;
      %and;
        %if;(public_name != "")%public_name;%else;%first_name;%end;
        %if;(qualifier != "") %qualifier;%end;
        %sp;%surname;
      %end;
    %end;
  </title>
  <meta name="robots" content="none"%/>
  <meta http-equiv="content-type" content="text/html; charset=%charset;"%/>
  <meta http-equiv="content-style-type" content="text/css"%/>
  <link rel="shortcut icon" href="%image_prefix;/favicon_gwd.png"%/>
%include.css;
%base_header;
</head>
<body%body_prop;>
%message_to_wizard;

<h1>%nn;
  %if;(evar.t = "F")
    %if;(public_name != "")%public_name;%else;%first_name;%end;
    %if;(qualifier != "") <em>%qualifier;</em>%end;
    %sp;%surname;
    %if;(alias != "") <em>(%alias;)</em>%end;<br%/>
    - [*surnames branch] -
  %elseif;(evar.t = "E")
    %if;(public_name != "")%public_name;%else;%first_name;%end;
    %if;(qualifier != "") <em>%qualifier;</em>%end;
    %sp;%surname;
    %if;(alias != "") <em>(%alias;)</em>%end;<br%/>
    - [*list eclair] -
  %else;
    %apply;a_of_b%with;[*ancestors]%and;
      %if;(public_name != "")%public_name;%else;%first_name;%end;
      %if;(qualifier != "") <em>%qualifier;</em>%end;
      %sp;%surname;
      %if;(alias != "") <em>(%alias;)</em>%end;
    %end;
    %if;(evar.t = "D") [up to] %pvar.1;%end;
  %end;
</h1>

%if;(evar.cgl != "on")
  <table style="float:%right;"><tr><td>
    %if;(referer != "")
      <a href="%referer;"><img
       src="%image_prefix;/left.png"%wid_hei;left.png; 
       alt="&lt;&lt;" title="&lt;&lt;"%/></a>
    %end;
    <a href="%prefix;"><img%sp;
    src="%image_prefix;/up.png"%wid_hei;up.png; 
    alt="^^" title="^^"%/></a>
  </td></tr></table>
%end;

%define;tothegen(xx)
  [*to the %s generation:::xx]%nn;
%end;

%define;togen(xx)
  %if;(xx = 1)[*specify::generation/generations]0%nn;
  %elseif;(xx = 2)[*to the parents]%nn;
  %elseif;(xx = 3)[*to the grandparents]%nn;
  %elseif;(xx = 4)[*to the great-grandparents]%nn;
  %else;
    %apply;tothegen%with;
      %apply;nth([nth (generation)], xx)
    %end;
  %end;
%end;

%define;ancestors_by_list(xx, nnn)
  %if;(xx.has_parents and nnn > 1)
    <ul>
    <li class="male"><a href="%prefix;
    %xx.father.access;">%xx.father;</a>%xx.father.title;%xx.father.dates;%nl;
    %apply;ancestors_by_list("xx.father", nnn - 1)</li>
    <li class="female"><a href="%prefix;
    %xx.mother.access;">%xx.mother;</a>%xx.mother.title;%xx.mother.dates;%nl;
    %apply;ancestors_by_list("xx.mother", nnn - 1)</li>
    </ul>
  %end;
%end;

%define;ancestors_horizontally(pp, xx, ss1, ss2, ss3)
  %if;(xx > 0)
    %if;(pp.has_parents)
      %apply;ancestors_horizontally(
        "pp.father", xx - 1, "ss1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;",
        "ss1&nbsp;+--&nbsp;", "ss1&nbsp;|&nbsp;&nbsp;&nbsp;")
    %end;
    <tt>ss2</tt><a href="%prefix;%pp.access;">%pp;</a>%pp.title;%pp.dates;<br%/>
    %if;(pp.has_parents)
      %apply;ancestors_horizontally(
        "pp.mother", xx - 1, "ss3&nbsp;|&nbsp;&nbsp;&nbsp;",
        "ss3&nbsp;+--&nbsp;", "ss3&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;")
    %end;
  %end;
%end;

%if;(evar.v = "" or evar.v <= 1)
  [*specify::generation/generations]0.
%else;
  %if;(evar.t = "L")
    %( by list %)
    %let;xx;
      %if;(bvar.max_anc_level = "")%apply;min(evar.v, max_anc_level, 7)
      %else;%apply;min(evar.v, max_anc_level, bvar.max_anc_level)%end;
    %in;
    <p>
    %apply;togen(xx).
    </p>
    %apply;ancestors_by_list("self", xx)
  
  %elseif;(evar.t = "H")
    %( horizontally %)
    %let;xx;
      %if;(bvar.max_anc_level = "")%apply;min(evar.v, max_anc_level, 7)
      %else;%apply;min(evar.v, max_anc_level, bvar.max_anc_level)%end;
    %in;
    <p>
    %apply;togen(xx).
    </p>
    <table><tr><td style="white-space:nowrap">
    %apply;ancestors_horizontally(
      "self", xx, "&nbsp;&nbsp;&nbsp;", "--&nbsp;", "&nbsp;&nbsp;&nbsp;")
    </td></tr></table>
  
  %elseif;(evar.t = "E" and evar.sort != "")
    %( list eclair sorted by date begin or number of individuals or number of events %)
    %empty_sorted_list;
    %foreach;ancestor_surname(evar.v)
      %apply;add_in_sorted_list%with;
        %if;(evar.sort = "ind")
          %ancestor.nb_ind;
        %elseif;(evar.sort = "evt")
          %ancestor.nb_events;
        %else;
          %ancestor.date_begin.year;
        %end;
        %and;%ancestor.surname_end;
        %and;%ancestor.surname_begin;
        %and;%ancestor.place;
        %and;%ancestor.date_begin.prec;
        %and;%ancestor.date_begin.year;
        %and;%ancestor.date_end.prec;
        %and;%ancestor.date_end.year;
        %and;%ancestor.nb_ind;
        %and;%ancestor.nb_events;
      %end;
    %end;    

    %let;nb_gen;%apply;min(evar.v, max_anc_level)%in;
    <p>%apply;togen(nb_gen).</p>
    <div class="not_printable" style="margin-bottom:15px;">
      <table class="display_search">
        <tr>
          <td><b>[*sort by/date begin/alphabetic order/nb individuals/nb events]0</b></td>
          <td><img src="%image_prefix;/picto_calendar.png"%/></td>
          <td>
            %if;(evar.sort = "date")
              [sort by/date begin/alphabetic order/nb individuals/nb events]1
            %else;
              <a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;&amp;t=%evar.t;&amp;v=%evar.v;&amp;sort=date">
                [sort by/date begin/alphabetic order/nb individuals/nb events]1
              </a>
            %end;
          </td>
          <td><img src="%image_prefix;/picto_alphabetic_order.png"%/></td>
          <td>
            <a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;&amp;t=%evar.t;&amp;v=%evar.v;">
              [sort by/date begin/alphabetic order/nb individuals/nb events]2
            </a>
          </td>
          <td><img src="%image_prefix;/picto_numeric_order.png"%/></td>
          <td>
            %if;(evar.sort = "ind")
              [sort by/date begin/alphabetic order/nb individuals/nb events]3
            %else;
              <a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;&amp;t=%evar.t;&amp;v=%evar.v;&amp;sort=ind">
                [sort by/date begin/alphabetic order/nb individuals/nb events]3%nn;
              </a>
            %end;
            [or]
            %if;(evar.sort = "evt")
              [sort by/date begin/alphabetic order/nb individuals/nb events]4
            %else;
              <a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;&amp;t=%evar.t;&amp;v=%evar.v;&amp;sort=evt">
                [sort by/date begin/alphabetic order/nb individuals/nb events]4
              </a>
            %end;
          </td>
        </tr>
      </table>
    </div>

    <table class="list_eclair_table">
      <tr class="list_eclair_table_header">
        <th>[*surname/surnames]0</th>
        <th>[*place]</th>
        <th>[*date begin]</th>
        <th>[*date end]</th>
        <th>[*nb individuals]</th>
        <th>[*nb events]</th>
      </tr>
      %foreach;sorted_list_item;
        <tr>
          <td>%item.2;%item.3</td>
          <td>%item.4;</td>
          <td align="center">
            %if;(item.5 = "&lt;")
              /%item.6;
            %elseif(item.5 = "&gt;")
              %item.6;/
            %elseif;(item.5 = "|" or item.5 = "..")
              %item.6;
            %else;
              %item.5;%item.6;
            %end;
          </td>
          <td align="center">
            %if;(item.7 = "&lt;")
              /%item.7;
            %elseif(item.7 = "&gt;")
              %item.8;/
            %elseif;(item.7 = "|" or item.7 = "..")
              %item.8;
            %else;
              %item.7;%item.8;
            %end;
          </td>
          <td align="center">%item.9;</td>
          <td align="center">%item.10;</td>
        </tr>
      %end;
    </table>

  %elseif;(evar.t = "E")
    %( list eclair by alphabetic order %)
    %let;nb_gen;%apply;min(evar.v, max_anc_level)%in;
    <p>%apply;togen(nb_gen).</p>
    <div class="not_printable" style="margin-bottom:15px;">
      <table class="display_search">
        <tr>
          <td><b>[*sort by/date begin/alphabetic order/nb individuals/nb events]0</b></td>
          <td><img src="%image_prefix;/picto_calendar.png"%/></td>
          <td>
            <a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;&amp;t=%evar.t;&amp;v=%evar.v;&amp;sort=date">
              [sort by/date begin/alphabetic order/nb individuals/nb events]1
            <a>
          </td>
          <td><img src="%image_prefix;/picto_alphabetic_order.png"%/></td>
          <td>[sort by/date begin/alphabetic order/nb individuals/nb events]2</td>
          <td><img src="%image_prefix;/picto_numeric_order.png"%/></td>
          <td>
            <a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;&amp;t=%evar.t;&amp;v=%evar.v;&amp;sort=ind">
              [sort by/date begin/alphabetic order/nb individuals/nb events]3%nn;
            </a>
            [or]
            <a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;&amp;t=%evar.t;&amp;v=%evar.v;&amp;sort=evt">
              [sort by/date begin/alphabetic order/nb individuals/nb events]4
            </a>
          </td>
        </tr>
      </table>
    </div>

    <table class="list_eclair_table">
      <tr class="list_eclair_table_header">
        <th>[*surname/surnames]0</th>
        <th>[*place]</th>
        <th>[*date begin]</th>
        <th>[*date end]</th>
        <th>[*nb individuals]</th>
        <th>[*nb events]</th>
      </tr>
      %foreach;ancestor_surname(evar.v)
        <tr>
          <td>
            %ancestor.surname_end;%ancestor.surname_begin;
          </td>
          <td>
            %ancestor.place;
          </td>
          <td align="center">
            %if;(ancestor.date_begin.prec = "&lt;")
              /%ancestor.date_begin.year;%nn;
            %elseif;(ancestor.date_begin.prec = "&gt;")
              %ancestor.date_begin.year;/%nn;
            %elseif;(ancestor.date_begin.prec = "|" or ancestor.date_begin.prec = "..")
              %ancestor.date_begin.year;%nn;
            %else;
              %ancestor.date_begin.prec;%ancestor.date_begin.year;%nn;
            %end;
          </td>
          <td align="center">
            %if;(ancestor.date_end.prec = "&lt;")
              /%ancestor.date_end.year;%nn;
            %elseif;(ancestor.date_end.prec = "&gt;")
              %ancestor.date_end.year;/%nn;
            %elseif;(ancestor.date_end.prec = "|" or ancestor.date_end.prec = "..")
              %ancestor.date_end.year;%nn;
            %else;
              %ancestor.date_end.prec;%ancestor.date_end.year;%nn;
            %end;
          </td>
          <td align="center">%ancestor.nb_ind;</td>
          <td align="center">%ancestor.nb_events;</td>
        </tr>
      %end;
    </table>
  
  %elseif;(evar.t = "F" and evar.sort = "on")
    %( surnames branch sorted by number of branches %)
    %empty_sorted_list;
    %reset_count;
    %foreach;ancestor_surname(evar.v)
      %incr_count;
      %apply;add_in_sorted_list(
        ancestor.nb_times,
        ancestor.surname_end,
        ancestor.surname_begin,
        ancestor.sosa_access,
        ancestor.place,
        ancestor.date_begin.prec,
        ancestor.date_begin.year,
        ancestor.date_end.prec,
        ancestor.date_end.year)
    %end;    
  
    %let;nb_gen;%apply;min(evar.v, max_anc_level)%in;
    <p>%apply;togen(nb_gen).</p>
  
    %if;(count > 100)
      <p>
        <span>[*number of branches] : </span>
        %foreach;sorted_list_item;
          %if;(prev_item.1 != item.1)
            <a href="#a_%apply;hexa(item.1)">%item.1;</a>
          %end;
        %end;
      </p>
    %end;
  
    <p>[*help surname branch].</p>
    <div class="not_printable">
      <table class="display_search">
        <tr>
          <td><b>[*sort by/branch/alphabetic order]0</b></td>
          <td><img src="%image_prefix;/picto_branch.png"%/></td>
          <td>[sort by/branch/alphabetic order]1</td>
          <td><img src="%image_prefix;/picto_alphabetic_order.png"%/></td>
          <td>
            <a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;&amp;sosab=%evar.sosab;&amp;t=%evar.t;&amp;v=%evar.v;">
              [sort by/branch/alphabetic order]2
            </a>
          </td>
        </tr>
      </table>
    </div>
    <ul class="surname_branch_sort">
      %if;(count <= 100)
        <li>%nn;
        <table class="surname_branch_table">
          <tr class="surname_branch_table_header">
            <th width="30%%">[*surname/surnames]0</th>
            <th width="10%%">[*nb branches]</th>
            <th width="45%%">[*place]</th>
            <th width="15%%">[*date/dates]0</th>
          </tr>
      %end;
      %foreach;sorted_list_item;
        %if;(prev_item.1 != item.1 and count > 100)
          <li>%nn;
          <a name="a_%apply;hexa(item.1)">%item.1;</a>
          <table class="surname_branch_table">
            <tr class="surname_branch_table_header">
              <th width="30%%">[*surname/surnames]0</th>
              <th width="10%%">[*nb branches]</th>
              <th width="45%%">[*place]</th>
              <th width="15%%">[*date/dates]0</th>
            </tr>
        %end;
        <tr>
          <td>
            %item.2;%item.3;
          </td>
          <td align="center">
            %if;(evar.cgl != "on")
              <a href="%prefix;m=DAG;%item.4;">%item.1;</a>
            %else;
              %item.1;
            %end;
          </td>
          <td>
            %item.5;
          </td>
          <td>
            %if;(item.6 = "&lt;")
              /%item.7;
            %elseif(item.6 = "&gt;")
              %item.7;/
            %elseif;(item.6 = "|" or item.6 = "..")
              %item.7;
            %else;
              %item.6;%item.7;
            %end;%nn;
            -%nn;
            %if;(item.8 = "&lt;")
              /%item.9;
            %elseif(item.8 = "&gt;")
              %item.9;/
            %elseif;(item.8 = "|" or item.8 = "..")
              %item.9;
            %else;
              %item.8;%item.9;
            %end;
          </td>
        </tr>
        %if;(item.1 != next_item.1 and count > 100)
          </table>
          </li>
        %end;
      %end;
      %if;(count <= 100)
        </table>
        </li>
      %end;
    </ul>
    <p style="clear:both"></p>
  
  %elseif;(evar.t = "F")
    %( surnames branch %)
    %let;nb_gen;%apply;min(evar.v, max_anc_level)%in;
    <p>%apply;togen(nb_gen).</p>
    <p>[*help surname branch].</p>
    <div class="not_printable" style="margin-bottom:25px;">
      <table class="display_search">
        <tr>
          <td><b>[*sort by/branch/alphabetic order]0</b></td>
          <td><img src="%image_prefix;/picto_branch.png"%/></td>
          <td>
            <a href="%prefix;&amp;m=A&amp;p=%first_name_key;&amp;n=%surname_key;&amp;oc=%evar.oc;&amp;sosab=%evar.sosab;&amp;t=%evar.t;&amp;v=%evar.v;&amp;sort=on">
              [sort by/branch/alphabetic order]1
            </a>
          </td>
          <td><img src="%image_prefix;/picto_alphabetic_order.png"%/></td>
          <td>[sort by/branch/alphabetic order]2</td>
        </tr>
      </table>
    </div>
    <table class="surname_branch_table">
      <tr class="surname_branch_table_header">
        <th>[*surname/surnames]0</th>
        <th>[*nb branches]</th>
        <th>[*place]</th>
        <th>[*date/dates]0</th>
      </tr>
      %foreach;ancestor_surname(evar.v)
        <tr>
          <td>
            %ancestor.surname_end;%ancestor.surname_begin;
          </td>
          <td align="center">
            %if;(evar.cgl != "on")
              <a href="%prefix;m=DAG;%ancestor.sosa_access;">%ancestor.nb_times;</a>
            %else;
              %ancestor.nb_times;
            %end;
          </td>
          <td>
            %ancestor.place;
          </td>
          <td>
            %if;(ancestor.date_begin.prec = "&lt;")
              /%ancestor.date_begin.year;%nn;
            %elseif;(ancestor.date_begin.prec = "&gt;")
              %ancestor.date_begin.year;/%nn;
            %elseif;(ancestor.date_begin.prec = "|" or ancestor.date_begin.prec = "..")
              %ancestor.date_begin.year;%nn;
            %else;
              %ancestor.date_begin.prec;%ancestor.date_begin.year;%nn;
            %end;
            -%nn;
            %if;(ancestor.date_end.prec = "&lt;")
              /%ancestor.date_end.year;%nn;
            %elseif;(ancestor.date_end.prec = "&gt;")
              %ancestor.date_end.year;/%nn;
            %elseif;(ancestor.date_end.prec = "|" or ancestor.date_end.prec = "..")
              %ancestor.date_end.year;%nn;
            %else;
              %ancestor.date_end.prec;%ancestor.date_end.year;%nn;
            %end;
          </td>
        </tr>
      %end;
    </table>
  %end;
%end;

%base_trailer;
%copyright;
</body>
</html>
