I finally found some airport/travel time to work on the Wookie
integration again. I'm almost there, but not quite.
I need to be able to get at the user from w3CWidgetRenderer.render(RegionWidget)
public String render(RegionWidget item) {
Widget widget = item.getWidget();
if(!WIDGET_TYPE.equals(widget.getType())) {
throw new NotSupportedException("Invalid widget type
passed to renderer: " + widget.getType());
}
// FIXME: got to find the user and context
// the user is held in the page object, do we have a refernece
to it from here?
Widget contextualizedWidget = widgetService.getWidget(null,
null, widget);
String url = contextualizedWidget == null ? null :
contextualizedWidget.getUrl();
return String.format(IFRAME_MARKUP, WIDGET_TYPE, item.getId(), url);
}
As the comment indicates the user is stored in the page object:
Page -> Regions -> RegionWidget
The Page object is available in the JSP and I could pass in the user from there:
<portal:render-widget regionWidget="${regionWidget}"
user="${${defaultPage.owner.id}}"/>
Another option is to change the unidirectional one-to-many mapping of
Region -> RegionWidgets and Page -> RegionWidgets to biderectional
mappings.
A third option would be... (that's a question ;-)
Ross
--
Ross Gardler (@rgardler)
Programme Leader (Open Development)
OpenDirective http://opendirective.com