You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Addi <ad...@rocktreesky.com> on 2005/06/13 00:42:15 UTC

View HowTos small questions

I've been going through the View HowTos, which are really spot on and 
easy to follow (thanks Thorsten!).

As I'm going, I have been doing a little reader editing, mainly small 
typos or just sentence flow kind of things.  I do have some 
documentation clarification questions that I wasn't sure about.

in View Install:
    The note on why we set leather-dev as the default skin states:
"We exchanging only site2xhtml.xsl of leather-dev skin by the plugins 
and some contracts are based on e.g. document2html.xsl output of 
leather-dev."
I wasn't sure what exchanging the .xsl by the plugins really meant.  
Does this mean to say that the plugins require leather-dev's 
site2xhtml.xsl or is something actually getting exchanged between 
leather-dev and views?

in View DSL:
    1) When we create our first view it says to create a file named 
"index.ft".  As we proceed and add the contract-main, the HowTo states 
what our "index.fv" file should look like.  I'm assuming the first is a 
typo?  I wanted to check before I changed it.
    2) When creating the custom css file it says to save it to 
{project:skins-dir}{path} and the example goes to 
...src/documentation/skins/css... but skins/css/ does not exist in the 
src dir from a forrest seed so maybe it should be made clear that you 
need to create those dirs?

If you want to see my patch, should I open a new issue to submit it or 
do you have an issue open that you would rather I attach to?

Thanks
Addi

PS: I agree with Ross, Views Rocks!

Re: View HowTos small questions

Posted by Thorsten Scherler <th...@apache.org>.
On Sun, 2005-06-12 at 18:42 -0400, Addi wrote: 
> I've been going through the View HowTos, which are really spot on and 
> easy to follow (thanks Thorsten!).
> 
> As I'm going, I have been doing a little reader editing, mainly small 
> typos or just sentence flow kind of things.  I do have some 
> documentation clarification questions that I wasn't sure about.
> 

Can you submit a patch, if you not already did. ;-)

> in View Install:
>     The note on why we set leather-dev as the default skin states:
> "We exchanging only site2xhtml.xsl of leather-dev skin by the plugins 
> and some contracts are based on e.g. document2html.xsl output of 
> leather-dev."
> I wasn't sure what exchanging the .xsl by the plugins really meant.  
> Does this mean to say that the plugins require leather-dev's 
> site2xhtml.xsl 

No, that is the only stylesheet that view replaces from leather-dev and
where views has *no* dependency to lether-dev.

In our main/sitemap.xmap you can find:
<map:match pattern="*.html">
  <map:aggregate element="site">
    <map:part src="cocoon:/skinconf.xml"/>
    <map:part src="cocoon:/build-info"/>
    <map:part src="cocoon:/tab-{0}"/>
    <map:part src="cocoon:/menu-{0}"/>
    <map:part src="cocoon:/body-{0}"/>
  </map:aggregate>
  <map:call resource="skinit">
    <map:parameter name="type" value="site2xhtml"/>
    <map:parameter name="path" value="{0}"/>
  </map:call>
</map:match>

The map:aggregate is the presentation model and the map:call dispatches
the view helper.

This is the last step of forrest for html. <map:parameter name="type"
value="site2xhtml"/> This step *only* is exchanged by the view plugin. 
"We exchanging only site2xhtml.xsl of leather-dev skin by the plugins"

In view internal.xmap we are generating a slightly different
presentation model, you can find:
<map:match pattern="*.page">
  <map:aggregate element="site">
    <map:part src="cocoon://skinconf.xml"/>
    <map:part src="cocoon://build-info"/>
    <map:part src="cocoon://tab-{1}.html"/>
    <map:part src="cocoon://menu-{1}.html"/>
    <map:part src="cocoon://body-{1}.html"/>
    <map:part src="cocoon:/prepare.view-nugget.{1}"/>
  </map:aggregate>
  <map:serialize type="xml"/>
</map:match>

It is nearly the same as the one from core besides I added <map:part
src="cocoon:/prepare.view-nugget.{1}"/>. This allows the view to
dispatch businessHelper and add the resulting models to the presentation
model. e.g. the content-feeder contract is using this feature. My next
how to will be about advanced contracts and will cover this there.

..and in viewHelper.xhtml output.xmap you find the view helper
dispatcher:
<!--
  Last processing step. 
  Here we are overriding the default skin generation.
  -->
<map:match pattern="*.html">
  <map:generate src="cocoon://{1}.page"/>
  <map:transform src="cocoon://getStylesheet.xhtml.{1}">
    <map:parameter name="path" value="{0}"/>
  </map:transform>
  <map:transform src="resources/stylesheets/strip_namespaces.xsl"/>
  <map:serialize type="xhtml"/>
</map:match>

The getStylesheet.xhtml.{1} is equal to site2xhtml. With the different
that is generated dynamically and not static which enables us to freely
place our contracts. That means that the view helper will be aggregated
on-demand.

Back to the presentation model (pm). Each aggregate part e.g. <map:part
src="cocoon:/body-{0}"/> from the pm comes from an earlier stage. 

This part is done in the main/sitemap.xmap:
<map:match pattern="**body-*.html">
  <map:generate src="cocoon:/{1}{2}.xml"/>
  <map:transform type="idgen"/>
  <map:transform type="xinclude"/>
  <map:transform type="linkrewriter" src="cocoon:/{1}linkmap-{2}.html"/>
  <map:transform
src="resources/stylesheets/declare-broken-site-links.xsl" />
  <map:call resource="skinit">
    <map:parameter name="type" value="document2html"/>
    <map:parameter name="path" value="{1}{2}.html"/>
    <map:parameter name="notoc" value="false"/>
  </map:call>
</map:match>

Each "old fashion" skin was providing the stylesheets for the skinit
part. The evolution that we made was leather-dev->views because I notice
that what I was planing to do, was something that I should do with
plugins. They let you override core parts as you like in your own
plugin-environment. :)

> or is something actually getting exchanged between 
> leather-dev and views?
> 

All:
    <map:part src="cocoon://skinconf.xml"/>
    <map:part src="cocoon://build-info"/>
    <map:part src="cocoon://tab-{1}.html"/>
    <map:part src="cocoon://menu-{1}.html"/>
    <map:part src="cocoon://body-{1}.html"/>
which are generated in the core (leather-dev) and used in views

> 
> in View DSL:
>     1) When we create our first view it says to create a file named 
> "index.ft".  As we proceed and add the contract-main, the HowTo states 
> what our "index.fv" file should look like.  I'm assuming the first is a 
> typo?  I wanted to check before I changed it.
> 

Yes, thanks. I just fixed it.

>     2) When creating the custom css file it says to save it to 
> {project:skins-dir}{path} and the example goes to 
> ...src/documentation/skins/css... but skins/css/ does not exist in the 
> src dir from a forrest seed so maybe it should be made clear that you 
> need to create those dirs?
> 

Yes you are right. I added it to the install howto. 

Thanks. :)

> 
> If you want to see my patch, should I open a new issue to submit it or 
> do you have an issue open that you would rather I attach to?
> 

Yes, go ahead open an issue and submit your patch. :) 

> 
> Thanks
> Addi

Yes, to you. :)

Muchas gracias

> 
> PS: I agree with Ross, Views Rocks!

:)

salu2
-- 
thorsten

"Together we stand, divided we fall!" 
Hey you (Pink Floyd)