Janne Jalkanen wrote:
I'm writing a Plugin/Filter using for example the preTranslate hook. It looks to me like this method is called for each of the content panels: LeftMenu, top, main and bottom seperately. I only want to do filter-operations on the main-content. Can anyone tell me, how to find out (from the WikiContext-object??) which panel currently is processed by a preTranslate-call.

A suitable combination of getPage() & getRealPage() calls should do
the trick...

getRealPage() should always return you the main content page.  Of
course, you'll still get called many times, so it's probably a good
idea to check whether getPage() and getRealPage() are equal so you
know you are rendering the main content pane.

You can also check out the existing FormPlugin, which uses a separate
Handler to receive the form post, or the CeryleWikiPlugin FormPlugin,
which does everything from within the one plugin. The latter was a bit
tricky since it has to be aware of the various modes during a page
lifecycle. It's not straightforward (you'll likely have to fiddle with
it a lot), but you might find some clues there as to how to perform the
processing you want during the PreTranslate phase.

   JSPWiki WikiForms
   http://www.jspwiki.org/wiki/WikiFormsPlugin

   CeryleWikiPlugins FormPlugin
   http://www.altheim.com/ceryle/wiki/Wiki.jsp?page=FormPlugin

It's also possible to use a WikiEventListener to receive events
indicating the PreTranslate phase, adding a filter within the
listener for page name, etc.

Murray

...........................................................................
Murray Altheim <murray07 at altheim.com>                           ===  = =
http://www.altheim.com/murray/                                     = =  ===
SGML Grease Monkey, Banjo Player, Wantanabe Zen Monk               = =  = =

      Boundless wind and moon - the eye within eyes,
      Inexhaustible heaven and earth - the light beyond light,
      The willow dark, the flower bright - ten thousand houses,
      Knock at any door - there's one who will respond.
                                      -- The Blue Cliff Record

Reply via email to