where you put things in the dispatcher?

2 views
Skip to first unread message

Stuart A. Yeates

unread,
Oct 4, 2007, 9:28:16 AM10/4/07
to simal-con...@googlegroups.com
I'm working on http://www.oss-watch.ac.uk/catalogue/ (or more
accurately, a local copy that will be copied over there once it
works).

I think it's the dispatcher I'm having difficulties with, what I'm
trying to do is work out where to add content (mainly text but also
images) to make them appear:

(a) in the nav bar at the lower left
(b) in the tabs div (across the top of the content)

I'm also uncertain where to put CSS definitions that are global on my site.

I think I'm getting lost in the fact there are so many levels of
defaults, but I'm not really sure.

I've read http://forrest.apache.org/pluginDocs/plugins_0_80/org.apache.forrest.plugin.internal.dispatcher/how/howto-dispatcher-quickstart.html
which is written from the point of view of someone who already groks
everything else in forrest.

I've also found a 404s from
http://forrest.apache.org/docs_0_80/dispatcher.html
to
http://forrest.apache.org/docs_0_80/howto/howto-dispatcher-install.html
and
http://forrest.apache.org/docs_0_80/howto/howto-dispatcher-quickstart.html

cheers
stuart

Ross Gardler

unread,
Oct 4, 2007, 10:01:44 AM10/4/07
to simal-con...@googlegroups.com
On 04/10/2007, Stuart A. Yeates <sye...@gmail.com> wrote:
>
> I'm working on http://www.oss-watch.ac.uk/catalogue/ (or more
> accurately, a local copy that will be copied over there once it
> works).
>
> I think it's the dispatcher I'm having difficulties with,

That is no suprise to me. The dispatcher is still in the whiteboard of
Forrest and is therefore poorly documented and has not been fully QA'd
for release. The result can be very confusing. Lets see if we can sort
out the confusion, I'll add to the dispatcher documentation over at
Forrest as a result of your questions.

> what I'm
> trying to do is work out where to add content (mainly text but also
> images) to make them appear:
>
> (a) in the nav bar at the lower left
> (b) in the tabs div (across the top of the content)

It really depends on what you want to appear precisely where. Can you
give a specific use case for us to tackle?

> I'm also uncertain where to put CSS definitions that are global on my site.

It looks like your site is using the default Simal theme, so my
answers are based on that assumption.

Just as above, there is no simple answer to such a general question.
It depends what you mean by "global on my site". I'm going to take the
most literal interpretation of it (partly because it means I can give
the easiest answer).

If the changes are applicable to all Simal users and to every page in
a Simal site then the CSS is defined in [1].

However, be aware that it is possible to define custom CSS on any
level of granularity down to a per page definition. If that is what
you want to do, now or in the future, then ask again.

That one needs to be reported bia the Forrest issue tracker at [2]

Ross

[1] http://simal.googlecode.com/svn/trunk/uk.ac.osswatch.forrest.plugins/uk.ac.osswatch.forrest.themes/themes/simal/css/simal.css
[2] http://issues.apache.org/jira/browse/FOR

Stuart A. Yeates

unread,
Oct 4, 2007, 10:27:01 AM10/4/07
to simal-con...@googlegroups.com
On 10/4/07, Ross Gardler <ross.g...@googlemail.com> wrote:
>
> On 04/10/2007, Stuart A. Yeates <sye...@gmail.com> wrote:
> >
> > I'm working on http://www.oss-watch.ac.uk/catalogue/ (or more
> > accurately, a local copy that will be copied over there once it
> > works).
> >
> > I think it's the dispatcher I'm having difficulties with,
>
> That is no suprise to me. The dispatcher is still in the whiteboard of
> Forrest and is therefore poorly documented and has not been fully QA'd
> for release. The result can be very confusing. Lets see if we can sort
> out the confusion, I'll add to the dispatcher documentation over at
> Forrest as a result of your questions.
>
> > what I'm
> > trying to do is work out where to add content (mainly text but also
> > images) to make them appear:
> >
> > (a) in the nav bar at the lower left

I want to put some text (and probably a JISC logo) at the bottom of
the nav bar, under the dynamically generated portion.

> > (b) in the tabs div (across the top of the content)

Currently there is only the "Home" link. My thought was to add links
to the catalogue, the Simal homepage, the OSS Watch homepage and the
JISC homepage. That or make the entire div vanish.

> It really depends on what you want to appear precisely where. Can you
> give a specific use case for us to tackle?
>
> > I'm also uncertain where to put CSS definitions that are global on my site.
>
> It looks like your site is using the default Simal theme, so my
> answers are based on that assumption.
>
> Just as above, there is no simple answer to such a general question.
> It depends what you mean by "global on my site". I'm going to take the
> most literal interpretation of it (partly because it means I can give
> the easiest answer).
>
> If the changes are applicable to all Simal users and to every page in
> a Simal site then the CSS is defined in [1].
>
> However, be aware that it is possible to define custom CSS on any
> level of granularity down to a per page definition. If that is what
> you want to do, now or in the future, then ask again.

I was planning on lifting some of the CSS from
http://www.oss-watch.ac.uk/, in particular the colour for the nav bar
and perhaps styling of headings. I'd want this to appear on all pages
in my site, but would not necessarily want to inflict my (lack of)
style on others.

Done.

cheers
stuart

Ross Gardler

unread,
Oct 4, 2007, 11:53:37 AM10/4/07
to simal-con...@googlegroups.com
On 04/10/2007, Stuart A. Yeates <sye...@gmail.com> wrote:
>
> On 10/4/07, Ross Gardler <ross.g...@googlemail.com> wrote:
> >
> > On 04/10/2007, Stuart A. Yeates <sye...@gmail.com> wrote:
> > >
> > > I'm working on http://www.oss-watch.ac.uk/catalogue/ (or more
> > > accurately, a local copy that will be copied over there once it
> > > works).
> > >

...

> I want to put some text (and probably a JISC logo) at the bottom of
> the nav bar, under the dynamically generated portion.

I assume this is static content that will appear on every page (if you
don't then the answer is different).

To do this you need to modify the page template. Each page is made up
of one or more panels and each panel is made up of one or more panels
and zero or more contracts, each contract adds some content to the
page. So what you want to do is add a new contract to whatever panel
displayed the nav bar on the left.

There are two ways of finding this, guessing it from filenames (which
requires a little inside knowledge), or drilling down through the page
definition. I'll show you how to do it with the drill down method as
you'll understand more of what is going on, with practice you will be
able to work it out for yourself.

Starting at the top, the master page is defined in themes/simal.fv in
the simal theme plugin. However, this page merely delegates to another
file using:

<jx:import uri="cocoon://prepare.panels.simal-commonPage-html"/>

So, you need to know how the simal-commonPage-html panel is generated
from this request. Panels come from the themes/simal/panels directory.
In there you find a file called simal-commonPage-html.xml, seems like
a good bet, lets look inside.

Bah! more imports:

<jx:import uri="cocoon://prepare.panels.simal-commonCSS-html" />
<jx:import uri="cocoon://prepare.panels.simal-commonMeta-html" />
<jx:import uri="cocoon://prepare.panels.simal-commonBody-html" />
<jx:import uri="cocoon://prepare.panels.simal-commonFooter-html" />

Here we define four subpanels for this panel. It would seem to be a
good guess that the nav bar you want is somewhere in the
simal-commonBody-html panel, so lets look in there.

Now we are getting somewhere, this has some real content, not just imports.

It's even possible for us to guess that the following element defines
what we want:

<forrest:hook name="leftbar">
...
</forrest:hook>

But lets confirm that before going any further. Check out the id of
the div that contains the HTML code you want to modify. You can do
this by doing a view source, but if you are a FireFox user then I
recommend the WebDeveloper plugin which provides loads of useful tools
for this kind of work.

Sure enough the id of the div in question is "leftbar". That is
because a forrest:hook, when transformed into HTML becomes a div with
an id equal to the hooks name. Of course, if you are generating PDF,
RTF, Text or some other XML format this is not necessarily the case,
but we are only worrying about HTML right now since this is an HTML
panel.

Looking inside this forrest:hook element we see a single contract
(remember a contract is what puts content in the page). The name of
the contract is "nav-section", it is a fair guess that this creates
the navigation section, especially since it is the only contract here
and the navigation section is the content we see.

Ok, so now we know where our content should go we need to figure out
how to do it. But hang on...

We can't add it in this copy of simal-commonBody-html.panel.xml
because that will add the content to all Simal sites using this theme
(I'm assuming you don't want to do that). What we need to do is create
our own version of the panel that will override the default one.
Fortunately, that is easy. Simply copy this file into
PROJECT_HOME/src/documentation/resources/themes/simal/panels/simal-commonBody-html.panel.xml

You can confirm you are using your new panel by changing it in some
obvious way, such as removing the navigation section.

NOTE: if you have not turned off locationmap cacheing you will need to
restart simal for this change to take effect

OK, so now you have a local copy of the panel that you can edit
without affecting anyone else. You can now add new contracts in here
to add new content. But what contract should you use?

Unfortunately there is no easy answer to this, I'd like to be able to
point at a documentation page, but there isn't one. Fortunately, the
contracts are all self documenting and so there will be a
documentation page soon, for now you have to resort to looking in the
Forrest source code. Take a look at [1], this shows you all the
contracts available in the core Forrest theme (others are provided by
plugins and by the simal theme itself, but we'll ignore them for now).

Looking through this list we see a contract called genericMarkup [2]
Sounds hopeful, open it up and take a look, you'll see (amongst other
things):

<description>
<p>genericMarkup - Template will output generic markup.</p>
</description>

Sounds very promising. You'll also see:

<usage>
<![CDATA[
<forrest:contract name="genericMarkup">
<forrest:property name="genericMarkup">
<hr/>
</forrest:property>
</forrest:contract>
]]>
</usage>

OK, this looks good. And you are now on your final step. Add the
contract as defined in the usage element to your new panel definition
in the right place (i.e.after the "nav-section" hook). You'll probably
want to edit the markup being used too (i.e. replace "<hr/>" with what
you need).

Now refresh your browser and your should see what you need.

If not, then I've not been as clear as I thought and you should report back.

> > > (b) in the tabs div (across the top of the content)
>
> Currently there is only the "Home" link. My thought was to add links
> to the catalogue, the Simal homepage, the OSS Watch homepage and the
> JISC homepage. That or make the entire div vanish.

An easy one ;-)

If you want to add stuff here it's easy. Take a look at
src/documentation/content/xdocs/tabs.xml You'll find documentation at
[3] and [4]

If you actually want to remove the tabs then you need to find the
relevant contract in the relevant panel and remove it in your local
theme config (the above will help guide you, if you can't find it then
ask again).

> > It really depends on what you want to appear precisely where. Can you
> > give a specific use case for us to tackle?
> >
> > > I'm also uncertain where to put CSS definitions that are global on my site.
> >
> > It looks like your site is using the default Simal theme, so my
> > answers are based on that assumption.
> >
> > Just as above, there is no simple answer to such a general question.
> > It depends what you mean by "global on my site". I'm going to take the
> > most literal interpretation of it (partly because it means I can give
> > the easiest answer).
> >
> > If the changes are applicable to all Simal users and to every page in
> > a Simal site then the CSS is defined in [1].
> >
> > However, be aware that it is possible to define custom CSS on any
> > level of granularity down to a per page definition. If that is what
> > you want to do, now or in the future, then ask again.
>
> I was planning on lifting some of the CSS from
> http://www.oss-watch.ac.uk/, in particular the colour for the nav bar
> and perhaps styling of headings. I'd want this to appear on all pages
> in my site, but would not necessarily want to inflict my (lack of)
> style on others.

I have to go right now so don't have the time for a full answer.
However, you should be able to figure it out from the above and from
[5]

Ross

[1] http://svn.apache.org/repos/asf/forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/
[2] http://svn.apache.org/repos/asf/forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/genericMarkup.ft
[3] http://forrest.apache.org/docs_0_90/your-project.html#tabs.xml
[4] http://forrest.apache.org/docs_0_90/linking.html#tab-site
[5] http://forrest.apache.org/pluginDocs/plugins_0_80/org.apache.forrest.plugin.internal.dispatcher/how/howto-dispatcher-structurer.html#cssstructurer

Gav...

unread,
Oct 8, 2007, 3:06:28 AM10/8/07
to Simal contributors

On 4 Oct, 21:28, "Stuart A. Yeates" <syea...@gmail.com> wrote:

...

> andhttp://forrest.apache.org/docs_0_80/howto/howto-dispatcher-quickstart...
>
> cheers
> stuart

Can you tell me where you came across this (old) link to /
dispatcher.html, it is an old location that has a new home at
http://forrest.apache.org/pluginDocs/plugins_0_80/org.apache.forrest.plugin.internal.dispatcher/

Thanks

Gav...

Stuart A. Yeates

unread,
Oct 8, 2007, 3:43:55 AM10/8/07
to simal-con...@googlegroups.com

Almost certainly I came across the link from google, which I use to
find my way through the forrest docs. It seems to be the first hit
when you type "dispatcher" into the search box of the forrest web
site, so I'm guessing I got to it that way (I don't recall exactly).

cheers
stuart

Ross Gardler

unread,
Oct 8, 2007, 6:58:38 AM10/8/07
to simal-con...@googlegroups.com

This highlights the problem of using a search engine to navigate the
docs. It doesn't know which is the best, just which is the most
commonly linked. In this case you were looking at the docs for the 0.8
release, but Forrest is in the 0.9 dev cycle. So you were looking at
old docs.

Anyway, sorry I didn't notice you had an older URL.

Ross

Ross Gardler

unread,
Oct 8, 2007, 7:01:08 AM10/8/07
to simal-con...@googlegroups.com
On 08/10/2007, Ross Gardler <rgar...@apache.org> wrote:
> This highlights the problem of using a search engine to navigate the
> docs. It doesn't know which is the best, just which is the most
> commonly linked. In this case you were looking at the docs for the 0.8
> release, but Forrest is in the 0.9 dev cycle. So you were looking at
> old docs.

I ought to point out that you will almost certainly have been given a
different URL by Google, one that points at the "current" docs, i.e.
doesn't have a version number in it. When 0.9 is released that will
become the current set of docs and the Google link will still work.

However, as a developer (rather than user) you do need to work with
the latest docs.

I'm not sure how Forrest can fix this, perhaps a more prominent link
to updated docs from the "current" docs. I'll bring this up on the
Forrest lists.

Ross

Stuart A. Yeates

unread,
Oct 8, 2007, 8:46:55 AM10/8/07
to simal-con...@googlegroups.com
On 10/8/07, Ross Gardler <rgar...@apache.org> wrote:

> I'm not sure how Forrest can fix this, perhaps a more prominent link
> to updated docs from the "current" docs. I'll bring this up on the
> Forrest lists.

I'd be tempted to try using background images on the pages with
"stable" "unstable" and "developer" or similar, because of the number
of anchors in the docs users can jump into them anywhere, not just at
the top.

cheers
stuart

Reply all
Reply to author
Forward
0 new messages