You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@continuum.apache.org by ca...@apache.org on 2006/09/08 21:33:54 UTC

svn commit: r441626 - in /maven/continuum/branches/continuum-acegi/continuum-webapp/src/main: java/org/apache/maven/continuum/web/action/ProjectGroupPermissionsAction.java resources/xwork.xml webapp/projectGroupPermissions.jsp

Author: carlos
Date: Fri Sep  8 12:33:53 2006
New Revision: 441626

URL: http://svn.apache.org/viewvc?view=rev&rev=441626
Log:
More working in group permissions editing

Modified:
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupPermissionsAction.java
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/xwork.xml
    maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/projectGroupPermissions.jsp

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupPermissionsAction.java
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupPermissionsAction.java?view=diff&rev=441626&r1=441625&r2=441626
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupPermissionsAction.java (original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/java/org/apache/maven/continuum/web/action/ProjectGroupPermissionsAction.java Fri Sep  8 12:33:53 2006
@@ -16,7 +16,10 @@
  * limitations under the License.
  */
 
+import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Map;
 
 import org.apache.maven.continuum.ContinuumException;
 import org.apache.maven.continuum.model.project.ProjectGroup;
@@ -44,6 +47,8 @@
     private int projectGroupId;
 
     private List users;
+    
+    private Map map = new HashMap();
 
     public String execute()
         throws ContinuumException
@@ -60,6 +65,22 @@
     public String save()
         throws ContinuumException
     {
+        for(Iterator i = map.keySet().iterator(); i.hasNext(); ) {
+            String id = (String) i.next();
+            getLogger().info("key value == " + id);
+        }
+        for(Iterator i = map.values().iterator(); i.hasNext(); ) {
+            String[] id = (String[])i.next();
+            for (int y = 0; y < id.length; y++){
+                getLogger().info("class name == " + id[y].getClass().getSimpleName());
+                getLogger().info("value == " + id[y]);
+            }
+        }
+        // TODO - compare the values from the map to userManager.getUsersInstancePermissions() then save the differences
+        // NOTE: only the checkboxes that are checked are saved on the map.
+        //       each user has 4 possible checkboxes and all of them are saved into an array of String.
+        //       so to determine each checkbox(view) from the others(edit/delete/build), we need a special notation. see below...
+        // KEY FORMAT: username + view/edit/delete or build. sample would be adminbuild or guestview
         return SUCCESS;
     }
 
@@ -76,5 +97,13 @@
     public List getUsers()
     {
         return users;
+    }
+
+    public Map getMap() {
+        return map;
+    }
+
+    public void setMap(Map map) {
+        this.map = map;
     }
 }

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/xwork.xml
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/xwork.xml?view=diff&rev=441626&r1=441625&r2=441626
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/xwork.xml (original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/resources/xwork.xml Fri Sep  8 12:33:53 2006
@@ -99,6 +99,7 @@
     
     <action name="projectGroupPermissions" class="projectGroupPermissions">
       <result name="input">projectGroupPermissions.jsp</result>
+      <result name="success" type="chain">projectGroupView</result>
     </action>
 
     <!--

Modified: maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/projectGroupPermissions.jsp
URL: http://svn.apache.org/viewvc/maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/projectGroupPermissions.jsp?view=diff&rev=441626&r1=441625&r2=441626
==============================================================================
--- maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/projectGroupPermissions.jsp (original)
+++ maven/continuum/branches/continuum-acegi/continuum-webapp/src/main/webapp/projectGroupPermissions.jsp Fri Sep  8 12:33:53 2006
@@ -15,27 +15,43 @@
         <jsp:include page="/navigations/ProjectGroupMenu.jsp">
           <jsp:param name="tab" value="permissions"/>
         </jsp:include>
- 
+
         <h3>Users</h3>
- 
-        <ww:form id="myForm" action="projectGroupPermissions!save.action" method="post">
-          <ec:table items="users" 
-                    showExports="false"
-                    showPagination="false"
-                    showStatusBar="false"
-                    filterable="false"
-                    action="projectGroupPermissions!save.action"
-                    form="myForm">
-            <ec:row highlightRow="true">
-              <ec:column property="user.username" title="User Name" width="48%" />
-              <ec:column property="view" title="View" width="1%" sortable="false" cell="org.apache.maven.continuum.web.view.ProjectGroupPermissionsCell" />
-              <ec:column property="edit" title="Edit" width="1%" sortable="false" cell="org.apache.maven.continuum.web.view.ProjectGroupPermissionsCell" />
-              <ec:column property="delete" title="Delete" width="1%" sortable="false" cell="org.apache.maven.continuum.web.view.ProjectGroupPermissionsCell" />
-              <ec:column property="build" title="Build" width="1%" sortable="false" cell="org.apache.maven.continuum.web.view.ProjectGroupPermissionsCell" />
-            </ec:row>
-          </ec:table>
-          <ww:submit value="Save"/>
-        </ww:form>
+        <form action="projectGroupPermissions!save.action">
+          <ww:iterator value="users" id="user">
+            <ww:property value="user.username"/>
+            <ww:set name="view" value="<ww:property value='view'/>"/>
+            <ww:set name="edit" value="<ww:property value='edit'/>"/>
+            <ww:set name="delete" value="<ww:property value='delete'/>"/>
+            <ww:set name="build" value="<ww:property value='build'/>"/>
+            <ww:if test="view == true">
+              <input type="checkbox" name="map['<ww:property value="user.username"/>view']" checked="true">
+            </ww:if>
+            <ww:else>
+              <input type="checkbox" name="map['<ww:property value="user.username"/>view']">
+            </ww:else>
+            <ww:if test="edit == true">
+              <input type="checkbox" name="map['<ww:property value="user.username"/>edit']" checked="true">
+            </ww:if>
+            <ww:else>
+              <input type="checkbox" name="map['<ww:property value="user.username"/>edit']">
+            </ww:else>
+            <ww:if test="delete == true">
+              <input type="checkbox" name="map['<ww:property value="user.username"/>delete']" checked="true">
+            </ww:if>
+            <ww:else>
+              <input type="checkbox" name="map['<ww:property value="user.username"/>delete']">
+            </ww:else>
+            <ww:if test="build == true">
+              <input type="checkbox" name="map['<ww:property value="user.username"/>build']" checked="true">
+            </ww:if>
+            <ww:else>
+              <input type="checkbox" name="map['<ww:property value="user.username"/>build']">
+            </ww:else>
+            <br/>
+          </ww:iterator>
+          <input type="submit" value="Save"/>
+        </form>
       </div>
     </body> 
   </ww:i18n>