The OGo portal has an own navigation system ...
Overview
TODO: write something ...
Interaction with browser back button
TODO: write something, explain direct actions, component actions, etc
Objective-C API
The navigation object is implemented in the OGoNavigation class
which is part of WebUI/OGoFoundation. To get hold of the
navigation object, do this:
OGoNavigation *navi = [[self session] navigation];
or in .wod templates:
closeAction = session.navigation.leavePage;
Methods
Note that you should only add objects conforming to the OGoContentPage
protocol as pages in the navigation.
- (id)activePage;
- (NSArray *)pageStack;
- (BOOL)containsPages;
- (void)enterPage:(id)_page;
- (id)leavePage;
Navigation in Components
Some component classes (eg OGoEditorPage's) have some additional methods
for navigation, like saveAndGoBackWithCount:. TODO...
Traps
The -leavePage method ensures that at least one page is on the page stack,
so this code will lead to an infinite loop (also known as OGo bug #680 ;-):
nav = [[self session] navigation];
while ([nav containsPages])
[nav leavePage];
[nav enterPage:page];
The intention of this code to clean the navigation and then push a single
page.
Navigation Labels
The linklist generated by the SkyNavigation component contains a page specific
label, like:
News / Preferences (helge)
The content of the page stack navigation links is retrieved using the
label attribute of the respective page. Since most (all?) pages which
end up in the navigation are subclasses of the OGoContentPage class,
they usually inherit the label method of that class.
The default implementation of OGoContentPage resolves the name
of the page component (eg LSWPreferencesViewer) using the labels
localization dispatcher. In short: the name of the page must be mapped to a
readable name in the bundles string file, everything else is automagic.
Subclasses of OGoViewerPage or OGoEditorPage get
additional support for the object being edited. They (currently) first render the
localized component name and then the "title" of the object being edited.
The object title is retrieved using the objectLabel method which
can be overridden by a subclass. The default implementation uses the
labelForObject: method of the OGoSession to get a title of an object.
To find the object being edited or viewed, the -object method is used.
Finally, labels are automagically truncated. The length can be configured per user using the SkyMaxNavLabelLength default.