cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conny Krappatsch <co...@smb-tec.com>
Subject [C2] enhanced DirectoryGenerator (patch attached)
Date Wed, 07 Mar 2001 12:54:45 GMT
Hi,

during a customer project I had to add some functionality to
DirectoryGenerator.

It now can be configured with an 'include' parameter and/or 'exclude'
parameter. The value of these two parameters is a regular expression and
specifies which files/directories shall be shown or hidden respectivly by
the generator.

little example:

<map:generate type="directory" src="{1}">
 <parameter name="include" value="^s.*"/>
 <parameter name="exclude" value="^sl.*"/>
</map:generate>

The created XML file will only contain directories and files whose name
starts with 's' but does not start with 'sl'.
If the 'include' paramater is omited all directories/files will be
included. If the 'exclude' parameter is omited no directories/file will be
excluded.

Another feature is to specify a root directory for the generated directory
tree.

What do I mean?
One specifies the root with a RE, let's say '^docs$', and the generator
goes up the directory tree starting at the requested directory until it
finds a directory that matches the given root pattern ('docs' in the
example). This directory becomes the root of the generated XML file. Its
descendants are the ancestors of the requested directory, the requested
directory itself and the descendants of the requested directory (according
to the 'include', 'exclude' and 'depth' parameter).

The requested directory is not necessarily represented by the document
element of the resulting XML file anymore. Thus, the corrsponding
<directory> element got a new parameter named 'requested' with the value
'true'.

What do I need it for?
With the information of the ancestors of the requested directory one can
show the path to it.
With this path information traveling through a directory structure can be
made much more convinient.

Without any of the additional parameters ('include', 'exclude' and 'root')
the DirectoryGenerator works like normal (except the additional
'requested' attribute).


I attached a diff to current CVS version. Would be great if somebody could
apply the patch.

thanks and regards,
Conny Krappatsch

-- 
______________________________________________________________________
Conny Krappatsch                              mailto:conny@smb-tec.com
SMB GmbH                                        http://www.smb-tec.com




Mime
View raw message