This tutorial demonstrates the use of the Flash tree and how it can be used to create a document library using the included contentdb database. The contentdb database is the same database used by the Content Explorer applet portlet. This tutorial uses the sample data that is already in the sampledb. In addition to the Flash tree, this tutorial covers creating a document display portlet that you can use to display the documents listed in the database.
A click across event is generated when a user double clicks on a tree element that contains a URL in the database. The click across event contains the URL of the document to display and when the Document Display portlet receives the event, it displays the URL that is included with the event.
Creating the XML for the portlet
There is a sample JSP file that reads from the contentdb located in <WEBAPPS>\onepage\portlets\flash\tree\SampleTree.jsp where <WEBAPPS> is the web portlets folder of the server.
In Web Studio, click the Portlets menu item on the far left menu.
In the right-hand frame click the New button to open the Portlet Builder window
In the Portlet Builder window, click the downward arrow button to the right of the Add button.
In the menu that displays, select XML Element to open the XML Element Definition window.
In the Element Definition window, in the XML URL field, enter:
http://<HOST>:<PORT>/onepage/portlets/flash/tree/SampleTree.jsp
Where <HOST> is the host name of the machine where Enterprise Portal is installed and <PORT> is the port number EP runs on. Click Preview to test the URL
A message displays saying, “There is no HTML display for this element.” This is not an error. Click Next.
Enter documents
for
the element the name, and click Next.
In the Continuous Capture window, click Finish to close the window and return to the Portlet Builder
In the Portlet Builder, click Template.
In the Find Template window, from the Type drop-down list, select JSP. Click Search.
On the right hand side a list of JSP templates displays. Highlight the FlashTree listing by clicking on it once, then click Select.
The Find Template window closes and the portlet preview in the Portlet Builder is replaced with the Flash tree
Once the template loads you see a message that says “Missing XML Data.” You can fully view the Flash tree from Web Studio or by deploying it to the Portal Interface. The Flash tree cannot be previewed from within the Portlet Builder.
Save the portlet:
Click Save, and in the windows that displays, enter:
Portlet Name – Documents tree
Version – select Off.
Click Add All to add all the roles to the portlet.
Click Finish.
Click Close to close the Portlet Builder.
Back in Web Studio the new portlet appears under the New category on the Status menu. Right-click the Documents tree portlet and select Preview.
A fully working preview of the portlet will appear in a new window
Creating the document display portlet
There is a sample document display JSP file located in <WEBAPPS>\onepage\portlets\jsp\documentdisplay_popup.jsp where <WEBAPPS> is the Web applications folder of the server.
There is also an alternative JSP file named documentdisplay.jsp in this directory. The only difference between documentdisplay_popup.jsp and documentdisplay.jsp is that documentdisplay_popup.jsp has a text link that allows users to open the document in a new browser window after it has been loaded into the portlet.
In Web Studio, click the Portlets menu on the far left menu.
In the right hand frame, click New to open the Portlet Builder window. Click the downward arrow button to the right of Add.
In the menu that displays, select JSP Element to open the JSP Element Definition window.
Select Use Web Application, and enter:
WAR file – onepage.war
Web App Display Name – onepage
Initial Resource – /portlets/jsp/documentdisplay_popup.jsp
Input Parameters – url=/onepage/home/docapps/framework/blank-domain.html
The value entered into the Input Parameters creates a CGI parameter named “url” in this portlet. The parameter URL can be set to any URL you want in order to change the document that is first displayed. You can specify full URLs like this:
url=http://www.sybase.com
Click Preview to preview the document display page.
Click Next.
In Element Name, enter document display
,
and click Finish to close the window and return to the Portlet Builder.
Save the portlet:
Click Save, and in the windows that displays, enter:
Portlet Name – Documents Display
Version – select Off.
Click Add All to add all the roles to the portlet.
Click Finish.
Click Close.
Back in Web Studio the new portlet appears under the New category on the Status menu. Right-click on the Document Display portlet and select Define Listeners.
In the Define Click Across Listeners window, enter DocURLEvent
.
This is the default event name in the tree.jsp template.
Verify the Listener Param drop-down list is set to “url,” the parameter that will receive the click across event data.
Check the Auto Submit checkbox so it is on. When this is on it means the portlet will refresh itself right away after an event is received
Click the plus sign icon on the far right to add the event-parameter association, then click OK.
In Web Studio the new portlet appears under the New category on the Status menu. Right-click the Document Display portlet, and select Approval Status | Approved.
See the Enterprise Portal Developer’s Guide for information about adding the portlet to a page, a page group, and view.
Copyright © 2004. Sybase Inc. All rights reserved. |
![]() |