The Resource Manager Portlet allows you to publish pages developed on one server to another (You can also publish page from one virtual portal to another in same portal server). After publishing the page would be initially visible to only limited set of users (By default to administrators but you can change publishRule, personalization rule to add or remove users) and once you review page on the target server you can promote that page so that it becomes available to all the users.
After promoting a page to all the users you can demote it so that it is no longer visible, in that case portal will check if there is a backup of the page if yes then backup page becomes visible. Portal maintains backup of only one last page.
Please note couple of important limitations on Site Management
1) You can only publish a page which has unique name. It looks like the Resource Manager portlet is using unique name to relate page on source and target. The Resource portlet adds published word to the unique name while publishing it on target
2) Source and target portal should have parent page with same unique name for the site management to work
3) You cannot mix Site Management with xmlaccess. If your using Site management for publishing you will have to stick with it, trying to use some other method would break it. It must because of the logic in Resource Portlet that relates source page to
target page
Read Portal Transfer using Site Management page for more details on the
Implement custom unique names
You can assign a unique name to portal resource using Manage Custom Unique Names Portlet or using the Portal SPI. Once unique name is assigned to a resource you can use that name to locate the resource using either the Portal Scripting Interface or XMLAccess Script
You can assign unique name to either Pages, Portlet Applications, Portlets, URL Mapping Contexts, User Groups, Web Modules, WSRP Producers by following these steps.
1) go to Manage Custom Unique Names portlets.
2) Click on the type of resource that you want to work on Ex. Page
3) Seach the Page to which you want to assign unique name.
4) Once the page is found click on the Edit button and it will show you a form where you can assign unique name to the page.

Restrictions: There are couple of restrictions on value of custom unique name
1) A unique name must not exceed 256 characters in length
2) This name should be unique within the portal
You can assign unique name to either Pages, Portlet Applications, Portlets, URL Mapping Contexts, User Groups, Web Modules, WSRP Producers by following these steps.
1) go to Manage Custom Unique Names portlets.
2) Click on the type of resource that you want to work on Ex. Page
3) Seach the Page to which you want to assign unique name.
4) Once the page is found click on the Edit button and it will show you a form where you can assign unique name to the page.

Restrictions: There are couple of restrictions on value of custom unique name
1) A unique name must not exceed 256 characters in length
2) This name should be unique within the portal
Configure the locking mechanism

You can lock content of page by going to the Manage Pages Portlets and editing the page. Third tab is a lock tab that allows you to lock content on either page, row or column container or portlet.
In order to modify the locks for a certain page a user must have Editor role on that page.
- Row or column Container: If you lock the content of a container on a page then portlet cannot be added to that container or moved into or out of that container.
- Portlet:The delete option is the check box located in the top right corner of the container. When the delete box is unchecked for a portlet, the delete icon for the portlet is unavailable for users who are modifying the page in Edit Layout and Content.
- Page:When you lock a page you cannot add new containers to that page
IBM New Site Wizard
The New Site Wizard feature provides the ability to quickly and easily create virtual portals based on selecting a site template, an initial look and feel style, and optional features. The wizard is designed to be used by administrators and business users alike, to aid in building new sites to support a multi-tenancy portal. The wizard encapsulates many administrative tasks, such as user enrollment, virtual portal creation, and content library creation. Once the portal is created, site owners can easily customize the layout and look and feel.
Portal developers can enhance the New Site Wizard by creating custom site templates and then adding them to the wizard. After the custom site templates are added to the wizard, users can select them when they use the wizard to create their sites
By default, the New Site Wizard creates new sites as virtual portals. Administrators or developers can extend the New Site Wizard to create any type of portal site, such as a composite application instance or a unique set of common pages, by providing their own custom site creation task implementation and set of site templates that use it.
The IBM New Site Wizard portlet is available for download from IBM Solution Catalog.
Portal developers can enhance the New Site Wizard by creating custom site templates and then adding them to the wizard. After the custom site templates are added to the wizard, users can select them when they use the wizard to create their sites
By default, the New Site Wizard creates new sites as virtual portals. Administrators or developers can extend the New Site Wizard to create any type of portal site, such as a composite application instance or a unique set of common pages, by providing their own custom site creation task implementation and set of site templates that use it.
The IBM New Site Wizard portlet is available for download from IBM Solution Catalog.
Theme and Skin in seperate .ear
Starting from WPS 6.1 you can create a Theme or Skin in separate .war file and install it on portal. You dont have to modify the wps.war any more. I followed the Infocenter Instructions for Creating a new theme and skin to create MyTheme.war and MySkin.war along with my own version of DeployTheme.xml that i can use to deploy both MyTheme.war and MySkin.war. Attaching those files below[>
First install MyTheme.war and MySkin.war as enterprise applications from the WAS Admin Console and then execute the DeployTheme.xml as xmlaccess script.
Problem with Getting started with the client side programming model for portlets
The WebSPhere Portal Server 6.1 Infocenter provides this sample code for making an XMLHttpRequest method call
I tried this to make AJAX call to my Portlet and my serveResources() method looks like this
The serveResource() method gets called on the servlet but i never get a callback. On debugging i was able to find this in portlet.js
"The XMLPortletRequest will only work for URLs which point to the portlet fragment feed."
From the code it looks like as soon as it gets response the ibm.portal.portlet.XMLPortletRequest is trying to parse it as ATOM feed and since i am returning simple text it does not like that. But it does not throw an error.
<%@ taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model" prefix="portlet-client-model" %>
<portlet-client-model:init>
<portlet-client-model:require module="ibm.portal.xml.*"/>
<portlet-client-model:require module="ibm.portal.portlet.*"/>
</portlet-client-model:init>
<script>
var <%=namespace%>_portletWindow = new ibm.portal.portlet.PortletWindow("<%=portletWindowID%>");
</script>
<script>
function sendXPR( /*string*/url, /*Function*/callback, /*String*/errMsg ) {
var xpr = <%=namespace%>_portletWindow.newXMLPortletRequest();
var me = this;
xpr.onreadystatechange = function () {
if ( xpr.readyState == 4 ) {
if ( xpr.status == 200 ) {
callback( xpr.responseText );
}
else {
<%=namespace%>_portletWindow.logError(“The request failed!”, errMsg );
}
}
};
xpr.open( "GET", url );
xpr.send( null );
}
</script>
I tried this to make AJAX call to my Portlet and my serveResources() method looks like this
public void serveResource(ResourceRequest request, ResourceResponse response)
throws PortletException, IOException {
System.out.println("XHRSamplePortlet.serveResource() method is called");
response.getWriter().println("This text is returned by XHRSamplePortlet.serveResource()");
}
The serveResource() method gets called on the servlet but i never get a callback. On debugging i was able to find this in portlet.js
"The XMLPortletRequest will only work for URLs which point to the portlet fragment feed."
From the code it looks like as soon as it gets response the ibm.portal.portlet.XMLPortletRequest is trying to parse it as ATOM feed and since i am returning simple text it does not like that. But it does not throw an error.
Sample XHR request to portelt
This is the sample of how you can send the XHR request to the portlet and call its serveResource() method. Click here to download sample portlet
The sample in Infocenter about _portletWindow.newXMLPortletRequest never works. Even though i can see the XHR request my callback does not get called.
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>
<%@taglib
uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model"
prefix="portlet-client-model"%>
<portlet-client-model:init>
<portlet-client-model:require module="ibm.portal.xml.*" />
<portlet-client-model:require module="ibm.portal.portlet.*" />
</portlet-client-model:init>
<portlet:defineObjects />
<div id="test">initial text</div>
<script language="JavaScript">
function handleOnClick(){
console.log("Exiting handleOnClick");
dojo.xhrGet({
url: '<portlet:resourceURL/>',
load: function(data){
console.log("load is called");
dojo.byId("test").innerHTML = data;
},
error: function(data){
console.log("error is called")
}
});
console.log("Exiting handleOnClick");
}
</script>
<p><input type="submit" name="Test" value="Test" onclick="handleOnClick()"></p>
Sample code for working with User Profiles on the clent side
<%@page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1" session="false"%><%@taglib
uri="http://java.sun.com/portlet" prefix="portlet"%><%@taglib
uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model"
prefix="portlet-client-model"%><%@taglib
uri="http://java.sun.com/portlet" prefix="portletx"%><portlet-client-model:init>
<portlet-client-model:require module="ibm.portal.xml.*" />
<portlet-client-model:require module="ibm.portal.portlet.*" />
</portlet-client-model:init>
<portlet:defineObjects />
<p>User Profile Sample</p>
<script>
_portletWindow = new ibm.portal.portlet.PortletWindow("<%=portletWindowID%>");
function handleUserProfile(portletWindow, status, userProfile){
console.log("Inside handleUserProfile");
console.log(userProfile);
if (status==ibm.portal.portlet.PortletWindow.STATUS_OK) {
// This is sample of how to get attributes from User Profile
console.log("Preferences.getValue()\n"+ userProfile.getAttribute("uid"));
//Follow these two steps to set attribute
userProfile.setAttribute("displayName","Sunil Patil");
_portletWindow.setUserProfile(userProfile);
}
else {
console.log("error loading feed");
}
}
_portletWindow.getUserProfile(handleUserProfile);
</script>
You can download this sample from here
pageEncoding="ISO-8859-1" session="false"%><%@taglib
uri="http://java.sun.com/portlet" prefix="portlet"%><%@taglib
uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model"
prefix="portlet-client-model"%><%@taglib
uri="http://java.sun.com/portlet" prefix="portletx"%><portlet-client-model:init>
<portlet-client-model:require module="ibm.portal.xml.*" />
<portlet-client-model:require module="ibm.portal.portlet.*" />
</portlet-client-model:init>
<portlet:defineObjects />
<p>User Profile Sample</p>
<script>
_portletWindow = new ibm.portal.portlet.PortletWindow("<%=portletWindowID%>");
function handleUserProfile(portletWindow, status, userProfile){
console.log("Inside handleUserProfile");
console.log(userProfile);
if (status==ibm.portal.portlet.PortletWindow.STATUS_OK) {
// This is sample of how to get attributes from User Profile
console.log("Preferences.getValue()\n"+ userProfile.getAttribute("uid"));
//Follow these two steps to set attribute
userProfile.setAttribute("displayName","Sunil Patil");
_portletWindow.setUserProfile(userProfile);
}
else {
console.log("error loading feed");
}
}
_portletWindow.getUserProfile(handleUserProfile);
</script>
You can download this sample from here
JavaScript Butification
If you want to uncompress the JavaScript then you can use JavaScript Beautifier
WebSphere Portal Client Side API - Working with preferences
This is sample of how you can add, update, delete and read portlet preferences on the client side
<%@page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1" session="false"%>
<%@taglib uri="http://java.sun.com/portlet" prefix="portlet"%>
<%@taglib uri="http://www.ibm.com/xmlns/prod/websphere/portal/v6.1/portlet-client-model" prefix="portlet-client-model"%>
<%@taglib uri="http://java.sun.com/portlet" prefix="portletx"%>
<portlet-client-model:init>
<portlet-client-model:require module="ibm.portal.xml.*" />
<portlet-client-model:require module="ibm.portal.portlet.*" />
</portlet-client-model:init>
<portlet:defineObjects />
<script>
_portletWindow = new ibm.portal.portlet.PortletWindow("<%=portletWindowID%>");
function handleReadPreference(portletWindow, status, portletPrefs) {
if (status==ibm.portal.portlet.PortletWindow.STATUS_OK) {
console.log("Preferences.getValue()\n"+portletPrefs.getValue("testPref"));
var prefs = portletPrefs.getMap();
var mapStr = "Preferences.getMap()\number of preferences: "+prefs.length + "\n";
for (var i=0; i<prefs.length; i++) {
mapStr += i+" - "+prefs[i].name+" - "+prefs[i].values+" - "+prefs[i].readonly + "\n";
}
console.log(mapStr);
}
else { console.log("error loading feed"); }
}
function listPreferences(){
console.log('Entering test.listPreferences()');
_portletWindow.getPortletPreferences(handleReadPreference);
console.log('Exiting test.listPreferences()');
}
function handleAddPreference(portletWindow, status, portletPrefs){
if (status==ibm.portal.portlet.PortletWindow.STATUS_OK) {
portletPrefs.setValue('testPref','testPrefValue');
//Print the modified preferences on console using the handleReadPreference
_portletWindow.setPortletPreferences(portletPrefs,handleReadPreference);
} else { console.log("error loading feed"); }
}
function addPreference(){
console.log('Entering test.addPreference()');
_portletWindow.getPortletPreferences(handleAddPreference);
console.log('Entering test.addPreference()');
}
function handleDeletePreference(portletWindow, status, portletPrefs){
if (status==ibm.portal.portlet.PortletWindow.STATUS_OK) {
portletPrefs.reset('testPref');
//Print the modified preferences on console using the handleReadPreference
_portletWindow.setPortletPreferences(portletPrefs,handleReadPreference);
} else { console.log("error loading feed"); }
}
function deletePreference(){
console.log('Entering test.deletePreference()');
_portletWindow.getPortletPreferences(handleDeletePreference);
console.log('Entering test.deletePreference()');
}
function handleUpdatePreference(portletWindow, status, portletPrefs){
if (status==ibm.portal.portlet.PortletWindow.STATUS_OK) {
portletPrefs.setValue('testPref','testUpdatedValue');
//Print the modified preferences on console using the handleReadPreference
_portletWindow.setPortletPreferences(portletPrefs,handleReadPreference);
} else { console.log("error loading feed"); }
}
function updatePreference(){
console.log('Entering test.updatePreference()');
_portletWindow.getPortletPreferences(handleUpdatePreference);
console.log('Entering test.updatePreference()');
}
</script>
<p>This is sample preference</p>
<a href='<portlet:actionURL/> '>Set Preference</a>
<table>
<tr>
<td>
<input type="button" onclick='javascript:listPreferences()' name="Read" value="Read"/>
</td>
</tr>
<tr>
<td>
<input type="button" onclick='javascript:addPreference()' name="Add" value="Add"/>
</td>
</tr>
<tr>
<td>
<input type="button" onclick='javascript:updatePreference()' name="Update" value="Update"/>
</td>
</tr>
<tr>
<td>
<input type="button" onclick='javascript:deletePreference()' name="Delete" value="Delete"/>
</td>
</tr>
</table>
<p></p>
Subscribe to:
Posts (Atom)