cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From un...@apache.org
Subject svn commit: rev 36347 - in cocoon/branches/BRANCH_2_1_X/src/blocks/slide: java/org/apache/cocoon/components/slide/impl samples samples/screens
Date Fri, 13 Aug 2004 13:44:19 GMT
Author: unico
Date: Fri Aug 13 06:44:19 2004
New Revision: 36347

Modified:
   cocoon/branches/BRANCH_2_1_X/src/blocks/slide/java/org/apache/cocoon/components/slide/impl/SlideConfigurationAdapter.java
   cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/flow.js
   cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/locks.jx
   cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/permissions.jx
   cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/users.jx
Log:
port changes from 2.2: fix slide sample administration app

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/slide/java/org/apache/cocoon/components/slide/impl/SlideConfigurationAdapter.java
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/slide/java/org/apache/cocoon/components/slide/impl/SlideConfigurationAdapter.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/slide/java/org/apache/cocoon/components/slide/impl/SlideConfigurationAdapter.java
Fri Aug 13 06:44:19 2004
@@ -25,7 +25,7 @@
 /**
  * The class represent an adapter for the configuration class from jakarta slide
  *
- * @version CVS $Id: SlideConfigurationAdapter.java,v 1.4 2004/04/13 15:16:37 unico Exp $
+ * @version CVS $Id$
  */
 public class SlideConfigurationAdapter implements Configuration {
 
@@ -62,6 +62,9 @@
      */
     public Configuration getConfiguration(String child)
       throws ConfigurationException {
+        if (this.configuration.getChild(child, false) == null)
+            throw new ConfigurationException("No configuration element " + child 
+                    + " at " + this.configuration.getLocation(), this);
         return new SlideConfigurationAdapter(this.configuration.getChild(child));
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/flow.js
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/flow.js	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/flow.js	Fri Aug 13 06:44:19 2004
@@ -16,12 +16,11 @@
 
 importPackage(Packages.org.apache.cocoon.components.modules.input);
 importPackage(Packages.org.apache.cocoon.components.slide);
-importPackage(Packages.org.apache.cocoon.components.source);
+importClass(Packages.org.apache.cocoon.components.source.SourceDTO);
 importPackage(Packages.org.apache.cocoon.components.source.helpers);
-importPackage(Packages.org.apache.cocoon.samples.slide);
+importPackage(Packages.org.apache.cocoon.slide.util);
 importPackage(Packages.org.apache.excalibur.source);
 
-var repository = cocoon.getComponent('org.apache.cocoon.components.repository.SourceRepository');
 var resolver = cocoon.getComponent(SourceResolver.ROLE);
 var global = cocoon.getComponent(InputModule.ROLE + "Selector").select("global");
 var namespace = global.getAttribute("namespace",null,null);
@@ -80,9 +79,18 @@
 
   login();
 
-  var baseUri        = "slide://" + principal + "@" + namespace + "/";
+  var baseUri  = "slide://" + principal + "@" + namespace + "/";
   var location = baseUri + parentPath + "/" + collectionName;
-  var status = repository.makeCollection(location);
+  var source = null;
+  try {
+    source = resolver.resolveURI(location);
+    source.makeCollection();
+  }
+  finally {
+    if (source != null) {
+      resolver.release(source);
+    }
+  }
 
   cocoon.redirectTo("viewcontent.do?path=" + parentPath);
 }
@@ -95,10 +103,24 @@
   //FIXME: retrieve upload object before login
   login();
 
-  var baseUri      = "slide://" + principal + "@" + namespace + "/";
+  var baseUri = "slide://" + principal + "@" + namespace + "/";
   var dest = baseUri + parentPath + "/" + resourceName;
   var src  = "upload://uploadFile";
-  var status = repository.save(src,dest);
+
+  var source, destination = null;
+  try {
+    source = resolver.resolveURI(src);
+    destination = resolver.resolveURI(dest);
+    SourceUtil.copy(source, destination);
+  }
+  finally {
+    if (source != null) {
+      resolver.release(source);
+    }
+    if (destination != null) {
+      resolver.release(destination);
+    }
+  }
 
   cocoon.redirectTo("viewcontent.do?path=" + parentPath);
 }
@@ -112,7 +134,16 @@
   
   var baseUri = "slide://" + principal + "@" + namespace + "/";
   var location = baseUri + parentPath + "/" + resourceName;
-  var status = repository.remove(location);
+  var source = null;
+  try {
+    source = resolver.resolveURI(location);
+    source["delete"].call(source);
+  }
+  finally {
+    if (source != null) {
+      resolver.release(source);
+    }
+  }
 
   cocoon.redirectTo("viewcontent.do?path=" + parentPath);
 }
@@ -209,18 +240,20 @@
   var roles = AdminHelper.listGroups(nat,principal,"/roles");
   var users = AdminHelper.listUsers(nat,principal);
   var privileges = AdminHelper.listPrivileges(nat,principal);
-  cocoon.sendPage("screens/permissions.html",{source:sourceDTO, roles:roles, users:users,
privileges:privileges});
+  var permissions = AdminHelper.listPermissions(nat,principal,path);
+  
+  cocoon.sendPage("screens/permissions.html",{source:sourceDTO, roles:roles, users:users,
privileges:privileges, permissions:permissions});
 }
 
 function removePermission() {
   var resourcePath = cocoon.request.getParameter("resourcePath");
   var subject      = cocoon.request.getParameter("subject");
-  var privilege    = cocoon.request.getParameter("privilege");
+  var action    = cocoon.request.getParameter("action");
 
   login();
   
-  AdminHelper.removePermission(nat,principal,resourcePath,subject,privilege);
-  cocoon.redirectTo("permissions/" + resourcePath);
+  AdminHelper.removePermission(nat, principal, resourcePath, subject, action);
+  cocoon.redirectTo("viewpermissions.do?path=" + resourcePath);
 }
 
 function addPermission() {
@@ -233,7 +266,7 @@
   login();
   
   AdminHelper.addPermission(nat,principal,resourcePath,subject,action,inheritable,negative);
-  cocoon.redirectTo("permissions/" + resourcePath);
+  cocoon.redirectTo("viewpermissions.do?path=" + resourcePath);
 }
 
 // ---------------------------------------------- lock management
@@ -258,7 +291,8 @@
   var roles = AdminHelper.listGroups(nat,principal,"/roles");
   var users = AdminHelper.listUsers(nat,principal);
   var privileges = AdminHelper.listPrivileges(nat,principal);
-  cocoon.sendPage("screens/locks.html",{source:sourceDTO, roles:roles, users:users, privileges:privileges});
+  var locks = AdminHelper.listLocks(nat, principal, path);
+  cocoon.sendPage("screens/locks.html",{source:sourceDTO, roles:roles, users:users, privileges:privileges,
locks:locks});
 }
 
 function removelock() {
@@ -277,14 +311,14 @@
   var resourcePath = cocoon.request.getParameter("resourcePath");
   var subject      = cocoon.request.getParameter("subject");
   var type         = cocoon.request.getParameter("type");
-  var exclusive    = cocoon.request.getParameter("exclusive");
   var expiration   = cocoon.request.getParameter("expiration");
+  var exclusive    = cocoon.request.getParameter("exclusive");
   var inheritable  = cocoon.request.getParameter("inheritable");
 
   login();
-  
-  AdminHelper.addLock(nat,principal,resourcePath,subject,type,expiration,exclusive,inheritable);
-  
+
+  AdminHelper.addLock(nat, principal, resourcePath, subject, type, expiration, exclusive,
inheritable);
+
   cocoon.redirectTo("viewlocks.do?path=" + resourcePath);
 }
 
@@ -306,14 +340,14 @@
   login();
   
   AdminHelper.addUser(nat,principal,username,password);
-  cocoon.redirectTo("users");
+  cocoon.redirectTo("viewusers.do");
 }
 
 function addrole () {
   var rolename = cocoon.request.getParameter("rolename");
   
   AdminHelper.addRole(nat,principal,rolename);
-  cocoon.redirectTo("users");
+  cocoon.redirectTo("viewusers.do");
 }
 
 function addgroup () {
@@ -322,7 +356,7 @@
   login();
   
   AdminHelper.addGroup(nat,principal,groupname);
-  cocoon.redirectTo("users");
+  cocoon.redirectTo("viewusers.do");
 }
 
 function removeobject() {
@@ -331,7 +365,7 @@
   login();
   
   AdminHelper.removeObject(nat,principal,objecturi);
-  cocoon.redirectTo("users");
+  cocoon.redirectTo("viewusers.do");
 }
 
 function addmember() {
@@ -339,9 +373,8 @@
   var subjecturi = cocoon.request.getParameter("subjecturi");
 
   login();
-  
   AdminHelper.addMember(nat,principal,objecturi,subjecturi);
-  cocoon.redirectTo("users");
+  cocoon.redirectTo("viewusers.do");
 }
 
 function removemember() {
@@ -351,14 +384,14 @@
   login();
   
   AdminHelper.removeMember(nat,principal,objecturi,subjecturi);
-  cocoon.redirectTo("users");
+  cocoon.redirectTo("viewusers.do");
 }
 
 function changepwd() {
-  var username = cocoon.request.getParameter("username");
+  var useruri = cocoon.request.getParameter("useruri");
   var password = cocoon.request.getParameter("password");
   
-  AdminHelper.changePassword(nat, principal, username, password);
-  cocoon.redirectTo("users");
+  AdminHelper.changePassword(nat, principal, useruri, password);
+  cocoon.redirectTo("viewusers.do");
 }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/locks.jx
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/locks.jx	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/locks.jx	Fri Aug 13 06:44:19
2004
@@ -60,7 +60,7 @@
               <b>Type</b>
             </td>
             <td align="left">
-              <b>Expiration (mins)</b>
+              <b>Expiration</b>
             </td>
             <td align="left">
               <b>Inheritable</b>
@@ -70,16 +70,16 @@
             </td>
             <td align="right"/>
           </tr>
-          <jx:forEach var="lock" items="${source.locks}">
+          <jx:forEach var="lock" items="${locks}">
             <tr bgcolor="#eeeeee">
               <td align="left">
-                ${lock.subject}
+                ${lock.subjectUri}
               </td>
               <td align="left">
-                ${lock.type}
+                ${lock.typeUri}
               </td>
               <td align="left">
-                ${lock.expiration}
+                ${lock.expirationDate}
               </td>
               <td align="left">
                 ${lock.inheritable}
@@ -90,8 +90,8 @@
               <td align="right">
                 <form action="removelock.do" method="post">
                   <input type="hidden" name="resourcePath" value="${source.path}"/>
-                  <input type="hidden" name="objectUri" value="${lock.object}"/>
-                  <input type="hidden" name="lockId" value="${lock.id}"/>
+                  <input type="hidden" name="objectUri" value="${lock.objectUri}"/>
+                  <input type="hidden" name="lockId" value="${lock.lockId}"/>
                   <input type="submit" name="doRemoveLock" value="Delete"/>
                 </form>
               </td>
@@ -102,18 +102,18 @@
               <input type="hidden" name="resourcePath" value="${source.path}"/>
               <td align="left">
                 <select name="subject">
-                  <option>self</option>
-                  <option>owner</option>
-                  <option>authenticated</option>
-                  <option>unauthenticated</option>
-                  <option>all</option>
+                  <option value="self">self</option>
+                  <option value="owner">owner</option>
+                  <option value="authenticated">authenticated</option>
+                  <option value="unauthenticated">unauthenticated</option>
+                  <option value="all">all</option>
                   <jx:forEach var="role" items="${roles}">
-                    <option value="{$role.uri}">
+                    <option value="${role.uri}">
                       role: ${role.uri}
                     </option>
                   </jx:forEach>
                   <jx:forEach var="user" items="${users}">
-                    <option value="{$user}">
+                    <option value="${user}">
                       user: ${user}
                     </option>
                   </jx:forEach>
@@ -121,10 +121,10 @@
               </td>
               <td align="left">
                 <select name="type">
-                  <option>all</option>
-                  <option>default</option>
+                  <option value="all">all</option>
+                  <option value="default">default</option>
                   <jx:forEach var="privilege" items="${privileges}">
-                    <option value="{$privilege}">
+                    <option value="${privilege}">
                       ${privilege}
                     </option>
                   </jx:forEach>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/permissions.jx
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/permissions.jx	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/permissions.jx	Fri Aug 13
06:44:19 2004
@@ -67,13 +67,13 @@
             </td>
             <td align="right"/>
           </tr>
-          <jx:forEach var="permission" items="${source.permissions}">
+          <jx:forEach var="permission" items="${permissions}">
             <tr>
               <td align="left">
-                ${permission.subject}
+                ${permission.subjectUri}
               </td>
               <td align="left">
-                ${permission.privilege}
+                ${permission.actionUri}
               </td>
               <td align="left">
                 ${permission.inheritable}
@@ -84,10 +84,10 @@
               <td align="right">
                 <form action="removePermission.do" method="post">
                   <input type="hidden" name="resourcePath" value="${source.path}"/>
-                  <input type="hidden" name="subject" value="${permission.subject}"/>
-                  <input type="hidden" name="privilege" value="{permission.privilege}"/>
-                  <input type="hidden" name="inheritable" value="{permission.inheritable}"/>
-                  <input type="hidden" name="negative" value="{permission.negative}"/>
+                  <input type="hidden" name="subject" value="${permission.subjectUri}"/>
+                  <input type="hidden" name="action" value="${permission.actionUri}"/>
+                  <input type="hidden" name="inheritable" value="${permission.inheritable}"/>
+                  <input type="hidden" name="negative" value="${permission.negative}"/>
                   <input type="submit" name="doRemovePermission" value="Delete"/>
                 </form>
               </td>
@@ -104,12 +104,12 @@
                   <option>unauthenticated</option>
                   <option>all</option>
                   <jx:forEach var="role" items="${roles}">
-                    <option value="{$role.uri}">
+                    <option value="${role.uri}">
                       role: ${role.uri}
                     </option>
                   </jx:forEach>
                   <jx:forEach var="user" items="${users}">
-                    <option value="{$user}">
+                    <option value="${user}">
                       user: ${user}
                     </option>
                   </jx:forEach>
@@ -120,7 +120,7 @@
                   <option>all</option>
                   <option>default</option>
                   <jx:forEach var="privilege" items="${privileges}">
-                    <option value="{$privilege}">
+                    <option value="${privilege}">
                       ${privilege}
                     </option>
                   </jx:forEach>

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/users.jx
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/users.jx	(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/slide/samples/screens/users.jx	Fri Aug 13 06:44:19
2004
@@ -55,7 +55,7 @@
                 </form>
               </td>
               <form action="changepwd.do" method="post">
-                <input type="hidden" name="username" value="${user}"/>
+                <input type="hidden" name="useruri" value="${user}"/>
                 <td align="left">
                   <input type="password" name="password" size="10" maxlength="40"/>
                 </td>
@@ -67,11 +67,15 @@
                 <input type="hidden" name="subjecturi" value="${user}"/>
                 <td align="left">
                   <select name="objecturi">
-                    <jx:forEach var="role" items="#{roles[member = $user]}">
-                      <option value="{$role.uri}">
-                        ${role.uri}
-                      </option>
-                    </jx:forEach> 
+                    <jx:forEach var="role" items="${roles}">
+                      <jx:forEach var="member" items="${role.members}">
+                        <jx:if test="${member == user}">
+                          <option value="${role.uri}">
+                            ${role.uri}
+                          </option>
+                        </jx:if>
+                      </jx:forEach>
+                    </jx:forEach>
                   </select>
                 </td>
                 <td align="left">
@@ -82,11 +86,11 @@
             <tr>
               <td colspan="4"/>
               <form action="addmember.do" method="post">
-                <input type="hidden" name="subjecturi" value="{$user}"/>
+                <input type="hidden" name="subjecturi" value="${user}"/>
                 <td align="left">
                   <select name="objecturi" size="1">
                     <jx:forEach var="role" items="${roles}">
-                      <option value="{$role.uri}">
+                      <option value="${role.uri}">
                         ${role.uri}
                       </option>
                     </jx:forEach>
@@ -127,7 +131,7 @@
           <jx:forEach var="role" items="${roles}">
             <tr>
               <form action="removeobject.do" method="post">
-                <input type="hidden" name="objecturi" value="{$roleuri}"/>
+                <input type="hidden" name="objecturi" value="${role.uri}"/>
                 <td align="left">
                   ${role.uri}
                 </td>

Mime
View raw message