[albatross-users] Access to current/other page objects/modules
Gregory Bond
gnb at itga.com.au
Fri Jan 17 14:34:28 EST 2003
I'm trying to work out a way to do semi-automated navigation. I'm using a
file-based session and page classes, tho something portable to page modules
wouldn't hurt.
The actual navigation I can do with a page base class, and a nav_to[] class
variable for each page class that the base class page_process() can look at.
But I can't work out a way to generate a nav bar HTML automatically. Ideally,
I'd like each page class to have a description, which might depend on the
current local context / session, and then have a single tag/function/macro/
something that can be called from a template and can:
- find the class object for the current page
- for each of the class objects mentioned in the nav_to[] member:
- find the class object for this destination page
- find the description of this destination page after possibly
substituing stuff from the current session with al-value etc
- Generate a <al-a> tag with the appropriate description.
So given something like:
class Start(PageBase):
name='start'
nav_desc='Start Again'
#...
class HomeAddress(PageBase):
name='homeaddr'
nav_to=['start', 'workaddr']
nav_desc = 'Update Home Address for <al-value expr="client">'
#...
class WorkAddress(PageBase):
name='workaddr'
nav_to=['start', 'homeaddr']
nav_desc = 'Update Work Address for <al-value expr="client">'
then I could from homeaddr.html call a macro / custom tag that would produce
<al-a href="?start=1">Start Again</al-a>
<al-a href="?workaddr=1">Update Work Address for BOND</al-a>
But I can't work out a way of doing this that has access to all the pieces
needed.... which (afaict) amounts to
- the current session (for substituting into descriptions)
- the current page class object ("self" in page_display())
- the list of page objects (hidden inside the current application object?)
and is callable from the middle of a HTML template.
Any ideas?
More information about the Albatross-users
mailing list