Pagelet and Portlet Development: Adaptive Pagelets

Adaptive Tags: Standard Tags and Links

Adaptive Tags can be used to build links to a variety of ALI portal resources. The simplest link tags provide access to useful URLs, including the portal Image Service, current stylesheet, and return URL. You can also use tags to create links to specific portal objects, the portal login page, or to specific portlets. Adaptive Tags also allow you to build gatewayed URLs, disable URL transformation, and enable Hosted Display Mode for gatewayed pages.

Note: The transformer copies any attributes not in the PT namespace to the output link tag (see the code samples that follow for examples). These links are platform and version independent, and they do not rely on particular ASP/JSP files or query string arguments.

Useful URLs

You can use tags to access some of the most useful URLs: the stylesheet, Image Service, and the correct return URL for the current user. These tags can be used in ALI portal and Ensemble.

Image Service URL

The pt://images URL replacement marker is replaced with the URL to the Image Service in both ALI portal and Ensemble.

<img src="pt://images/plumtree/portal/public/img/icon_help.gif">

Return To Portal URL

The pt://return URL replacement marker is replaced with a URL that returns users to the page from which they came in both ALI portal and Ensemble (i.e., the page on which the pagelet that launched the page is hosted).

<a href="pt://return">Back</a>

Stylesheet URL

The pt://styles URL replacement marker is replaced with the stylesheet URL in hosted pages and pagelets in both ALI portal and Ensemble.

<link type="text/css" href="pt://styles" rel="StyleSheet"></link>

The pt:standard.stylesheets tag allows you to enter the current portal stylesheet in the HEAD of any non-hosted gatewayed HTML page. (In previous versions, this tag was implemented as pt:styleSheets. This syntax is still supported.) This tag is only supported in the ALI portal.

<HTML>
  <HEAD>
     <pt:standard.stylesheets xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/>
     ...
   </HEAD>
<BODY>
 ...
</BODY>
</HTML>

For details on portal styles, see Modifying Portal Style Sheets.

Portal Object Links

The pt:standard.openerlink tag creates a link that can open or view an object or properties of an object that already exists within the portal. You can also create gatewayed links to remote resources; see Gatewayed URLs. For example, the code below is transformed into a link that brings users to a specific page within a Community. (In previous versions, this tag was implemented as pt:openerlink. This syntax is still supported.) This tag is only supported in the ALI portal.

<pt:standard.openerlink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:objectid='219' pt:classid='514' pt:mode='2' target='myWindow' onclick=window.top.open('','myWindow','height=800,width=700,status=no,toolbar=no,menubar=no, location=no');>view community page</pt:standard.openerlink>

You can use this tag for a variety of purposes, for example:

The pt:standard.openerlink tag is primarily controlled by three attributes:

Object Type

Class ID

Mode/Behavior

1 = Open

2 = View

3 =ViewMeta

Administrative Folder

20

Edit

View contents

View properties

Authentication Source

3

Edit

-

View properties

Community

512

Edit

Preview Community

View properties

Community Page

514

Edit

Preview Community

View properties

Community Template

54

Edit

-

View properties

Content Crawler

38

Edit

-

View properties

Content Source

35

Edit

-

View properties

Directory Link

18

Edit

-

View properties

Directory Folder

17

Edit

View contents

View properties

Content Type

37

Edit

-

View properties

External Operation

58

Edit

-

View properties

Federated Search

46

Edit

-

View properties

Filter

32

Edit

-

View properties

Invitation

44

Edit

-

View properties

Job

256

Edit

-

View properties

Page Template

56

Edit

-

View properties

Portlet

43

Edit

Preview Portlet

View properties

Portlet Bundle

55

Edit

-

View properties

Portlet Template

61

Edit

-

View properties

Profile Source

7

Edit

-

View properties

Property

36

Edit

-

-

Remote Server

48

Edit

-

View properties

Site Map Folder

515

Edit

-

View properties

Smart Sort

42

Edit

-

View properties

Snapshot Query

33

Edit

-

View properties

Experience Definition

8

Edit

-

View properties

User

1

Edit

View User Profile

View properties

User Group

2

Edit

-

View properties

Web Service

47

Edit

-

View properties

IMPORTANT: If you open an object in Edit mode from a gatewayed page, clicking Finish or Cancel will close the window. In this case, you should use a popup window. However, when you open an object in Edit mode from a non-gatewayed page (My Page or Community Page), clicking Finish or Cancel will redirect to the return URI within the same window. In this case, using a popup window might not be necessary. Always test your code in the portal to make sure it functions as expected.

If you want a link to open in a popup, you must add attributes to the link to control the popup window. The following example opens a Community page in a separate window. All attributes that are not in the PT namespace are passed through to the transformed link.

<pt:standard.openerlink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:objectid='1' pt:classid='512' pt:mode='2' target='myWindow' onclick=window.top.open ('','myWindow','height=800,width=700,status=no,toolbar=no,menubar=no,
location=no');>Check out my Community.</pt:standard.openerlink>

This code results in the following link:

<a href="/server.pt?..." target='myWindow' onclick=window.top.open
('','myWindow','height=800,width=700,status=no,toolbar=no,menubar=no,
location=no');>Check out my Community.</a>

You can also link to a specific page within a Community, as shown in the example below.

<pt:standard.openerlink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:objectid='219' pt:classid='514' pt:mode='2' target='myWindow' onclick=window.top.open('','myWindow','height=800,width=700,status=no,toolbar=no,menubar=no, location=no');>view community page</pt:standard.openerlink>

The Company Store uses pt:standard.openerlink to dynamically create a link to the main store page. In this case, the link is not a popup.

lblVisitCompanyStore.Text = "<pt:standard.openerlink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:objectid='" & _ lAdminPrefCommID & "' pt:classid='512' pt:mode='2'>" & LocRM.GetString("txtLabelVisitCompanyStore") & _ "</pt:openerlink>"

Any time a user's name is displayed on a page, it should be rendered as a clickable link to the user’s profile page. The pt:standard.openerlink tag allows you to create links on demand using the User ID.

<pt:standard.openerlink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:objectid='1' pt:classid='1' pt:mode='2' target='myWindow' onclick=window.top.open ('','myWindow','height=800,width=700,status=no,toolbar=no,menubar=no,
location=no');>Admin Bob</pt:standard.openerlink>

This code is replaced with a link of the following form:

http://portal.plumtree.com/portal/server.pt?space=CommunityPage&parentname=PortalSettings&parentid=1&in_hi_userid=1&control=SetCommunity&CommunityID=2&PageID=0 target='myWindow' onclick=window.top.open ('','myWindow','height=800,width=700,status=no,
toolbar=no,menubar=no,location=no');>Admin Bob</a>

Login Link

The pt:standard.loginlink tag creates a link to the portal login page. It is a best practice to include this link when the user accessing the page is a guest. For details on determining if the user is a guest, see Portlet Basics. (In previous versions, this tag was implemented as pt:loginLink. This syntax is still supported.) This tag is only supported in the ALI portal.

<pt:standard.loginlink xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'>Log in
</pt:standard.loginlink>

This code is replaced with a link of the following form:

<a href="http://portal.plumtree.com/portal/server.pt?space=Login&parentname= MyPage&parentid=9&in_hi_userid=1&control=Login">Log in</a>

The UI Tags library provides access to additional login form components.

Gatewayed URLs

The pt:standard.gatewaylink tag allows you to build gatewayed links to remote pages. Using attributes, you can include references to associated portal objects, usually a portlet or community. When the link is executed, the portal sends any preferences associated with the referenced object to the remote server. This tag is only supported in the ALI portal.

The pt:standard.gatewaylink tag supports the following attributes:

For example, the code below creates a link to a remote page associated with the portlet with ID 201.

<pt:standard.gatewaylink class="myStyle" xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/' pt:objectid='201' pt:href="doStuff.aspx?ID=5">Click here</pt:standard.gatewaylink>

The arguments in the resulting URL tell the portal to send the preferences associated with the portlet to the remote server. The code is replaced with a link of the following form:

<a href="http://portal.plumtree.com/portal/server.pt/gateway/PTARGS_0_0_201_0_0_43/ doStuff.aspx?ID=5" class="myStyle">Click here</a>

The code below creates a link to a page associated with the Web Service with ID 200, and also sends the Community preferences from the Community with ID 301 to the remote server.

<pt:standard.gatewaylink pt:href="http://myRemoteServer/myTestPage.jsp" pt:objectid="200" 
pt:classid="47" pt:communityid="301" xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/>
Click here</pt:standard.gatewaylink>

You can use the pt:standard.gatewayLink tag to gateway documents that have not been crawled or uploaded to the portal using the ID for the associated WWW Content Source, as shown in the code below.

<pt:standard.gatewaylink pt:href="http://myRemoteServer/mydocs/WhitePaper2002.doc" 
pt:objectid="202" pt:classid="35" xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/>
WhitePaper2002</pt:standard.gatewaylink>

You can also use the pt:common.url tag to transform URLs that should be gatewayed.

Hosted Display Mode

A special header tells the Portal Server when a page should be displayed in the style of the portal, with a portal banner. Hosted Display Mode ensures that your click-through pages look like an integral part of every user’s portal. It is easy to set this header using the pt:standard.displaymode tag. This tag is only supported in the ALI portal.

The tag can also set the title and subtitle of the page. The displaymode tag does not display any contents, and should only be used as a singleton.

<pt:standard.displaymode pt:mode="Hosted" pt:title="My title" pt:subtitle="My subtitle" xmlns:pt='http://www.plumtree.com/xmlschemas/ptui/'/>

Pages in Hosted Display Mode should not include <HTML>, <HEAD>, <META>, <TITLE> or <BODY> tags. The portal wraps the existing code in a Web page that includes the portal banner and the appropriate style sheet reference, so that the page appears in the style of the portal in which the service is implemented. Additional tags could confuse some browsers.

Small popup windows should not use Hosted Display Mode, but they can still take advantage of portal styles by accessing the user’s style sheet as described on the Using Adaptive Tags: Links page.

For a full list of tags and attributes, see the TagDocs.