continuum-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From eveni...@apache.org
Subject svn commit: r564274 - in /maven/continuum/trunk/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ProjectsListAction.java resources/xwork.xml webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp
Date Thu, 09 Aug 2007 16:44:08 GMT
Author: evenisse
Date: Thu Aug  9 09:44:05 2007
New Revision: 564274

URL: http://svn.apache.org/viewvc?view=rev&rev=564274
Log:
[CONTINUUM-983] Add delete action to delete a subset of group members based on selection.

Added:
    maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
  (with props)
Modified:
    maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp

Added: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java?view=auto&rev=564274
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
(added)
+++ maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
Thu Aug  9 09:44:05 2007
@@ -0,0 +1,108 @@
+package org.apache.maven.continuum.web.action;
+
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+import org.apache.maven.continuum.ContinuumException;
+import org.apache.maven.continuum.web.exception.AuthorizationRequiredException;
+import org.codehaus.plexus.util.StringUtils;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * @author <a href="mailto:evenisse@apache.org">Emmanuel Venisse</a>
+ * @version $Id$
+ * @plexus.component role="com.opensymphony.xwork.Action" role-hint="projects"
+ */
+public class ProjectsListAction
+    extends ContinuumActionSupport
+{
+    private Collection selectedProjects;
+
+    private String projectGroupName = "";
+
+    private int projectGroupId;
+
+    public String remove()
+        throws ContinuumException
+    {
+        try
+        {
+            checkModifyProjectGroupAuthorization( getProjectGroupName() );
+        }
+        catch ( AuthorizationRequiredException e )
+        {
+            return REQUIRES_AUTHORIZATION;
+        }
+
+        if ( selectedProjects != null && !selectedProjects.isEmpty() )
+        {
+            for ( Iterator i = selectedProjects.iterator(); i.hasNext(); )
+            {
+                int projectId = Integer.parseInt( (String) i.next() );
+
+                try
+                {
+                    getLogger().info( "Removing Project with id=" + projectId );
+
+                    getContinuum().removeProject( projectId );
+                }
+                catch ( ContinuumException e )
+                {
+                    getLogger().error( "Error removing Project with id=" + projectId );
+                    addActionError( "Unable to remove Project with id=" + projectId );
+                }
+            }
+        }
+
+        return SUCCESS;
+    }
+
+    public String getProjectGroupName()
+        throws ContinuumException
+    {
+        if ( StringUtils.isEmpty( projectGroupName ) )
+        {
+            projectGroupName = getContinuum().getProjectGroup( projectGroupId ).getName();
+        }
+
+        return projectGroupName;
+    }
+
+    public Collection getSelectedProjects()
+    {
+        return selectedProjects;
+    }
+
+    public void setSelectedProjects( Collection selectedProjects )
+    {
+        this.selectedProjects = selectedProjects;
+    }
+
+    public int getProjectGroupId()
+    {
+        return projectGroupId;
+    }
+
+    public void setProjectGroupId( int projectGroupId )
+    {
+        this.projectGroupId = projectGroupId;
+    }
+}
\ No newline at end of file

Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: maven/continuum/trunk/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectsListAction.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml?view=diff&rev=564274&r1=564273&r2=564274
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml (original)
+++ maven/continuum/trunk/continuum-webapp/src/main/resources/xwork.xml Thu Aug  9 09:44:05
2007
@@ -201,6 +201,13 @@
       </result>
     </action>
 
+    <action name="removeProjects" class="projects" method="remove">
+      <result name="success" type="redirect-action">
+        <param name="actionName">projectGroupSummary</param>
+        <param name="projectGroupId">${projectGroupId}</param>
+      </result>
+    </action>
+
     <action name="buildProject" class="buildProject">
       <result name="success" type="chain">groupSummary</result>
       <result name="to_group_page" type="redirect-action">

Modified: maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp?view=diff&rev=564274&r1=564273&r2=564274
==============================================================================
--- maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp
(original)
+++ maven/continuum/trunk/continuum-webapp/src/main/webapp/WEB-INF/jsp/components/projectSummaryComponent.jsp
Thu Aug  9 09:44:05 2007
@@ -28,6 +28,7 @@
 
   <h3><ww:text name="projectGroup.projects.title"/></h3>
 
+  <form id="projectsForm" action="removeProjects.action" method="post">
   <ec:table items="projects"
             var="project"
             showExports="false"
@@ -40,6 +41,11 @@
       <%-- needed to access project in included pages --%>
       <c:set var="project" value="${pageScope.project}" scope="request"/>
 
+      <redback:ifAuthorized permission="continuum-modify-group" resource="${projectGroupName}">
+        <ec:column alias="checkbox" title=" " style="width:5px" filterable="false" sortable="false"
width="1%">
+          <input type="checkbox" name="selectedProjects" value="${project.id}" />
+        </ec:column>
+      </redback:ifAuthorized>
       <ec:column property="state" title="&nbsp;" width="1%" cell="org.apache.maven.continuum.web.view.StateCell"/>
       <ec:column property="name" title="summary.projectTable.name" width="50%">
         <ww:url id="projectUrl" action="projectView" namespace="/" includeParams="none">
@@ -180,5 +186,22 @@
       </ec:column>
     </ec:row>
   </ec:table>
+  <ww:if test="${not empty projects}">
+    <div class="functnbar3">
+      <table>
+        <tbody>
+          <tr>
+            <td>
+              <redback:ifAuthorized permission="continuum-modify-group" resource="${projectGroupName}">
+                <input type="hidden" name="projectGroupId" value="${project.projectGroupId}"
/>
+                <input type="button" name="delete-project" value="<ww:text name="delete"/>"
onclick="document.forms.projectsForm.submit();" />
+              </redback:ifAuthorized>
+            </td>
+          </tr>
+        </tbody>
+      </table>
+    </div>
+  </ww:if>
+  </form>
 </ww:if>
 </ww:i18n>



Mime
View raw message