+

Search Tips   |   Advanced Search

Portal, V6.1


 

Enable 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.1.0, 5.1.0.1, 5.1.0.2, 5.1.0.3, 5.1.0.4, or 5.1.0.5 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. 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.

 

Parent topic

Enabling new functionality in migrated themes