Cyriaque Dupoirieux wrote:
le 26/04/2006 11:52 Ross Gardler a écrit :

Cyriaque Dupoirieux (JIRA) wrote:

[ http://issues.apache.org/jira/browse/FOR-412?page=comments#action_12376446 ]
Cyriaque Dupoirieux commented on FOR-412:
-----------------------------------------

The best way to do this should be to have a specific resource projectInfo.css - find via the lm -
Does anyone know how to use a specific resource with an input plugin ?


I don't quite understand the question, can you explain exactly what you mean by "specific resource with an input plugin"?

I mean that projectInfo specific styles should not appear in a standard forrest css file, but in a specific one which will be find with a good match in the projectInfo location map (with a fallback mecanism in order to let the customer override it) and only included in the pages generated by this plugin.
(Don't know if I am clear enough ?)

Yep, very clear.

There is no existing approach to this, but I think there are a number of potential solutions. First, lets notice that it is much easier to do this in the dispatcher than with skins. Therefore, the solution I propose below is a quick solution that should work (not tested) with minimal effort. I've noted a couple of problems with this approach at the end of the mail.

What we need to do is dynamically insert something into skinconf.xml. We therefore need to intercept the request for skinconf.xml, i.e. add a plugin locationmap entry of:

    <match pattern="project.skinconf">
        <location src="cocoon://projectInfo.skinconf" />
    </match>

Then add a match to the plugins input.xmap which reads the existing skinconf.xml file and dynamically adds (using XSL) the additions that the projectInfo plugin needs. The actual entries for the extra-css section should come from some config file resolved via the locationmap as normal, this is where you can provide the ability for the user to override the plugin provided defaults.

PROBLEM
=======

We will have to define the location of the original skinconf file in the input.xmap, we will not be able to retrieve it via the locationmap since this will put us into a loop.

I have a solution in mind, but since dispatcher is proposing to remove skinconf.xml this workaround will probably be OK.

PROBLEM 2
=========

Only one plugin will be able to override things in this way. Again, I have a solution to this in mind, but it requires much more work. Lets worry about it if/when the problem arises since it utilises the forrest.properties.xml code which is not slated for inclusion (or even architectural discussion) until 0.9

Ross