You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@apache.org on 2002/07/05 15:37:37 UTC

cvs commit: xml-cocoon2/src/scratchpad/webapp/samples/slide principal2html4users.xsl rdf2html4content.xsl rdf2html4locks.xsl rdf2html4permissions.xsl rdf2html4properties.xsl sitemap.xmap slide.xconf

stephan     2002/07/05 06:37:37

  Modified:    src/scratchpad/src/org/apache/cocoon/components/repository/impl
                        SlidePrincipalProvider.java slidepp.xconf
               src/scratchpad/webapp/samples/slide rdf2html4content.xsl
                        rdf2html4locks.xsl rdf2html4permissions.xsl
                        rdf2html4properties.xsl sitemap.xmap slide.xconf
  Added:       src/scratchpad/src/org/apache/cocoon/generation
                        PrincipalListGenerator.java
               src/scratchpad/webapp/samples/slide principal2html4users.xsl
  Log:
  Created a new site for the user management.
  Also added a PrincipalListGenerator which helps to
  retrieve the users from a repository.
  
  Revision  Changes    Path
  1.2       +67 -36    xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlidePrincipalProvider.java
  
  Index: SlidePrincipalProvider.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/SlidePrincipalProvider.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SlidePrincipalProvider.java	4 Jul 2002 17:32:41 -0000	1.1
  +++ SlidePrincipalProvider.java	5 Jul 2002 13:37:36 -0000	1.2
  @@ -75,7 +75,6 @@
   
   import org.apache.slide.authenticate.CredentialsToken;
   import org.apache.slide.authenticate.SecurityToken;
  -//import org.apache.slide.common.EmbeddedDomain;
   import org.apache.slide.common.NamespaceAccessToken;
   import org.apache.slide.common.NamespaceConfig;
   import org.apache.slide.common.SlideException;
  @@ -83,19 +82,9 @@
   import org.apache.slide.common.SlideTokenImpl;
   import org.apache.slide.content.Content;
   import org.apache.slide.content.NodeProperty;
  -//import org.apache.slide.content.NodeRevisionContent;
   import org.apache.slide.content.NodeRevisionDescriptor;
   import org.apache.slide.content.NodeRevisionDescriptors;
  -//import org.apache.slide.content.RevisionContentNotFoundException;
   import org.apache.slide.content.RevisionDescriptorNotFoundException;
  -//import org.apache.slide.content.RevisionNotFoundException;
  -import org.apache.slide.content.NodeRevisionNumber;
  -import org.apache.slide.lock.Lock;
  -//import org.apache.slide.lock.NodeLock;
  -//import org.apache.slide.lock.ObjectLockedException;
  -import org.apache.slide.macro.Macro;
  -//import org.apache.slide.security.AccessDeniedException;
  -import org.apache.slide.security.NodePermission;
   import org.apache.slide.security.Security;
   import org.apache.slide.structure.GroupNode;
   import org.apache.slide.structure.ObjectNode;
  @@ -134,29 +123,17 @@
       private Security security;
   
       /** Lock helper. */
  -    private Lock lock;
  +    //private Lock lock;
   
       /** Macro helper. */
  -    private Macro macro;
  +    //private Macro macro;
   
       /** Slide token. */
  -    private SlideToken slidetoken;
  +    //private SlideToken slidetoken;
   
       private String repository = null;
       private String namespace = null;
   
  -    /*public SlidePrincipalProvider(NamespaceAccessToken nat, SlideToken slidetoken) {
  -
  -        this.config = this.nat.getNamespaceConfig();
  -        this.structure = nat.getStructureHelper();
  -        this.content = nat.getContentHelper();
  -        this.security = nat.getSecurityHelper();
  -        this.lock = nat.getLockHelper();
  -        this.macro = nat.getMacroHelper();
  -
  -        this.slidetoken = slidetoken;
  -    }*/
  -
       /**
        * Set the current <code>ComponentManager</code> instance used by this
        * <code>Composable</code>.
  @@ -174,8 +151,8 @@
       public void configure(Configuration configuration)
           throws ConfigurationException {
   
  -        this.repository = configuration.getAttribute("repository", "slide");
  -        this.namespace = configuration.getAttribute("namespace", "slide");
  +        this.repository = configuration.getAttribute("repository", null);
  +        this.namespace = configuration.getAttribute("namespace", null);
       }
   
       /**
  @@ -205,15 +182,16 @@
               if (this.namespace==null)
                   this.namespace = sliderepository.getDomain().getDefaultNamespace();
   
  -            if (sliderepository.getDomain().getNamespaceToken(namespace)==null)
  +            if (sliderepository.getDomain().getNamespaceToken(this.namespace)==null)
                   throw new ProcessingException("Repository with the namespace '"+this.namespace+"' couldn't be found");
   
               this.nat = sliderepository.getDomain().getNamespaceToken(this.namespace);
  +            this.config = this.nat.getNamespaceConfig();
               this.structure = nat.getStructureHelper();
               this.content = nat.getContentHelper();
               this.security = nat.getSecurityHelper();
  -            this.lock = nat.getLockHelper();
  -            this.macro = nat.getMacroHelper();
  +            //this.lock = nat.getLockHelper();
  +           // this.macro = nat.getMacroHelper();
   
           } catch (ComponentException ce) {
               getLogger().error("Could not lookup for component.", ce);
  @@ -252,7 +230,7 @@
                   userobject = structure.retrieve(slidetoken, user);
   
                   if (!(userobject instanceof GroupNode)) {
  -                    String name = userobject.getUri().substring(userspath.length(), userobject.getUri().length()-userspath.length());
  +                    String name = userobject.getUri().substring(userspath.length()+1);
                       
                       // FIXME the CVS code from slide does only implement getRoles
                       /*Enumeration roles = this.security.getRoles(user);
  @@ -261,7 +239,7 @@
                           role = (String)children.nextElement();*/
   
                       NodeRevisionDescriptors revisionDescriptors = 
  -                        content.retrieve(this.slidetoken, user);
  +                        content.retrieve(slidetoken, user);
   
                       // Retrieve latest revision descriptor
                       NodeRevisionDescriptor revisionDescriptor = this.content.retrieve(slidetoken, revisionDescriptors);
  @@ -315,7 +293,7 @@
                   groupobject = structure.retrieve(slidetoken, group);
   
                   if (groupobject instanceof GroupNode) {
  -                    String name = groupobject.getUri().substring(userspath.length(), groupobject.getUri().length()-userspath.length());
  +                    String name = groupobject.getUri().substring(userspath.length()+1);
   
                       principalgroups.add(new PrincipalGroup(name));
                   }
  @@ -360,6 +338,10 @@
        * @return True if the principal is a member of this group, false otherwise.
        */
       public boolean isMember(Principal caller, PrincipalGroup group, Principal member) throws ProcessingException {
  +        Principal[] members = members(caller, group);
  +        for(int i=0; i<members.length; i++)
  +            if (members[i].equals(member))
  +                return true;
           return false;
       }
   
  @@ -371,7 +353,56 @@
        * @return An enumeration of the group members.
        */
       public Principal[] members(Principal caller, PrincipalGroup group) throws ProcessingException {
  -        return null;
  +        try {
  +            SlideToken slidetoken = new SlideTokenImpl(new CredentialsToken(caller));
  +
  +            String userspath = config.getUsersPath();
  +
  +            ObjectNode groupobject = structure.retrieve(slidetoken, userspath+"/"+group.getName());
  +
  +            if (groupobject instanceof GroupNode) {
  +                Vector principals = new Vector(); 
  +
  +                String user;
  +                ObjectNode userobject;
  +                for(Enumeration children = groupobject.enumerateChildren(); children.hasMoreElements();) {
  +                    user = (String)children.nextElement();
  +
  +                    userobject = structure.retrieve(slidetoken, user);
  +
  +                    if (!(userobject instanceof GroupNode)) {
  +                        String name = userobject.getUri().substring(userspath.length()+1);
  +
  +                        // FIXME the CVS code from slide does only implement getRoles
  +                        /*Enumeration roles = this.security.getRoles(user);
  +                        String role = null;
  +                        if (roles.hasMoreElements())
  +                            role = (String)children.nextElement();*/
  +
  +                        NodeRevisionDescriptors revisionDescriptors =
  +                            content.retrieve(slidetoken, userobject.getUri());
  +
  +                        // Retrieve latest revision descriptor
  +                        NodeRevisionDescriptor revisionDescriptor = this.content.retrieve(slidetoken,
  +                                                                                          revisionDescriptors);
  +                        String password = revisionDescriptor.getProperty("password").getValue().toString();
  +
  +                        principals.add(new Principal(name/*, role*/, password));
  +                    }
  +                }
  +
  +                Principal[] principalArray = new Principal[principals.size()];
  +                int i=0;
  +                for(Enumeration e = principals.elements(); e.hasMoreElements() ; i++)
  +                    principalArray[i] = (Principal)e.nextElement();
  +
  +                return principalArray;
  +            } else
  +                return new Principal[0];
  +
  +        } catch (SlideException se) {
  +            throw new ProcessingException(se);
  +        }
       }
   
       /**
  
  
  
  1.2       +1 -1      xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/slidepp.xconf
  
  Index: slidepp.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/components/repository/impl/slidepp.xconf,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- slidepp.xconf	4 Jul 2002 17:32:41 -0000	1.1
  +++ slidepp.xconf	5 Jul 2002 13:37:36 -0000	1.2
  @@ -12,6 +12,6 @@
     <!-- Default implementation via Jakarta Slide -->
     <component-instance class="org.apache.cocoon.components.repository.impl.SlidePrincipalProvider" 
                         name="slide" logger="core.repositories.slide"
  -                      repository="slide" namespace="slide"/>
  +                      repository="slide" namespace="myrepository"/>
    </component>
   </xconf>
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/PrincipalListGenerator.java
  
  Index: PrincipalListGenerator.java
  ===================================================================
  /*
  
   ============================================================================
                     The Apache Software License, Version 1.1
   ============================================================================
  
   Copyright (C) 1999-2002 The Apache Software Foundation. All rights reserved.
  
   Redistribution and use in source and binary forms, with or without modifica-
   tion, are permitted provided that the following conditions are met:
  
   1. Redistributions of  source code must  retain the above copyright  notice,
      this list of conditions and the following disclaimer.
  
   2. Redistributions in binary form must reproduce the above copyright notice,
      this list of conditions and the following disclaimer in the documentation
      and/or other materials provided with the distribution.
  
   3. The end-user documentation included with the redistribution, if any, must
      include  the following  acknowledgment:  "This product includes  software
      developed  by the  Apache Software Foundation  (http://www.apache.org/)."
      Alternately, this  acknowledgment may  appear in the software itself,  if
      and wherever such third-party acknowledgments normally appear.
  
   4. The names "Apache Cocoon" and  "Apache Software Foundation" must  not  be
      used to  endorse or promote  products derived from  this software without
      prior written permission. For written permission, please contact
      apache@apache.org.
  
   5. Products  derived from this software may not  be called "Apache", nor may
      "Apache" appear  in their name,  without prior written permission  of the
      Apache Software Foundation.
  
   THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
   INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
   FITNESS  FOR A PARTICULAR  PURPOSE ARE  DISCLAIMED.  IN NO  EVENT SHALL  THE
   APACHE SOFTWARE  FOUNDATION  OR ITS CONTRIBUTORS  BE LIABLE FOR  ANY DIRECT,
   INDIRECT, INCIDENTAL, SPECIAL,  EXEMPLARY, OR CONSEQUENTIAL  DAMAGES (INCLU-
   DING, BUT NOT LIMITED TO, PROCUREMENT  OF SUBSTITUTE GOODS OR SERVICES; LOSS
   OF USE, DATA, OR  PROFITS; OR BUSINESS  INTERRUPTION)  HOWEVER CAUSED AND ON
   ANY  THEORY OF LIABILITY,  WHETHER  IN CONTRACT,  STRICT LIABILITY,  OR TORT
   (INCLUDING  NEGLIGENCE OR  OTHERWISE) ARISING IN  ANY WAY OUT OF THE  USE OF
   THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  
   This software  consists of voluntary contributions made  by many individuals
   on  behalf of the Apache Software  Foundation and was  originally created by
   Stefano Mazzocchi  <st...@apache.org>. For more  information on the Apache
   Software Foundation, please see <http://www.apache.org/>.
  
  */
  
  package org.apache.cocoon.generation;
  
  import org.apache.avalon.excalibur.pool.Recyclable;
  
  import org.apache.avalon.framework.activity.Disposable;
  import org.apache.avalon.framework.component.Component;
  import org.apache.avalon.framework.component.ComponentException;
  //import org.apache.avalon.framework.component.ComponentManager;
  import org.apache.avalon.framework.component.ComponentSelector;
  //import org.apache.avalon.framework.component.Composable;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.parameters.ParameterException;
  import org.apache.avalon.framework.parameters.Parameters;
  
  import org.apache.cocoon.ProcessingException;
  import org.apache.cocoon.components.repository.Principal;
  import org.apache.cocoon.components.repository.PrincipalGroup;
  import org.apache.cocoon.components.repository.PrincipalProvider;
  import org.apache.cocoon.environment.SourceResolver;
  import org.apache.cocoon.xml.EmbeddedXMLPipe;
  
  //import org.xml.sax.Attributes;
  import org.xml.sax.SAXException;
  import org.xml.sax.helpers.AttributesImpl;
  
  import java.io.IOException;
  import java.net.MalformedURLException;
  import java.util.Enumeration;
  import java.util.Date;
  import java.util.Map;
  
  /**
   * The generator generates a list of all principals and group of
   * principals from a PrincipalProvider.
   *
   * @author <a href="mailto:stephan@apache.org">Stephan Michels</a>
   * @version CVS $Id: PrincipalListGenerator.java,v 1.1 2002/07/05 13:37:37 stephan Exp $
   */
  public class PrincipalListGenerator extends ComposerGenerator 
          implements Recyclable {
  
      /** Namespace of the generated list. */
      private static final String PL_NS =
        "http://xml.apache.org/cocoon/PrincipalListGenerator";
  
      /** The namespace prefix of the resource description framework. */
      private static final String PL_PREFIX                   = "pl";
  
      private static final String LIST_ELEMENT_NAME           = "list";
      private static final String PRINCIPAL_ELEMENT_NAME      = "principal";
      private static final String PRINCIPALGROUP_ELEMENT_NAME = "group";
  
      private static final String NAME_ATTR_NAME              = "name";
      private static final String ROLE_ATTR_NAME              = "role";
      private static final String PASSWORD_ATTR_NAME          = "password";
  
      private Principal principalcaller = null;
      private String principalprovidername = null;
  
      public void setup(SourceResolver resolver, Map objectModel, String location, Parameters parameters)
          throws ProcessingException, SAXException, IOException {
          super.setup(resolver, objectModel, location, parameters);
  
          try {
              this.principalcaller = new Principal(parameters.getParameter("principalcaller", "guest"));
              this.principalprovidername = parameters.getParameter("principalprovider");
          } catch (ParameterException pe) {
              throw new ProcessingException("Could not retrieve parameters", pe);
          }
      }
  
      /**
       * Generate XML data.
       */
      public void generate() throws IOException, SAXException, ProcessingException {
  
          ComponentSelector principalproviders = null;
          PrincipalProvider principalprovider = null;
          try {
              principalproviders = (ComponentSelector)this.manager.lookup(PrincipalProvider.ROLE+"Selector");
  
              principalprovider = (PrincipalProvider)principalproviders.select(this.principalprovidername);
  
              Principal[] principals = principalprovider.getPrincipals(this.principalcaller);
              PrincipalGroup[] principalgroups = principalprovider.getPrincipalGroups(this.principalcaller);
  
              this.contentHandler.startDocument();
              this.contentHandler.startPrefixMapping(PL_PREFIX,PL_NS);
  
              this.contentHandler.startElement(PL_NS, LIST_ELEMENT_NAME,
                                               PL_PREFIX+':'+LIST_ELEMENT_NAME, new AttributesImpl());
  
              AttributesImpl attributes;
              for(int i=0; i<principals.length; i++) {
                  attributes = new AttributesImpl();
                  attributes.addAttribute(PL_NS, NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principals[i].getName());
                  if (principals[i].getRole()!=null)
                      attributes.addAttribute(PL_NS, ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", principals[i].getRole());
                  if (principals[i].getPassword()!=null)
                      attributes.addAttribute(PL_NS, PASSWORD_ATTR_NAME, PASSWORD_ATTR_NAME, "CDATA", principals[i].getPassword());
  
                  this.contentHandler.startElement(PL_NS, PRINCIPAL_ELEMENT_NAME,
                                                   PL_PREFIX+':'+PRINCIPAL_ELEMENT_NAME, attributes);
                  this.contentHandler.endElement(PL_NS, PRINCIPAL_ELEMENT_NAME, PL_PREFIX+':'+PRINCIPAL_ELEMENT_NAME);
              }
  
              for(int i=0; i<principalgroups.length; i++) {
                  attributes = new AttributesImpl();
                  attributes.addAttribute(PL_NS, NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principalgroups[i].getName());
  
                  this.contentHandler.startElement(PL_NS, PRINCIPALGROUP_ELEMENT_NAME,
                                                   PL_PREFIX+':'+PRINCIPALGROUP_ELEMENT_NAME, attributes);
  
                  Principal[] members = principalprovider.members(this.principalcaller, principalgroups[i]);
                  for(int j=0; j<members.length; j++) {
                      attributes = new AttributesImpl();
                      attributes.addAttribute(PL_NS, NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", members[j].getName());
                      if (principals[i].getRole()!=null) 
                          attributes.addAttribute(PL_NS, ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", members[j].getRole());
                      if (principals[i].getPassword()!=null)
                          attributes.addAttribute(PL_NS, PASSWORD_ATTR_NAME, PASSWORD_ATTR_NAME, "CDATA",
                                                  members[j].getPassword());
  
                      this.contentHandler.startElement(PL_NS, PRINCIPAL_ELEMENT_NAME,
                                                       PL_PREFIX+':'+PRINCIPAL_ELEMENT_NAME, attributes);
                      this.contentHandler.endElement(PL_NS, PRINCIPAL_ELEMENT_NAME, PL_PREFIX+':'+PRINCIPAL_ELEMENT_NAME);
                  }
  
                  this.contentHandler.endElement(PL_NS, PRINCIPALGROUP_ELEMENT_NAME, PL_PREFIX+':'+PRINCIPALGROUP_ELEMENT_NAME);
              }
                  
  
              this.contentHandler.endElement(PL_NS, LIST_ELEMENT_NAME, PL_PREFIX+':'+LIST_ELEMENT_NAME);
  
              this.contentHandler.endPrefixMapping(PL_PREFIX);
              this.contentHandler.endDocument();
  
          } catch (ComponentException ce) {
              getLogger().error("Could not lookup for component.", ce);
          } finally {
              if (principalprovider!=null)
                  principalproviders.release(principalprovider);
              principalprovider = null;
  
              if (principalproviders!=null)
                  this.manager.release(principalproviders);
              principalproviders = null;
          }
      }
  
      public void recycle() {
          this.principalcaller = null;
          this.principalprovidername = null;
      }
  }
  
  
  
  
  1.3       +3 -0      xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4content.xsl
  
  Index: rdf2html4content.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4content.xsl,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- rdf2html4content.xsl	4 Jul 2002 17:32:41 -0000	1.2
  +++ rdf2html4content.xsl	5 Jul 2002 13:37:37 -0000	1.3
  @@ -25,6 +25,9 @@
            <tr>
               <td width="90%" align="left" bgcolor="#0086b2"><font size="+1" face="arial,helvetica,sanserif"
       color="#ffffff"><xsl:value-of select="rdf:RDF/rdf:Description[1]/@rdf:about"/></font></td>
  +            <td nowrap="nowrap" bgcolor="#ffffff"><a href="/cocoon/samples/slide/users/">
  +             <i>users</i></a>
  +            </td>
               <td nowrap="nowrap" bgcolor="#ffffff"><a
       href="/cocoon/samples/slide/content/{substring-after(rdf:RDF/rdf:Description[1]/@rdf:about,'://')}">
                <i>content</i></a>
  
  
  
  1.2       +3 -0      xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4locks.xsl
  
  Index: rdf2html4locks.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4locks.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- rdf2html4locks.xsl	2 Jul 2002 23:42:39 -0000	1.1
  +++ rdf2html4locks.xsl	5 Jul 2002 13:37:37 -0000	1.2
  @@ -25,6 +25,9 @@
            <tr>
               <td width="90%" align="left" bgcolor="#0086b2"><font size="+1" face="arial,helvetica,sanserif"
       color="#ffffff"><xsl:value-of select="rdf:RDF/rdf:Description[1]/@rdf:about"/></font></td>
  +            <td nowrap="nowrap" bgcolor="#ffffff"><a href="/cocoon/samples/slide/users/">
  +             <i>users</i></a>
  +            </td>
               <td nowrap="nowrap" bgcolor="#ffffff"><a
       href="/cocoon/samples/slide/content/{substring-after(rdf:RDF/rdf:Description[1]/@rdf:about,'://')}">
                <i>content</i></a>
  
  
  
  1.2       +3 -0      xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4permissions.xsl
  
  Index: rdf2html4permissions.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4permissions.xsl,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- rdf2html4permissions.xsl	2 Jul 2002 23:42:39 -0000	1.1
  +++ rdf2html4permissions.xsl	5 Jul 2002 13:37:37 -0000	1.2
  @@ -25,6 +25,9 @@
            <tr>
               <td width="90%" align="left" bgcolor="#0086b2"><font size="+1" face="arial,helvetica,sanserif"
       color="#ffffff"><xsl:value-of select="rdf:RDF/rdf:Description[1]/@rdf:about"/></font></td>
  +            <td nowrap="nowrap" bgcolor="#ffffff"><a href="/cocoon/samples/slide/users/">
  +             <i>users</i></a>
  +            </td>
               <td nowrap="nowrap" bgcolor="#ffffff"><a
       href="/cocoon/samples/slide/content/{substring-after(rdf:RDF/rdf:Description[1]/@rdf:about,'://')}">
                <i>content</i></a>
  
  
  
  1.4       +3 -0      xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4properties.xsl
  
  Index: rdf2html4properties.xsl
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/rdf2html4properties.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- rdf2html4properties.xsl	4 Jul 2002 17:32:41 -0000	1.3
  +++ rdf2html4properties.xsl	5 Jul 2002 13:37:37 -0000	1.4
  @@ -25,6 +25,9 @@
            <tr>
               <td width="90%" align="left" bgcolor="#0086b2"><font size="+1" face="arial,helvetica,sanserif"
       color="#ffffff"><xsl:value-of select="rdf:RDF/rdf:Description[1]/@rdf:about"/></font></td>
  +            <td nowrap="nowrap" bgcolor="#ffffff"><a href="/cocoon/samples/slide/users/">
  +             <i>users</i></a>
  +            </td>
               <td nowrap="nowrap" bgcolor="#ffffff"><a
       href="/cocoon/samples/slide/content/{substring-after(rdf:RDF/rdf:Description[1]/@rdf:about,'://')}">
                <i>content</i></a>
  
  
  
  1.4       +40 -17    xml-cocoon2/src/scratchpad/webapp/samples/slide/sitemap.xmap
  
  Index: sitemap.xmap
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/sitemap.xmap,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- sitemap.xmap	2 Jul 2002 23:42:39 -0000	1.3
  +++ sitemap.xmap	5 Jul 2002 13:37:37 -0000	1.4
  @@ -5,7 +5,11 @@
     <map:generators default="file">
      <map:generator name="sourcedescription" 
                     src="org.apache.cocoon.generation.SourceDescriptionGenerator" 
  -                  logger="sitemap.generator.sourcedescriptiongenerator"
  +                  logger="sitemap.generator.sourcedescription"
  +                  label="content"/>
  +   <map:generator name="principallist"
  +                  src="org.apache.cocoon.generation.PrincipalListGenerator"
  +                  logger="sitemap.generator.principallist"
                     label="content"/>
     </map:generators>
   
  @@ -32,13 +36,13 @@
     <map:selectors default="browser"/>
   
     <map:actions>
  -   <map:action logger="sitemap.action.slide.upload" name="slide-upload"
  +   <map:action logger="sitemap.action.slide.upload" name="source-upload"
                  src="org.apache.cocoon.acting.SourceUploadAction"/>
  -   <map:action logger="sitemap.action.slide.addproperty" name="slide-addproperty"
  +   <map:action logger="sitemap.action.slide.addproperty" name="source-addproperty"
                  src="org.apache.cocoon.acting.SourceAddPropertyAction"/>
  -   <map:action logger="sitemap.action.slide.deleteproperty" name="slide-deleteproperty"
  +   <map:action logger="sitemap.action.slide.deleteproperty" name="source-deleteproperty"
                  src="org.apache.cocoon.acting.SourceDeletePropertyAction"/>
  -   <map:action logger="sitemap.action.slide.deletecontent" name="slide-deletecontent"
  +   <map:action logger="sitemap.action.slide.deletecontent" name="source-deletecontent"
                  src="org.apache.cocoon.acting.SourceDeleteContentAction"/>
   
      <map:action name="portal-auth" src="org.apache.cocoon.webapps.portal.acting.AuthAction"/>
  @@ -48,7 +52,7 @@
       <handlers>
        <handler name="slidehandler" xmlns:map="http://apache.org/cocoon/sitemap/1.0">
         <redirect-to    uri="cocoon://samples/slide/login.html"/>
  -      <authentication uri="cocoon://samples/slide/slide-authuser"/>
  +      <authentication uri="cocoon://samples/slide/source-authuser"/>
        </handler>
       </handlers>
      </map:action>
  @@ -80,20 +84,23 @@
    </map:views>
   
     <map:action-sets>
  -   <map:action-set name="slide-actions">
  -    <map:act action="upload"         type="slide-upload"/>
  -    <map:act action="addproperty"    type="slide-addproperty"/>
  -    <map:act action="deleteproperty" type="slide-deleteproperty"/>
  -    <map:act action="deletecontent" type="slide-deletecontent"/>
  +   <map:action-set name="source-actions">
  +    <map:act action="upload"         type="source-upload"/>
  +    <map:act action="addproperty"    type="source-addproperty"/>
  +    <map:act action="deleteproperty" type="source-deleteproperty"/>
  +    <map:act action="deletecontent" type="source-deletecontent"/>
  +   </map:action-set>
  +
  +   <map:action-set name="repository-actions">
      </map:action-set>
     </map:action-sets>
   
    <map:pipelines>
   
   <!--  <map:pipeline>
  -   <map:match pattern="slide-*">
  +   <map:match pattern="source-*">
   
  -    <map:match pattern="slide-authuser">
  +    <map:match pattern="source-authuser">
        <map:generate type="slidecollection" src="myrepository/users"/>
        <map:transform src="resources/slideuser2user.xsl">
         <map:parameter name="use-request-parameters" value="true"/>
  @@ -159,7 +166,7 @@
   
        <!-- ============= Source content ================== -->
        <map:match pattern="content/**">
  -      <map:act set="slide-actions">
  +      <map:act set="source-actions">
          <map:parameter name="cocoon-source-principal" value="root"/>
         </map:act>
   
  @@ -170,7 +177,7 @@
   
        <!-- ============= Source properties =============== -->
        <map:match pattern="properties/**">
  -      <map:act set="slide-actions">
  +      <map:act set="source-actions">
          <map:parameter name="cocoon-source-principal" value="root"/>
         </map:act>
   
  @@ -181,7 +188,7 @@
   
        <!-- ============= Source permissions ============== -->
        <map:match pattern="permissions/**">
  -      <map:act set="slide-actions">
  +      <map:act set="source-actions">
          <map:parameter name="cocoon-source-principal" value="root"/>
         </map:act>
   
  @@ -192,7 +199,7 @@
   
        <!-- ============= Source locks ==================== -->
        <map:match pattern="locks/**">
  -      <map:act set="slide-actions">
  +      <map:act set="source-actions">
          <map:parameter name="cocoon-source-principal" value="root"/>
         </map:act>
   
  @@ -201,8 +208,24 @@
         <map:serialize type="html"/>
        </map:match>
   
  +     <!-- ============= Source direct ================== -->
  +
        <map:match pattern="view/**">
         <map:read src="slide://{1}?cocoon-source-principal=root"/>
  +     </map:match>
  +
  +     <!-- ============= Repository users =============== -->
  +     <map:match pattern="users/**">
  +      <map:act set="repository-actions">
  +       <map:parameter name="cocoon-repository-principal" value="root"/>
  +      </map:act>
  +
  +      <map:generate type="principallist">
  +       <map:parameter name="principalprovider" value="slide"/>
  +       <map:parameter name="principalcaller" value="root"/>
  +      </map:generate>
  +      <map:transform src="principal2html4users.xsl"/>
  +      <map:serialize type="html"/>
        </map:match>
   
   <!--    </map:act>
  
  
  
  1.4       +0 -2      xml-cocoon2/src/scratchpad/webapp/samples/slide/slide.xconf
  
  Index: slide.xconf
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/slide.xconf,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- slide.xconf	2 Jul 2002 16:54:25 -0000	1.3
  +++ slide.xconf	5 Jul 2002 13:37:37 -0000	1.4
  @@ -105,8 +105,6 @@
                     linkedUri="/users/john"/>
         <objectnode classname="org.apache.slide.structure.LinkNode" uri="/users/groupA/root"
                     linkedUri="/users/root"/>
  -      <objectnode classname="org.apache.slide.structure.SubjectNode"
  -                  uri="/users/groupA/singleGroupMember"/>
        </objectnode>
   
        <!-- /users/root represents the administrator -->
  
  
  
  1.1                  xml-cocoon2/src/scratchpad/webapp/samples/slide/principal2html4users.xsl
  
  Index: principal2html4users.xsl
  ===================================================================
  <?xml version="1.0"?>
  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
                  xmlns:pl="http://xml.apache.org/cocoon/PrincipalListGenerator">
  
   <xsl:output indent="yes"/>
  
   <xsl:template match="/">
    <html>
     <head>
      <title>Apache Cocoon @version@</title>
      <link rel="SHORTCUT ICON" href="favicon.ico"/>
     </head>
     <body bgcolor="#ffffff" link="#0086b2" vlink="#00698c" alink="#743e75">
      <table border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
       <tr>
        <td width="*"><font face="arial,helvetica,sanserif" color="#000000">The Apache Software Foundation is proud to present...</font></td>
        <td width="40%" align="center"><img border="0" src="/cocoon/samples/images/cocoon.gif"/></td>
        <td width="30%" align="center"><font face="arial,helvetica,sanserif" color="#000000"><b>version @version@</b></font></td>
       </tr>
       <tr>
         <table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
           <tr>
              <td width="90%" align="left" bgcolor="#0086b2"><font size="+1" face="arial,helvetica,sanserif"
      color="#ffffff">User management</font></td>
              <td nowrap="nowrap" bgcolor="#ffffff"><a href="/cocoon/samples/slide/users/">
               <i>users</i></a>
              </td>
              <td nowrap="nowrap" bgcolor="#ffffff"><a href="/cocoon/samples/slide/content/">
               <i>content</i></a>
              </td>
              <td nowrap="nowrap" bgcolor="#ffffff"><a href="/cocoon/samples/slide/properties/">
               <i>properties</i></a>
              </td>
              <td nowrap="nowrap" bgcolor="#ffffff"><a href="/cocoon/samples/slide/permissions/">
               <i>permissions</i></a>
              </td>
              <td nowrap="nowrap" bgcolor="#ffffff"><a href="/cocoon/samples/slide/locks/">
               <i>locks</i></a>
              </td>
           </tr>
         </table>
       </tr>
      </table>
  
      <xsl:apply-templates select="pl:list"/>
  
      <p align="center">
       <font size="-1">
        Copyright &#169; @year@ <a href="http://www.apache.org/">The Apache Software Foundation</a>.<br/>
        All rights reserved.
       </font>
      </p>
     </body>
    </html>
   </xsl:template>
  
   <xsl:template match="pl:list">
  
    <table width="100%">
     <tr>
  
      <td width="60%" valign="top">
       <table border="0" bgcolor="#000000" cellpadding="0" cellspacing="0" width="97%">
        <tbody>
         <tr>
          <td>
           <table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
            <tr>
             <td bgcolor="#0086b2" width="100%" align="left">
              <font size="+1" face="arial,helvetica,sanserif" color="#ffffff">Users</font>
             </td>
            </tr>
            <tr>
             <td width="100%" bgcolor="#ffffff" align="left">
              <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2"  width="100%" align="center">
  
               <font size="+0" face="arial,helvetica,sanserif" color="#000000">
  
                <tr>
                 <td align="left"><b>User</b></td>
                 <td align="left"></td>
                 <td align="left"><b>Role</b></td>
                 <td align="left"><b>Groups</b></td>
                 <td align="left"></td>
                 <td align="right"></td>
                </tr>
   
                <xsl:for-each select="pl:principal">
                 <tr>
    
                  <form action="" method="post">
                  <input type="hidden" name="name" value="{@pl:name}"/>
   
                   <td align="left">
                    <xsl:value-of select="@pl:name"/>
                   </td>
   
                   <td align="left">
                    <input type="submit" name="cocoon-action-deleteprincipal" value="Delete user"/>
                   </td>
   
                  </form>
   
                  <td align="left"><xsl:value-of select="@pl:role"/></td>
   
                  <form action="" method="post">
                  <input type="hidden" name="principal" value="{@pl:name}"/>
   
                   <td align="left">
                    <xsl:variable name="name" select="@pl:name"/>
                    <select name="group" size="{count(../pl:group/pl:principal[@pl:name=$name])}">
                     <xsl:for-each select="../pl:group/pl:principal[@pl:name=$name]">
                      <option><xsl:value-of select="../@pl:name"/></option>
                     </xsl:for-each>
                    </select>
                   </td>
   
                   <td align="left">
                    <input type="submit" name="cocoon-action-removemember" value="Remove group"/>
                   </td>
                  </form>
   
                 </tr>
   
                 <tr>
                  <td align="left"></td>
                  <td align="left"></td>
                  <td align="left"></td>
   
                  <form action="" method="post">
                  <input type="hidden" name="principal" value="{@pl:name}"/>
   
                   <td align="left">
                    <xsl:variable name="name" select="@pl:name"/>
                    <select name="group" size="1">
                     <xsl:for-each select="../pl:group">
                      <option><xsl:value-of select="@pl:name"/></option>
                     </xsl:for-each>
                    </select>
                   </td>
   
                   <td align="left">
                    <input type="submit" name="cocoon-action-addmember" value="Add group"/>
                   </td>
                  </form>
   
                 </tr>
                </xsl:for-each>
   
                <tr>
                 <form action="" method="post">
                  <td align="left">
                   <input name="principal" type="text" size="10" maxlength="40"/>
                  </td>
                  <td align="left"></td>
                  <td align="left">
                   <input name="role" type="text" size="10" maxlength="40"/>
                  </td>
                  <td align="left"></td>
                  <td align="left"></td>
                  <td align="right">
                   <input type="submit" name="cocoon-action-addprincipal" value="Add user"/>
                  </td>
                 </form>
                </tr>
  
               </font>
  
              </table>
             </td>
            </tr>
           </table>
  
          </td>
         </tr> 
        </tbody>
       </table>
  
       <br/>
      </td>
  
      <td valign="top">
       <table border="0" bgcolor="#000000" cellpadding="0" cellspacing="0" width="97%">
        <tbody>
         <tr>
          <td>
           <table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" align="center" width="100%">
            <tr>
             <td bgcolor="#0086b2" width="100%" align="left">
              <font size="+1" face="arial,helvetica,sanserif" color="#ffffff">Groups</font>
             </td>
            </tr>
            <tr>
             <td width="100%" bgcolor="#ffffff" align="left">
              <table bgcolor="#ffffff" border="0" cellspacing="0" cellpadding="2"  width="100%" align="center">
  
               <font size="+0" face="arial,helvetica,sanserif" color="#000000">
  
                <tr>
                 <td align="left"><b>Group</b></td>
                 <td align="right"></td>
                </tr>
  
                <xsl:for-each select="pl:group">
                 <tr>
  
                  <form action="" method="post">
                  <input type="hidden" name="name" value="{@pl:name}"/>
   
                   <td align="left">
                    <xsl:value-of select="@pl:name"/>
                   </td>
  
                   <td align="right">
                    <input type="submit" name="cocoon-action-deletegroup" value="Delete group"/>
                   </td>
  
                  </form>
                 </tr>
                </xsl:for-each>
  
                <tr>
                 <form action="" method="post">
                  <td align="left">
                   <input name="group" type="text" size="25" maxlength="40"/>
                  </td>
                  <td align="right">
                   <input type="submit" name="cocoon-action-addgroup" value="Add group"/>
                  </td>
                 </form>
                </tr>
  
               </font>
  
              </table>
             </td>
            </tr>
           </table>
  
          </td>
         </tr> 
        </tbody>
       </table>
  
       <br/>
      </td>
  
     </tr>
    </table>
  
   </xsl:template>
  
  </xsl:stylesheet>
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org