<!-- $Id: templm/ancsosa_tdz.txt v7.0 15/04/2015 23:36:21 $ -->

%let;lai;alt="[image/images]0"%in;
%let;ltap;%if;(wizard and not cancel_links) title="[add::parents]" %end;%in;
%let;ltmf;%if;(wizard and not cancel_links) title="[modify::family/families]0" %end;%in;
%let;ltmp;%if;(wizard and not cancel_links) title="[modify::person/persons]0" %end;%in;

%define;link(aa, xx)
  %if;(cancel_links)xx%else;<a href="%prefix;aa">xx</a>%end;
%end;

%define;link_dates1(xx)
  %sp;
  %if;(wizard and not cancel_links)
    <a id="mi%xx.index;" class="date" href="#mi%xx.index;" %ltmp;
       onclick="window.open('%prefix;m=MOD_IND;i=%xx.index;');">%nn;
  %end;
  %apply;lazy_print(birth_symbol)
  %if;(xx.has_birth_date or xx.has_baptism_date)
    %if;(xx.birth_date.year != "")<tt>%lazy_force;</tt>%xx.slash_birth_date;%nn;
    %elseif;(xx.baptism_date.year != "")<tt>%lazy_force;</tt>%xx.slash_baptism_date;%nn;
    %end;
  %end;
  %if;(xx.has_birth_place or xx.has_baptism_place)
    %sp;%lazy_force;%if;xx.has_birth_place;%xx.birth_place;%elseif;xx.has_baptism_place;%xx.baptism_place;%end;
  %end;
  %let;l1;%if;lazy_printed; <br>%end;%in;
  %if;(xx.is_dead)
    %l1;
    %apply;lazy_print(death_symbol)
    %if;(xx.has_death_date or xx.has_burial_date)
      %if;(xx.death_date.year != "")<tt>%lazy_force;</tt>%xx.slash_death_date;%nn;
      %elseif;(xx.burial_date.year != "")<tt>%lazy_force;</tt>%xx.slash_burial_date;%nn;
      %end;
    %end;
    %if;(xx.has_death_place or xx.has_burial_place)
      %sp;%lazy_force;%if;xx.has_death_place;%xx.death_place;%elseif;xx.has_burial_place;%xx.burial_place;%end;
    %end;
  %end;
  %let;l2;%if;lazy_printed; %else;%lazy_force;%end;%in;
  %if;(wizard and not cancel_links)
    %if;(l1 = "" and l2 = "") - %end;
    </a>%nn;
  %end;
%end;

%define;link_marriage1(xx)
  %if;(wizard and not cancel_links)
    <a id="mf%family.index;" class="date p_%left;" href="#mf%family.index;" %ltmf;
      onclick="window.open('%prefix;m=MOD_FAM;i=%family.index;;ip=%index;;');">%nn;
      <span>&amp;</span>%nn;
        %if;(nb_children > 1)%nb_children;<br>%end;
        %slash_marriage_date; %marriage_place;
    </a>
  %else;
    <span>&amp;</span>%nn;
    %slash_marriage_date; %marriage_place;
    <br>&amp;%nb_children;
  %end;
%end;

%define;link_parents()
  %if;(evar.only != "on" and ancestor.father_sosa != "")
    <a href="#i%ancestor.father_sosa;"
       title="[father/mother]0 : %ancestor.father_sosa;"><strong>%ancestor.anc_sosa;</strong></a>%nn;
  %elseif;(evar.cgl != "on" and wizard and not ancestor.has_parents and
    ancestor.first_name != "?" and ancestor.surname != "?")
    <a style="color: rgb(255,0,0);" href="#mi%ancestor.index;"
       onclick="window.open('%prefix;m=ADD_PAR;ip=%ancestor.index;');" %ltap;
    ><strong>%ancestor.anc_sosa;</strong></a>%nn;
  %else;
    <strong>%ancestor.anc_sosa;</strong>%nn;
  %end;
%end;

%define;imgtdz(xx)
  %if;(evar.image!="off" and xx.has_image)
    <img class="imgtdz" src="%xx.image_url;" %lai; title="%xx;">%nn;
  %end;
%end;

%define;info3(xx)
  %if;(xx.has_nobility_titles)
    <em>%xx.nobility_title;</em><br>
  %end;
  %if;(xx.has_occupation)
    <span class="highlight1">%xx.occupation;</span><br>
  %end;
  %if;xx.computable_age;
    [age] : %xx.age;<br>
  %end;
  %if;(xx.computable_death_age)
    %xx.death_age;<br>
  %end;
  %if;(xx.has_consanguinity and (bvar.show_consang != "no" or manitou))
    %xx.consanguinity;
  %end;
%end;

%define;nb_fam(xx)
  %if;(xx.same = "")
    %if;(not cancel_links)
      <a href="%prefix;m=A;t=D;i=%index;;i1=%ancestor.index;;l=%level;;image=%evar.image;" title="^^">
    %end;
      %apply;symbol1("xx")
      %if;(xx.nb_families > 1)
        <br>%xx.nb_families;&amp;%xx.nb_children;
      %end;
    %if;(not cancel_links)
      </a>
    %end;
  %else;
    %apply;link_rel%with;
      %xx.same;
    %end;
  %end;
%end;

%define;link_rel(xx)
  %if;(cancel_links)
    ==<br>xx
  %else;
    <a href="%prefix;em=R;ei=%ancestor.index;;m=NG;select=%index;;n=1;t=PN;et=A;spouse=on;image=on;" title="%ancestor; …[relationship]… %self;">==<br>xx</a>
  %end;
%end;

%define;symbol2(xx)
  %if;(xx.has_siblings)
    &diams;%nn;
  %elseif;(xx.has_parents)
    &loz;%nn;
  %else;
    -%nn;
  %end;
%end;

%define;symbol1(xx)
  %if;(xx.has_sosa)
    <span class="color_sosa">%apply;symbol2("xx")</span>%nn;
  %else;
    %apply;symbol2("xx")
  %end;
%end;

%define;male_line(xx,z1)
    <td>
      %apply;link_parents()
      %apply;nb_fam("xx")
    </td>
    <td z1>
      %apply;imgtdz("xx")
      <div>%apply;link(xx.access, xx)</div>
      %apply;info3("xx")
    </td>
    <td style="text-align:%left;">%apply;link_dates1("xx")</td>
%end;

%define;female_line(xx,z1)
    <td style="text-align:%left;">%apply;link_dates1("xx")</td>
    <td z1>
      %apply;imgtdz("xx")
      <div>%apply;link(xx.access, xx)</div>
      %apply;info3("xx")
    </td>
    <td>
      %apply;link_parents()
      %apply;nb_fam("xx")
    </td>
%end;

%define;one_line(z1)
  %if;(ancestor.anc_sosa.v % 2 = 0)
    <tr id="i%ancestor.anc_sosa.v;">
      %apply;male_line("ancestor","z1")
      <td style="text-align:%left;">
      %if;(ancestor.same = "")
        %foreach;ancestor.family;
          %if;(family.index = ancestor.family.index)
            %apply;link_marriage1("ancestor")
          %end;
        %end;
      %end;
      </td>
  %end;
  %if;(ancestor.anc_sosa.v % 2 = 1)
    %apply;female_line("ancestor","z1")</tr>
  %end;
%end;

%define;tX()
  %( ancestors up to somebody %)
  %p_of_index.1.mark_descendants;
  %foreach;ancestor_level;
    %apply;lazy_print%with;
      <tr><th colspan="7" >%nl;[*generation/generations]0 %level;%nl;</th></tr>
    %end;
    %if;(level <= evar.l + 1)
      %foreach;ancestor;
        %if;(level != 1 and ancestor.same = "" and (ancestor.is_descendant or ancestor.spouse.is_descendant))
          %lazy_force;
          %let;l1;%if;(ancestor.is_descendant)class="is_desc_1%ancestor.sex;"%end;%in;
          %apply;one_line(l1)
        %end;
      %end;
    %end;
  %end;
%end;

%define;tY()
  %foreach;ancestor_level(l_v)
    %if;(level > 1 and (evar.only != "on" or level = l_v))
      <tr><th colspan="7" >%nl;[*generation/generations]0 %level;%nl;</th></tr>
      %foreach;ancestor
          %if;(ancestor.same = "")%incr_count;%end;
          %apply;one_line("")
      %end;
    %end;
  %end;
  <tr><td colspan="9">[*total] : %count; [[person/persons]1@(c)]</td></tr>
%end;

%( main %)
%if;(evar.only != "on" and evar.t != "X")
  %apply;togen()
%end;
%if;(evar.t = "X")
  <p>[*up to] %p_of_index.1; %p_of_index.1.dates;</p>
  %if;(not cancel_links)
    <div class="menu">
      %if;(has_sosa)<span><a href="%prefix;m=X;t=X;t1=1;i=%evar.i1;;i1=%index;;siblings=on;alias=on;spouse=on;parents=on;rel=on;notes=on;src=on;hide=on;witn=on;v=%evar.l;;maxv=%evar.l;;l=%evar.l;">[*descendants]0</a></span>%end;
      <span><a href="%prefix;m=A;t=G;i=%index;;i1=%evar.i1;;siblings=on;alias=on;spouse=on;parents=on;rel=on;witn=on;notes=on;src=on;hide=on;l=%evar.l;">[*ancestor/ancestors]1</a></span>
    </div>
  %end;
%end;
%reset_count;
<table summary="ancestors" class="short_display_table">
  <colgroup>
    <col width="10"%/>
    <col width="400"%/>
    <col width="400" align="%left;"%/>
    <col width="400" align="%left;"%/>
    <col width="400" align="%left;"%/>
    <col width="400"%/>
    <col width="10"%/>
  </colgroup>
  %if;(evar.t = "X")
    %apply;tX()
  %else;
    %apply;tY()
  %end;
</table>
