Automatic Generation of Menus
Andreas Hartmann <[email protected]> Thu, 06 Mar 2003 20:30:49 +0100
| Newsgroups | gmane.comp.cms.wyona.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Lenya developers,
today Felix and I discussed how the cryptic menu XSPs could
be replaced by a cleaner solution. Once we have a workflow
engine, we can probably integrate the menu generation in the
workflow management (see below). Until then, we have to find
an easier solution.
-------------------------------------------------------------
WITHOUT WORKFLOW
-------------------------------------------------------------
Our first idea looked like follows:
- Menu items contain:
- a label
- a link that can contain parameters for tasks or for the
scheduler
- There is a default menu that is used by every page type.
- For every page type it is possible to
- add menu items
- remove menu items
- override menu items
- The menu generation pipeline
- looks if there is a specific menu overriding the default one
- if no, it takes the default menu
- if yes, it combines the default and the specific menu using
aggregation and merges them using a stylesheet
- When the default menu is loaded, a stylesheet creates default
menu items based on page parameters (URI, ...).
The default menu could look like:
<menu>
<item id="edit-bitflux">Edit with Bitflux</item>
<item id="edit-xopus">Edit with Xopus</item>
<item id="publish">Publish</item>
<item id="schedule">Schedule</item>
</menu>
The overriding menu could look like:
<menu>
<!-- keep editing items untouched -->
<!-- override publish item -->
<item id="publish">
<href>publish.html?page=<xsp:expr>headlinesUri</xsp:expr></href>
Publish Article
</item>
<!-- remove schedule item -->
<item id="schedule" show="false"/>
<!-- add newsletter item -->
<item id="newsletter">
<href>newsletter.html?page=<xsp:expr>...</xsp:expr></href>
Send Newsletter
</item>
</menu>
This is just a first idea.
-------------------------------------------------------------
WITH WORKFLOW
-------------------------------------------------------------
I attached a PDF showing an analysis diagram for the connection
between workflow and menus:
- A page can contain 0..* documents.
- The page asks the workflow engine for the transitions
that can fire for each document.
- For each transition, a menu item is created:
Document documents[] = page.getDocuments();
foreach document in documents {
Transition transitions[]
= Workflow.getNextTransitions(document);
foreach transition in transitions {
String eventLabel = transition.getEvent().getLabel();
String doctypeLabel = document.getType().getLabel();
addMenuItem(eventLabel + " " + doctypeLabel, ...);
// "Publish Article"
}
}
The menu item link must contain
- a reference to the document to manipulate
- the event (i.e. the transition to invoke)
Of course, there can also be menu items that are not
connected to the workflow.
But I don't know if this mechanism is powerful enough.
What do you think?
Andreas
workflow1.pdf
(application/pdf, 26.8 KB) - not displayed