[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
The Catalog software is made of separate Perl packages.
All these packages have a configuration
file that is read at startup time. They are found
in the current working directory if no CONFIG_DIR
environment
variable is set,
See section Environment variables
.
The instructions found in the configuration files alter the behavior of Catalog. For instance, they can be used to change the display of an HTML page. The general structure of a configuration file is an ASCII file where lines beginning with a dash (#) are ignored as well as empty lines.
A configuration instruction has the following form
keyword = value |
or
keyword : value |
The prefered form is using the equal sign instead of colon.
The keyword can contain alpha-numerical characters, underscore (_) and dash (-). The value can contain any character except newline or carriage return. There is no way to specify a multi-line value for a given keyword.
Here is a simple example of a configuration file:
# # Name of the database to connect. # base = test |
Configurations instructions may be nested. If a keyword is not followed by an equal sign, it is considered to be the start of a sub section of the configuration file. The end of a sub section is marked by the keyword end, alone on a line. Here is a simple example:
# # Parameters for set and enum built from tables instead of builtin types # dictionaries name = mydict end |
Nesting can be recursive. Note that the leading white spaces are cosmetic only and are ignored by the configuration file parser. Here is an example of recursively nested instructions:
# # Parameters for set and enum built from tables instead of builtin types # dictionaries name = mydict mydict where = valid = 'yes' end end |
The white space characters surrounding the keyword and the value are always ignored. This means that there is no way to specify a value that would contain leading or trailing white space.
In the following chapters you will find a complete description of the configuration files available in Catalog.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Used by the Catalog package (Catalog.pm). It influences the global behavior of Catalog.
cedit.html
.
cedit.html
.
Intuitive navigation (pathcontext)
.
If set it must contain the name parameter that specifies the name of the
catalog to display.
Catalog search (csearch)
.
The following instructions only apply to the thematic catalog whose name is catalog name. All the field names must belong to the table associated with the named catalog.
A comma separated list of fields to be searched. These fields must be of type char, varchar or text. If not specified, all the fields of the listed types are used. All the fields must be fully qualified by prepending the name of the table in the following way: table.field.
@cindex extracted instruction
A comma separated list of fields to be extracted. If not specified, all the fields of the table
are extracted and available for display, See section csearch.html
. This instruction
is used to limit the number of fields extracted from the database, if the records are made of many
fields and only a few are needed for display. All the fields must be fully qualified by
prepending the name of the table in the following way: table.field.
@cindex order instruction
Here is an example configuration file:
# # Catalog.pm configuration file # # # HTML code that separates two component of the path # path_separator = / # # Label for the root of the hierarchy tree # path_root_label = <b>Ze root</b> # # When cgi-bin is invoked with path_info instead of regular arguments, # pretend that these parameters were used. It must at least contain # the name of the catalog (name=NAME) and may also contain a style, for instance. # The id and path parameters are automaticaly calculated from the path_info. # pathcontext_params = name=urlcatalog # # Search specifications # search # # Specifications for urlcatalog thematic catalog # urlcatalog # # Search these fields # searched = urldemo.url,urldemo.comment # # Only extract these fields for display # extracted = urldemo.url,urldemo.comment,urldemo.created # # ORDER BY clause to sort the records found # order = urldemo.url asc end end # # Encoding of the catalog data (default is ISO-8859-1) # #encoding = ISO-8859-1 |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Used by the mysql package (mysql.pm). It defines which base must be used and parameters for the connection.
datetime not null
. Each time a record is inserted using
the mysql
package, if the created field does not contain
any value, it is set with the current date.
Hook Fulcrum configuration file
.
Hook Mifluz configuration file
}.
Here is an example configuration file:
# # MySQL client configuration file # # # Name of the database to connect. Mandatory. # base = interbat # # Host name. Comment if using localhost. # #host = enkidu # # Port number. Comment if using default. # port = 8301 # # File name of the socket for local communications. Comment if # using a remote host or if mysql does not support non-TCP/IP # communications on local host. # unix_port = /usr/local/lib/interbat/db/8401.sock # # User name. Comment if authentification is off. # #user = myname # # Password. Comment if authentification is off. # #passwd = mypass # # Uncomment to trigger special handling of the created field. # If active, field whose name is 'created' will be filled with the # current date during insert. # auto_created = yes # # Every update/delete/insert is passed to this hook # hook = Catalog::tools::hook_fulcrum |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Used by the cgi package (cgi.pm).
Catalog
depends on a modified CGI.pm package.
This configuration file deals with the additions specific to Catalog
.
Here is an example configuration file:
# # Derived cgi class (Catalog::cgi) configuration file # # # Directory that will contain the saved execution contexts. # fct_dir = /usr/local/lib/interbat/cache |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Used by the sqledit package (sqledit.pm).
This configuration file is created during the installation. It is
used by sqledit to find the location of the Catalog
components.
Here is an example configuration file:
# # Emacs info format documentat directory # infodir = # # cgi-bin directory # cgidir = /home/httpd/cgi-bin # # cgi-bin directory HTML path # cgipath = /cgi-bin # # configuration files (*.conf) installation directory # config_dir = /home/httpd/cgi-bin # # Catalog material directory # htmldir = /home/httpd/html/Catalog # # Catalog material HTML path # htmlpath = /Catalog |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Used by the sqledit package (sqledit.pm). This module implements an HTML interface to an SQL database. The instructions of this configuration file modifies the behavior of the interface.
Catalog CGI
.
Alternatively, context_allow may be set to star (*, the default) to allow every operations.
If the user is denied a specific operation, the following error message will be displayed:
"%s context is not allowed" |
Messages translation
.
Assuming that you want to give read-only access to your catalog, use the following:
context_allow = cbrowse |
normalize
and
match
instructions in the check nested instruction.
The keyword is the name of the function and the value is the body of the
function. The body of the function must be a piece of Perl code
that returns a function pointer when evaluated. Most of the time it is
a simple lambda (sub { ... }). No parameters are passed to the function,
however the $_
variable contains the current value
of the field for which the function was called. See the description of
the match
and check instructions for a description of the
return values expected from these functions.
Since the available libraries are not documented you can only rely on the standard Perl libraries here.
functions normalize_lc = sub { $_ = lc; return 1; } check_alnum = sub { /[a-z0-9]+/ || "alphanumerical" } end |
check table1 field1 normalize = <function> match = <function> mandatory = yes end field2 ... end ... end ... end |
We will define bellow the instructions that may be associated with each field.
function
section of this configuration file.
The $_ variable contains the value of the field for the current
record.
The normalize
function is called when the value of the field is
updated or a new value is inserted.
The return value of the function must be
If the return value is 1, the $_ variable is expected to contain the normalized value when the function returns.
If the return value is 0, the following error message will be issued to the end user:
table %s : field %s : value %s normalize failed %s |
Messages translation
.
function
section of this configuration file.
The $_ variable contains the value of the field for the current
record.
The match
function is called when the value of the field is
updated or a new value is inserted.
The return value of the function must be
If the return value is a string, the following error message will be issued to the end user:
table %s : field %s : value %s match failed %s |
Messages translation
.
where the last %s
is replaced by the string returned by the function,
thus providing precise error messages.
The mandatory check is done when the value of the field is updated or a new value is inserted.
If the new value is null (only contains white space), the following error message will be issued to the end user:
table %s : field %s must be set |
Messages translation
.
Parameters that apply to the dictionaries as defined by the relational
specifications,
See section Relational constraints
.
Keep in mind that dictionaries are handled as if they were native
enum
or set
types of MySQL. This instruction allows to
control the display of such dictionaries.
dictionary tablename1 where = <where clause1> order = <order clause1> end tablename2 where = <where clause2> order = <order clause2> end ... end |
select * from tablename
.
The values displayed to the user will only be those matching the
where clause, for more information on how to display a dictionary
See section Template files introduction
.
select * from tablename
. The menu
generated for this dictionary will show the values listed according to
this clause. If not provided, no specific order can be expected.
The structure of this instruction is as follow:
display select general multiple = <number of lines> labelnull = <HTML text> end tablename1 field1 multiple = <number of lines> labelnull = <HTML text> end ... end ... end table general columns = <number of columns> font = <font ...> end tablename1 field1 columns = <number of columns> font = <font ...> end ... end ... end end |
In both select
and table
, there is a special table name,
general, that provides the default for all the table names not
specifically listed.
Apache
documentation and the CGI.pm
documentation.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Maps template file names according to style names.
The structure of this nested instruction is as follows:
style stylename templatepath = othertemplatepath ... end ... |
The templatepath must be a template path name as defined for the
current application, See section Template files introduction
.
# # Templates system configuration # # style liensacteur cbrowse_root.html = liensacteurtop.html cbrowse.html = liensacteur.html end lienstheme cbrowse_root.html = liensthemetop.html cbrowse.html = lienstheme.html end liensalpha calpha_root.html = liensalphatop.html calpha.html = liensalpha.html end end |
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
Relational constraints
.
The general structure of the file is as follows:
# # Link fulcrum with SQL database # # # Fulcrum field numbering start from serial and up (suggested 230) # serial = <number> # # How many fulcrum deletions/update can be done in one # request (suggested 1000) # chunksize = <number> # # SQL base name # <sql database> # # General parameters for base # params # # Name of the fulcrum table # table = <fulcrum tablename> end # # SQL tables mapping # tables <sql tablename> params # # Only records matching this where # clause will be inserted # where = <sql where clause> # # Merge part of a linked row into # each entry. Link must be defined in # relations.spec. # merge table = <sql tablename> fields = <sql fieldname,sql fieldname,...> end end fields <sql fieldname> field = <fulcrum fieldname> end ... end end ... query params # # Name of the fulcrum table # table = <fulcrum tablename> # # Reduce factor for or'ed terms (suggested 100) # divide_or = <number> # # When a row is found, retrieve only these fields # extract = <fulcrum fieldname>,<fulcrum fieldname>,... # # Relevance method # relevance = relevance(<fulcrum relevance>) as rel, <fulcrum orderby fields> # # When querying the order by clause is order # order = <fulcrum orderby> # # If a constraint is matched, apply this weight # (suggested 1000) # constraint_weight = <number> # # Map table names to template names # templates <sql table,sql table,...> = <template basename> ... end end groups <group number> where = <fulcrum where clause> weight = <number> constraint = <constraint re> fields = <fulcrum fields> end ... end end end |
Here is a complete example:
# # Link fulcrum with SQL database # # # Fulcrum field numbering start from serial and up # serial = 230 # # How many deletions/update can be done in one request # chunksize = 1000 # # Mysql base name # interbat # # General parameters for base # params # # Name of the fulcrum table # table = intersmall end # # Mysql tables mapping # tables societe params # # Only records matching this where # clause will be inserted # where = find_in_set('interbat', typesociete) end fields typesociete field = so_typesociete end nomaffiche field = so_nomaffiche end raisonsociale field = so_raisonsociale end raisonsocialecomplementaire field = so_raisonsocialec end sigle field = so_sigle end motscles field = so_motscles end descriptif field = so_descriptif end descriptiflong field = so_descriptiflong end activite field = so_activite end url field = so_url end mail field = so_mail end adresse field = so_adresse end codepostal field = so_codepostal end ville field = so_ville end pays field = so_pays end tel field = so_tel end end end start params # # Only records matching this where # clause will be inserted # where = disabled = 'no' end fields descriptif field = st_descriptif end url field = st_url end debut field = st_debut end fin field = st_fin end end end personne params # # Only records matching this where # clause will be inserted # where = publiable = 'yes' # # Merge part of a linked row into # each entry. Link must be defined in # relations.spec # merge table = societe fields = typesociete end end fields nom field = pe_nom end url field = pe_url end mail field = pe_mail end fonction field = pe_fonction end adresse field = pe_adresse end codepostal field = pe_codepostal end ville field = pe_ville end pays field = pe_pays end tel field = pe_tel end end end produitsnouveaux params # # Only records matching this where # clause will be inserted # # where = end fields texte field = pn_texte end nom field = pn_nom end url field = pn_url end debut field = pn_debut end fin field = pn_fin end end end marque params # # Only records matching this where # clause will be inserted # # where = # # Merge part of a linked row into # each entry. Link must be defined in # relations.spec # merge table = societe fields = typesociete end end fields marque field = ma_marque end descriptif field = ma_descriptif end end end end query params # # Name of the fulcrum table # table = interall # # Reduce factor for or'ed terms # #divide_or = 100 # # When a row is found, retrieve only these fields # extract = r_societe,r_marque # # Relevance method # relevance = relevance('2:2') as rel,ma_marque # # When querying the order by clause is order # order = rel desc,ma_marque # # If a constraint is matched, apply this weight # constraint_weight = 1000 # # Map table names to template names # templates societe,start = start marque,societe = marquebatibase personne,societe = personnebatibase produitsnouveaux,societe = produitsnouveaux societe = societebatibase end end groups 1 where = so_typesociete contains 'interbat' weight 0 weight = 900 constraint = so_.* fields = so_raisonsociale,so_sigle,so_motscles end 2 where = so_typesociete contains 'interbat' weight 0 weight = 900 constraint = ma_.* fields = ma_marque,ma_descriptif end 3 where = (pn_debut < now() and pn_fin > now()) weight = 800 constraint = pn_.* fields = pn_nom,pn_texte,pn_url end 4 # where = (st_debut < now() and st_fin > now()) weight = 700 constraint = st_.* fields = st_url,st_descriptif end 5 weight = 700 # st_url,ho,pa,tx constraint = (ho|pa|tx|e_text) fields = e_text end 6 where = so_typesociete contains 'batibase' weight 0 weight = 130 constraint = so_.* fields = so_raisonsociale,so_sigle,so_motscles end 7 where = so_typesociete contains 'batibase' weight 0 weight = 130 constraint = ma_.* fields = ma_marque,ma_descriptif end 8 weight = 50 constraint = so_.* fields = so_url,so_mail,so_adresse,so_codepostal end 9 weight = 50 constraint = pe_.* fields = pe_nom,pe_url,pe_mail,pe_fonction,pe_adresse end end end end |
[ << ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |