BigAdmin System Administration Portal
Sun Docs
Print-friendly VersionPrint-friendly Version

Adding Sun Java System Portal Server 7.1 Community Services to Your Portal

Kanchana Sekhar, October 2007

This article contains instructions for integrating the Sun Java System Portal Server Community Sample into your portal desktop. The Community Sample provides the ability for a portal user to create a new community, view communities, join a community, and maintain a community through portlets.

All of the examples in this article use the Enterprise Sample desktop and associated JavaServer Pages (JSP) files.

Default Settings Used in This Document

The following settings are used throughout this document:

Sample Portal Distinguished Name (DN)

o=EnterpriseSample,dc=sun,dc=com

Portal ID

portal-ID

Portal Desktop Parent Container

ASCTabContainer

Portal Desktop Service CommunityParentContainerURLParameter

CommunityParentContainer.selectedChannel

Portal Desktop Service CommunityHomeContainerName

CommunityHomeContainer

Portal Desktop Service CommunityCreateContainerName

CommunityCreatePortlet

Display Profile Container CommunityParentContainer

JSPSingleContainerProvider

Display Profile Container CommunityHomeContainer

JSPTableContainerProvider

Display Profile Channel CommunityPortlet

__Portlet__communityportlets.CommunityPortlet

Display Profile Channel CommunityCreatePortlet

__Portlet__communityportlets.CommunityCreatePortlet

Display Profile Channel CommunityMembershipPortlet

__Portlet__communityportlets.CommunityMembershipPortlet

Adding the Community Sample

Before adding the Community Sample, ensure that Portal Server 7.1 software is installed and then follow the instructions in To Save Your Existing Portal Server Data to make a backup copy of existing data. After making a backup copy of your existing data, you can proceed to add the Community Sample to your portal by referring to the Task Map for Adding the Community Sample to Your Portal.

To Save Your Existing Portal Server Data

  1. Make a backup copy of the display profile document.

    For example, type PortalServer-base/bin/psadmin list-display-profile --adminuser uid --passwordfile passwordfile --dn "o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID > /tmp/dpbackup.xml. Here:

    PortalServer-base

    The directory where Portal Server software is installed (by default, /opt/SUNWportal/)

    uid

    The administrator's distinguished name

    passwordfile

    The file that contains the administrator's password

    portal-ID

    The portal ID (by default, portal1)

  2. Make a backup copy of your desktopType directory.

    For example, type cp -Rf /var/opt/SUNWportal//portals/portal-ID/desktop/enterprise_sample/ PortalServer-DataDir/portals/portal-ID/desktop/enterprise_sample.bak/. Here portal-ID refers to the portal ID (by default, portal1).

Task Map for Adding the Community Sample to Your Portal

Use the following task map (that explains the tasks you must do) to add the Community Sample to your portal.

Task
Description
Instruction
1. Specify the portal desktop service attributes.
The Community Sample portlets must construct URLs that access and control the Community Sample in which they are executing. The Portal Desktop Service attributes define how these community URLs are constructed. The desktop service attributes for the Community Sample page must be set for all Access Manager organization and roles associated with the desktop user.
2. Create the PAR directory structure and the PAR DPMapping.properties file.
The PAR file format is the file structure that is used by the psadmin import and psadmin export commands to store portal data. The PAR directory structure is the directory structure from where a PAR file can be generated using the psadmin create-par command. The PAR directory structure describes the file system directories that is similar to the PAR file format with additional mapping properties file.
3. Set up the display profile.
The display profile creates the display configuration for the standard Desktop by defining the Provider, channel, and Provider and channel properties.
4. Set up the theme tag libraries.
The Community Sample uses the Sun JavaTM Web User Interface Components theme support for stylesheet and JavaScript functionality. You must include the Tag Library Descriptor (TLD) in your portal desktopType path.
5. Set up the Community Sample templates.
This step is optional if the Community Sample is already installed. If the Community Sample is not installed, then copy the sample templates from the Community Sample to the PAR and copy the Community Template images to the PAR.
6. Set up the left navigation Community Sample template CSS and JSP Files.
To set up the left navigation Community Sample template CSS and JSP files with the same look and feel as the left navigation in the Community Sample, create the JSPMenuContainerProvider directory, JSP files, and CSS in the PAR.
7. Customize the community templates.
A community template contains a set of services (channels) and the visual layout. Community templates define (in the role display profile document) the type of services available for the community, the default settings for each service, and the containers that bind the services. You can customize the template to define the layout of the Community Sample in your portal.
8. Set up the CommunityParentContainer JSP files.
The CommunityParentContainer used by the Community Sample is based on the JSPSingleContainerProvider. The content page for this container is the single.jsp file. If your portal desktop default channel or parent container is a JSPSingleContainerProvider and you want the Community Sample look and feel, then you can use the Community Sample's single.jsp file. Otherwise, create a new file.
9. Create and import the PAR file.
Use the pasadmin utility to create and import the PAR file.
10. Add the Sun Java Web User Interface theme and JavaScript utilities to the portal desktop parent container.
The Sun Java Web User Interface theme and JavaScript utilities must be added to the portal desktop parent container.
11. Remove the Community Sample from Anonymous portal desktop.
If you do not want to display the Community Page on the Anonymous Portal Desktop, use the management console or the psadmin utility to remove the Community sample on the Anonymous portal desktop.
To Set the Portal Desktop Service Attributes

The desktop service attributes for the Community Sample page must be set for all Access Manager organization and roles associated with the desktop user. For example, the Enterprise Sample roles NewCustomerToursRole and AustralianExpansionRole need the portal desktop service attributes set before user mary can use the Community Sample page. For more information about the portal desktop service attributes, see Chapter 14, Modifying the Attributes, in Sun Java System Portal Server 7.1 Update 1 Community Guide.

  1. Specify the value for the CommunityParentContainerURLParameter attribute.

    Value for this attribute is CommunityParentContainer.selectedChannel. This attribute specifies the top level container for the community page, as well as the URL parameter that causes this container to select a new contained channel.

    For example, to set this attribute, type PortalServer-base/bin/psadmin set-attribute --adminuser uid --passwordfile passwordfile --dn "o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID --component desktop --attribute-name CommunityParentContainerURLParameter CommunityParentContainer.selectedChannel.

    The top level container used in this example is the CommunityParentContainer which is a based on JSPSingleContainerProvider. The Portal Desktop URL syntax for specifying the JSPSingleContainerProvider's selected channel is the container name followed by .selectedChannel. The Enterprise Sample roles NewCustomerToursRole and AustralianExpansionRole need the portal desktop service attribute, CommunityParentContainerURLParameter, set before user mary can use the Community Sample page.

    To set the attribute for:

    • The NewCustomerToursRole, type PortalServer-base/bin/psadmin set-attribute --adminuser amadmin --passwordfile passwordfile --dn "cn=NewCustomerToursRole,o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID --component desktop --attribute-name CommunityParentContainerURLParameter CommunityParentContainer.selectedChannel

    • The AustraliaExpansionRole, type PortalServer-base/bin/psadmin set-attribute --adminuser amadmin --passwordfile passwordfile --dn "cn=AustraliaExpansionRole,o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID --component desktop --attribute-name CommunityParentContainerURLParameter CommunityParentContainer.selectedChannel.

  2. Specify the value for the CommunityHomeContainerName attribute.

    The value for this attribute is CommunityHomeContainer. This attribute specifies the name of the container that defines the community home page.

    For example, to set this attribute, type PortalServer-base/bin/psadmin set-attribute --adminuser uid --passwordfile passwordfile --dn "o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID --component desktop --attribute-name CommunityHomeContainer CommunityHomeContainer.

    The community home page container used in this example is the CommunityHomeContainer. The Enterprise Sample roles NewCustomerToursRole and AustralianExpansionRole need the portal desktop service attribute, CommunityHomeContainerName, set before user mary can use the Community Sample page.

    To set the attribute for:

    • The NewCustomerToursRole, type PortalServer-base/bin/psadmin set-attribute --adminuser amadmin --passwordfile passwordfile --dn "cn=NewCustomerToursRole,o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID --component desktop --attribute-name CommunityHomeContainer CommunityHomeContainer

    • The AustraliaExpansionRole, type PortalServer-base/bin/psadmin set-attribute --adminuser amadmin --passwordfile passwordfile --dn "cn=AustraliaExpansionRole,o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID --component desktop --attribute-name CommunityHomeContainer CommunityHomeContainer.

  3. Specify the value for the CommunityCreateContainerName attribute.

    The value for this attribute is CommunityCreatePortlet. This attribute specifies the name of the community portlet channel used to create new communities.

    For example, to set this attribute, type PortalServer-base/bin/psadmin set-attribute --adminuser uid --passwordfile passwordfile --dn "o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID --component desktop --attribute-name CommunityCreateContainer CommunityCreatePortlet.

    The Enterprise Sample roles NewCustomerToursRole and AustralianExpansionRole need the portal desktop service attribute, CommunityCreateContainerName, set before user mary can use the Community Sample page.

    To set the attribute for:

    • The NewCustomerToursRole, type PortalServer-base/bin/psadmin set-attribute --adminuser amadmin --passwordfile passwordfile --dn "cn=NewCustomerToursRole,o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID --component desktop --attribute-name CommunityCreateContainer CommunityCreatePortlet

    • The AustraliaExpansionRole, type PortalServer-base/bin/psadmin set-attribute --adminuser amadmin --passwordfile passwordfile --dn "cn=AustraliaExpansionRole,o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID --component desktop --attribute-name CommunityCreateContainer CommunityCreatePortlet.

To Create the PAR Source
  1. Create the PAR directory structure.

    The PAR directory structure is as follows:

    basedir/dp basedir/pbfiles basedir/static

    For example, type:

    mkdir -p /tmp/communitypagepar/dp mkdir -p /tmp/communitypagepar/pbfiles/templateBaseDir mkdir -p /tmp/communitypagepar/pbfiles/templateBaseDir/enterprise_sample mkdir -p /tmp/communitypagepar/static/web-src/enterprise/css mkdir -p /tmp/communitypagepar/static/web-src/community/images

    For more information, see PAR Directory Structure in Sun Java System Portal Server 7.1 Command Line Reference.

  2. Create the PAR DPMapping.properties file.

    The DPMapping.properties file specifies the mapping for the display profile documents. The display profile node (dpnode) is set to the defaultOrganization value.

    For example, create /tmp/communitypagepar/dp/DPMapping.properties file with the following contents:

    dpnode=defaultOrganization
    organization=o=EnterpriseSample,dpnode

    In this example, the key is the organization and the value is set to the Enterprise Sample distinguished node.

    For more information, see DPMapping.properties File in Sun Java System Portal Server 7.1 Command Line Reference.

To Set Up the Display Profile
  • Specify the community page containers and channels for use with the community portlets. In addition, add the community parent container to the portal desktop parent container.

    For example, in the Enterprise Sample, the Parent Container, ASCTabContainer, must be updated to include the CommunityParentContainer as one of the available and selected tabs. Your portal desktop parent container may be different than the one used in the Enterprise Sample.

    Type
    Name
    Provider
    Container
    CommunityParentContainer
    JSPSingleContainerProvider
    Container
    CommunityHomeContainer
    JSPTableContainerProvider
    Channel
    CommunityPortlet
    __Portlet__communityportlets.CommunityPortlet
    Channel
    CommunityCreatePortlet
    __Portlet__communityportlets.CommunityCreatePortlet
    Channel
    CommunityMembershipPortlet
    __Portlet__communityportlets.CommunityMembershipPortlet

    For example, create the /tmp/communitypagepar/dp/organization-communitypage.xml file with the following content:

    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <!DOCTYPE DisplayProfile SYSTEM "jar://resources/psdp.dtd">
    
    <DisplayProfile version="1.0" priority="10">
       <Properties>
       </Properties>
       <Channels>
          <Container name="ASCTabContainer" provider="ASCTabContainerProvider">
             <Properties>
                <Collection name="TabProperties">
                   <Collection name="CommunityParentContainer">
                      <Boolean name="removable" value="true"/>
                      <Boolean name="renamable" value="true"/>
                      <Boolean name="predefined" value="false"/>
                   </Collection>
                </Collection>
             </Properties>
             <Available>
                <Reference value="CommunityParentContainer"/>
             </Available>
             <Selected>
                <Reference value="CommunityParentContainer"/>
             </Selected>
             <Channels>
             </Channels>
          </Container>
    
          <Container name="CommunityParentContainer" provider="JSPSingleContainerProvider">
             <Properties>
                <String name="title" value="My Communities"/>
                <String name="description" value="My Communities"/>
                <String name="contentPage" value="single.jsp" propagate="false"/>
                <String name="editPage" value=""/>
                <String name="processPage" value=""/>
                <Boolean name="isTopLevel" value="true" advanced="true"/>
                <Boolean name="isEditable" value="true" advanced="true"/>
                <String name="editType" value="edit_complete" advanced="true"/>
                <ConditionalProperties condition="locale" value="en">
                   <String name="title" value="My Communities"/>
                   <String name="description" value="My Communities"/>
                </ConditionalProperties>
             </Properties>
             <Available>
                <Reference value="CommunityHomeContainer"/>
             </Available>
             <Selected>
                <Reference value="CommunityHomeContainer"/>
             </Selected>
             <Channels>
             </Channels>
          </Container>
    
          <Container name="CommunityHomeContainer" provider="JSPTableContainerProvider">
             <Properties>
                <Boolean name="isEditable" value="true"/>
                <String name="title" value="Communities Home"/>
                <String name="description" value="Click to goto home page."/>
                <Integer name="layout" value="3"/>
                <String name="refreshTime" value="0"/>
                <Boolean name="removable" value="false"/>
                <Boolean name="renamable" value="false"/>
                <Boolean name="predefined" value="false"/>
                <Boolean name="defaultChannelIsMinimizable" value="true"/>
                <Boolean name="defaultChannelIsMaximizable" value="true"/>
                <Boolean name="defaultChannelIsDetachable" value="true"/>
                <Boolean name="defaultChannelIsRemovable" value="true"/>
                <Boolean name="defaultBorderlessChannel" value="true" advanced="true"/>
                <Collection name="channelsRow" advanced="true">
                </Collection>
                <Collection name="channelsColumn" advanced="true">
                </Collection>
                <Collection name="channelsIsRemovable">
                <Boolean name="CommunityMembershipPortlet" value="false"/>
                <Boolean name="CommunityPortlet" value="false"/>
                </Collection>
                <Collection name="channelsHasFrame" advanced="true">
                </Collection>
                <Collection name="channelsIsMinimizable">
                </Collection>
                <Collection name="channelsIsMaximizable">
                </Collection>
                <Collection name="channelsIsMovable">
                </Collection>
                <Collection name="channelsIsDetachable">
                </Collection>
                <Collection name="borderlessChannels">
                </Collection>
                <ConditionalProperties condition="locale" value="en">
                   <String name="title" value="Communities Home"/>
                   <String name="description" value="Click to goto home page."/>
                </ConditionalProperties>
             </Properties>
             <Available>
                <Reference value="CommunityMembershipPortlet"/>
                <Reference value="CommunityPortlet"/>
             </Available>
             <Selected>
                <Reference value="CommunityMembershipPortlet"/>
                <Reference value="CommunityPortlet"/>
             </Selected>
             <Channels>
             </Channels>
          </Container>
    
          <Channel name="CommunityPortlet" 
           provider="__Portlet__communityportlets.CommunityPortlet">
             <Properties>
                <String name="helpURL" value="community/content/Help/communities.html"/>
                <String name="title" value="Community Portlet"/>
                <String name="shortTitle" value="Community" advanced="true"/>
                <String name="description" value="Community Portlet" advanced="true"/>
                <String name="width" value="thick"/>
                <Boolean name="isEditable" value="false"/>
                <ConditionalProperties condition="locale" value="en">
                   <String name="helpURL" value="community/content/Help/communities.html"/>
                   <String name="title" value="Community Portlet"/>
                   <String name="shortTitle" value="Community" advanced="true"/>
                   <String name="description" value="Community Portlet" advanced="true"/>
                </ConditionalProperties>
             </Properties>
          </Channel>
    
          <Channel name="CommunityCreatePortlet" 
           provider="__Portlet__communityportlets.CommunityCreatePortlet">
             <Properties>
                <String name="helpURL" value="community/content/Help/communities.html"/>
                <String name="title" value="Create New Community"/>
                <String name="shortTitle" value="Community Create" advanced="true"/>
                <String name="description" value="Community Create Portlet" advanced="true"/>
                <String name="width" value="thick"/>
                <Boolean name="isEditable" value="false"/>
                <ConditionalProperties condition="locale" value="en">
                   <String name="title" value="Create New Community"/>
                   <String name="shortTitle" value="Community Create" advanced="true"/>
                   <String name="description" value="Community Create Portlet" advanced="true"/>
                   <String name="helpURL" value="community/content/Help/communities.html"/>
                </ConditionalProperties>
             </Properties>
          </Channel>
    
          <Channel name="CommunityMembershipPortlet" 
           provider="__Portlet__communityportlets.CommunityMembershipPortlet">
             <Properties>
                <String name="helpURL" value=" "/>
                <String name="title" value="Community Membership Portlet"/>
                <String name="shortTitle" value="Community Membership" advanced="true"/>
                <String name="description" value="Community Membership Portlet" advanced="true"/>
                <String name="width" value="thin"/>
                <Boolean name="isEditable" value="false"/>
                <ConditionalProperties condition="locale" value="en">
                   <String name="title" value="Community Membership Portlet"/>
                   <String name="shortTitle" value="Community Membership" advanced="true"/>
                   <String name="description" value="Community Membership Portlet" advanced="true"/>
                   <String name="helpURL" value=" "/>
                </ConditionalProperties>
             </Properties>
          </Channel>
       </Channels>
       <Providers>
       </Providers>
    </DisplayProfile>

    For more information on the display profile, see Part III, Display Profile, in Sun Java System Portal Server 7.1 Technical Reference and Administering the Display Profile in Sun Java System Portal Server 7.1 Administration Guide.

To Set Up the Theme Tag Libraries
To Set Up the Community Sample Templates

For more information on Community templates, see Chapter 4, Understanding Community Templates, in Sun Java System Portal Server 7.1 Update 1 Community Guide.

  1. Copy the communityTemplateBaseDir directory in the PortalServer-base/par-src/community_sample/pbfiles/ directory to the PAR.

    For example, type cp -Rf PortalServer-base/par-src/community_sample/pbfiles/communityTemplateBaseDir /tmp/communitypagepar/pbfiles/communityTemplateBaseDir.

  2. Copy the Community Template images in PortalServer-base/par-src/community_sample/static/web-src/community/images/templates directory to the PAR.

    For example, type cp -Rf PortalServer-base/par-src/community_sample/static/web-src/community/images/templates /tmp/communitypagepar/static/web-src/community/images/templates.

To Set Up the Left Navigation Community Sample Template CSS and JSP Files
  1. Create the JSPMenuContainerProvider directory in the PAR.

    Type mkdir /tmp/communitypagepar/pbfiles/templateBaseDir/enterprise_sample/JSPMenuContainerProvider.

  2. Copy the menu.jsp file from the JSPMenuContainerProvider directory (under the PortalServer-base/par-src/community_sample/pbfiles/templateBaseDir/community_sample/ directory) to the PAR.

    Type cp PortalServer-base/par-src/community_sample/pbfiles/templateBaseDir/ community_sample/JSPMenuContainerProvider/menu.jsp \ /tmp/communitypagepar/pbfiles/templateBaseDir/enterprise_sample/JSPMenuContainerProvider \

    where the default value for PortalServer-base is /opt/SUNWportal.

  3. Create the menumain.jsp file in this directory: /tmp/communitypagepar/pbfiles/templateBaseDir/enterprise_sample/JSPMenuContainerProvider.

    The file must contain the following:

    <!-- JSPMenuContainerProvider/menumain.jsp -->
    <%@ page session="false"%><%
    
    %><%@ page import="
    java.net.URL,
    com.sun.portal.providers.containers.jsp.menu.JSPMenuContainerProvider,
    com.sun.portal.providers.context.ProviderContext,
    com.sun.portal.providers.*,
    com.sun.portal.providers.error.*,
    com.sun.portal.providers.context.*"
    %><%
    
    %><%@ taglib uri="/tld/desktop.tld" prefix="dt"%><%
    %><%@ taglib uri="/tld/desktopContainerProviderContext.tld" prefix="dtcpc"%><%
    %><%@ taglib uri="/tld/desktopProviderContext.tld" prefix="dtpc"%><%
    %><%@ taglib uri="/tld/desktopTab.tld" prefix="tab"%><%
    %><%@ taglib uri="/tld/jx.tld" prefix="jx"%><%
    
    %><%!
    // This scriptlet gets the url for editing the right-side selected provider/portlet.
    public URL getEditURL(HttpServletRequest request, 
     JSPMenuContainerProvider provider, String targetProvider) {
      URL redirectURL =null;
      try {
        ProviderContext pc =provider.getProviderContext();
        redirectURL =new URL( pc.getDesktopURL(request)
          + "?action=edit"
          + "&provider=" + pc.getStringProperty(provider.getName(), "editContainerName")
          + "&targetProvider=" + targetProvider
          + "&containerName=" + provider.getName());
      } catch (Exception e) { }
      return redirectURL;
    }
    
    public String getHelpURL(HttpServletRequest request, 
     JSPMenuContainerProvider provider, String targetProvider) {
      String helpURLPropertyValue ="";
      try {
        ProviderAdapter p = 
            (ProviderAdapter)provider.getContainerProviderContext().getProvider
          (request, provider.getName(), targetProvider);
        helpURLPropertyValue = (String)p.getProviderContext().getStringProperty
          (targetProvider, "helpURL", true);
      } catch (Exception e) { }
      return helpURLPropertyValue.trim();
    }
    %>
    <dt:obtainContainer container="$JSPProvider">
       <tab:tabContainerProvider>
          <tab:getSelectedTabs id="selectedTabs" scope="request"/>
          <tab:getSelectedTabName id="selectedTabName" scope="request"/>
          <table cellpadding="0" cellspacing="0" class="menucontainer">
          <tr>
             <!-- left-side navigation menu -->
             <td class="navcontainer" valign="top" nowrap>
                <%@ include file="menu.jsp"%>
             </td>
             <!-- right-side selected provider/portlet -->
             <td class="servicecontainer" valign="top" nowrap>
                <dtcpc:obtainChannelFromContainer channel="$selectedTabName">
                   <!-- right-side selected provider/portlet titlebar w/options -->
                   <table title="" cellspacing="0" cellpadding="0" width="100%" 
                    class="titlebar">
                   <tr>
                      <td class="title">
                         <dt:getTitle/>
                      </td>
                      <td class="links" align="right">
                         <dt:getName id="targetProvider"/>
                         <jx:declare id="targetProvider" type="String"/>
                         <%-- show edit link if provider/portlet isEditable --%>
                         <dtpc:getBooleanProperty key="isEditable" id="isEditable"/>
                         <jx:if test="$isEditable == true">
                            <%
                               URL editURL = getEditURL(request, 
                                  (JSPMenuContainerProvider)pageContext.getAttribute
                                   ("JSPProvider"), targetProvider);
                         if (editURL != null) {
                              %><%=editURL%>" title="Click to Edit Options">Edit Options</a>
                                  <%
                               }
                            %>
                         </jx:if>
                         <%-- show help link if provider/portlet has help url --%>
                         <%
                            String helpURL = getHelpURL(request, 
                               (JSPMenuContainerProvider)pageContext.getAttribute("JSPProvider"), 
                               targetProvider);
                       if ( !helpURL.equals("") && (helpURL.indexOf("helpURL") == -1) ) {
                            %><a id="last" href="<%=helpURL%>" title="Click to View Help" 
                               target="ps_help">View Help</a><%
                            }
                          %>
                      </td>
                   </tr>
                   </table>
                   <!-- right-side selected provider/portlet content -->
                   <dt:getContent/>
                </dtcpc:obtainChannelFromContainer>
             </td>
          </tr>
          </table>
          <div class="clearall"></div>
       </tab:tabContainerProvider>
    </dt:obtainContainer>
  4. Create the CSS file leftnavigation.css in the /tmp/communitypagepar/static/web-src/enterprise/css directory.

    The file must contain the following:

    .menucontainer {
      background-color: #fff;
    }
    
    ..menucontainer  .title {
      color: #000;
      font-size: 14px;
      font-weight: bold;
    }
    
    ..menucontainer  .navcontainer {
      background-color: #eee;
      border-right: 1px solid #A3B8CB;
      padding: 20px 10px 20px 10px;
    }
    
    ..menucontainer  .navcontainer ul {
      border-bottom: 1px solid #999;
      border-left: 1px solid #999;
      border-right: 1px solid #999;
      list-style: none;
      margin: 0;
      margin-top: 10px;
      padding: 0;
    }
    
    ..menucontainer .navcontainer ul li {
      border-top: 1px solid #999;
    }
    
    ..menucontainer .navcontainer ul li a {
      background: #fefdf1;
      border-left: 1em solid #eee;
      display: block;
      padding: 5px;
    }
    
    ..menucontainer .navcontainer ul li a:hover {
      background: #fff;
      border-color: #B1C26B;
    }
    
    ..menucontainer .navcontainer ul li a#selected {
      background: #DEE8F1;
      border-color: #3C5983;
      color: #000;
      font-weight: bold;
      text-decoration: none;
    }
    
    ..menucontainer .servicecontainer {
      padding: 20px 10px 20px 10px;
      width: 100%;
      margin-right: 10px;
    }
    
    ..menucontainer .servicecontainer .titlebar {
      border-bottom: 1px  solid #A3B8CB;
      margin-bottom: 20px;
      padding-bottom: 2px;
    }
    
    ..menucontainer .servicecontainer .titlebar .links a {
      border-right: 1px solid #A3B8CB;
      font-size: 11px;
      padding: 0 6px;
    }
    
    ..menucontainer .servicecontainer .titlebar .links a#last {
      border-right: none;
      padding-right: 0;
    }
To Customize the Community Templates

A community template contains a set of services (channels) and the visual layout. Community templates define (in the role display profile document) the type of services available for the community, the default settings for each service, and the containers that bind the services. Change the layout setting for the Two Column community template must to 3 if you are using the Enterprise Sample desktop.

  1. Change directories to /tmp/communitypagepar/pbfiles/communityTemplateBaseDir/2column.
  2. Edit all XML files to change the layout value.

    For the %COMMUNITY_CONTAINER%, add the property <Integer name="layout" value="integer"/>. For example, to change the layout setting for the Two Column community template to 3 for the Enterprise Sample desktop:

    <Container name="%COMMUNITY_CONTAINER%" provider="JSPTableContainerProvider">
       <Properties>
          <String name="title" value="%COMMUNITY_NAME%"/>
          <String name="description" value="%COMMUNITY_DESCRIPTION%"/>
          <Boolean name="compileToRealPath" value="true"/>
          <Integer name="layout" value="3"/>
       </Properties>

    For more information, see Creating and Modifying a Template in Sun Java System Portal Server 7.1 Update 1 Community Guide.

To Set Up the CommunityParentContainer JSP files
  1. Create the CommunityParentContainer directory in the PAR.

    Type mkdir /tmp/communitypagepar/pbfiles/templateBaseDir/enterprise_sample/CommunityParentContainer.

  2. Create the single.jsp file in the /tmp/communitypagepar/pbfiles/templateBaseDir/enterprise_sample/CommunityParentContainer directory.

    The file must contain the following:

    <!-- CommunityParentContainer/single.jsp -->
    <%@ page session="false"%><%
    %><%@ taglib uri="/tld/desktop.tld" prefix="dt"%><%
    %><%@ taglib uri="/tld/jx.tld" prefix="jx"%><%
    %><%@ page import="
    com.sun.portal.providers.containers.jsp.single.JSPSingleContainerProvider,
    com.sun.portal.providers.Provider,
    com.sun.portal.providers.ProviderException,
    com.sun.portal.providers.context.ProviderContext,
    com.sun.portal.desktop.TypedException"
    %><%
    %><dt:obtainContainer container="$JSPProvider"><%
    %><%
    String defaultContainer = "CommunityHomeContainer";
      String selectedChannel = null;
      Boolean isCommunity = new Boolean(false);
      Boolean isHome = new Boolean(false);
    
      // community parent container
      JSPSingleContainerProvider communityParentContainer =
          (JSPSingleContainerProvider)pageContext.getAttribute("JSPProvider");
    
      // need a try/catch block because the community parent container does
      // not have any available/selected channels defined in the dp, which
      // results in an ArrayIndexOutOfBoundsException
      try {
        if (communityParentContainer.getSelectedChannel(request) != null) {
          selectedChannel = (String)communityParentContainer.getSelectedChannel(request);
          if (selectedChannel.equals(defaultContainer)) {
              isHome = new Boolean(true);
          } else {
              isCommunity = new Boolean(true);
          }
        }
      } catch (Exception e) {
          isHome = new Boolean(true);
          selectedChannel = defaultContainer;
      }
    
      // retrieve the Provider object for the selectedChannel
      Provider selectedCommunityContainer =
        (Provider)communityParentContainer.getContainerProviderContext().getProvider(
        request, communityParentContainer.getName(), selectedChannel);
    
      // null check
      if(selectedCommunityContainer == null) {
        throw new ProviderException("Attempt to access a non-existent community " +
        " failed.  The selected channel not found." + TypedException.UNKNOWN_CHANNEL_TYPE +
        " selectedChannel=" + selectedChannel);
      }
    
      // community logistics
      String name = selectedCommunityContainer.getName();
      String title = selectedCommunityContainer.getTitle();
      String description = selectedCommunityContainer.getDescription();
      boolean isEditable = selectedCommunityContainer.isEditable();
    
      // page context
      pageContext.setAttribute("isHome", isHome, PageContext.REQUEST_SCOPE);
      pageContext.setAttribute("isCommunity", isCommunity, PageContext.REQUEST_SCOPE);
      pageContext.setAttribute("name", name, PageContext.REQUEST_SCOPE);
      pageContext.setAttribute("title", title, PageContext.REQUEST_SCOPE);
      pageContext.setAttribute("description", description, PageContext.REQUEST_SCOPE);
      pageContext.setAttribute("isEditable", new Boolean(isEditable), PageContext.REQUEST_SCOPE);
      %>
    <jsp:include page="breadcrumb.jsp" flush="true"/>
    <br>
    <% out.println(selectedCommunityContainer.getContent(request, response).toString()); %>
    </dt:obtainContainer>
  3. Create the breadcrumb.jsp file in the /tmp/communitypagepar/pbfiles/templateBaseDir/enterprise_sample/CommunityParentContainer directory.

    The user needs a breadcrumb or navigational link to return back to the Communities Home page when the user is viewing a community.

    <!-- breadcrumb.jsp -->
    <%@ page session="false"%><%
    
    %><%@ taglib uri="/tld/desktopContainerProviderContext.tld" prefix="dtcpc"%><%
    %><%@ taglib uri="/tld/desktopProviderContext.tld" prefix="dtpc"%><% 
    %><%@ taglib uri="/tld/desktop.tld" prefix="dt"%><%
    %><%@ taglib uri="/tld/jx.tld" prefix="jx"%><%
    %><%@ page import="
    com.sun.portal.providers.containers.jsp.single.JSPSingleContainerProvider,
    com.sun.portal.providers.containers.jsp.table.JSPTableContainerProvider,
    java.util.*"
    %><%
    
    %><dt:obtainContainer container="$JSPProvider"><%
    %><%!
    public class Crumb {
        String url ="";
        String title ="";
        String description ="";
        String onclick ="";
        String onkeypress ="";
    
        public Crumb(String url, String title, String description) {
            this.url = url;
            this.title = title;
            this.description = description;
        }
        public Crumb(String url, String title, String description, String onclick, 
             String onkeypress) {
            this.url = url;
            this.title = title;
            this.description = description;
            this.onclick = onclick;
            this.onkeypress = onkeypress;
        }
        public String toString() {
            StringBuffer buf = new StringBuffer("[url="+url);
            buf.append(", title="+title);
            buf.append(", description="+description);
            buf.append(", onclick="+onclick);
            buf.append(", onkeypress="+onkeypress);
            buf.append("]");
            return buf.toString();
        }
        public String getURL() { return url; }
        public String getTitle() { return title; }
        public String getDescription() { return description; }
        public String getOnclick() { return onclick; }
        public String getOnkeypress() { return onkeypress; }
    }
    %><%
    
    %><%
    // community home container portal desktop url
    String homeContainer="CommunityHomeContainer";
    String url = "?provider=ASCTabContainer&CommunityParentContainer.selectedChannel=" 
       +homeContainer;
    
    // breadcrumb url events (not used)
    String onclick = "";
    String onkeypress = "";
    
    // list of Crumbs
    List list = Collections.synchronizedList(new ArrayList());
    
    // retrieve information for the breadcrumb and add to list
    JSPSingleContainerProvider scp =
     (JSPSingleContainerProvider)pageContext.getAttribute("JSPProvider");
    String name = (String)pageContext.getAttribute("name", PageContext.REQUEST_SCOPE);
    JSPTableContainerProvider tcp = 
     (JSPTableContainerProvider)scp.getContainerProviderContext().getProvider(request,
      scp.getName(), homeContainer);
    String title = tcp.getProviderContext().getStringProperty(tcp.getName(), 
     "title", true);
    String description = tcp.getProviderContext().getStringProperty(tcp.getName(), 
     "description", true);
    Crumb crumb = new Crumb(url, title, description);
    list.add(crumb);
    
    // add Community link if there
    boolean community = false;
    
    if (pageContext.getAttribute("isCommunity", PageContext.REQUEST_SCOPE) != null) {
        community = ((Boolean)pageContext.getAttribute("isCommunity", 
             PageContext.REQUEST_SCOPE)).booleanValue();
        if (community) {
            title = (String)pageContext.getAttribute("title", PageContext.REQUEST_SCOPE);
    
            if (name != null && title != null) {
                url = "?provider=ASCTabContainer&CommunityParentContainer.selectedChannel=
                      "+ name;
                description = (String)pageContext.getAttribute("description", 
                      PageContext.REQUEST_SCOPE);
                if (description == null) description = title;
                crumb = new Crumb(url, title, description);
                list.add(crumb);
            }
        }
    }
    
    %><%
    // write out breadcrumb
    boolean hasError = false;
    if (pageContext.getAttribute("hasError", PageContext.REQUEST_SCOPE) != null) {
        hasError = ((Boolean)pageContext.getAttribute("hasError", 
             PageContext.REQUEST_SCOPE)).booleanValue();
    }
    %>
    
    <div class="secondaryContainer">
    <table cellpadding="0" cellspacing="0" border="0" width="100%">
    <tr>
    <td nowrap width="40%" style="vertical-align: top;">
    <div id="secondaryContainerNavigation">
    <span class="Selected">Path: </span>
    <%
    for (int j=0; j < list.size(); j++) {
        crumb = (Crumb)list.get(j);
        url = crumb.getURL();
        title = crumb.getTitle();
        description = crumb.getDescription();
        onclick = crumb.getOnclick();
        onkeypress = crumb.getOnkeypress();
        if (j != 0) {
    %> > <%
    }
    %>
    
    <%
    if (j == (list.size()-1) && !hasError ) {
       %><li><a href="<%=url%>" onkeypress="<%=onkeypress%>" onclick="<%=onclick%>" 
          title="<%=description%>" class="Selected"><%=title%></a></li><%
    } else {
     %><li><a href="<%=url%>" onkeypress="<%=onkeypress%>" onclick="<%=onclick%>" 
          title="<%=description%>" class="UnSelected"><%=title%></a></li><%
    }
    }
    %>
    </div>
    </td>
    
    <td nowrap width="40%" class="navigationBackground" style="vertical-align: top;">
    <div id="secondaryContainerNavigation" style="text-align:right">
    <span class="selectedDivider">|</span>
    <li><a href="<dtpc:getDesktopURL/>?provider=PagePreferencesContainer&container=
     <%=name%>&last=false" 
    class="Unselected" title="Click to edit content and layout for this page">Page
     Content & Layout</a></li>
    <span class="selectedDivider">|</span>
    </div>
    </td>
    </tr>
    </table>
    </div>
    <br>
    </dt:obtainContainer>
To Create and Import the PAR File

Use the pasadmin utility to create and import the PAR file.

For example, type:

PortalServer-base/bin/psadmin create-par --dir /tmp/ communitypagepar /tmp/communitypagepar.par

PortalServer-base/bin/psadmin import --adminuser amadmin --  passwordfile passwordfile \
--portal portal-ID --dp-only /tmp/communitypagepar.par

PortalServer-base/bin/psadmin import --adminuser amadmin -- passwordfile passwordfile \
--portal portal-ID --files-only --overwrite --redeploy \ /tmp/communitypagepar.par

For more information on the command line utilities for PAR, see Chapter 5, Management Subcommands, in Sun Java System Portal Server 7.1 Command Line Reference.

To Add the Sun Java Web User Interface Theme and JavaScript Utilities to the Portal Desktop Parent Container
  1. Add the tag library URIs <%@ taglib uri="/tld/desktop.tld" prefix="dt" %> and <%@ taglib uri="/tld/portletSetupTags.tld" prefix="pui"%>.
  2. Add the Sun Java Web User Interface Theme tag and JavaScript utilities to the HTML HEAD as follows:
    <HEAD>
    <pui:setupTheme themeName="defaulttheme" supportedLocales="en,en_US" 
    sessionDataStrategyClass="com.sun.web.ui.portletSetup.PSSessionDataStrategy"/>
    <link rel="stylesheet" type="text/css" href="<dt:scontent/>/enterprise/css/leftnavigation.css" />
    </HEAD>

    For example, the header.jsp file used by the Enterprise Sample's parent container ASCTabContainer is PortalServer-DataDir/portals/portal-ID/desktop/enterprise_sample/header.jsp.

    <%@ taglib uri="/tld/desktop.tld" prefix="dt" %>
    <%@ taglib uri="/tld/portletSetupTags.tld" prefix="pui"%>
    <jsp:include page="user.jsp" flush="true"/>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <html>
    <head>
    <jsp:include page="meta.jsp" flush="true"/>
    <jsp:include page="title.jsp" flush="true"/>
    <jsp:include page="script.jsp" flush="true"/>
    <pui:setupTheme themeName="defaulttheme" supportedLocales="en,en_US" 
    sessionDataStrategyClass="com.sun.web.ui.portletSetup.PSSessionDataStrategy"/>
    <link rel="stylesheet" type="text/css" href="<dt:scontent/>/enterprise/css/leftnavigation.css" />
    </head>
    <jsp:include page="body.jsp" flush="true"/>
To Remove the Community Sample From Anonymous Portal Desktop
  • From the command line, type PortalServer-base/bin/psadmin modify-display-profile --combine --adminuser uid --passwordfile passwordfile --dn "uid=authlessenterprisesample,ou=People,o=EnterpriseSample,dc=sun,dc=com" --portal portal-ID /tmp/parentcontainerremoveedp.xml.
    <?xml version="1.0" encoding="utf-8" standalone="no"?>
    <!DOCTYPE DisplayProfile SYSTEM "jar://resources/psdp.dtd">
    
    <DisplayProfile version="1.0" priority="10">
       <Properties>
       </Properties>
       <Channels>
          <Container name="ASCTabContainer" provider="ASCTabContainerProvider">
             <Properties>
             </Properties>
             <Available>
                <Reference value="CommunityParentContainer" merge="remove"/>
             </Available>
             <Selected>
                <Reference value="CommunityParentContainer" merge="remove"/>
             </Selected>
             <Channels>
             </Channels>
          </Container>
       </Channels>
       <Providers>
       </Providers>
    </DisplayProfile>

More Information


Comments (latest comments first)

Discuss and comment on this resource in the BigAdmin Wiki

Unless otherwise licensed, code in all technical manuals herein (including articles, FAQs, samples) is provided under this License.


BigAdmin
  
 
BigAdmin Upgrade Hub