WebSphere Portal, Express Beta Version 6.1
Operating systems: i5/OS, Linux,Windows


Enabling drag-and-drop in migrated skins

Drag-and-drop support was not available before V6.0, so you cannot access this functionality in migrated skins from V5.0.2.2 or V5.0.2.3 unless you explicitly enable it.

Use the following steps to enable drag-and-drop in your migrated skins
  1. Add the following code near the top of the file Control.jsp.
    <%@ taglib uri="/WEB-INF/tld/dnd.tld" prefix="dnd" %>
    <dnd:DNDPortletHelper/>
    
    <%!
    private static com.ibm.portal.identification.Identification identification;
    public void jspInit(){
        try{
            /* Perform this JNDI lookup once as it hinders performance */
            javax.naming.Context ctx = new javax.naming.InitialContext();
            identification = (com.ibm.portal.identification.Identification) 
    					ctx.lookup( "portal:service/Identification" );
    	}
        catch ( javax.naming.NamingException ne ){
        // nothing is logged here because if Portal ever enters
    		// this catch statement then severe problems have 
    		// occurred and will have already been logged by 
    		// errors reported by the lookup.
     
      }
    }
    %>
  2. In the file Control.jsp, enclose the table containing the container of your portlet's skin with a <drag> tag. Also place a <dragHandle> tag around your portlet title bar, but not on the buttons in the title bar. The following code provides an example:
    <%-- Modification for Drag and Drop - need to pass the portlet control ID - Cannot use the 
    		tag because it is an attribute --%>
    <% 
        String currentLayoutNodeStr = "";
        if (pageContext.getAttribute("currentLayoutNode", pageContext.REQUEST_SCOPE) != null) { 
            LayoutNode currLayoutNode = (LayoutNode)pageContext.getAttribute("currentLayoutNode", 
    					pageContext.REQUEST_SCOPE);
            currentLayoutNodeStr = identification.serialize(currLayoutNode.getObjectID());
        } 
        else {
    		LayoutNode currLayoutNode=(LayoutNode)pageContext.getRequest().getAttribute
    			("com.ibm.wps.composition.element");
    		currentLayoutNodeStr=identification.serialize(currLayoutNode.getObjectID());
    	}
                                        	
    %>
    <dnd:drag namespace="wp" type="portlet_windowID" value="<%=currentLayoutNodeStr%>" 
    includeDragHandle="false" validator="com.ibm.wps.dnd.impl.DNDDragPortletValidator">
    
    	.......   BEGIN SKIN MARKUP .......
    	.......   BEGIN TITLE BAR .......
    
    	<dnd:dragHandle>TITLE BAR CONTENT</dnd:dragHandle>TITLEBAR BUTTONS
    
    	.......   END TITLE BAR   .......
    	.......   PORTLET RENDER .......
    	.......   END SKIN MARKUP .......
    </dnd:drag>
    
  3. Copy the files UnlayeredContainer-H.jsp and UnlayeredContainer-V.jsp from the V6.1 default skin into your skin's directory. If you customized either of these files, merge the code/markup from the customized versions of the files into the default skin version of the files.
Related tasks
Adding support for top-level navigation
Enabling the Organize Favorites portlet in themes
Making search options easier to read
Making inadvertent changes to the default theme

Library | Support | Terms of use |

Last updated: Wednesday, February 20, 2008 10:51am EST

Copyright IBM Corporation 2000, 2008. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)