Difference between revisions of "templates"

From GeneWeb
Jump to: navigation, search
m (spelling" invoked)
m
 
(4 intermediate revisions by one other user not shown)
Line 2: Line 2:
 
{{languages|templates}}
 
{{languages|templates}}
  
The '''[[gwd]]''' server produces the HTML code displayed by the client browser according to instructions stored into text files. Examples of such files are:
+
The '''[[gwd]]''' server produces HTML code displayed by the client browser according to instructions stored in text files. Examples of such files are:
 
* welcome.txt the welcome page shown when you connect to <code>localhost:2317/basename</code>.
 
* welcome.txt the welcome page shown when you connect to <code>localhost:2317/basename</code>.
 
* perso.txt the page that displays one individual of the base.
 
* perso.txt the page that displays one individual of the base.
Line 22: Line 22:
 
See the [[expert#Template programming|experts]] section for further discussion on template programming.
 
See the [[expert#Template programming|experts]] section for further discussion on template programming.
  
==Perso.txt==
+
== Personnalisation Modules ==
  
The file perso.txt offers an additional customization level by providing several options for the display of personnal data.
+
La version 7 de GeneWeb offre nouvelle manière pour personnaliser l'aspect de la page personnelle. Cette solution repose sur l'existence d'une liste de modules définis dans le fichier de configuration base.gwf en associant chaque module à une lettre entre a et z (attention à ne pas mettre de texte supplémentaire après le nom de l'option - ni espaces, ni commentaires!).  
The code below is somewhat self explanatory:
+
<pre>
+
%import;perso_utils
+
%include.perso_header;
+
  
%if;(bvar.perso_module_tplnb="" or bvar.perso_module_tplnb=0)
+
perso_module_i=individual
  %apply;show_templ("perso_module/etat_civil")
+
perso_module_p=parents
  %apply;show_templ("perso_module/parent_simple")
+
perso_module_u=unions
  %apply;show_templ("perso_module/union_simple")
+
  %apply;show_templ("perso_module/freresoeur_simple")
+
  %apply;show_templ("perso_module/relations")
+
  %apply;show_templ("perso_module/timeline")
+
  %apply;show_templ("perso_module/notes")
+
  %apply;show_templ("perso_module/sources")
+
  %apply;show_templ("perso_module/arbre_3gen_v_photo")
+
%else;
+
  %for;i;0;bvar.perso_module_tplnb;
+
    %apply;get_templ(i)
+
  %end;
+
%end;
+
</pre>
+
  
== Modules ==
+
Each module can be displayed with a choice of options.
For most of the modules, several alternatives are available and can be selected by editing the appropriate line. here is the current content of the perso_modules folder:
+
<pre>
+
drwxr-xr-x  23 Henri  staff    782  1 oct 22:26 .
+
drwxr-xr-x  64 Henri  staff  2176 15 oct 23:56 ..
+
-rw-r--r--  1 Henri  staff  3979  1 oct 22:26 arbre_3gen_v.txt
+
-rw-r--r--  1 Henri  staff  12691  1 oct 22:26 arbre_3gen_v_photo.txt
+
-rw-r--r--  1 Henri  staff  10477  1 oct 22:26 arbre_4gen_v.txt
+
-rw-r--r--  1 Henri  staff  19592  1 oct 22:26 arbre_5gen_h.txt
+
-rw-r--r--  1 Henri  staff  2303  1 oct 22:26 etat_civil.txt
+
-rw-r--r--  1 Henri  staff  7283  1 oct 22:26 famille.txt
+
-rw-r--r--  1 Henri  staff  2964  1 oct 22:26 freresoeur_complet.txt
+
-rw-r--r--  1 Henri  staff  2972  1 oct 22:26 freresoeur_simple.txt
+
-rw-r--r--  1 Henri  staff  1636  1 oct 22:26 notes.txt
+
-rw-r--r--  1 Henri  staff    785  1 oct 22:26 parent_complet.txt
+
-rw-r--r--  1 Henri  staff    431  1 oct 22:26 parent_evolue.txt
+
-rw-r--r--  1 Henri  staff  1653  1 oct 22:26 parent_photo.txt
+
-rw-r--r--  1 Henri  staff    271  1 oct 22:26 parent_simple.txt
+
-rw-r--r--  1 Henri  staff  1877  1 oct 22:26 relations.txt
+
-rw-r--r--  1 Henri  staff    360  1 oct 22:26 sources.txt
+
-rw-r--r--  1 Henri  staff  1099  1 oct 22:26 timeline.txt
+
-rw-r--r--  1 Henri  staff  7374  1 oct 22:26 union_complet.txt
+
-rw-r--r--  1 Henri  staff  3636  1 oct 22:26 union_evolue.txt
+
-rw-r--r--  1 Henri  staff  2532  1 oct 22:26 union_photo.txt
+
-rw-r--r--  1 Henri  staff  1861  1 oct 22:26 union_simple.txt
+
</pre>
+
  
Changing the content of perso.txt can be achieved through a set of parameters stored in the {{c|.gwf}} file where the value of the parameter is the name of the desired module:
+
The display of modules on a personnal pages will be governed by a vector defining
 +
a selection amongst the modules above, the order in which they are displayed and the chosen option.
  
<pre>
+
The vector appears as a string of letters and digits.
perso_module_0=etat_civil
+
Each pair "letter, digit" identifies the selected module,
perso_module_1=parent_simple
+
and the value of its display options
perso_module_2=union_simple
+
The modules are displayed in the order in which they appear in the {{c|p_mod}} parameter as
perso_module_3=freresoeur_simple
+
in the example below, "gd_parents", "individual", "parents", "unions", ...
perso_module_4=relations
+
perso_module_5=notes
+
perso_module_6=sources
+
perso_module_7=arbre_3gen_v_photo
+
</pre>
+
  
One must add a last parameter specifying the total number of modules:
+
p_mod=g1i1p1u1r1c1f1s1
perso_module_tplnb=8
+
 
</pre>
+
[[File:p_mod-configuration.png|thumb|400px|right|Pull-down menu for module and option selection.]]
 +
 
 +
Selecting {{c|1=p_mod=p1p2p3p4p5}} will display all five options for the module {{c|parents}}.
 +
 
 +
The menubar of the {{c|perso.txt}} page provides an interface to change the value of this {{c|p_mod}} parameter and to select options. As the mouse hovers on the option button, a pop-up showing the general aspect of the chosen option will appear. On the rignt of the selection window, thise pop-ups will accumulate representing the resulting page..
 +
 
 +
You may choose any set of (single) letters (a-z) to designate modules.
 +
 
 +
The default configuration file {{c|a.gwf}} provides the list of available modules. Users have the possibility to add their own modules to be stored in the folder:
 +
 
 +
bases/etc/perso_modules/new_module.txt
 +
 
 +
Note that the value of {{c|p_mod}} can be stored in the {{c|base.gwf}} parameter file. GeneWeb copies this value automatically in each URL in a fashion similar to the {{c|1=templ=}} variable.
 +
It may therefore be stored in a shortcut memorised by your browser. This is particularly usefull in the case of multi-user GeneWeb servers as GeneWeb cannot remember a user specific profile.
 +
 
 +
A graphical user interface facilitates the module and option selection. Thumbnails provide a graphical hint of the visual aspect of each option, and the right colums of the menu displays a mock-up of the resulting page. Personnal modules added by the user do not show up in this interface, but may be added through some editing of the {{c|gw/etc/p_mod.js}} file (use existing modules fas examples).
 +
 
 +
Several modules have their own visual adjustment buttons (number of generations, with or without images, with or without half brothers ans sisters, ...).
 +
 
 +
==Perso.txt==
 +
The file {{c|perso.txt}} controls the display of information associated with each person. Two modes of operation are provided through the following structure:
  
=== Module and options selection (Version 7) ===
+
Import of utilities functions and menu bar.
  
Version 7 of GeneWeb offers an alternative solution to module selection, augmented with the possibility to select a display option for each module.
+
%import;perso_utils;
 +
%include.menubar;
  
Note first that the module names have been changed to:
+
Two display modes:
  
 +
1/ two columns, fixed set of modules
 
<pre>
 
<pre>
perso_module_0=individual
+
%if;(p_mod="zz")
perso_module_1=parents
+
  %(Statique%)
perso_module_2=unions
+
  %( two columns if screen_width>=992px but full width for tablets/phone < 992px %)
perso_module_3=fratrie
+
    %if;(has_parents and (father.has_parents or mother.has_parents))
perso_module_4=relations
+
      <div class="collapse" id="collapseExample1">
perso_module_5=notes
+
          %let;op_m;1%in;%apply;show_templ("perso_module/gr_parents")
perso_module_6=sources
+
      </div>
perso_module_7=arbres
+
    %end;
perso_module_8=chronologie
+
    <div class="row">
perso_module_9=gr_parents
+
      %(be carefull h1 is full width then an opening <div class="col-8"> in individu module %)
perso_module_10=ligne
+
      %let;op_m;3%in;%apply;show_templ("perso_module/individu")
 +
      %let;op_m;2%in;%apply;show_templ("perso_module/unions")
 +
      %let;op_m;1%in;%apply;show_templ("perso_module/chronologie")
 +
      %let;op_m;1%in;%apply;show_templ("perso_module/notes")
 +
      %let;op_m;2%in;%apply;show_templ("perso_module/sources")
 +
      </div> %( closing the <div class="col-8"> in module individu %)
 +
      <div class="d-none d-lg-block col-lg-4">%(second column above lg%)
 +
        %let;op_m;2%in;%apply;show_templ("perso_module/arbre_3gen_photo")
 +
        %let;op_m;1%in;%apply;show_templ("perso_module/fratrie")
 +
        %let;op_m;1%in;%apply;show_templ("perso_module/relations")
 +
      </div>
 +
    </div>
 
</pre>
 
</pre>
  
The {{c|.gwf}} file holds another set of variable definitions using letters rather that digits:
+
2/ One column. Modules modules labeled from a to z as defined in {{c|base.gwf}} and governed by the {{c|p_mod}} variable.
 
<pre>
 
<pre>
perso_module_i=individual
+
%else;(p_mod!="")
 +
  %(Dynamic %)
 +
    %for;i;0;p_mod_nbr;
 +
      %let;mmi;%apply;mm(i)%in;
 +
      %let;ooi;%apply;oo(i)%in;
 +
      %if;(mmi!="" and ooi!=0)
 +
        %apply;get_mod(mmi, ooi)
 +
      %end
 +
    %end;
 +
 
 +
%end;
 +
</pre>
 +
 
 +
Examples of module definitions:
 +
 
 +
<pre>
 +
perso_module_i=individu
 
perso_module_p=parents
 
perso_module_p=parents
 
perso_module_u=unions
 
perso_module_u=unions
Line 123: Line 126:
 
perso_module_a=arbres
 
perso_module_a=arbres
 
perso_module_g=gr_parents
 
perso_module_g=gr_parents
perso_module_d=data_3col
 
 
perso_module_l=ligne
 
perso_module_l=ligne
 
</pre>
 
</pre>
[[File:Option-selection.png|thumb|400px|right|Pull-down menu for module and option selection.]]
 
 
Each module can be displayed with a choice of options.
 
 
The display of modules on a personnal pages will be governed by a vector defining
 
a selection amongst the modules above, the order in which they are displayed and the chosen option.
 
 
The vector appears as a string of letters and digits.
 
Each pair "letter, digit" identifies the selected module,
 
and the value of its display options
 
The modules are displayed in the order in which they appear in the {{c|p_mod}} parameter as
 
in the example below, "gd_parents", "individual", "parents", "unions", ...
 
 
p_mod=g1i1p1u1r1c1f1s1
 
 
Selecting {{c|1=p_mod=p1p2p3p4p5}} will display all five options for the module [[c|parents}}.
 
 
The menubar of the {{c|perso.txt}} page provides an interface to change the value of this {{c|p_mod}} parameter and to select options. As the mouse hovers on the option button, a pop-up showing the general aspect of the chosen option will appear. On the rignt of the selection window, thise pop-ups will accumulate representing the resulting page..
 
 
You may choose any set of (single) letters (a-z) to designate modules.
 
  
 
==Examples==
 
==Examples==

Latest revision as of 16:44, 25 July 2019

150px-Geographylogo svg.png Language: English • français

The gwd server produces HTML code displayed by the client browser according to instructions stored in text files. Examples of such files are:

  • welcome.txt the welcome page shown when you connect to localhost:2317/basename.
  • perso.txt the page that displays one individual of the base.
  • updfam.txt the page containing the form to update a family.

A template is a set of such files organized into a coherent user interface. Template files are stored in folders named distribution/gw/etc/template_name and bases/etc/basename/template_name. Note that when searching for a template file, GeneWeb will search in the following order:

  • bases/etc/basename/file
  • bases/etc/template_name/file
  • distribution/gw/etc/template_name/file
  • distribution/gw/etc/file ?

If no file is found, then the search continues with the list of templates defined by the configuration variable template found in base.gwf.

As a result, you may limit your editing to the file whose content you want to change. All the other files will be found in the default folder according to the sequence above.

Templates are invoked by adding (through a clickable button if available, or manually if not) templ=templ_name; in the URL at the top of your browser. GeneWeb will "remember" this request for a template use and will automatically add the appropriate text in all subsequent URL requests.

See the experts section for further discussion on template programming.

Personnalisation Modules

La version 7 de GeneWeb offre nouvelle manière pour personnaliser l'aspect de la page personnelle. Cette solution repose sur l'existence d'une liste de modules définis dans le fichier de configuration base.gwf en associant chaque module à une lettre entre a et z (attention à ne pas mettre de texte supplémentaire après le nom de l'option - ni espaces, ni commentaires!).

perso_module_i=individual
perso_module_p=parents
perso_module_u=unions

Each module can be displayed with a choice of options.

The display of modules on a personnal pages will be governed by a vector defining a selection amongst the modules above, the order in which they are displayed and the chosen option.

The vector appears as a string of letters and digits. Each pair "letter, digit" identifies the selected module, and the value of its display options The modules are displayed in the order in which they appear in the p_mod parameter as in the example below, "gd_parents", "individual", "parents", "unions", ...

p_mod=g1i1p1u1r1c1f1s1
Pull-down menu for module and option selection.

Selecting p_mod=p1p2p3p4p5 will display all five options for the module parents.

The menubar of the perso.txt page provides an interface to change the value of this p_mod parameter and to select options. As the mouse hovers on the option button, a pop-up showing the general aspect of the chosen option will appear. On the rignt of the selection window, thise pop-ups will accumulate representing the resulting page..

You may choose any set of (single) letters (a-z) to designate modules.

The default configuration file a.gwf provides the list of available modules. Users have the possibility to add their own modules to be stored in the folder:

bases/etc/perso_modules/new_module.txt

Note that the value of p_mod can be stored in the base.gwf parameter file. GeneWeb copies this value automatically in each URL in a fashion similar to the templ= variable. It may therefore be stored in a shortcut memorised by your browser. This is particularly usefull in the case of multi-user GeneWeb servers as GeneWeb cannot remember a user specific profile.

A graphical user interface facilitates the module and option selection. Thumbnails provide a graphical hint of the visual aspect of each option, and the right colums of the menu displays a mock-up of the resulting page. Personnal modules added by the user do not show up in this interface, but may be added through some editing of the gw/etc/p_mod.js file (use existing modules fas examples).

Several modules have their own visual adjustment buttons (number of generations, with or without images, with or without half brothers ans sisters, ...).

Perso.txt

The file perso.txt controls the display of information associated with each person. Two modes of operation are provided through the following structure:

Import of utilities functions and menu bar.

%import;perso_utils;
%include.menubar;

Two display modes:

1/ two columns, fixed set of modules

 %if;(p_mod="zz")
  %(Statique%)
  %( two columns if screen_width>=992px but full width for tablets/phone < 992px %)
    %if;(has_parents and (father.has_parents or mother.has_parents))
       <div class="collapse" id="collapseExample1">
          %let;op_m;1%in;%apply;show_templ("perso_module/gr_parents")
       </div>
    %end;
    <div class="row">
      %(be carefull h1 is full width then an opening <div class="col-8"> in individu module %)
      %let;op_m;3%in;%apply;show_templ("perso_module/individu")
      %let;op_m;2%in;%apply;show_templ("perso_module/unions")
      %let;op_m;1%in;%apply;show_templ("perso_module/chronologie")
      %let;op_m;1%in;%apply;show_templ("perso_module/notes")
      %let;op_m;2%in;%apply;show_templ("perso_module/sources")
      </div> %( closing the <div class="col-8"> in module individu %)
      <div class="d-none d-lg-block col-lg-4">%(second column above lg%)
        %let;op_m;2%in;%apply;show_templ("perso_module/arbre_3gen_photo")
        %let;op_m;1%in;%apply;show_templ("perso_module/fratrie")
        %let;op_m;1%in;%apply;show_templ("perso_module/relations")
      </div>
    </div>

2/ One column. Modules modules labeled from a to z as defined in base.gwf and governed by the p_mod variable.

 %else;(p_mod!="")
  %(Dynamic %)
    %for;i;0;p_mod_nbr;
      %let;mmi;%apply;mm(i)%in;
      %let;ooi;%apply;oo(i)%in;
      %if;(mmi!="" and ooi!=0)
        %apply;get_mod(mmi, ooi)
      %end
    %end;

%end;

Examples of module definitions:

perso_module_i=individu
perso_module_p=parents
perso_module_u=unions
perso_module_f=fratrie
perso_module_r=relations
perso_module_c=chronologie
perso_module_n=notes
perso_module_s=sources
perso_module_a=arbres
perso_module_g=gr_parents
perso_module_l=ligne

Examples

The result corresponding to each choice is as follows:

(These examples ware taken from a version 6 instance. Version 7 of GeneWeb may provide somewhat different results).

File name Example
etat_civil
Personal data.
parent_simple
Parents (simple).
parent_evolue
Parents (more complex).
parent_complet
Parents (full).
parent_photo
Parents (with photo).
union_simple
Union (simple).
union_evolue
Union (more complex).
union_complet
Union (full).
union_photo
Union (with photo).
freresoeur_simple
Brothers and sisters (simple).
freresoeur_complet
Brothers and sisters (full).
famille
Family.
relations
Relations.
notes
Notes.
sources
Sources.
timeline
arbre_3gen_v
Tree, vertical, 3 generations.
arbre_nav3_photo
Tree, vertical, 3 generations with photos.
arbre_4gen_v
Tree, vertical, 4 generations.
arbre_5gen_h
Tree, horizontal, 5 generations.

GeneWeb Manual

Rembrandt Old Man Reading a Book.jpg

Use and manage genealogical databases

Technical annex