Hi Rudolf,

yes, I (we) would be happy to share this code, and what I've seen, we already
did: it is in the lenya-extras repository we created in our last Lenya meeting,
you can find it under modules/contentunit. The Generator is the
"SiteSubtreeGenerator".
At the moment it's still not documented perfectly and should be reviewed in
regard to the needs we had and to make it (partly?) more flexible/configurable
(if needed).

Here's the (not complete) source documentation-comment giving an idea of the
possible configuration:
 * parameters (<param name="nnn" value="vvv">)
 * CONFIGURATION:
 * - coverage-ns:
 *         namespace of metadata-set containing field 'coverage'
 * - valid-ns:
 *         namespace of metadata-set containing field 'valid'
 * - categories-ns:
 *         namespace of metadata-set containing field 'categories'
 *
 * GENERATION:
 * - selectorPath: (default: '' = root)
 *         absolute path to the root-node for the selection.
 *         if empty or '/' the selections starts with the top-level nodes
 *         if it ends with '/' the selection starts with the children of the
given node
 *         else selection starts with the given node (level 1 in level counting)
 *         UUIDs:
 *         it's possible to use a UUID in <code>selectorPath</code>.
 *         this requires that the parameter value starts with "lenya-document:"
 *         any character after this prefix up to the end or the first '/' is
treated as UUID
 * - path:
 *         path (of the current document) that is used to set the attributes
 *         'current' and 'ancestorOfCurrent'
 * - reverse: 'false' (default) | 'true'
 *         if true, the nodes are processed in reversed order (from bottom to
top)
 * - child-add:
 *         (GS/20100520)
 *         name of the child node that should be added anyway
 *       (only the nodename is matched against the passed value)
 *       value can be a RegEx (example: ".*-image")
 *       when the first matching node is found none of the remaining siblings
 *       are checked.
 * - lang:
 *         language - only links for the given language are generated
 *         (GS/20100420)
 *         if language ends with "-all" all link-nodes are generated
 *     - alternative-lang
 *         if there's no link for the current language
 *      the one for the alternativeLanguage is used (if available)


Here how we use it in the sitemap (see module) with some additional params:
- limit: maximum number of delivered documents
- start: if we do not want to start with the first result document (example:
news 4-20)
- countlevel: the level of the resulting structure the documents should be
counted (example: we want to list the latest 20 news which are organized in
folders by year - so we count on level 2 (news documents) and ignore level one
(year folder) or level 3 (thumb images))
- maxlevel: the deepest level to generate

      <!--
        match:
navigator/{1:type}/{2:style}/{3:publication-id}/{4:area}/{5:language}/{6:path}
          !path: the root-/ must be included in the url!
(.../<lang>//foo/bar.html)
      -->
      <map:match pattern="navigator/*/*/*/*/*/**">
        <map:generate type="sitesubtree">
          <map:parameter name="pub" value="{3}"/>
          <map:parameter name="area" value="{4}"/>
          <map:parameter name="lang" value="{5}"/>
          <map:parameter name="path" value="/"/>
          <map:parameter name="selectorPath" value="{6}"/>
          <map:parameter name="reverse" value="{request-param:reverse}"/>
          <map:parameter name="limit" value="{request-param:limit}"/>
          <map:parameter name="start" value="{request-param:start}"/>
          <map:parameter name="countlevel" value="{request-param:countlevel}"/>
          <map:parameter name="maxlevel" value="{request-param:maxlevel}"/>
          <map:parameter name="visible" value="{request-param:visible}"/>
          <map:parameter name="meta-coverage" value="{request-param:coverage}"/>
          <map:parameter name="meta-valid" value="{request-param:valid}"/>
          <map:parameter name="meta-categories"
value="{request-param:categories}"/>
          <map:parameter name="meta-issue" value="{request-param:issue}"/>
          <!-- adds a child by its nodename -->
          <map:parameter name="child-add" value="{request-param:child-add}"/>
          <!-- alternative language (used if there's no link available for the
current language) -->
          <map:parameter name="alternative-lang"
value="{request-param:alternative-lang}"/>
        </map:generate>


Feel free to kick me for more informations/documentation ;-)

Best regards,
 Gerd


rudolf.korhum...@uniklinik-freiburg.de hat am 5. Juni 2012 um 17:01 geschrieben:

> Hi Gerd,
>
> > Hi Rudolf,
> >
> > interesting, I also created a FragmentGenerator (mainly for use in
> > our "ContentUnits") that supports additional parameters.
> >
> Very interesting !
> What kind of parameters do you use ?
> What do you think about adding them to the apache repository ?
>
> Best
>
> Rudolf
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@lenya.apache.org
> For additional commands, e-mail: dev-h...@lenya.apache.org
>

Reply via email to