Portlet Development Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Adding the Content Presenter Portlet

The Content Presenter portlet allows users to retrieve and display different kinds of content in a portal in real time, without assistance from your IT Department or software developers. For example, you might want to display a list of the most recent Press Releases so users can browse them and click one to read the entire Press Release. You can place images (a photograph or a chart, for example) or add textual content on a portal page. You can also segregate content by subject matter to target different audiences.

In the Content Presenter Example, you can perform inline editing to quickly change the content that displays in the portlet.

Tip: The Content Presenter portlet works only with streamed portals.

This chapter includes these sections:

 


Using the Content Presenter Example

WebLogic Portal includes a Content Presenter Example, and allows you to perform inline editing on a Content Presenter portlet to modify the portlet’s content. Editing the portlet’s content also changes the content in the content repository. The Example’s Content Presenter portlet uses the public Dojo rich text editor.

This section contains the following topics:

Starting the Content Presenter Example

Note: You must install the Portal Examples before you perform these steps. See “Installing the Sample Applications and Domain” in the WebLogic Portal Release Notes for details.

To start the Content Presenter sample:

  1. From the Windows Start Menu, start the WebLogic sample server. (You can also double-click the startWebLogic.cmd file located in the <WLPORTAL_HOME>/samples/domains/portal/bin directory.)
  2. After the server starts, from the Windows Start Menu choose Oracle Products > WebLogic Portal > Examples > Visit Portal Examples.
  3. On the WebLogic Portal Sample Domain, select Go to the Content Presenter demo. (You can also launch the Content Presenter Example in a browser at http://localhost:7041/contentpresenter/).
  4. Enter your username and password (for example, weblogic/weblogic) and click Login.

See Performing Inline Editing in the Content Presenter Example for instructions on how to perform inline edits to the content in a portlet in the Content Presenter Example.

Performing Inline Editing in the Content Presenter Example

The Content Presenter Example is the only portal where you can perform inline HTML content editing without doing additional setup tasks. By default, the Content Presenter Example lets you immediately edit the content in the Letter from the CEO Portlet, or you can enable the Training Announcement Portlet for inline editing. Inline editing in the Content Presenter Example works only on single-item portlets.

The Letter from the CEO portlet in the Content Presenter Example is already configured for inline editing because it uses the template view with inline editing enabled and has the appropriate entitlement rights. To configure the Training Announcement portlet for inline editing, seeEnabling Inline Editing for the Training Announcement Portlet.)

This section contains the following topics:

Entering Inline Edits

To enter inline edits to the Letter from the CEO portlet:

  1. Follow the steps in Starting the Content Presenter Example to start the Content Presenter Example and log in.
  2. After you log in, click Edit HTML in the Letter from the CEO portlet, as shown in Figure 10-1. The Content Presenter Configuration Wizard appears.
  3. Figure 10-1 Click the Edit HTML Button that Appears in the Text of the Portlet


    Click the Edit HTML Button that Appears in the Text of the Portlet

  4. Enter your edits or insert a link to other content or graphics outside your content management system. For example, before the signature line, type Sincerely, as shown in Figure 10-2.
  5. Figure 10-2 Enter Text in the Signature Line


    Enter Text in the Signature Line

  6. Click Save. Your changes appear in the portlet and are saved to the CM Repository.
Tip: You can perform inline editing on two portlets in the Content Presenter Example. Inline editing is not available for the Content Presenter portlets in your portal.

Enabling Inline Editing for the Training Announcement Portlet

One other portlet in the Content Presenter Example, the Training Announcement portlet, allows inline editing. Inline editing is turned off by default for this portlet, so you must first enable the inline editing capability by choosing a different content display template view.

To enable inline editing for the Training Announcement portlet:

  1. Follow the instructions in Starting the Content Presenter Example to log into the Content Presenter Example.
  2. In the Training Announcement portlet in the Content Presenter Example, click Edit in the portlet’s title bar, as shown in Figure 10-3.
  3. Figure 10-3 Click Edit to Enable Inline Editing for this Portlet


    Click Edit to Enable Inline Editing for this Portlet

  4. In the Content Presenter Configuration Wizard’s Single or Multiple Items window, click Next. (If you use the wizard to change this portlet to allow multiple content items, rather than a single item, you cannot enable inline editing. For more information on configuring the portlet, see Configuring the Content Presenter Portlet.)
  5. In the wizard’s Select Content window, click Next.
  6. In the wizard’s Select Template & View window, select Single Item View with Inline Edit and click Next.
  7. In the wizard’s Portlet Properties window, click Next.
  8. In the wizard’s Finish window, click Save. The Edit HTML button appears in the Training Announcement portlet. If you do not see the Edit Content button, you might not have the correct entitlement. See the Security Guide for instructions on setting entitlements.
  9. Click Edit HTML to change the content in the portlet or insert a link to other content or graphics outside your content management system.
  10. Click Save. Your changes are saved to the CM Repository.

Enabling Inline Editing in Your Portlets

You can use the three sample JSP files that ship with WLP to enable inline HTML editing in your own Content Presenter portlets. Inline editing does not work with library services enabled, because library services support versioning.

Edit the files in the order listed below. The files are located in the following directories:

  1. Display Template (Outer Template) – <WLPORTAL_HOME>\samples\applications\portalApp\ contentPresenterSampleWeb\samplePresenterTemplates\ inlineEditExamplePresenterTemplate.jsp
  2. CM Display Template (Inner Template) That Displays the Content – <WLPORTAL_HOME>\samples\applications\portalApp\contentPresenterSampleWeb\sampleCMTemplates\inlineEditExampleCMTemplate.jsp
  3. JSP File that Performs Other Work – <WLPORTAL_HOME>\samples\applications\portalApp\contentPresenterSampleWeb\sampleCMTemplates\saveNode.jsp

The files include detailed comments to help you customize them for your portlets. For example, you might want to replace the DOJO rich text editor with your own rich text editor. You might want to change the entitlements on the portlets or their look and feel.

 


Configuring the Content Presenter Portlet in Your Portal

The Content Presenter portlet ships with WebLogic Portal. You must configure the portlet before you can use it.

Tip: To see a sample web application built with the Content Presenter portlet, download a demo at http://wlp.bea.com.

The Content Presenter portlet uses a portlet framework that is based on Content Management, metadata, and templates that let business users step through a wizard to quickly retrieve and display content that is appropriate to the audience. The framework allows WebLogic Portal customers to easily publish content in a variety of ways to almost any site.

The Content Presenter portlet can read content from any configured content provider. Content providers can be any repository that implements the WebLogic Portal Content Management Service Provider Interface, including third-party Content Management vendor products, file systems, or other database systems.

When you plan your Content Presenter portlet, determine who will view your content and if you plan to re-use the portlet later for a different audience. Plan entitlements to determine who can choose content to display in the Content Presenter portlet. If a logged-in user has Delegated Administration rights, the user can edit the content in the Content Presenter portlet.

You must be a member of the Portal System Administrators role or the Content Presenter Administrators role to configure the Content Presenter portlet. Portal System Administrators and Content Presenter Administrators have edit and delete capabilities on the Content Presenter portlet itself, and edit capabilities on any page where the portlet is placed.

If you plan to have a group of users (for example, a subset of the Portal System Administrators role) edit the Content Presenter portlet, this subgroup must have edit and delete capabilities for the Content Presenter portlet itself and edit capabilities for the page that contains the portlet. If the group does not have edit and delete capabilities to the portlet, the group’s members will not be able to see the Edit icon in the portlet.

See the Security Guide for more information on setting entitlements and creating roles and groups. Portal System Administrators and Content Presenter Administrators can also turn a portlet off by disabling the activation flag in the portlet’s preferences in the Administration Console.

WARNING: If you add or modify your Content Presenter portlet using the Visitor Tools (rather than the Administration Console), the portlet is no longer configurable in your desktop. You should add or modify your Content Presenter portlet in the Administration Console.

If you use Portlet Publishing to configure a Content Presenter portlet, some features are not available. See Using Portlet Publishing to Expose a Content Presenter Portlet for more information.

This section contains the following topic:

Configuring the Content Presenter Portlet

The Content Presenter portlet ships with WebLogic Portal. You must add the Content Presenter facet in Workshop for WebLogic when you set up your portal web project. By default, your portal administrator has the ability to administer the Content Presenter portlet (to move portlets, turn a portlet off, and so on) in the Administration Console.

In a desktop, use the Content Presenter's Configuration Wizard to determine the content you want to display, and how to display it (through templates and template views). The Content Presenter portlet stores those choices as portlet preferences for each portlet instance.

Perform the following steps to configure the Content Presenter portlet:

  1. In Workshop for WebLogic, create and deploy a Portal EAR project, web project, a portal, and a method to authenticate users (such as a login portlet) according to the instructions in the Getting Started With WebLogic Portal tutorial. You should also create a Datasync project if you plan to use Content Selectors to display content in the Content Presenter portlet.
  2. Tip: When you create your Portal Web Project, you must select the Content Presenter Framework facet in the WebLogic Portal (Optional) directory in order to view and use the Content Presenter portlet.
  3. Start the Administration Console and choose Portal > Portal Management.
  4. Create a page and a desktop (you can choose to create a desktop from a desktop template, library resources, or a .portal file) according to the instructions in Getting Started With WebLogic Portal tutorial.
  5. Select the page you created in step 3 in the Portal Management tree in the Library/Pages directory (or wherever you saved it). Add the Content Presenter portlet to the page by clicking Add Page Contents. Click Add Contents in the appropriate column, select the check boxes next to the Content Presenter portlet and a login portlet (if that is the method you are using to authenticate users), and click Save. (If you do not see a list of portlets in the Add Books and Portlets to Placeholder page, click the drop-down box and select Portlets, and click Show all.)
  6. In the Portal Management tree, select the Portals directory, the portal you created, and your desktop.
  7. With the desktop selected, click View Desktop.
  8. In the new browser window, log into the desktop and click Open Configuration Wizard in the Content Presenter portlet. A new unconfigured Content Presenter portlet does not appear until you log in, and only if you have rights to edit it.
  9. In the Content Presenter Configuration Wizard, select one of the following in the Single or Multiple Items window:
    • Multiple Content Items – Pick more than one content item and display them. You can create a custom list of content, choose all content in a specific folder, use the results of a Content Selector, or run a search to find content. The result is a list of content items in the portlet.
    • Single Content Item – Browse or search for one item. The item can be an image, article, link to a file, link to a URL, and so on. The result is the content item displaying inline in the portlet.
    • See Figure 10-4. Click Next after you select an option.

      Figure 10-4 Determine How Much Content You Want to Display


      Determine How Much Content You Want to Display

  10. The choice you made in step 8 in this section determines which wizard pages you see and what you choose next.
    1. If you chose Single Content Item in step 8, you can select Browse in the wizard’s Select Content window to navigate through the repository tree to locate content, select the item, and click Next.
    2. You can also select Search to find content by keyword or content type. (If you have multiple content repositories configured, you can also search by repository.) By default, all content types are listed in the Content Type field. If you want to control which content types appear in the Content Type field, you can set entitlements by user. In order to have these entitlements by user evaluated, override the com.bea.content.ui.framework.AllowObjectClassViewRights context parameter in the web.xml file. If you change the setting to false, the entitlements set on the content types determine the content types that are listed in the Content Type field. If you change the setting to true, or you omit the context parameter altogether, all content types appear for all users.

      See the Security Guide for instructions on setting up users and roles in the Administration Console, and adding view capabilities so users can see the object classes in the Content Type field. Click Update Search Results to view the results. Adjust the Items per Page field to determine how many search results to display in the wizard. Select an item; see Figure 10-6. Click Next.

      Figure 10-5 Narrow Your Search with a Keyword


      Narrow Your Search with a Keyword

    3. If you chose Multiple Content Items in step 8 of this section, select one of the following in the wizard’s Select Content window to specify your content items:
    • Custom List of Specific Content Items – This type of content retrieval is not a live search; it displays content from a list that you create. Click Browse for Content Items to navigate through the repository tree to locate content.
    • You can also click Search for Content Items, enter a keyword, and click Update Search Results to retrieve content by keyword. If you have multiple content repositories configured, you can also search within a specific repository. To search your repository, you must configure it and make it searchable. The repository that ships with a WebLogic Portal for a new domain is not automatically indexed for searching. See the Content Management Guide for instructions on indexing your repository.

      Figure 10-6 shows that after you retrieve multiple items and click Browse for Content Items, you can select an item and click Add Item to List. The custom list lets you control the order in which the content displays by selecting the check box next to the item and clicking Move Up or Move Down. Moving content to the top of the list ensures that a certain content item displays first. See Figure 10-7.

      Figure 10-6 Custom List of Specific Content Items


      Custom List of Specific Content Items

      You can also verify that you selected the correct content by clicking View Content to preview the content you selected. The actual content and other details appear in a separate window. If you selected an image, the image also appears. You can also click Edit Content to change the property values of the item. If the item is a binary file, you can download the item, upload new values, or change the property values.

      After you determine the order of the content, click Next.

    • Results of a Search Query – Locate content by entering a keyword or selecting a content type (such as an image or a book) and clicking Preview Query Results. You can enter multiple keywords (separated by a space) and the or connector is assumed. For example, if you search for IRA retirement, results will include the keyword IRA or retirement. If you have multiple content repositories configured and you are entitled to view them, you can also search by repository.
    • You can click Advanced Search Query Options to create a query filter or a sort filter. Clicking Create New Query Filter applies a filter to your query, such as property name, an operator, and a value to narrow down your search results. For example, you can search for content created after 1/1/07 by selecting the Creation Date property, selecting After, and then entering a date. Click Add Filter and the new filter appears in the Query Filters section, as shown in Figure 10-7.

      Tip: The Similar operator retrieves results that contain words that are similar to the keyword (for example, the word might be misspelled).

      You can click Create New Sort Filter to determine how to display the search results. For example, you can display the most recently-modified content by selecting the Last Modified Date property, selecting Descending, and clicking Add Sort Filter. The new sort filter appears in the Sort Filters section. See Figure 10-7 to see how you can display the most recently-modified content first (descending order). You can change the order in which the results are sorted by clicking the up or down arrow to move the items in the sort filter up or down in the list (from ascending to descending, for example.)

      Figure 10-7 Query Filter and Sort Filter


      Query Filter and Sort Filter

      Click Preview Query Results to view the results of the search query. The search query searches both property values and binary content. Adjust the Items per page field to determine how many search results to display in the wizard (it does not affect the final display). Each time someone visits the Content Presenter portlet, the search is re-run. Since content in the repository can change, the results might be different the next time the portlet renders. Click Next.

      Tip: Running a search query is more resource intensive than retrieving content from a specific node or retrieving the contents of a specific folder. When possible, try to retrieve specific content, rather than running a search.
    • Contents of a Folder – Navigate through the repository tree to locate a content folder, click Select this Item, and click Next. Each time a user views this portlet, the most current content items in the selected folder are retrieved. Any content can behave like a folder; therefore, you can select any child items under that content.
    • Results of a Content Selector – Select a Content Selector that you created in WebLogic for Workshop, and click Select this Item. Content Selectors use rules to target specific groups of people with content items from the WLP Virtual Content Repository. See the Interaction Management Guide for more information. Each time the portlet renders, the most current Content Selectors are retrieved. Click Next after you locate the Content Selector you want to display.
  11. In the wizard’s Select Template & View window, select an item from the Template Category field, and then select a template. A template category helps you organize your templates and template views. You can have as many template categories as you need, but you should plan your organization strategy early, so that you do not have to update the preference values of existing Content Presenter portlet instances. A template is similar to a folder and is used to organize content. The default template that appears is based on the single or multiple content choice you made in step 8 in this section.
  12. WebLogic Portal ships with the following two default templates:

    • Default Single Item Template – Lets you view a single item and a single property. See Figure 10-8. This template appears because you chose Single Content Item in step 8.
    • Default Multiple Items Template – Lets you view multiple items and properties in a bulleted list. This template appears because you chose Multiple Content Items in step 8.
    • You should create your own custom template based on the content you want to display. The custom templates you create appear in the wizard. See the Content Management Guide for instructions on creating custom templates and views.

      Select an item in the Template Views field. A template view controls the layout and formatting of the content in the portlet. For example, you might create a template for your company’s Press Releases. You could then create several custom template views that display the content in the following ways: a summary of the Press Release, the full text of the press release, details of the Press Release, and so on.

      If you chose the Default Single Item Template in step 10 in this section (which displays a single piece of content), or a custom template that you created that does not contain views, select Default Single Item View for the template view. If you chose the Default Multiple Items Template in step 10 in this section, select Default Multiple Items View for the template view. If you created a custom template view as described in the Content Management Guide, that template view also appears here.

      For templates or views that support pagination of multiple content items, set the Items per Page value to the maximum number of items you want to display at one time on the template. With the appropriate pagination JSP tags on the template or view, users can navigate large numbers of items while viewing only a manageable few.

      Note: You can customize how templates and views paginate in the Content Presenter Configuration Wizard. For more information on the pagination tags, see the CM JSP Tag Javadoc.

      Click Next after you select a template and view. See Figure 10-8.

      Figure 10-8 Select a Template and View


      Select a Template and View

  13. In the wizard’s Title & Theme window, enter a title (which appears as the portlet’s title in the titlebar and the Administration Console) and description for the portlet. Select a theme from the Portlet Theme field and click Next. See Figure 10-9. The borderless theme presents your content with no background or border, so the content looks as if it is inline. If you choose the borderless theme, the Edit icon (discussed in step 12) appears only when you mouse over the top of the portlet.
  14. Figure 10-9 Enter a Description for the Portlet and Pick a Theme


    Enter a Description for the Portlet and Pick a Theme

  15. In the portlet’s Preview & Save window, you can click View Content or Edit Content. Click Save to save your changes to this page and to shared portlets in the library. Click Preview Changes in Portlet to view the changes in the portlet. Only you can see this version of this portlet. When previewing the portlet, you can click Edit to make changes to it. (If someone is authorized to make changes to your portlet and does so while you are previewing the portlet, you can no longer preview your version of the portlet. If this occurs, click Continue to see the newer version of the portlet.)
  16. Tip: Clicking Preview Changes in Portlet puts the portlet into a "preview state". The portlet will remain in its preview state until you click Cancel or Save in the wizard. The preview state is maintained even if you log out or close your browser window. If you make changes in other steps of the wizard, you must click Preview Changes in Portlet to update the preview with your changes, or click Save to make the changes public.

    You can also click Advanced Options and select Save to Current Page (to save your changes to the current page only) or select Save to Shared Portlet in Library, to save changes to this shared portlet in the library. Saving changes at the library level globally affects everywhere the shared portlet was placed. You see this option enabled only if you clicked Create New Shared Portlet. When you click Create New Shared Portlet, you use these settings to create a new portlet in the library. The new portlet is available to all entitled users of this web application and can be placed on any page. The current page is updated to use this new portlet, rather than the current portlet. The new portlet also appears in the Administration Console in the \Library\Portlets\ directory. Inheritance rules apply to shared portlets in the library. See the Portal Development Guide for more information on inheritance. Figure 10-10 shows the Finish window.

    Note: Content Presenter portlets that are configured on pages in the library will remain on the page in the library, even if the page has been customized on the desktop. The only way to make Content Presenter configurations local to a desktop is to add a configured or unconfigured Content Presenter portlet directly to the desktop, or customize the portlet on the desktop by changing or adding localizations to the portlet on the desktop using the Administration Console.

    When you finish previewing the portlet, click Return to Wizard or click the Edit icon to return to this step in the wizard and make any additional changes. If you want to save your changes, click Save.

Tip: To be able to use the Create New Shared Portlet button in the Advanced Options, you must have edit rights on the page and delete rights on the portlet, in addition to the rights needed to configure a Content Presenter portlet.
Figure 10-10 Preview or Save the Portlet

Preview or Save the Portlet

The new content displays in the Content Presenter portlet. Figure 10-11 shows an example of content that is an advertisement for a college savings account.

Figure 10-11 A Single Content Item Displayed in the Content Presenter Portlet

A Single Content Item Displayed in the Content Presenter Portlet

You can use a custom template or template view to change the look of the Content Presenter portlet. See Displaying Content with the Content Presenter Portlet in the Content Management Guide for instructions.

Tip: The Content Presenter portlet uses error logging to catch exceptions and displays an error message in the portlet if you have rights to configure the portlet. For example, you might receive an error message if content your portlet is referencing was deleted, or a template or view the portlet is using was removed. The error message instructs you to reconfigure the Content Presenter portlet to fix the errors. You must have edit and delete capabilities in order to configure the portlet.

This section also contains the following topics:

Changing How Much Content Appears in the Portlet

You can change the amount of content that a portlet displays. Use the Content Presenter Example to edit the Avitek - In the News portlet to display three specific press releases, rather than a list of all press releases.

Perform the following steps to change how much content appears in a portlet:

  1. Follow the instructions in Starting the Content Presenter Example to log into the Content Presenter Example.
  2. In the Avitek - In the News portlet in the Content Presenter Example, click Edit in the portlet’s title bar.
  3. In the Content Presenter Configuration Wizard, click 2. Select Content.
  4. Select Custom List of Specific Content Items to display content from a list that you create.
  5. Navigate through the repository tree to locate content in the Shared Content Repository folder and select the HR > Press Releases folder.
  6. Select the AvitekFutureInvestorsProgram.htm press release and click Add Item to List. Repeat these steps for two additional press releases: DividendsAnnouncement.htm and NewRewardsCreditCard.htm. This step will control what displays in the portlet– rather than all press releases appearing, only these three will appear.
  7. If you want user to see the DividendsAnnouncement press release first in the list, select the check box next to it and click Move Up.
  8. Click Next to save your changes.
  9. In the Select Template & View window, click Next.
  10. In the Portlet Properties window, click Next.
  11. In the Finish window, click Preview Changes in Portlet.
  12. The three press releases now appear. Click Return to Wizard.
  13. Click Save.

Using Portlet Publishing to Expose a Content Presenter Portlet

You must be entitled to use Portlet Publishing to expose a Content Presenter portlet. If you use Portlet Publishing to expose your Content Presenter portlet, some features are not available.

The following list describes features that are not part of a Content Presenter portlet exposed with Portlet Publishing:

Tip: When you use Portlet Publishing, work with only one Content Presenter portlet on a page at a time. If you work on more than one Content Presenter portlet on a page, an error appears. Close one of the Content Presenter wizards to continue working.

For more information on Portlet Publishing, see the Portlet Guide.


  Back to Top       Previous  Next