Oracle Portal Building Advanced Portals Release 3.0 Part Number A86183-02 |
Library | Service | Contents | Index

# 3
Creating an intranet portal and adding simple portlets

This chapter describes how to use Oracle Portal to build an interface, or a portal, that contains such material as calendars, reports from your own database, links to external Web sites, and customized HTML. If you've already built several portals and wish to work with advanced applications, see Chapter 4, "Creating a line of business page for your intranet portal".

In this chapter, you will create a portal that enables users to access multiple components and information from the same screen. The first step in creating a portal is designing the page: figuring out what applications your users need, what information they would like to see, and how you want the information to display. For more information on planning a page, see Chapter 2, "Planning Your Web Content".

You will then set up the page for your portal (the screen that displays the applications, links, etc.) with a style you like, create the applications you want to include in the portal, then add those applications to the portal so users can easily access them.

To build a simple intranet portal, you will use the Create Page Wizard to create a page and the Customize Page tab set to add and edit portlets. You will also use the Create Calendar, Create Forms, Create Sequence, and Create Links wizards to build an event calendar.

You need Edit or higher access privileges to the demo schema to complete this chapter. You also need Edit or higher application privileges to build the calendar portion of this chapter. If you do not have these privileges, contact your portal administrator.

The following figure illustrates the four parts of your simple intranet portal.

The completed portal is available in the installation package that contains the demo schema. For more information, contact your portal administrator.

This chapter contains the following sections:

Feature | Location
--- | ---
Use the Create Page Wizard to create a page. | Section 3.1, "Create a page"
Create an HTML portlet that contains your own customized HTML content. | Section 3.2, "Add customized HTML code as a portlet"
Add and modify a Favorites portlet. | Section 3.3, "Add and customize a Favorites portlet"
Use the Create Calendar Wizard, the Create Link Wizard, the Create Form Wizard, and the Create Database Sequence Wizard to build an updateable calendar portlet. | Section 3.4, "Create an event calendar and add it as a portlet"
Display the portal to the public. | Section 3.5, "Displaying the portal to others"

## 3.1 Create a page

The steps in this section show you how to use the Create Page Wizard to create a page, and design its layout.

For more information: Visit the Oracle Portal Online Help. From the Categories list, choose Page Tasks and click Go. In the right pane, click Creating a page.

1. Log into Oracle Portal.

Note: If you do not have a user name and password, contact your portal administrator.

2. In the Navigator, click the Pages tab.
3. Next to My Pages, under Actions, click Create.

The Page Properties tab of the Create Page Wizard displays.

4. In the Name field, enter <YourName>_Main.
5. In the Display Name field, enter <YourName> Main.
6. Click Next.
7. From the Layout drop-down list, choose Plain Layout.

A preview of the layout displays below the list.

8. From the Style drop-down list, choose Healthy Living Page Style.

A preview of the style displays below the list.

9. Click Next.
10. Click Next.
11. Select the Publish As Portlet check box.
12. Click Finish.

Tip: If you end your Oracle Portal session, you can always return to this page by going to the Navigator. Click the Pages tab, then My Pages. Then, find the Main page. Click any of the actions listed next to the Main page, such as View or Customize.

13. The Main page now displays in your browser.

Note: You can change the graphic in the banner by clicking the Edit Defaults link in the banner located on the Portlets tab of the Customize Page dialog. Under Banner Logo Settings, enter the filename of the logo you want to use.

The page should look something like this:

## 3.2 Add customized HTML code as a portlet

The steps in this section help you to add customized HTML as a portlet. When you create an HTML portlet, you can write your own HTML in a text editor and paste it in a portlet, or write HTML directly into the portlet. You can use this portlet when you have HTML you want to copy into your portal, for example a banner. In this section, we create a company news HTML page and paste it into the portlet.

1. In the Navigator, click the Pages tab.
2. Navigate to the <YourName> Main page.
3. Next to the page, click Edit.
4. On the Portlets tab, in the middle column, click .
5. In the View By list, make sure Provider is chosen.
6. Under Oracle Portal, find HTML Portlet.
7. Click to add the portlet.
8. Click OK.
9. In the HTML portlet, click Edit Defaults.
10. In the Display Name field, enter Healthy Living Company News.
11. In the Content field, paste the following HTML:

    <html>
      <li>Nutritionists choose Healthy Living as their #1 wholesaler.</li>
      <li>Healthy Living allies with so-far-unnamed wholesale healthy pet food
    company.</li>
      <li>New associate program now available. Become an affiliate of Healthy
    Living!</body></html>

12. Click OK.
13. Click Close.

Your portal should now look something like this:

## 3.3 Add and customize a Favorites portlet

The steps in this section help you customize the Favorites portlet by adding a new favorite link and deleting existing links. You can use the Favorites portlet to maintain and organize your more commonly used services. For example, instead of relying on the bookmarks in your browser, you can add the same links to the Favorites portlet and access the Web sites via your portal.

### 3.3.1 Add the Favorites portlet

1. Display the Portlets tab of the Customize Page dialog for the Main page.
2. On the Portlets tab, in the middle region, click .
3. In the View By list, make sure Provider is chosen.
4. Under Oracle Portal, find Favorites.
5. Click to add the portlet.
6. Click OK.
7. Click Close.
8. Click Finish.

### 3.3.2 Add a new favorite link

When you add the Favorites portlet, the Oracle Portal default links display. To take advantage of this portlet, you will always want to add new links to this portlet. You can enable your users to add and remove links, but you might want to add a few commonly-used ones. For example, you might add your organization's Internet address.

1. On the Main page, in the Favorites portlet, click Customize.

Tip: To display the Main page, click the Pages tab in the Navigator. Click My Pages, then find <YourName>_Main page.

2. In the Customize Favorites dialog, click Add or Edit Favorites.
3. On the Navigate Favorites page, click Create Favorite.

The Add Favorite page displays.

4. In the Name field, enter Oracle Technology Network.
5. In the URL field, enter http://technet.oracle.com.
6. Click Create.

Oracle Portal creates the new link and displays the Add Favorite page again so you can add another favorite link.

Note: You can click the link at the top of the page to edit the link you just created.

7. Click Close.

The new Oracle Technology Network favorite now displays on the Navigate Favorites page.

The Oracle Technology Network link should now display in the Favorites portlet.

### 3.3.3 Remove an existing favorite link

1. On the Main portal, in the Favorites portlet, click Customize.
2. Click Add or Edit Favorites.
3. Next to Oracle (for example), click Delete.
4. In the upper right corner, click Close.
5. In the shortcut bar, click .
6. On the Pages tab, click My Pages.
7. Click Main.

The Favorites portlet should now look like this:

## 3.4 Create an event calendar and add it as a portlet

The steps in this section help you create an event calendar, where you can add an event and display it in a calendar format. One of the most common portal functions is a calendaring application, where users can immediately see the events for a particular day.

In these steps, you will create an Oracle Portal application. To do so, you will use the following:

- Create Calendar Wizard to create the calendar
- Create Forms from Table or View Wizard to create a form that updates the calendar
- Create Sequence Wizard to create a database sequence for the information the form accepts
- Create Links Wizard to connect the form and the calendar
- Create Calendar Wizard again to create a button to access the form.

Note: To create the components in this section, you must have access to the <DEMO SCHEMA>.EVENTS table, where DEMO SCHEMA is the name of the schema where the demo schema objects are installed. You must also have access to create components within the Casebook30_Application application. If you do not have access to this table, or if you do not have access to this application, contact your portal administrator. Instructions are in Appendix A of this manual.

### 3.4.1 Create an event calendar using the Create Calendar Wizard

To create a view-only calendar, where users can view the dates but not add events, you can simply follow the steps in this section (Section 3.4.1). To make the calendar updateable, however, you will need to complete all sections in Section 3.4, "Create an event calendar and add it as a portlet".

For more information: Visit the Oracle Portal Online Help. From the Categories list, choose Application Tasks and click Go. In the right pane, click Building Components.

1. In the shortcut bar, click .
2. Click the Applications tab.
3. Make sure the path looks like this: Path: Applications. If you do not see this exact path, click Applications to access the root folder.
4. Under Name, click Casebook30_Application.

You should now see the following path: Path: Applications, Casebook30_Application.

5. Next to Create New, click Calendar.

The Create Calendar Wizard displays.

6. In the Calendar Name field, enter <YourName>_EVENT_CAL.
7. In the Display Name field, enter <YourName> Event Calendar.
8. In the Application list, choose Casebook30_Application.
9. Click Next.
10. On step 2 of the Create Calendar Wizard, enter the following SQL query in the SQL Query field:

    select
        e.event_start_date   the_date,
        e.event_title        the_name,
        null                 the_name_link,
        null                 the_date_link,
        null                 the_target
    from <DEMO SCHEMA>.hlw_events e
    order by 1

    Note: Do not directly copy and paste the SQL from this text. You must replace the
    schema name (DEMO SCHEMA) with the name of the schema where the demo schema
    objects are installed.

11. Click Finish.

Note: Doing so accepts the defaults in the remainder of the wizard. You can always return to the wizard later to customize the appearance of the calendar.

12. The Manage Component dialog for the new calendar displays.

Note: You can always view the Manage Component dialog for a particular component by clicking Manage next to the component name on the Application tab.

13. Click the Access tab.
14. Select the Publish to Portal check box.
15. Click Apply.
16. Click the Develop tab, then click Run.

The calendar displays in a new browser window, and should look something like this:

Note: If you get the error "No Rows Returned," it's because you have no data in the calendar. Continue the steps in this section. After you've created the form, you can insert data, and the calendar should display.

### 3.4.2 Create a form to update the calendar

To manage events using the calendar, you'll need to create a form in which users can add, remove, and modify events.

Note: To complete this section, you must have UPDATE privileges on the <DEMO SCHEMA>.HLW_EVENTS table. If you do not have these privileges, contact your database administrator.

1. In the Navigator, click the Applications tab and navigate to Casebook30_Application.

Tip: Follow steps 2 through 5 in Section 3.4.1, "Create an event calendar using the Create Calendar Wizard".

2. Next to Create New, click Form.
3. On the Forms page, click Forms based on table or view.

The Create Form from Table or View Wizard displays.

4. In the Name field, enter <YourName>_EVENT_FORM.
5. In the Display Name field, enter <YourName> Event Form.
6. From the Application list, choose Casebook30_Application.
7. Click Next.
8. In the Table or View field, enter <DEMO_SCHEMA>.HLW_EVENTS.

Note: DEMO_SCHEMA is the name of the schema in which the demo schema objects are installed. The table now displays in the Table or View field.

9. Click Next.
10. On the Form Layout tab, make sure Tabular is selected.
11. Click Next.
12. In the left pane, make sure FORM is highlighted.
13. In the right pane, scroll down until you see the PL/SQL text box.
14. In the text box, enter something like this:

    go('<http://<host name>/pls/<DAD>/<DEMO SCHEMA>.<YourName>_EVENT_
    CAL.show>');

Note: Replace the text "<host namel>" with the URL for Oracle Portal, ex. "http://mycomputer.domain.com/pls/portal30". You can find this URL by displaying the Manage Component dialog for the <yourName>_EVENT_CAL and dragging your mouse over RUN. The URL displays at the bottom of your browser.

15. Click Finish.

Doing so builds the form using the default values in the remaining steps of the wizard. If you want to see the default values, click Next in each of the wizard steps, but do not change any of the values. Then, click Finish when you're done.

16. When you click Finish, the Manage Component dialog for your new form displays.
17. Click the Access tab.
18. Select the Publish to Portal check box.

Note: Selecting this check box enables you to display the form as a portlet.

19. Click Apply.
20. Click the Develop tab.
21. Click Run.

The new form displays in a separate browser window.

### 3.4.3 Change the appearance of the form

Since users of your calendar will also use the form to update and view events in the calendar, you might also want to customize the way the form displays.

1. On the Applications tab, next to <YourName>_EVENT_FORM, click Edit.
2. On the Formatting and Validation Options page, make sure FORM is highlighted.
3. Under Form Level Options, choose Wheat from the Box Background Color drop-down list.
4. Choose Dude from the Box Background Image drop-down list.
5. Choose Thick Border from the Box Border drop-down list.
6. Order the query by EVENT_START_DATE.
7. From the list, choose Ascending.
8. In the left pane, if the FORM item list is collapsed, click .
9. Click INSERT_TOP.
10. In the right-hand pane, in the Label field, enter Save.
11. In the left-hand pane, click INSERT_BOTTOM.
12. In the right-hand pane, in the Label field, enter Save. Completing steps 9-13 changes the button label to Save in the form.
13. In the left-hand pane, click EVENT_ID.
14. In the right-hand pane, in the Label field, enter Event ID#.
15. In the left-hand pane, click EMPLOYEE_ID.
16. In the right-hand pane, in the Label field, enter Employee ID#.
17. In the left-hand pane, click DEPARTMENT_NO.
18. In the right-hand pane, in the Label field, enter Department#.
19. In the left-hand pane, click EVENT_START_DATE.
20. In the right-hand pane, in the Label field, enter Start Date (DD-MON-YY).
21. In the left-hand pane, click EVENT_END_DATE.
22. In the right-hand pane, in the Label field, enter End Date (DD-MON-YY).
23. In the left-hand pane, click EVENT_START_TIME.
24. In the right-hand pane, in the Label field, enter Start Time.
25. In the left-hand pane, click EVENT_END_TIME.
26. In the right-hand pane, in the Label field, enter End Time.
27. In the left-hand pane, click EVENT_TITLE.
28. In the right-hand pane, in the Label field, enter Title.
29. In the left-hand pane, click EVENT_DESCRIPTION.
30. In the right-hand pane, in the Label field, enter Description.
31. In the left-hand pane, click EVENT_NOTE.
32. In the right-hand pane, in the Label field, enter Note.
33. In the left-hand pane, click EVENT_COMPLETED.
34. In the right-hand pane, in the Label field, enter Completed?.
35. Click OK.
36. In the Manage Component dialog, click Run.

The form now displays in a new browser window with the new colors and label names.

### 3.4.4 Create a database sequence for the form

Since you will be allowing users to add, update, and delete events by using your new form, you will need to assign sequence numbers to each record. You can use the Create Sequence Wizard to enable Oracle Portal to automatically generate a new sequence number for each record in the database. This way, when a user edits or removes an event, the user (and Oracle Portal) can refer to the sequence number to retrieve the appropriate record.

Note: You must have MANAGE ALL SCHEMAS global privilege or Manage privileges on the <DEMO_SCHEMA> schema to create database objects.

For more information: Visit the Oracle Portal Online Help. From the Categories list, choose Administration Tasks and click Go. In the right pane, click Building Database Objects.

1. In the shortcut bar, click .
2. In the Navigator, click the Database Objects tab.
3. Next to Path, make sure it says Path: Database Schemas, <DEMO_SCHEMA>. If you do not see this, click Database Schemas to navigate to the root of the directory. Then, find <DEMO SCHEMA> in the list. Click <DEMO SCHEMA> to access the schema.
4. Next to Create New, click Sequence.
5. On step 1 of the Create Sequence Wizard, leave the Schema name as <DEMO_SCHEMA>.
6. In Sequence Name, enter <YourName>_EVENT_SEQ.
7. Click Next.
8. On step 2, in the Increment By field, enter 10.
9. In the Start With field, enter 1000.
10. Click Next.
11. On step 3, click Finish

<YourName>_EVENT_SEQ now displays in the Database Navigator.

Note: If you don't see the sequence in the list, you may have to click Next, or you can use the Find field.

12. In the Database Objects Navigator, next to <YourName>_EVENT_SEQ, click Grant Access.
13. In the User/Role field, enter PUBLIC.

Tip: Granting access to PUBLIC enables the form you create to use this sequence. Doing so also enables anyone who can use your form to insert records in the database. Note that you can also grant access on a user-by-user or group-by-group basis.

14. From the list, choose SELECT.
15. Make sure the with Grant Option check box is not selected.

Note: If you select the with Grant Option check box, you will enable the public to grant other users privileges to the database sequence.

16. Click Add to List.
17. Click Close.
18. Click the Applications tab.
19. In Casebook_HLW_APP, find <YourName>_EVENT_FORM. Note that the path should display as follows: Path: Applications, Casebook30_Application, Components.
20. Next to <YourName>_EVENT_FORM, click Edit.
21. On the Formatting and Validation Options page, in the left-hand pane, find the EVENT_ID column. You may have to click next to FORM to display all the columns.
22. Click EVENT_ID.
23. In the right-hand pane, find the Validation section.
24. In the Default Value field, enter:

    #<DEMO_SCHEMA>.<YourName>_EVENT_SEQ.nextval

25. From the Default Value Type list, choose Expression returns number.
26. Click OK.

Now, whenever a user adds an event using the EVENT_FORM, Oracle Portal automatically assigns the new record an ID number. This number is unique to each record, and makes it easy to retrieve, update, and delete the record.

### 3.4.5 Create a link between the form and the calendar

To enable users to update the event calendar, you must create a link between the form and the calendar.

For more information: Visit the Oracle Portal Online Help. From the Categories list, choose Application Tasks and click Go. In the right pane, click Building Components, then click Using a link between components.

1. On the Applications tab, next to Create, click Link.
2. On step 1 of the Create Link Wizard, in the Link Name field, enter EVENT_LINK.
3. In the Application list, choose Casebook30_Application.
4. Click Next.
5. On step 2 of the Create Links Wizard, select Oracle Portal Component.
6. In the Target Component or URL field, enter Casebook30_Application.<YourName>_EVENT_FORM.
7. Click Finish.

The link now displays in the Manage Component dialog.

8. Click Run.
9. In the Navigator, click the Application tab and navigate to <Your Name> EVENT CAL.
10. Click Edit.

The SQL Query for your event calendar displays.

11. In your SQL query, add your link to the the_name_link column of the query. To do so, edit the SQL query so that it looks something like this:

    select
        e.event_start_date the_date,
        e.event_title      the_name,
     <DEMO_SCHEMA>.wwv_app_module.link?p_arg_names=moduleid&p_arg_
    values=<EventFormID>&p_arg_names=_event_id_cond&p_arg_values=%3D&p_arg_
    names=_show_header&p_arg_values=YES'||E.EVENT_ID||'
    '       the_date_link,
        null               the_target
    from <DEMO_SCHEMA>.events e
    order by 1

Note: Do not copy and paste the code directly from this text. You should change the text from DEMO SCHEMA to the user name that owns the schema, as well as change the name of the application to your application. Also, replace "EventFormID" with the module ID of <YourName>_EVENT_FORM. You can find this value by displaying the Manage Component dialog for <YourName_EVENT_FORM. Drag your mouse over Run, and the module ID displays at the end of the URL at the bottom of your browser. See your portal administrator for more details.

12. Click OK. The calendar displays in the Manage Component dialog.

You have now finished creating links for your calendar.

### 3.4.6 Create a button on the calendar to access the form

To make the form conveniently accessible, you need to create a button on the calendar.

1. On the Application tab of the Navigator, next to <YourName>_EVENT_CAL, click Edit.
2. Click to display the Additional PL/SQL Code tab.
3. In the Calendar column, find the ...before displaying the header field.
4. Enter Javascript to create a button called "New Appointment" that, when clicked, executes the form you created in Section 3.4.3, "Change the appearance of the form".

To do so, in the field, enter:

    htp.formOpen(owa_util.get_owa_service_path||'<PORTAL_SCHEMA>.wwa_app_
    module.link?p_arg_names=_moduleid&p_arg_values=<EventFormID>&p_arg_names=_
    sessionid&p_arg_values=&p_arg_names=EVENT_START_DATE&p_arg_
    values=%23sysdate&p_arg_names=_event_start_date_cond&p_arg_values=%3D&p_arg_
    names=_show_header&p_arg_values=YES');
    htp.formSubmit(null, 'New Appointment');
    htp.formClose;

Note: Replace "EventFormID" with the module ID of <YourName>_EVENT_FORM. You can find the module ID for a component by display its Manage Component dialog, then dragging your mouse over Run. The module ID displays at the bottom of your browser. Copy the code in the calendar column in the `... after displaying the header' box.

5. Click OK.
6. In the Manage Component dialog, click Run.
7. Click New Appointment.
8. In the form, enter sample information, making sure you enter information for the required fields (in red).
9. Click Save.
10. Click your browser's Back button to return to the calendar.
11. Click your browser's Reload or Refresh button.

The event now displays in the calendar.

### 3.4.7 Add the calendar as a portlet

Now that you've created a calendar that users can update, you can add the calendar directly to your intranet portal.

1. In the shortcut bar, click .
2. In the My Pages list, next to <YourName>_Main, click Edit.
3. In the right region, click to add a column.
4. In the new region, click to add a portlet.
5. In the Providers list, under Casebook_HLW, find <YourName>_EVENT_CAL.

Tip: If your calendar does not display in the drop-down list, return to the Navigator and find the event calendar. Next to the calendar, click Manage. On the Access tab, make sure the Publish to Portal check box is selected, then click Apply.

6. Click to add the calendar as a portlet.
7. In the Selected Portlets list, click <YourName>_EVENT_CAL.
8. Click to move the calendar above the Favorites portlet.
9. Click OK.
10. Click Close.

The calendar now displays as a portlet in the right-hand region of your page.

## 3.5 Displaying the portal to others

Currently, the only users who can view your portal are the DBA and yourself. To make your portal useful to others, you should grant other users access to the portal.

1. In the Navigator, click the Applications tab.

Tip: To access the Navigator, click in the shortcut bar.

2. Navigate to the path: Applications
3. In the list, next to Casebook30_Application, click Grant Access.
4. In the Grantee field, type Public.
5. From the list, select EXECUTE.
6. Click Add to List. Public now displays in the Modify Privilege list.
7. Click OK.
8. Test the user's privileges by exiting Oracle Portal, then logging in as the user. When you display the Main portal (in the Navigator, click the Pages tab, then find the Main page you created), you should see all the applications you built in Chapter 1.

## 3.6 Summary

Congratulations! You have created an intranet portal and added different types of portlets to it. You now know how to:

- Create a page
- Create a customized HTML portlet
- Customize the Favorites portlet

- Create a new Favorite link
- Remove an existing Favorite link

- Create an event calendar
- Create a form based on a table to update the calendar
- Create a database sequence to update the event records in your database
- Create a link between the form and calendar
- Add a calendar application as a portlet provider

For more information about creating a portal and using portlets, see the Oracle Portal Online Help.

| Copyright © 2000 Oracle Corporation. All Rights Reserved. |
Library | Service | Contents | Index