[portal-commits] JBoss Portal SVN: r5804 - in trunk/core/src: main/org/jboss/portal/core/portlet/dashboard resources/portal-core-war/WEB-INF/jsp/dashboard

portal-commits at lists.jboss.org portal-commits at lists.jboss.org
Mon Dec 11 16:32:59 EST 2006


Author: roy.russo at jboss.com
Date: 2006-12-11 16:32:57 -0500 (Mon, 11 Dec 2006)
New Revision: 5804

Modified:
   trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
   trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
Log:
JBPORTAL-1138 - delete page feature in dashboard configurator

Modified: trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java
===================================================================
--- trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java	2006-12-11 20:52:39 UTC (rev 5803)
+++ trunk/core/src/main/org/jboss/portal/core/portlet/dashboard/Configurator.java	2006-12-11 21:32:57 UTC (rev 5804)
@@ -173,6 +173,7 @@
       {
          page = (Page)portal.getChild(editPage);
       }
+      editPage = page.getName();
 
       if ("copy".equals(op))
       {
@@ -294,6 +295,26 @@
          actionResponse.setRenderParameter("editPageSelect", pageName);
          actionResponse.setRenderParameter("op", "editPage");
       }
+      else if ("delete".equals(op))
+      {
+         String pageName = actionRequest.getParameter("pagename");
+         try
+         {
+            // TODO: check for default page.
+            portal.destroyChild(pageName);
+         }
+         catch (Exception e)
+         {
+            // do something
+         }
+
+         actionResponse.setRenderParameter("op", "editPage");
+      }
+      else
+      {
+         actionResponse.setRenderParameter("editPageSelect", editPage);
+         actionResponse.setRenderParameter("op", "editPage");
+      }
    }
 
    private int doWindowNaming()

Modified: trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp
===================================================================
--- trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp	2006-12-11 20:52:39 UTC (rev 5803)
+++ trunk/core/src/resources/portal-core-war/WEB-INF/jsp/dashboard/editpage.jsp	2006-12-11 21:32:57 UTC (rev 5804)
@@ -75,10 +75,20 @@
                for (int i = 0; i < pages.size(); i++)
                {
                   Page onePage = (Page)pages.get(i);
+                  if (onePage.getName().equals(currentPage))
+                  {
             %>
+            <option selected="true" value="<%= onePage.getName() %>"><%= onePage.getName() %>
+            </option>
+            <%
+            }
+            else
+            {
+            %>
             <option value="<%= onePage.getName() %>"><%= onePage.getName() %>
             </option>
             <%
+                  }
                }
             %>
          </select>
@@ -181,6 +191,24 @@
    </td>
 </tr>
 </table>
-</td>
-</tr>
-</table>
\ No newline at end of file
+<hr/>
+<%
+   if (!"default".equals(currentPage))
+   {
+%>
+<table width="100%">
+   <tr>
+      <td align="left">
+         <form action="<portlet:actionURL><portlet:param name="op" value="delete"></portlet:param>
+    </portlet:actionURL>" method="POST" style="padding:0;margin:0">
+            <input type="hidden" name="pagename" value="<%= currentPage %>"/>
+            <input type="submit" name="submit" value="Delete this Page"/>
+            <br/>
+            <font color="red">You cannot undo this action!</font>
+         </form>
+      </td>
+   </tr>
+</table>
+<%
+   }
+%>
\ No newline at end of file




More information about the portal-commits mailing list