Portal Page metadata (Alternative to theme policies)

The navigation attributes can be overidden by the page meta data also (overrides the theme policy values).

Instead of using the themePolicy directly, use EL variables initialized to the page meta-data values with the theme policy values as a default in case the attributes aren't specified in the page meta-data.

<portal-logic:pageMetaData varname="pageMetaData"><c:set var="renderTopNavigation"><c:out value='${pageMetaData["com.ibm.portal.themepolicy.renderTopNavigation"]}' default="${themePolicy.renderTopNavigation}"/></c:set><c:set var="topNavigationStartLevel"><c:out value='${pageMetaData["com.ibm.portal.themepolicy.topNavigationStartLevel"]}' default="${themePolicy.topNavigationStartLevel}"/></c:set><c:set var="topNavigationStopLevel"><c:out value='${pageMetaData["com.ibm.portal.themepolicy.topNavigationStopLevel"]}' default="${themePolicy.topNavigationStopLevel}"/></c:set>
</portal-logic:pageMetaData>

Exporting Theme Policies in WP7

Exporting Theme Policy in WP7 is changed little bit compared to previous versions.

To Export all Theme Policies in previous Versions(till 6.1.5) XML looks like below

a)      To export all theme policies

<?xml version="1.0" encoding="UTF-8"?>
<request xsi:noNamespaceSchemaLocation="PortalConfig_1.4.xsd"
 create-oids="true" type="export"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
     <portal action="locate">
        <policy-node action="export" label="WebPage"
                type="theme" path="">
             <url>file:///c:/temp/exportThemePolicies.xml</url>
        </policy-node>
    </portal>
</request>

b)      To export specific theme policy

<?xml version="1.0" encoding="UTF-8"?>
<request xsi:noNamespaceSchemaLocation="PortalConfig_1.4.xsd"
 create-oids="true" type="export"
 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <portal action="locate">
        <policy-node action="export" label="WebPage"
                type="theme" path="TestThemePolicy">
             <url>file:///c:/temp/exportTestThemePolicy.xml</url>
        </policy-node>
    </portal>
</request>


But from WP 7.0.X onwards , XML will be like below

a)      To export all theme policies

<?xml version="1.0" encoding="UTF-8"?>
<request xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd" 
         create-oids="true" type="export"  
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <portal action="locate">
        <policy-node action="export" path="/theme" />
    </portal>
</request>

b)      To export the specific theme policy

<?xml version="1.0" encoding="UTF-8"?>
<request xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd"
         create-oids="true" type="export"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <portal action="locate">
        <policy-node action="export" path="/theme/TestThemePolicy" />
    </portal>
</request>

c)      To delete theme policy

<request xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd"
         create-oids="true" type="update"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <portal action="locate">
        <policy-node action="delete" path="/theme/TestThemePolicy">
        </policy-node>
    </portal>
</request>

Run the following xmlacess command ( at /ibm/websphere/portalserver/bin/ )
xmlaccess.bat -in c:/siva_work/exportThemePolicy.xml -url http://localhost:10039/wps/config -user wpsadmin -password wpsadmin –out c:/siva_work/exportThemePolicyResults.xml

Creating Custom Themes in WP7

Following are the two ways we can build the custom themes in the WP7.  

Approach 1:  Using WebDav and separate WAR file
  1. Connect webdav client (like BitKinex or windows webfolders) to http://localhost:10039/wps/mycontenthandler/dav/themelist/
  2. Copy the existing theme pagebuilder2(csa2.theme) folder to local drive
  3. Change the theme title in the localized_en.properties file under the metadata folder and rename the entire folder (like customTheme)
  4. Copy that entire folder back to the http://localhost:10039/wps/mycontenthandler/dav/themelist/  (Make sure localized_en.properties file is updated on WebDav after copying)
  5. Now you should able to see the new theme (customTheme) in the themes and skins admin portlet. But dynamic resources are still pointing to pageBuilder2 theme
  6. Create war file based on the pagebuilder.war (location is \IBM\WebSphere\PortalServer\theme\wp.mashup.cc.theme\installedApps\wp.mashup.cc.theme.ear\PageBuilder2.war  ) make sure to change the "pagebuilder2" references
  7. Deploy the war file with your own contextroot (/customTheme) while installing, make sure to start the application after installation
  8. Connect to  http://localhost:10039/wps/mycontenthandler/dav/themelist/customTheme/  using webDav client(customTheme folder is the one copied in step 3)
  9. Follow the steps below to connect your theme with context root of installed WAR file
    1. Export the existing theme using the following xmlaccess script
<?xml version="1.0" encoding="UTF-8"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd" type="export" create-oids="true">
<portal action="locate">
<theme action="export" objectid="*" />
</portal>
</request>
    1. update the "customTheme" definition in exported results xml file as below (update the context root, resource root, and uniquename)
<theme action="update" active="false" context-root="/customTheme" default="false" domain="rel" objectid="ZJ_618LOIP300NI60IE2H5GHD3001" resourceroot="customTheme" uniquename="customTheme">
    1. Import the updated results xml file back to portal using xmlaccess.

  1. Change the theme.html file (by copying it to local drive , modify and copy back to webdav) . Assuming customTheme is your context root and name of theme
<link rel="dynamic-content" href="dyn-cs:id:head@tl:oid:csa2.theme">  replace with following <link rel="dynamic-content" href=" res:/customTheme/themes/html/customTheme/head.jsp">

Do the same for the remaining jsp's using following path.
res:/customTheme/themes/html/customTheme/bannerNav.jsp
res:/customTheme/themes/html/customTheme/search.jsp
res:/customTheme/themes/html/customTheme/bannerCommonActions.jsp
res:/customTheme/themes/html/customTheme/status.jsp
res:/customTheme/themes/html/customTheme/tabNav.jsp
res:/customTheme/themes/html/customTheme/pageToolbar.jsp
res:/customTheme/themes/html/customTheme/asa.jsp
res:/customTheme/themes/html/customTheme/config.jsp

Note : you may need to do the same changes in nls/theme_en.html file to take your changes effect.
  1. Now you theme is pointing to JSP's from the your custom WAR file and static resources from the webDav store, you can change the static resources directly using the WebDav directly.
  2. Assign this theme to any portal page (page properties-->select this theme)

Approach 2:  Using single WAR file

  1. Create war file based on the pagebuilder.war (location is \IBM\WebSphere\PortalServer\theme\wp.mashup.cc.theme\installedApps\wp.mashup.cc.theme.ear\PageBuilder2.war  ) . Make sure default.jsp conatins all logic to include your theme (like including the navigation and layout)

  1. Deploy the war file with your own contextroot (/customTheme) while installing, make sure to start the application after installation

  1. Run following XML using the xmlaccess to import the theme into portal

<?xml version="1.0" encoding="UTF-8"?>
<request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="PortalConfig_7.0.0.xsd" type="update" create-oids="true">
<portal action="locate">
<skin action="update" active="true" objectid="NoSkin" uniquename="wps.skin.noSkin" resourceroot="NoSkin" >
<localedata locale="en">
<title>NoSkin</title>
<description>A skin with no skin</description>
</localedata>
</skin>
<theme action="update" active="true" defaultskinref="NoSkin" uniquename="custome.sivasecondtheme" resourceroot="sivasecondtheme" context-root="/sivasecondtheme">
<localedata locale="en">
<title>sivasecondtheme</title>
</localedata>
<allowed-skin skin="NoSkin" update="set"/>
</theme>
</portal>
</request>

  1. Assign this theme to any portal page (page properties-->select this theme)