Author: sohil.shah(a)jboss.com
Date: 2008-06-30 12:18:54 -0400 (Mon, 30 Jun 2008)
New Revision: 11216
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/folderlist.jsp
Log:
JBPORTAL-2046 - Exception is thrown upon clicking the '+' symbol of the 'Root
Folder' node when moving content
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-06-30
16:16:11 UTC (rev 11215)
+++
branches/JBoss_Portal_Branch_2_6/core-cms/src/main/org/jboss/portal/core/cms/ui/admin/CMSAdminPortlet.java 2008-06-30
16:18:54 UTC (rev 11216)
@@ -253,34 +253,60 @@
}
else if (CMSAdminConstants.OP_CONFIRM_CREATE_COLLECTION.equals(op))
{
- String sNavPath = rReq.getParameter("navpath");
-
- List folders = this.getFolderList(sNavPath);
-
- rReq.setAttribute("folders", folders);
- rRes.setContentType("text/html");
- rReq.setAttribute("navpath", sNavPath);
-
- String sPath = rReq.getParameter("path");
- rRes.setContentType("text/html");
- rReq.setAttribute("createpath", sPath);
- javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/confirmcreatecollection.jsp");
- prd.include(rReq, rRes);
+ try
+ {
+ String sNavPath = rReq.getParameter("navpath");
+
+ List folders = this.getFolderList(sNavPath);
+ if((folders == null || folders.isEmpty()) &&
+ !sNavPath.equals("/"))
+ {
+ sNavPath = NodeUtil.getParentPath(sNavPath);
+ folders = this.getFolderList(sNavPath);
+ }
+
+ rReq.setAttribute("folders", folders);
+ rRes.setContentType("text/html");
+ rReq.setAttribute("navpath", sNavPath);
+
+ String sPath = rReq.getParameter("path");
+ rRes.setContentType("text/html");
+ rReq.setAttribute("createpath", sPath);
+ javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/confirmcreatecollection.jsp");
+ prd.include(rReq, rRes);
+ }
+ catch(Exception e)
+ {
+ throw new PortletException(e);
+ }
}
else if (CMSAdminConstants.OP_UPLOADCONFIRM.equals(op))
{
- String sPath = rReq.getParameter("path");
- String sNavPath = rReq.getParameter("navpath");
-
- List folders = this.getFolderList(sNavPath);
-
- rReq.setAttribute("folders", folders);
- rRes.setContentType("text/html");
- rReq.setAttribute("currpath", sPath);
- rReq.setAttribute("navpath", sNavPath);
- rReq.setAttribute("defaultlocale", CMSService.getDefaultLocale());
- javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/upload.jsp");
- prd.include(rReq, rRes);
+ try
+ {
+ String sPath = rReq.getParameter("path");
+ String sNavPath = rReq.getParameter("navpath");
+
+ List folders = this.getFolderList(sNavPath);
+ if((folders == null || folders.isEmpty()) &&
+ !sNavPath.equals("/"))
+ {
+ sNavPath = NodeUtil.getParentPath(sNavPath);
+ folders = this.getFolderList(sNavPath);
+ }
+
+ rReq.setAttribute("folders", folders);
+ rRes.setContentType("text/html");
+ rReq.setAttribute("currpath", sPath);
+ rReq.setAttribute("navpath", sNavPath);
+ rReq.setAttribute("defaultlocale", CMSService.getDefaultLocale());
+ javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/upload.jsp");
+ prd.include(rReq, rRes);
+ }
+ catch(Exception e)
+ {
+ throw new PortletException(e);
+ }
}
else if (CMSAdminConstants.OP_VIEWFILE.equals(op))
{
@@ -364,49 +390,88 @@
}
else if (CMSAdminConstants.OP_UPLOADARCHIVECONFIRM.equals(op))
{
- String sPath = rReq.getParameter("path");
- String sNavPath = rReq.getParameter("navpath");
-
- List folders = this.getFolderList(sNavPath);
-
- rReq.setAttribute("folders", folders);
- rRes.setContentType("text/html");
- rReq.setAttribute("currpath", sPath);
- rReq.setAttribute("navpath", sNavPath);
- javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/uploadarchive.jsp");
- prd.include(rReq, rRes);
+ try
+ {
+ String sPath = rReq.getParameter("path");
+ String sNavPath = rReq.getParameter("navpath");
+
+ List folders = this.getFolderList(sNavPath);
+ if((folders == null || folders.isEmpty()) &&
+ !sNavPath.equals("/"))
+ {
+ sNavPath = NodeUtil.getParentPath(sNavPath);
+ folders = this.getFolderList(sNavPath);
+ }
+
+ rReq.setAttribute("folders", folders);
+ rRes.setContentType("text/html");
+ rReq.setAttribute("currpath", sPath);
+ rReq.setAttribute("navpath", sNavPath);
+ javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/uploadarchive.jsp");
+ prd.include(rReq, rRes);
+ }
+ catch(Exception e)
+ {
+ throw new PortletException(e);
+ }
}
else if (CMSAdminConstants.OP_CONFIRMCOPY.equals(op))
{
- String sPath = rReq.getParameter("path");
- String sNavPath = rReq.getParameter("navpath");
- String sType = rReq.getParameter("type");
-
- List folders = this.getFolderList(sNavPath);
-
- rReq.setAttribute("folders", folders);
- rRes.setContentType("text/html");
- rReq.setAttribute("currpath", sPath);
- rReq.setAttribute("navpath", sNavPath);
- rReq.setAttribute("type", sType);
- javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/confirmcopy.jsp");
- prd.include(rReq, rRes);
+ try
+ {
+ String sPath = rReq.getParameter("path");
+ String sNavPath = rReq.getParameter("navpath");
+ String sType = rReq.getParameter("type");
+
+ List folders = this.getFolderList(sNavPath);
+ if((folders == null || folders.isEmpty()) &&
+ !sNavPath.equals("/"))
+ {
+ sNavPath = NodeUtil.getParentPath(sNavPath);
+ folders = this.getFolderList(sNavPath);
+ }
+
+ rReq.setAttribute("folders", folders);
+ rRes.setContentType("text/html");
+ rReq.setAttribute("currpath", sPath);
+ rReq.setAttribute("navpath", sNavPath);
+ rReq.setAttribute("type", sType);
+ javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/confirmcopy.jsp");
+ prd.include(rReq, rRes);
+ }
+ catch(Exception e)
+ {
+ throw new PortletException(e);
+ }
}
else if (CMSAdminConstants.OP_CONFIRMMOVE.equals(op))
{
- String sPath = rReq.getParameter("path");
- String sNavPath = rReq.getParameter("navpath");
- String sType = rReq.getParameter("type");
-
- List folders = this.getFolderList(sNavPath);
-
- rReq.setAttribute("folders", folders);
- rRes.setContentType("text/html");
- rReq.setAttribute("currpath", sPath);
- rReq.setAttribute("navpath", sNavPath);
- rReq.setAttribute("type", sType);
- javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/confirmmove.jsp");
- prd.include(rReq, rRes);
+ try
+ {
+ String sPath = rReq.getParameter("path");
+ String sNavPath = rReq.getParameter("navpath");
+ String sType = rReq.getParameter("type");
+
+ List folders = this.getFolderList(sNavPath);
+ if((folders == null || folders.isEmpty()) &&
+ !sNavPath.equals("/"))
+ {
+ sNavPath = NodeUtil.getParentPath(sNavPath);
+ folders = this.getFolderList(sNavPath);
+ }
+
+ rReq.setAttribute("folders", folders);
+ rRes.setContentType("text/html");
+ rReq.setAttribute("currpath", sPath);
+ rReq.setAttribute("navpath", sNavPath);
+ rReq.setAttribute("type", sType);
+ javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/confirmmove.jsp");
+ prd.include(rReq, rRes);
+ }
+ catch(Exception e)
+ {
+ throw new PortletException(e);
+ }
}
else if (CMSAdminConstants.OP_CONFIRMDELETE.equals(op))
{
@@ -538,17 +603,30 @@
}
else if (CMSAdminConstants.OP_EXPORTARCHIVE.equals(op))
{
- String sPath = rReq.getParameter("path");
- String sNavPath = rReq.getParameter("navpath");
-
- List folders = this.getFolderList(sNavPath);
-
- rReq.setAttribute("folders", folders);
- rRes.setContentType("text/html");
- rReq.setAttribute("currpath", sPath);
- rReq.setAttribute("navpath", sNavPath);
- javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/exportarchive.jsp");
- prd.include(rReq, rRes);
+ try
+ {
+ String sPath = rReq.getParameter("path");
+ String sNavPath = rReq.getParameter("navpath");
+
+ List folders = this.getFolderList(sNavPath);
+ if((folders == null || folders.isEmpty()) &&
+ !sNavPath.equals("/"))
+ {
+ sNavPath = NodeUtil.getParentPath(sNavPath);
+ folders = this.getFolderList(sNavPath);
+ }
+
+ rReq.setAttribute("folders", folders);
+ rRes.setContentType("text/html");
+ rReq.setAttribute("currpath", sPath);
+ rReq.setAttribute("navpath", sNavPath);
+ javax.portlet.PortletRequestDispatcher prd =
getPortletContext().getRequestDispatcher(CMSAdminConstants.CMS_JSP_PATH +
"/exportarchive.jsp");
+ prd.include(rReq, rRes);
+ }
+ catch(Exception e)
+ {
+ throw new PortletException(e);
+ }
}
else if (CMSAdminConstants.OP_EXPORTARCHIVE_PICKUP.equals(op))
{
Modified:
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/folderlist.jsp
===================================================================
---
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/folderlist.jsp 2008-06-30
16:16:11 UTC (rev 11215)
+++
branches/JBoss_Portal_Branch_2_6/core-cms/src/resources/portal-cms-war/WEB-INF/jsp/cms/admin/folderlist.jsp 2008-06-30
16:18:54 UTC (rev 11216)
@@ -26,7 +26,7 @@
<a href="<portlet:renderURL>
<portlet:param name="op" value="<%= OP %>"/>
- <portlet:param name="path" value="/"/>
+ <portlet:param name="path" value="<%= sCurrPath %>"/>
<portlet:param name="navpath" value="/"/>
<%
if (sCMType != null)