You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@roller.apache.org by Fredrik Jonson <fr...@myrealbox.com> on 2007/10/12 20:12:57 UTC

Proper way to make custom modules available in themes?

Hi,

I need to add a small homegrown module for custom user polls to roller,
so that it is available in the velocity templates of my themes. I've 
looked  around but haven't found any hint on how to achieve that.

I guess I could write and add a servlet filter that instantiates my
object and publishes it in the user's session. But I'm hoping there is
a better, ie more proper way?

I'm developing on the roller 4.0 release candidate, btw.

-- 
Fredrik Jonson


Re: Proper way to make custom modules available in themes?

Posted by Dave <sn...@gmail.com>.
On 10/16/07, Guy Katz <gk...@allot.com> wrote:
> Also;
> What method should I invoke on the cache manager for maximum
> performance?
> Must I invalidate everything? (there are many methods for invalidation
> of folders, users, comments, etc...) I just want to invalidate enough to
> have my model displayed properly.

If possible, limit your invalidation to a specific weblog, i.e.
CacheManager.invalidate(weblog);

- Dave

RE: Proper way to make custom modules available in themes?

Posted by Guy Katz <gk...@allot.com>.
Also;
What method should I invoke on the cache manager for maximum
performance?
Must I invalidate everything? (there are many methods for invalidation
of folders, users, comments, etc...) I just want to invalidate enough to
have my model displayed properly.
Thanks in advance.

-----Original Message-----
From: Dave [mailto:snoopdave@gmail.com] 
Sent: Tuesday, October 16, 2007 4:05 AM
To: user@roller.apache.org
Subject: Re: Proper way to make custom modules available in themes?

On 10/12/07, Fredrik Jonson <fr...@myrealbox.com> wrote:
> I need to add a small homegrown module for custom user polls to
roller,
> so that it is available in the velocity templates of my themes. I've
> looked  around but haven't found any hint on how to achieve that.
>
> I guess I could write and add a servlet filter that instantiates my
> object and publishes it in the user's session. But I'm hoping there is
> a better, ie more proper way?
>
> I'm developing on the roller 4.0 release candidate, btw.

Hi Fredrik,

To make your own object available in Roller scripts here's what you do:

1) Have your object implement the Roller interface "PageModel"

2) In your roller-custom.properties file, override these properties.
For each, you'll have to replicate the original list of classnames
*and* add your new model.
   rendering.siteModels=
   rendering.pageModels=
   rendering.searchModels=
   rendering.previewModels=

If you just want your object to be available in the aggregated
front-page blog and nowhere else, then add it only to the
rendering.siteModels property.

There is an example model plugin at the following link, but it has not
bee updated for the Roller 4.0 classnames: http://tinyurl.com/3bx8q6

- Dave

Re: Proper way to make custom modules available in themes?

Posted by Dave <sn...@gmail.com>.
On 10/12/07, Fredrik Jonson <fr...@myrealbox.com> wrote:
> I need to add a small homegrown module for custom user polls to roller,
> so that it is available in the velocity templates of my themes. I've
> looked  around but haven't found any hint on how to achieve that.
>
> I guess I could write and add a servlet filter that instantiates my
> object and publishes it in the user's session. But I'm hoping there is
> a better, ie more proper way?
>
> I'm developing on the roller 4.0 release candidate, btw.

Hi Fredrik,

To make your own object available in Roller scripts here's what you do:

1) Have your object implement the Roller interface "PageModel"

2) In your roller-custom.properties file, override these properties.
For each, you'll have to replicate the original list of classnames
*and* add your new model.
   rendering.siteModels=
   rendering.pageModels=
   rendering.searchModels=
   rendering.previewModels=

If you just want your object to be available in the aggregated
front-page blog and nowhere else, then add it only to the
rendering.siteModels property.

There is an example model plugin at the following link, but it has not
bee updated for the Roller 4.0 classnames: http://tinyurl.com/3bx8q6

- Dave