clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From i..@apache.org
Subject svn commit: r960043 - in /incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface: ./ src/main/java/org/apache/clerezza/platform/usermanager/webinterface/ src/main/resources/org/apache/clerezza/platform...
Date Fri, 02 Jul 2010 16:01:34 GMT
Author: ito
Date: Fri Jul  2 16:01:33 2010
New Revision: 960043

URL: http://svn.apache.org/viewvc?rev=960043&view=rev
Log:
CLEREZZA-250: using permissiondescriptions in usermanager.webinterface: initial gui update

Added:
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-role-permission.js
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-user-permission.js
Modified:
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/pom.xml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/java/org/apache/clerezza/platform/usermanager/webinterface/UserManagerWeb.java
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-multiple-property-template.xhtml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-single-property-template.xhtml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-user-template.xhtml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/custom-field-template.xhtml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/custom-property-template.xhtml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/role-overview-template.xhtml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/role-permission-template.xhtml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-overview.js
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-role-overview.js
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/update-user-template.xhtml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/user-overview-template.xhtml
    incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/user-permission-template.xhtml

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/pom.xml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/pom.xml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/pom.xml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/pom.xml Fri Jul  2 16:01:33 2010
@@ -80,6 +80,10 @@
 			<groupId>org.apache.clerezza</groupId>
 			<artifactId>org.apache.clerezza.platform.config</artifactId>
 		</dependency>
+		<dependency>
+			<groupId>org.apache.clerezza</groupId>
+			<artifactId>org.apache.clerezza.permissiondescriptions</artifactId>
+		</dependency>
 	</dependencies>
 	<build>
 		<plugins>

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/java/org/apache/clerezza/platform/usermanager/webinterface/UserManagerWeb.java
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/java/org/apache/clerezza/platform/usermanager/webinterface/UserManagerWeb.java?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/java/org/apache/clerezza/platform/usermanager/webinterface/UserManagerWeb.java (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/java/org/apache/clerezza/platform/usermanager/webinterface/UserManagerWeb.java Fri Jul  2 16:01:33 2010
@@ -28,7 +28,6 @@ import java.security.AccessControlExcept
 import java.security.AccessController;
 import java.util.ArrayList;
 import java.util.Arrays;
-import java.util.Collections;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -56,6 +55,8 @@ import javax.ws.rs.core.Response.Status;
 import org.apache.clerezza.jaxrs.utils.RedirectUtil;
 import org.apache.clerezza.jaxrs.utils.TrailingSlash;
 import org.apache.clerezza.jaxrs.utils.form.MultiPartBody;
+import org.apache.clerezza.permissiondescriptions.PermissionDescripton;
+import org.apache.clerezza.permissiondescriptions.PermissionGatherer;
 import org.apache.clerezza.platform.config.SystemConfig;
 import org.apache.clerezza.platform.dashboard.GlobalMenuItem;
 import org.apache.clerezza.platform.dashboard.GlobalMenuItemsProvider;
@@ -80,6 +81,7 @@ import org.apache.clerezza.rdf.core.impl
 import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
 import org.apache.clerezza.rdf.core.impl.TripleImpl;
 import org.apache.clerezza.rdf.core.sparql.ParseException;
+import org.apache.clerezza.rdf.ontologies.DCTERMS;
 import org.apache.clerezza.rdf.ontologies.FOAF;
 import org.apache.clerezza.rdf.ontologies.LIST;
 import org.apache.clerezza.rdf.ontologies.PERMISSION;
@@ -122,6 +124,9 @@ public class UserManagerWeb implements G
 	private RenderletManager renderletManager;
 
 	@Reference
+	private PermissionGatherer permGatherer;
+
+	@Reference
 	private ContentGraphProvider cgProvider;
 
 	@Reference
@@ -145,7 +150,7 @@ public class UserManagerWeb implements G
 
 		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
 				new UriRef(getClass().getResource(
-						"user-overview-template.xhtml").toURI().toString()),
+				"user-overview-template.xhtml").toURI().toString()),
 				USERMANAGER.UserOverviewPage, "naked",
 				MediaType.APPLICATION_XHTML_XML_TYPE, true);
 		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
@@ -158,8 +163,8 @@ public class UserManagerWeb implements G
 				USERMANAGER.UserPermissionPage, "naked",
 				MediaType.APPLICATION_XHTML_XML_TYPE, true);
 		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
-				new UriRef(getClass().getResource("update-user-template.xhtml")
-						.toURI().toString()), USERMANAGER.UpdateUserPage, "naked",
+				new UriRef(getClass().getResource(
+				"update-user-template.xhtml").toURI().toString()), USERMANAGER.UpdateUserPage, "naked",
 				MediaType.APPLICATION_XHTML_XML_TYPE, true);
 		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
 				new UriRef(getClass().getResource(
@@ -168,12 +173,12 @@ public class UserManagerWeb implements G
 				MediaType.APPLICATION_XHTML_XML_TYPE, true);
 		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
 				new UriRef(getClass().getResource(
-						"role-overview-template.xhtml").toURI().toString()),
+				"role-overview-template.xhtml").toURI().toString()),
 				USERMANAGER.RoleOverviewPage, "naked",
 				MediaType.APPLICATION_XHTML_XML_TYPE, true);
 		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
 				new UriRef(getClass().getResource(
-						"role-permission-template.xhtml").toURI().toString()),
+				"role-permission-template.xhtml").toURI().toString()),
 				USERMANAGER.RolePermissionPage, "naked",
 				MediaType.APPLICATION_XHTML_XML_TYPE, true);
 		renderletManager.registerRenderlet(ScalaServerPagesRenderlet.class.getName(),
@@ -544,6 +549,22 @@ public class UserManagerWeb implements G
 
 		MGraph resultGraph = new SimpleMGraph();
 		NonLiteral userPermissionPage = new BNode();
+		Iterator<PermissionDescripton> permDescs = permGatherer.getAllPermissionDescriptors();
+		while(permDescs.hasNext()) {
+			PermissionDescripton desc = permDescs.next();
+			BNode providedPermission = new BNode();
+			resultGraph.add(new TripleImpl(userPermissionPage,
+					USERMANAGER.permission, providedPermission));
+
+			resultGraph.add(new TripleImpl(providedPermission,
+					PERMISSION.javaPermissionEntry, new PlainLiteralImpl(desc.getJavaPermissionString())));
+
+			resultGraph.add(new TripleImpl(providedPermission,
+					DCTERMS.title, new PlainLiteralImpl(desc.getSimpleName())));
+
+			resultGraph.add(new TripleImpl(providedPermission,
+					DCTERMS.description, new PlainLiteralImpl(desc.getDescription())));
+		}	
 		resultGraph.add(new TripleImpl(userPermissionPage, RDF.type,
 				PLATFORM.HeadedPage));
 		resultGraph.add(new TripleImpl(userPermissionPage, RDF.type,
@@ -555,10 +576,6 @@ public class UserManagerWeb implements G
 					USERMANAGER.user, user));
 			Iterator<NonLiteral> permissions = userManager
 					.getPermissionsOfUser(user);
-			while (permissions.hasNext()) {
-				resultGraph.add(new TripleImpl(userPermissionPage,
-						USERMANAGER.permission, permissions.next()));
-			}
 			return new GraphNode(userPermissionPage, new UnionMGraph(
 					resultGraph, systemGraph));
 			
@@ -569,6 +586,22 @@ public class UserManagerWeb implements G
 	}
 
 	/**
+	 * update user permissionEntries
+	 */
+	@POST
+	@Path("update-user-permissions")
+	public Response updateUserPermissions(
+			@FormParam(value = "name") String userName,
+			@FormParam(value = "permEntries") List<String> permissionEntries,
+			@Context UriInfo uriInfo) {
+		checkUserParam(userName);
+		userManager.deleteAllPermissionsOfUser(userName);
+		userManager.assignPermissionsToUser(userName, permissionEntries);
+		return Response.status(Status.CREATED).build();
+	
+	}
+
+	/**
 	 * add user permissionEntries
 	 */
 	@POST
@@ -786,6 +819,20 @@ public class UserManagerWeb implements G
 
 		MGraph resultGraph = new SimpleMGraph();
 		NonLiteral rolePermissionPage = new BNode();
+		Iterator<PermissionDescripton> permDescs = permGatherer.getAllPermissionDescriptors();
+		while(permDescs.hasNext()) {
+			PermissionDescripton desc = permDescs.next();
+			BNode providedPermission = new BNode();
+			resultGraph.add(new TripleImpl(rolePermissionPage,
+					USERMANAGER.permission, providedPermission));
+			resultGraph.add(new TripleImpl(providedPermission,
+					PERMISSION.javaPermissionEntry, new PlainLiteralImpl(desc.getJavaPermissionString())));
+			resultGraph.add(new TripleImpl(providedPermission,
+					DCTERMS.title, new PlainLiteralImpl(desc.getSimpleName())));
+			resultGraph.add(new TripleImpl(providedPermission,
+					DCTERMS.description, new PlainLiteralImpl(desc.getDescription())));
+		}
+
 		resultGraph.add(new TripleImpl(rolePermissionPage, RDF.type,
 				PLATFORM.HeadedPage));
 		resultGraph.add(new TripleImpl(rolePermissionPage, RDF.type,
@@ -795,15 +842,13 @@ public class UserManagerWeb implements G
 		if (role != null) {
 			resultGraph.add(new TripleImpl(rolePermissionPage,
 					USERMANAGER.role, role));
-			Iterator<NonLiteral> permissions = userManager
-					.getPermissionsOfRole(role);
-			while (permissions.hasNext()) {
-				resultGraph.add(new TripleImpl(rolePermissionPage,
-						USERMANAGER.permission, permissions.next()));
-			}
+			return new GraphNode(rolePermissionPage, new UnionMGraph(
+					resultGraph, systemGraph));
+
 		}
-		return new GraphNode(rolePermissionPage, new UnionMGraph(resultGraph,
-				systemGraph));
+		throw new WebApplicationException(Response.status(Status.NOT_FOUND)
+				.entity("Role " + role + "does not exist in our database")
+				.build());
 	}
 
 	/**
@@ -848,6 +893,25 @@ public class UserManagerWeb implements G
 		}
 	}
 
+	/**
+	 * update role permissionEntries
+	 */
+	@POST
+	@Path("update-role-permissions")
+	public Response updateRolePermissions(
+			@FormParam(value = "roleTitle") String title,
+			@FormParam(value = "permEntries") List<String> permissionEntries,
+			@Context UriInfo uriInfo) {
+
+		checkRoleParam(title);
+		userManager.deleteAllPermissionsOfRole(title);
+		userManager.assignPermissionsToRole(title, permissionEntries);
+
+		return Response.status(Status.CREATED).build();
+		
+	}
+
+
 	@GET
 	@Path("add-single-property")
 	public GraphNode getAddSinglePropertyPage(
@@ -963,8 +1027,7 @@ public class UserManagerWeb implements G
 	@Path("{path:.+}")
 	public PathNode getStaticFile(@PathParam("path") String path) {
 		final PathNode node = fileServer.getNode(path);
-		return node;
-
+		return node;	
 	}
 
 	@Override

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-multiple-property-template.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-multiple-property-template.xhtml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-multiple-property-template.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-multiple-property-template.xhtml Fri Jul  2 16:01:33 2010
@@ -6,7 +6,7 @@ resultDocModifier.addNodes2Elem("tx-modu
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="list-users">Users</a></li>);
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="list-roles">Roles</a></li>);
 
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-generic" href="list-roles">Back</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-generic" href="list-roles">Back to Overview</a></li>);
 resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-create" href="#">Save</a></li>);
 		 
         <div id="tx-content">

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-single-property-template.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-single-property-template.xhtml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-single-property-template.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-single-property-template.xhtml Fri Jul  2 16:01:33 2010
@@ -6,7 +6,7 @@ resultDocModifier.addNodes2Elem("tx-modu
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="list-users">Users</a></li>);
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="list-roles">Roles</a></li>);
 
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-generic" href="list-roles">Back</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-generic" href="list-roles">Back to Overview</a></li>);
 resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-create" href="#">Save</a></li>);
 
 

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-user-template.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-user-template.xhtml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-user-template.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/add-user-template.xhtml Fri Jul  2 16:01:33 2010
@@ -9,7 +9,7 @@ resultDocModifier.addNodes2Elem("tx-modu
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Users</a></li>);
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="list-roles">Roles</a></li>);
 
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-modify" href="list-users">Cancel</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-generic" href="list-users">Back to Overview</a></li>);
 resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-create" href="javascript:saveUser()">Save</a></li>);
 
 

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/custom-field-template.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/custom-field-template.xhtml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/custom-field-template.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/custom-field-template.xhtml Fri Jul  2 16:01:33 2010
@@ -9,7 +9,7 @@ resultDocModifier.addNodes2Elem("tx-modu
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Users</a></li>);
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="list-roles">Roles</a></li>);
 
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-generic" href="list-roles">Cancel</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-generic" href="list-roles">Back to Overview</a></li>);
 resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-create" href="javascript:saveUser()">Save</a></li>);
 
         <div id="tx-content">

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/custom-property-template.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/custom-property-template.xhtml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/custom-property-template.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/custom-property-template.xhtml Fri Jul  2 16:01:33 2010
@@ -9,7 +9,7 @@ resultDocModifier.addNodes2Elem("tx-modu
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="list-users">Users</a></li>);
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="list-roles">Roles</a></li>);
 
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-generic" href="list-roles">Back</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-generic" href="list-roles">Back to Overview</a></li>);
 
 
 

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/role-overview-template.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/role-overview-template.xhtml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/role-overview-template.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/role-overview-template.xhtml Fri Jul  2 16:01:33 2010
@@ -2,10 +2,10 @@ def permission(s: Any) = new UriRef("htt
 def umr(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#" + s)
 def dc(s: Any) = new UriRef("http://purl.org/dc/elements/1.1/" + s)
 def rdf(s: Any) = new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#" + s)
+def rdfs(s: Any) = new UriRef("http://www.w3.org/2000/01/rdf-schema#" + s)
 
 resultDocModifier.addStyleSheet("js/fancybox/jquery.fancybox.css");
 resultDocModifier.addScriptReference("js/fancybox/jquery.fancybox-1.2.1.pack.js");
-resultDocModifier.addScriptReference("js/customfield.js");
 resultDocModifier.addScriptReference("js/usermanager-role-overview.js");
 
 resultDocModifier.setTitle("User Manager");
@@ -14,28 +14,26 @@ resultDocModifier.addNodes2Elem("tx-modu
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="list-users">Users</a></li>);
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Roles</a></li>);
 
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-remove" href="#">Remove</a></li>);
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-create" href="add-role.xhtml">Create</a></li>)
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-remove tx-inactive" href="#">Delete</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="showPermissionsButton" class="tx-button tx-button-modify tx-inactive" href="#">Show Permission</a></li>);
 
 		<div id="tx-content">
-			<div class="tx-panel">
 
-			</div>
-
-			<div class="tx-list">
-				<fieldset>
+			<div class="tx-tree">
+				<fieldset >
 					<table>
 						<colgroup>
-							<col width="40" />
-							<col width="40" />
-							<col width="80" />
-							<col width="100" />
+							<col width="10" />
+							<col width="240" />
+							<col width="300" />
+							<col/>
 						</colgroup>
 						<thead>
 							<tr>
-								<th colspan="2"><a href="">Name</a></th>
-								<th><a href="">Special</a></th>
-								<th><a href="">Permissions</a></th>
+								<th></th>
+								<th><a href="">Name</a></th>
+								<th><a href="">Description</a></th>
+								<th><a href="">Special Properties</a></th>
 							</tr>
 						</thead>
 						<tbody>
@@ -53,22 +51,37 @@ resultDocModifier.addNodes2Elem("tx-cont
 										}
 										if (!isBaseRole) {
 											<input type="checkbox" 	value={role/dc("title")*}/>
-										} else {}
+										} else {
+											<input type="checkbox" disabled="disabled"	value={role/dc("title")*}/>
+										}
 
 									}
 								</td>
 								<td>{role/dc("title")*}</td>
+								<td style="line-height: 1.5em;">{role/rdfs("comment")*}</td>
 								<td>
 									<a href={"add-single-property?roleTitle=" + (role/dc("title")*)} >add single-valued property</a> /
 									<a href={"add-multiple-property?roleTitle=" + (role/dc("title")*)} >add multiple-valued property</a> /
 									<a href={"manage-custom-properties?role=" + (role/dc("title")*)} >manage customfields</a>
 								</td>
-								<td><a href={"manage-role-permissions?roleTitle=" + (role/dc("title")*)}>show permissions</a></td>
 							</tr>
 					   }
 					}
 					</tbody>
 					</table>
 				</fieldset>
+				<br/>
+				<br/>
+				<h2>Add a new Role</h2>
+				<form id="form1" method="post" action="/admin/user-manager/add-role">
+					<div>
+						<label for="roleTitle">Title: </label>
+						<input name="roleTitle" type="text" />
+						<a id="saveButton" href="#" class="tx-button tx-button-create">Create Role</a>
+					</div>
+				</form>
+				<br/>
+				<br/>
+				
 			</div>
 		</div>

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/role-permission-template.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/role-permission-template.xhtml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/role-permission-template.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/role-permission-template.xhtml Fri Jul  2 16:01:33 2010
@@ -1,6 +1,11 @@
 def dc(s: Any) = new UriRef("http://purl.org/dc/elements/1.1/" + s)
 def permission(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#" + s)
 def umr(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#" + s)
+def dct(s: Any) = new UriRef("http://purl.org/dc/terms/" + s)
+
+resultDocModifier.addScriptReference("/scripts/alert-message.js");
+resultDocModifier.addScriptReference("/scripts/ajax-options.js");
+resultDocModifier.addScriptReference("js/usermanager-role-permission.js");
 
 resultDocModifier.setTitle("User Manager");
 resultDocModifier.addNodes2Elem("tx-module", <h1>User Manager</h1>);
@@ -8,49 +13,65 @@ resultDocModifier.addNodes2Elem("tx-modu
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="list-users">Users</a></li>);
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li  class="tx-active"><a href="#">Roles</a></li>);
 
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-generic" href="list-roles">Back</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-generic" href="list-roles">Back to Overview</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="saveButton" class="tx-button tx-button-create tx-inactive" href="#">Save Permissions</a></li>);
 
+var allRolePermissions = "Permissions:";
+for (perm <- (res/umr("role")/permission("hasPermission"))) {
+	allRolePermissions = allRolePermissions + "," + (perm/permission("javaPermissionEntry")*)
+}
 
 	<div id="tx-content">
-        <div class="tx-list">
-		<script type="text/javascript">
-				function removePermission(form) {{
-					form.roleTitle.value = {"'" + (res/umr("role")/dc("title")*) + "'"};
-					form.submit();
-				}}
-			</script>
-			<h2>Add new Permission to {res/umr("role")/dc("title")*}</h2>
-			<form method="post" action="add-role-permissions">
-				<div>
-					<input type="hidden" name="roleTitle" value={res/umr("role")/dc("title")*} />
-					<label for="permEntries">Permission Entry:</label>
-					<input type="text" name="permEntries" />
-					<input type="submit" value="Add new permission" />
-				</div>
-			</form>
-			<h2>List of Permissions for {res/umr("role")/dc("title")*}</h2>
+        <div class="tx-tree">
+			
+			<h2>List of Permissions for role {res/umr("role")/dc("title")*}</h2>
 			<br/>
+			<form id="form1">
+			<input type="hidden" name="roleTitle" value={res/umr("role")/dc("title")*} />
 			<table>
 				<thead>
-				<tr align="center">
-					<th colspan="2">Permission Entry</th>
+				<tr >
+					<th></th>
+					<th>Name</th>
+					<th>Description</th>
+					<th>Java Permission Entry</th>
 				</tr>
 				</thead>
 				<tbody>
 				{for (perm <- (res/umr("permission"))) yield {
 				<tr>
-					<td>{perm/permission("javaPermissionEntry")*}</td>
-					<td>
-						<form method="post" action="delete-role-permissions">
-							<input type="hidden" name="roleTitle" value="" />
-							<input type="hidden" name="permEntries" value={perm/permission("javaPermissionEntry")*} />
-							<input type="button" onclick="javascript: removePermission(this.parentNode)" value="delete" />
-						</form>
+					<td>{
+						val javaPermission = (perm/permission("javaPermissionEntry")*);
+						
+						if(allRolePermissions.contains(javaPermission)) {
+							<input type="checkbox" checked="checked" name="permEntries" value={javaPermission} />
+						} else {
+							<input type="checkbox" name="permEntries" value={javaPermission} />
+						}
+						
+						}
 					</td>
+
+					<td><span style="line-height: 1.5em;">{perm/dct("title")*}</span></td>
+					<td><span style="line-height: 1.5em;">{perm/dct("description")*}</span></td>
+					<td><span style="line-height: 1.5em;">{perm/permission("javaPermissionEntry")*}</span></td>
 				</tr>
 				}
 				}
 				</tbody>
 			</table>
+			</form>
+			<br/>
+			<h2>Add new Permission manually to role {res/umr("role")/dc("title")*}</h2>
+			<form id="form2" method="post">
+				<div>
+					<input type="hidden" name="roleTitle" value={res/umr("role")/dc("title")*} />
+					<label for="permEntries">Permission Entry:</label>
+					<input type="text" name="permEntries" />
+					<a id="addButton" href="#" class="tx-button tx-button-create">Add Permission</a>
+				</div>
+			</form>
+			<br/>
+			<br/>
         </div>
 	</div>
\ No newline at end of file

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-overview.js
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-overview.js?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-overview.js (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-overview.js Fri Jul  2 16:01:33 2010
@@ -1,41 +1,63 @@
 $(document).ready(function() {
-	$("a#include").fancybox();
-	$("#deleteButton").hide();
-	$("#editButton").hide();
-	$("#deleteButton").bind("click", function() {
-		$(":checkbox:checked").each(function() {
-			var name = $(this).val();
-			$.ajax({
-			type: "POST",
-			url: "./delete-user",
-			data: "userName="+name,
-			success: function(msg) {
-				$("#" + name).remove();
-			}
-		});
+	UserManager.initButtons();
+	buttonVisibilty();
+
+});
+UserManager = function(){};
 
-		});
+UserManager.initButtons = function() {
+
+	$("#deleteButton").bind("click", function() {
+		if(!$(this).hasClass("tx-inactive")){
+			var activatedCheckBoxes = $(".tx-tree input[type=checkbox]:checked")
+			var counter = 1;
+			activatedCheckBoxes.each(function() {
+				var name = $(this).val();
+				var options = new AjaxOptions("delete-user-" + counter, "deleting user ", function(data) {
+					$("#" + name).remove();
+				});
+				options.type = "POST";
+				options.url = "./delete-user";
+				options.data = {"userName": name};
+				$.ajax(options);
+				counter++;
+			});
+		}
 	});
 	$("#editButton").bind("click", function() {
-		$(":checkbox:checked").each(function() {
-			document.location = "update-user?userName=" + $(this).val();
-		});
+		if(!$(this).hasClass("tx-inactive")){
+			var activatedCheckBox = $(".tx-tree input[type=checkbox]:checked")
+			document.location = "update-user?userName=" + activatedCheckBox.val();
+		}
+
+	});
+
+	$("#showPermissionsButton").bind("click", function() {
+		if(!$(this).hasClass("tx-inactive")){
+			var activatedCheckBox = $(".tx-tree input[type=checkbox]:checked")
+			document.location = "manage-user-permissions?userName=" + activatedCheckBox.val();
+		}
 
 	});
-	$(":checkbox").bind("click", function() {
+
+	$("input[type=checkbox]").bind("click", function() {
 		buttonVisibilty();
 	});
-});
+}
+
 function buttonVisibilty() {
-	if ($(":checkbox:checked").length == 1) {
-		$("#deleteButton").show();
-		$("#editButton").show();
-	}
-	if ($(":checkbox:checked").length > 1) {
-		$("#deleteButton").show();
-		$("#editButton").hide();
-	} else if ($(":checkbox:checked").length == 0) {
-		$("#deleteButton").hide();
-		$("#editButton").hide();
+	var activatedCheckBoxes = $(".tx-tree input[type=checkbox]:checked").length
+	if (activatedCheckBoxes == 1) {
+		$("#deleteButton").removeClass("tx-inactive");
+		$("#editButton").removeClass("tx-inactive");
+		$("#showPermissionsButton").removeClass("tx-inactive");
+	} else if (activatedCheckBoxes > 1) {
+		$("#deleteButton").removeClass("tx-inactive");
+		$("#editButton").addClass("tx-inactive");
+		$("#showPermissionsButton").addClass("tx-inactive");
+	} else {
+		$("#deleteButton").addClass("tx-inactive");
+		$("#editButton").addClass("tx-inactive");
+		$("#showPermissionsButton").addClass("tx-inactive");
 	}
 }
\ No newline at end of file

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-role-overview.js
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-role-overview.js?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-role-overview.js (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-role-overview.js Fri Jul  2 16:01:33 2010
@@ -1,29 +1,56 @@
 $(document).ready(function() {
-	$("a#include").fancybox();
-	$("#deleteButton").hide();
+	RoleManager.initButtons();
+	buttonVisibilty();
+});
+RoleManager = function(){};
+
+RoleManager.initButtons = function() {
+
 	$("#deleteButton").bind("click", function() {
-		$(":checkbox:checked").each(function() {
-			var title = $(this).val();
-			$.ajax({
-				type: "POST",
-				url: "./delete-role",
-				data: "roleTitle="+title,
-				success: function(msg) {
+		if(!$(this).hasClass("tx-inactive")){
+			var activatedCheckBoxes = $(".tx-tree input[type=checkbox]:checked")
+			var counter = 1;
+			activatedCheckBoxes.each(function() {
+				var title = $(this).val();
+				var options = new AjaxOptions("delete-role-" + counter, "deleting role ", function(data) {
 					$("#" + title).remove();
-				}
+				});
+				options.type = "POST";
+				options.url = "./delete-role";
+				options.data = {"title": title};
+				$.ajax(options);
+				counter++;
 			});
+		}
+	});
+
+	$("#showPermissionsButton").bind("click", function() {
+		if(!$(this).hasClass("tx-inactive")){
+			var activatedCheckBox = $(".tx-tree input[type=checkbox]:checked")
+			document.location = "manage-role-permissions?roleTitle=" + activatedCheckBox.val();
+		}
 
-		});
 	});
-	$(":checkbox").bind("click", function() {
+	$("#saveButton").bind("click", function() {
+		$("#form1")[0].submit();
+	});
+
+
+	$("input[type=checkbox]").bind("click", function() {
 		buttonVisibilty();
 	});
-});
-function buttonVisibilty() {
-	if ($(":checkbox:checked").length >= 1) {
-		$("#deleteButton").show();
+}
 
-	} else if ($(":checkbox:checked").length == 0) {
-		$("#deleteButton").hide();
+function buttonVisibilty() {
+	var activatedCheckBoxes = $(".tx-tree input[type=checkbox]:checked").length
+	if (activatedCheckBoxes == 1) {
+		$("#deleteButton").removeClass("tx-inactive");
+		$("#showPermissionsButton").removeClass("tx-inactive");
+	} else if (activatedCheckBoxes > 1) {
+		$("#deleteButton").removeClass("tx-inactive");
+		$("#showPermissionsButton").addClass("tx-inactive");
+	} else {
+		$("#deleteButton").addClass("tx-inactive");
+		$("#showPermissionsButton").addClass("tx-inactive");
 	}
 }
\ No newline at end of file

Added: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-role-permission.js
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-role-permission.js?rev=960043&view=auto
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-role-permission.js (added)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-role-permission.js Fri Jul  2 16:01:33 2010
@@ -0,0 +1,28 @@
+$(document).ready(function() {
+	UserManagerRolePermission.initButtons();
+});
+UserManagerRolePermission = function(){};
+
+UserManagerRolePermission.initButtons = function() {
+
+	$("#saveButton").bind("click", function() {
+		if(!$(this).hasClass("tx-inactive")){
+			var options = new AjaxOptions("update-permissions", "updating permissions", function(data) {
+
+			});
+			options.type = "POST";
+			options.url = "./update-role-permissions";
+			options.data = $("#form1").serialize();
+			$.ajax(options);
+		}
+
+	});
+	$("input[type=checkbox]").bind("click", function() {
+		$("#saveButton").removeClass("tx-inactive");
+	});
+
+	$("#addButton").bind("click", function() {
+		$("#form2")[0].action="add-role-permissions";
+		$("#form2")[0].submit();
+	});
+}

Added: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-user-permission.js
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-user-permission.js?rev=960043&view=auto
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-user-permission.js (added)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/staticweb/js/usermanager-user-permission.js Fri Jul  2 16:01:33 2010
@@ -0,0 +1,28 @@
+$(document).ready(function() {
+	UserManagerUserPermission.initButtons();
+});
+UserManagerUserPermission = function(){};
+
+UserManagerUserPermission.initButtons = function() {
+
+	$("#saveButton").bind("click", function() {
+		if(!$(this).hasClass("tx-inactive")){
+			var options = new AjaxOptions("update-permissions", "updating permissions", function(data) {
+					
+			});
+			options.type = "POST";
+			options.url = "./update-user-permissions";
+			options.data = $("#form1").serialize();
+			$.ajax(options);
+		}
+
+	});
+	$("input[type=checkbox]").bind("click", function() {
+		$("#saveButton").removeClass("tx-inactive");
+	});
+
+	$("#addButton").bind("click", function() {
+		$("#form2")[0].action="add-user-permissions";
+		$("#form2")[0].submit();
+	});
+}

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/update-user-template.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/update-user-template.xhtml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/update-user-template.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/update-user-template.xhtml Fri Jul  2 16:01:33 2010
@@ -14,7 +14,7 @@ resultDocModifier.addNodes2Elem("tx-modu
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Users</a></li>);
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="list-roles">Roles</a></li>);
 
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-remove" href="list-users">Cancel</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-generic" href="list-users">Back  to Overview</a></li>);
 resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-create" href="javascript:saveUser()">Save</a></li>);
 
         <div id="tx-content">

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/user-overview-template.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/user-overview-template.xhtml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/user-overview-template.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/user-overview-template.xhtml Fri Jul  2 16:01:33 2010
@@ -1,4 +1,6 @@
 def foaf(s: Any) = new UriRef("http://xmlns.com/foaf/0.1/" + s)
+import java.net._
+
 def osgi(s: Any) = new UriRef("http://clerezza.org/2008/11/osgi#" + s)
 def permission(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#" + s)
 def list(s: Any) = new UriRef("http://clerezza.org/2009/04/list#" + s)
@@ -6,8 +8,19 @@ def sioc(s: Any) = new UriRef("http://rd
 def dc(s: Any) = new UriRef("http://purl.org/dc/elements/1.1/" + s)
 def platform(s: Any) = new UriRef("http://clerezza.org/2009/08/platform#" + s)
 
-resultDocModifier.addStyleSheet("js/fancybox/jquery.fancybox.css");
-resultDocModifier.addScriptReference("js/fancybox/jquery.fancybox-1.2.1.pack.js");
+resultDocModifier.addStyleSheet("/yui/2/container/assets/container-core.css");
+
+resultDocModifier.addScriptReference("/yui/2/yahoo-dom-event/yahoo-dom-event.js");
+resultDocModifier.addScriptReference("/yui/2/animation/animation-min.js");
+resultDocModifier.addScriptReference("/yui/2/dragdrop/dragdrop-min.js");
+resultDocModifier.addScriptReference("/yui/2/logger/logger-min.js");
+resultDocModifier.addScriptReference("/yui/2/element/element-min.js");
+resultDocModifier.addScriptReference("/yui/2/container/container-min.js");
+resultDocModifier.addScriptReference("/yui/2/resize/resize-min.js")
+
+resultDocModifier.addScriptReference("/scripts/alert-message.js");
+resultDocModifier.addScriptReference("/scripts/ajax-options.js");
+resultDocModifier.addScriptReference("/scripts/overlay.js");
 resultDocModifier.addScriptReference("js/usermanager-overview.js");
 
 resultDocModifier.setTitle("User Manager");
@@ -16,46 +29,55 @@ resultDocModifier.addNodes2Elem("tx-modu
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Users</a></li>);
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="list-roles">Roles</a></li>);
 
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-remove" href="#">Remove</a></li>);
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-modify" href="#">Edit</a></li>);
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-create" href="add-user">Create</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="deleteButton" class="tx-button tx-button-remove tx-inactive" href="#">Delete</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-modify tx-inactive" href="#">Edit</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="showPermissionsButton" class="tx-button tx-button-modify tx-inactive" href="#">Show Permissions</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="addButton" class="tx-button tx-button-create" href="add-user">Create User</a></li>);
+
+
 
 <div id="tx-content">
-	<div class="tx-list">
+	<div class="tx-tree">
 		<fieldset>
 			<table>
 				<colgroup>
-					<col width="40" />
-					<col width="40" />
-					<col width="40" />
-					<col width="120" />
-					<col width="150" />
-					<col width="100" />
-					<col width="100" />
+					<col width="10" />
+					<col width="180" />
+					<col width="240" />
+					<col/>
+					<col width="180" />
+					<col width="240" />
 				</colgroup>
 				<thead>
 					<tr>
-						<th colspan="2"><a href="">Name</a></th>
+						<th></th>
+						<th><a href="">Username</a></th>
+						<th><a href="">Name</a></th>
 						<th><a href="">Email</a></th>
 						<th><a href="">Path Prefix</a></th>
-						<th><a href="">Password</a></th>
 						<th><a href="">Roles</a></th>
-						<th><a href="">Permissions</a></th>
 					</tr>
 				</thead>
 				<tbody>
-                    {import java.net._
+                    {
 					for (user <- (res!!)) yield {
 					<tr id={user/platform("userName")*}>
                         <td>
                             <input type="checkbox" value={user/platform("userName")*} />
                         </td>
                         <td><a href={"update-user?userName=" + URLEncoder.encode(user/platform("userName")*, "utf-8")}>{user/platform("userName")*}</a></td>
-                        <td>{user/foaf("mbox")*}</td>
+                        <td>{(user/foaf("givenName")*) + " " + (user/foaf("familyName")*)}</td>
+						<td>{
+							val mbox = (user/foaf("mbox")*);
+							if(mbox.length > 0) {
+								mbox.substring(7);
+							} else {
+								""
+							}
+
+							}</td>
                         <td>{user/osgi("agent_path_prefix")*}</td>
-                        <td>{user/permission("passwordSha1")*}</td>
-                        <td>{for (title <- (user/sioc("has_function"))) yield {  title/dc("title")* }}</td>
-                        <td><a href={"manage-user-permissions?userName=" + URLEncoder.encode(user/platform("userName")*, "utf-8")}>show permissions</a></td>
+                        <td style="line-height: 1.5em;">{for (title <- (user/sioc("has_function"))) yield {  title/dc("title")* }}</td>
                     </tr>
                     }}
 				</tbody>

Modified: incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/user-permission-template.xhtml
URL: http://svn.apache.org/viewvc/incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/user-permission-template.xhtml?rev=960043&r1=960042&r2=960043&view=diff
==============================================================================
--- incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/user-permission-template.xhtml (original)
+++ incubator/clerezza/trunk/org.apache.clerezza.parent/org.apache.clerezza.platform.usermanager.webinterface/src/main/resources/org/apache/clerezza/platform/usermanager/webinterface/user-permission-template.xhtml Fri Jul  2 16:01:33 2010
@@ -1,6 +1,12 @@
 def permission(s: Any) = new UriRef("http://clerezza.org/2008/10/permission#" + s)
 def umr(s: Any) = new UriRef("http://clerezza.org/2009/05/usermanager#" + s)
 def platform(s: Any) = new UriRef("http://clerezza.org/2009/08/platform#" + s)
+def dct(s: Any) = new UriRef("http://purl.org/dc/terms/" + s)
+def sioc(s: Any) = new UriRef("http://rdfs.org/sioc/ns#" + s)
+
+resultDocModifier.addScriptReference("/scripts/alert-message.js");
+resultDocModifier.addScriptReference("/scripts/ajax-options.js");
+resultDocModifier.addScriptReference("js/usermanager-user-permission.js");
 
 resultDocModifier.setTitle("User Manager");
 resultDocModifier.addNodes2Elem("tx-module", <h1>User Manager</h1>);
@@ -8,53 +14,74 @@ resultDocModifier.addNodes2Elem("tx-modu
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li class="tx-active"><a href="#">Users</a></li>);
 resultDocModifier.addNodes2Elem("tx-module-tabs-ol", <li><a href="list-roles">Roles</a></li>);
 
-resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="editButton" class="tx-button tx-button-generic" href="list-users">Back</a></li>);
-
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="backButton" class="tx-button tx-button-generic" href="list-users">Back to Overview</a></li>);
+resultDocModifier.addNodes2Elem("tx-contextual-buttons-ol", <li><a id="saveButton" class="tx-button tx-button-create tx-inactive" href="#">Save Permissions</a></li>);
 
-		
+var allUserPermissions = "Permissions:";
+for (perm <- (res/umr("user")/permission("hasPermission"))) {
+	allUserPermissions = allUserPermissions + "," + (perm/permission("javaPermissionEntry")*)
+}
+
+var rolePermissions = "Permissions:";
+for (role <- (res/umr("user")/sioc("has_function"))) {
+	rolePermissions = rolePermissions + "," + (role/permission("hasPermission")/permission("javaPermissionEntry")*);
+}
 
-		
         <div id="tx-content">
-        <div class="tx-list">
-			<script type="text/javascript">
-				function removePermission(form) {{
-					form.name.value = {"'" + (res/umr("user")/platform("userName")*) + "'"};
-					form.submit();
-				}}
-			</script>
-			<h2>Add new Permission to {res/umr("user")/platform("userName")*}</h2>
-			<form method="post" action="add-user-permissions">
-				<div>
-					<input type="hidden" name="name" value={res/umr("user")/platform("userName")*} />
-					<label>Permission Entry:
-						<input type="text" name="permEntries" />
-					</label>
-					<input type="submit" value="Add new permission" />
-				</div>
-			</form>
-			<h2>List of Permissions for {res/umr("user")/platform("userName")*}</h2>
+			
+        <div class="tx-tree">
+			
+			<h2>List of Permissions for user {res/umr("user")/platform("userName")*}</h2>
 			<br/>
+			<form id="form1">
+			<input type="hidden" name="name" value={res/umr("user")/platform("userName")*} />
 			<table>
 				<thead>
-				<tr align="center">
-					<th colspan="2">Permission Entry</th>
+				<tr >
+					<th></th>
+					<th>Name</th>
+					<th>Description</th>
+					<th>Java Permission Entry</th>
 				</tr>
 				</thead>
 				<tbody>
 				{for (perm <- (res/umr("permission"))) yield {
 				<tr>
-					<td>{perm/permission("javaPermissionEntry")*}</td>
-					<td>
-						<form method="post" action="delete-user-permissions">
-							<input type="hidden" name="name" value="" />
-							<input type="hidden" name="permEntries" value={perm/permission("javaPermissionEntry")*} />
-							<input type="button" onclick="javascript: removePermission(this.parentNode)" value="delete" />
-						</form>
+					<td>{
+						val javaPermission = (perm/permission("javaPermissionEntry")*);
+						if(rolePermissions.contains(javaPermission)) {
+							<input type="checkbox" checked="checked" disabled="disabled" value={javaPermission} />
+						} else {
+							if(allUserPermissions.contains(javaPermission)) {
+								<input type="checkbox" checked="checked" name="permEntries" value={javaPermission} />
+							} else {
+								<input type="checkbox" name="permEntries" value={javaPermission} />
+							}
+						}
+						}
 					</td>
+
+					<td><span style="line-height: 1.5em;">{perm/dct("title")*}</span></td>
+					<td><span style="line-height: 1.5em;">{perm/dct("description")*}</span></td>
+					<td><span style="line-height: 1.5em;">{perm/permission("javaPermissionEntry")*}</span></td>
 				</tr>
 				}
 				}
 				</tbody>
 			</table>
+			</form>
+			<br/>
+			<h2>Add new Permission manually to user {res/umr("user")/platform("userName")*}</h2>
+			<form id="form2" method="post">
+				<div>
+					<input type="hidden" name="name" value={res/umr("user")/platform("userName")*} />
+					<label>Permission Entry:
+						<input type="text" name="permEntries" />
+					</label>
+					<a id="addButton" href="#" class="tx-button tx-button-create">Add Permission</a>
+				</div>
+			</form>
+			<br/>
+			<br/>
         </div>
         </div>



Mime
View raw message