<!-- famille -->

%define;not_married_no_descendants()
  <img src="%image_prefix;/not_married_no_descendants.png" alt="[not married],&nbsp;[no descendants]" title="[not married],&nbsp;[no descendants]"%/>
%end;

%( 
  définition affichage de la puce d'un individu en compte tenu de ses éventuels enfants
    - aucune union, donc aucun enfant => cercle
    - au moins une union avec en tout aucun enfant => disque
    - au moins une union avec au moins un enfant => carré
%)
%define;type_puce_desc(nnn)
  <li style="list-style-type:%if;nnn.has_families;
    %if;nnn.has_children;square%else;disc%end;
    %else;circle%end;">
%end;

%(
  définition affichage de la puce d'un individu en compte tenu de ses éventuels parents
    - aucun parent connu => cercle
    - au moins un parent connu => disque
    - les deux parents connus => carré
%)
%define;type_puce_asc(nnn)
  %if;nnn.has_parents;
    %if;(nnn.father != "? ?" and nnn.mother != "? ?" and nnn.mother != "de l'une de ses épouses")
      <li style="list-style-type:square">
    %else;
      <li style="list-style-type:disc">
    %end;
  %else;
    <li style="list-style-type:circle">
  %end;
%end;

%define;access_ind(nnn)
  %if;(cancel_links or nnn.is_restricted)
    %nnn;
  %else;
    <a href="%prefix;%nnn.access;">%nnn;</a>%nnn.title;
  %end;
  %nnn.dates;%nl;
%end;

%define;type_wedding()
  %if;are_married;
    %if;(nb_children != 0)
      <img src="%image_prefix;/married.png" alt="[married]" title="[married]"%/>
    %else;
      <img src="%image_prefix;/married_no_descendants.png" alt="[married]" title="[married]"%/>
    %end;
  %elseif;are_not_married;
    <img src="%image_prefix;/not_married.png" alt="[not married]" title="[not married]"%/>
  %elseif;are_engaged;
    <img src="%image_prefix;/engaged.png" alt="[engaged]" title="[engaged]"%/>
  %elseif;is_no_sexes_check;
    <img src="%image_prefix;/not_married.png" alt="[relationship]" title="[relationship]"%/>
  %elseif;is_no_mention;
    <img src="%image_prefix;/not_married.png" alt="[with]" title="[with]"%/>
  %end;
%end;

%( 
   ATTENTION nb_families ne marche que pour la personne et les boucles sur enfants. 
   Pour les relations (him, her et related) cela donne le nb_families de la 
   personne d'où l'affichage sans nb d'enfants si la personne n'a qu'un mariage 
%)
%define;detail_wedding()
  %apply;type_wedding()
  %if;(nb_families != 1)<font size="-1">%family_cnt;</font>%end;
  %if(family.marriage_date.year != "")<font size="-1">(%family.marriage_date.year;)</font>%end;
  %if;(nb_children != 0)
    <br />
    <font>%nb_children;</font>
    %if;(nb_children=1)[child/children]0
    %else;[child/children]1
    %end;
  %end;
%end;

%define;desc_seq(yyy)
  <ul>
  %foreach;child;
    %( table pour les des enfants %)
    <table border="%border;" width="90%%" cellspacing="0" cellpadding="0">
      <tr>
        <td width="80%%"></td>
        <td width="20%%"></td>
      </tr>
      <tr><td align="left">
        %apply;type_puce_desc("child")
        %apply;image_MF("child","11")
        %apply;display_sosa("child")
        %if;("yyy" = "parhigh")
          %( comme le code est utilisable dans la descendance des grands 
             parents on teste father/mother, pour la descendance des parents 
             on est tjrs dans else %)
          %if;(child.access = father.access or child.access = mother.access)
            %( ici on met les parents en gras %)
            <u><b>%child;</b></u>%child.title;%child.dates;
          %else;
            %apply;access_ind("child")
          %end;
        %else;
          %apply;access_ind("child")
        %end;
      </td>
      <td align="right" valign="top">
        %if;child.has_families;
          %foreach;child.family;
            %if;(family_cnt != 1), %end;
            %apply;detail_wedding()
          %end;
        %else;
          %apply;not_married_no_descendants()
        %end;
      </td>
      </tr>
    </table>
    </li>
  %end;
  </ul>
%end;

%define;descendancy_grand_fathers(mmm,yyy)
  %foreach;mmm.father.family;
    <table border="%border;" width="90%%" cellspacing="0" cellpadding="0"><tr><td align="left">
      %apply;type_puce_asc("mmm.father")
      %apply;image_MF("mmm.father","13")
      %apply;display_sosa("mmm.father")
      %if;(spouse.access = mmm.mother.access)
        %apply;access_ind("mmm.father")
      %else;
        %mmm.father;%mmm.father.title;%mmm.father.dates;%nl;
      %end;
      %apply;type_wedding() 
      %if(family.marriage_date.year != "")<font size="-1">(%family.marriage_date.year;)</font>%end;
      %apply;type_puce_asc("spouse")
      %apply;image_MF("spouse","13")
      %apply;display_sosa("spouse")
      %if;(spouse.access = self.access)
        <u><b>%spouse;</b></u>%spouse.title;%spouse.dates;
        </td><td align="right" valign="top">
        %apply;detail_wedding()
        </td></tr></table>
      %else;
        %apply;access_ind("spouse")
        </td></tr></table>
        %apply;desc_seq("yyy")
      %end;
    <br%/>
  %end;
%end;

%define;descendancy_grand_mothers(mmm,yyy)
  %foreach;mmm.mother.family;
    %if;(spouse.access != mmm.father.access)
      <table border="%border;" width="90%%" cellspacing="0" cellpadding="0"><tr><td align="left">
        %apply;type_puce_asc("mmm.mother")
        %apply;image_MF("mmm.mother","13")
        %apply;display_sosa("mmm.mother")
        %mmm.mother;%mmm.mother.title;%mmm.mother.dates;%nl;
        %apply;type_puce_asc("spouse")
        %apply;type_wedding()
        %if(family.marriage_date.year != "")<font size="-1">(%family.marriage_date.year;)</font>%end;
        %apply;image_MF("spouse","13")
        %apply;display_sosa("spouse")
        %if;(spouse.access = self.access)
          <u><b>%spouse;</b></u>%spouse.title;%spouse.dates;
          </td><td align="right" valign="top">
          %apply;detail_wedding()
          </td></tr></table>
        %else;
          %apply;access_ind("spouse")
          </td></tr></table>
          %apply;desc_seq("yyy")
        %end;
    %end;
    <br%/>
  %end;
%end;

%if;(not (father.has_parents and mother.has_parents))
  %if;father.has_parents;
    <h3 class="highlight">[*paternal grand-parents],&nbsp;[uncles and aunts]1</h3>
  %elseif;mother.has_parents;
    <h3 class="highlight">[*maternal grand-parents],&nbsp;[uncles and aunts]1</h3>
  %end;
%end;

<table border="%border;" width="100%%">
  <tr>
      %if;father.has_parents;
      <td align="left" valign="top" width="50%%">
        %if;mother.has_parents;
          <h3 class="highlight">[*paternal grand-parents],&nbsp;[uncles and aunts]1</h3>
        %end;
        <ul>
          %apply;descendancy_grand_fathers("father","parhigh")
          %apply;descendancy_grand_mothers("father","parhigh")
        </ul>
      </td>
      %end;
    <td align="left" valign="top" width="50%%">
      %if;mother.has_parents;
        %if;father.has_parents;
          <h3 class="highlight">[*maternal grand-parents],&nbsp;[uncles and aunts]1</h3>
        %end;
        <ul>
          %apply;descendancy_grand_fathers("mother","parhigh")
          %apply;descendancy_grand_mothers("mother","parhigh")
        </ul>
      %end;
    </td>
    %if;(not father.has_parents)
      <td align="left" valign="top" width="50%%"></td>
    %end;
  </tr>
</table>
