There's been some recent activity on this very old thread in the newsgroups regarding displaying the help link in a portlet. Until G6, this could only be done with native code AFAIK. But, if you supress the portlet title bar, there really aren't many places where you can put native code in a portlet.
Enter G6 and the extensible taglib support, a quiet little feature that (without any fanfare or marketing by BID) has seriously changed my life.
The source speaks for itself. It look 15 minutes to write. (Granted, I already had my ALUI development environment all set up.)
HelpURL.java:
package com.bdgportal.alui.taglibs;import com.plumtree.openfoundation.util.*;
import com.plumtree.portaluiinfrastructure.tags.*;
import com.plumtree.portaluiinfrastructure.tags.metadata.*;
import com.plumtree.server.*;
import com.plumtree.xpshared.htmlelements.*;public class HelpURL extends ATag {
public static final ITagMetaData TAG;
public static final RequiredTagAttribute PORTLET_ID;
public static final RequiredTagAttribute ID;
public static final OptionalTagAttribute SCOPE;static
{
TAG = new TagMetaData("helpurl",
"Puts the help URL for this portlet into the variable specified by the ID attribute.");PORTLET_ID = new RequiredTagAttribute("portletid",
"The portlet ID.",
AttributeType.INT);ID = new RequiredTagAttribute("id",
"The name of the variable in which the help link should be stored.",
AttributeType.STRING);SCOPE = new OptionalTagAttribute("scope",
"The scope used to store the the help link.",
AttributeType.STRING, Scope.PORTLET_REQUEST.toString());
}public HTMLElement DisplayTag() {
((IXPList)GetState().GetSharedVariable(GetTagAttributeAsString(ID),
Scope.GetScope(GetTagAttributeAsString(SCOPE)))).Add(
((IPTWebService)((IPTSession)GetEnvironment().GetUserSession()).GetWebServices()
.Open(((IPTGadget)((IPTSession)GetEnvironment().GetUserSession()).GetGadgets()
.Open(GetTagAttributeAsInt(PORTLET_ID), false)).GetWebServiceID(), false))
.GetProviderInfo().ReadAsString("PTC_HTTPGADGET_HELPURL"));
return null;
}public ATag Create() {
return new HelpURL();
}
}
To deploy this code, see the excellent section on edocs about creating custom Adaptive Tags.
To use this code in a portlet, do the following.
myportlet.htm:
<span xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'>
<pt:mytaglibns.helpurl pt:portletid="234" pt:id="helplink"/>
<pt:core.html pt:tag="a" href="$helplink">Help</pt:core.html>
</span>
I didn't test this, so YMMV. Have fun!
Comments
Comments are listed in date ascending order (oldest first)
- That's slick, Chris - that'll be handy for porting between devstageprod where objectids may be different :)
- Hi, This code makes ten database requests just to get the the IPTWebService object for given portlet. Is there any better way to do this?