stephan 2002/10/30 09:01:29 Modified: src/scratchpad/src/org/apache/cocoon/acting SourceMultiAction.java src/scratchpad/src/org/apache/cocoon/components/repository/impl SlidePrincipalProvider.java src/scratchpad/src/org/apache/cocoon/generation PrincipalListGenerator.java src/scratchpad/webapp/samples/slide login-failed.html login.html principal2auth.xsl principal2html4users.xsl sitemap.xmap Log: Corrected some errors in the Slide example caused by renaming of the request parmeter input module. Also modified the behavoir of upload action, if no filename is specified. And fixed some NPEs of the PrincipalListGenerator. Revision Changes Path 1.13 +36 -33 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/SourceMultiAction.java Index: SourceMultiAction.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/acting/SourceMultiAction.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- SourceMultiAction.java 28 Oct 2002 14:50:19 -0000 1.12 +++ SourceMultiAction.java 30 Oct 2002 17:01:29 -0000 1.13 @@ -61,7 +61,7 @@ import org.apache.cocoon.Constants; import org.apache.cocoon.ProcessingException; import org.apache.cocoon.acting.AbstractAction; -import org.apache.cocoon.components.request.multipart.FilePartFile; +import org.apache.cocoon.components.request.multipart.FilePart; import org.apache.cocoon.components.source.InspectableSource; import org.apache.cocoon.components.source.ModifiableTraversableSource; import org.apache.cocoon.components.source.RestrictableSource; @@ -92,7 +92,7 @@ * @author <a href="mailto:stephan@;apache.org">Stephan Michels</a> * @version CVS $Id$ */ -public class SourceMultiAction extends AbstractMultiAction implements Contextualizable, ThreadSafe { +public class SourceMultiAction extends AbstractMultiAction implements ThreadSafe { public final static String SOURCE_URI = "cocoon-source-uri"; public final static String SOURCE_PROPERTY_NAMESPACE = "cocoon-source-property-namespace"; @@ -108,21 +108,12 @@ public final static String UPLOAD_FILE = "cocoon-upload-file"; public final static String SOURCE_NAME = "cocoon-source-name"; - File uploadDir = null; - - /** Contextualize this class */ - public void contextualize(Context context) throws ContextException { - uploadDir = (File) context.get(Constants.CONTEXT_UPLOAD_DIR); - } - public Map doUploadSource(Redirector redirector, SourceResolver resolver, Map objectModel, String src, Parameters parameters) throws Exception { - getLogger().debug("upload source called"); - Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); @@ -134,13 +125,22 @@ String password = parameters.getParameter(PASSWORD, request.getParameter(PASSWORD)); + getLogger().info("upload source called by '"+principal+"' for '"+uri+"'"); + if ((request.get(UPLOAD_FILE)!=null) && - (request.get(UPLOAD_FILE) instanceof FilePartFile)) { - File uploadFile = ((FilePartFile)request.get(UPLOAD_FILE)).getFile(); + (request.get(UPLOAD_FILE) instanceof FilePart)) { + FilePart filepart = (FilePart)request.get(UPLOAD_FILE); try { - if ((filename==null) || (filename.length()==0)) - filename = ((FilePartFile)request.get(UPLOAD_FILE)).getFilePath(); + if ((filename==null) || (filename.length()==0)) { + filename = filepart.getFilePath(); + int index = filename.lastIndexOf("/"); + if (index>=0) + filename = filename.substring(index+1); + index = filename.lastIndexOf("\\"); + if (index>=0) + filename = filename.substring(index+1); + } if ((uri==null) || (uri.length()==0)) uri = filename; @@ -162,9 +162,10 @@ byte[] buffer = new byte[8192]; int length = -1; - InputStream in = new FileInputStream(uploadFile); + InputStream in = filepart.getInputStream(); while ((length = in.read(buffer)) > -1) { out.write(buffer, 0, length); + getLogger().debug("="+length); } in.close(); out.flush(); @@ -181,6 +182,8 @@ getLogger().debug("Exception occurs while storing the content", ioe); throw new ProcessingException("Exception occurs while storing the content", ioe); } + } else { + getLogger().debug("Couldn't get upload file"); } return EMPTY_MAP; @@ -192,8 +195,6 @@ String src, Parameters parameters) throws Exception { - getLogger().debug("create collection called"); - Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); @@ -203,6 +204,8 @@ String password = parameters.getParameter(PASSWORD, request.getParameter(PASSWORD)); + getLogger().info("create collection called by '"+principal+"' for '"+uri+"'"); + try { Source source = resolver.resolveURI(uri); @@ -232,8 +235,6 @@ String src, Parameters parameters) throws Exception { - getLogger().debug("delete source called"); - Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); @@ -242,6 +243,8 @@ String password = parameters.getParameter(PASSWORD, request.getParameter(PASSWORD)); + getLogger().info("delete source called by '"+principal+"' for '"+uri+"'"); + try { Source source = resolver.resolveURI(uri); @@ -271,8 +274,6 @@ String src, Parameters parameters) throws Exception { - getLogger().debug("add property called"); - Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); @@ -288,6 +289,8 @@ String password = parameters.getParameter(PASSWORD, request.getParameter(PASSWORD)); + getLogger().info("add property called by '"+principal+"' for '"+uri+"'"); + try { Source source = resolver.resolveURI(uri); @@ -318,8 +321,6 @@ String src, Parameters parameters) throws Exception { - getLogger().debug("delete property called"); - Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); @@ -333,6 +334,8 @@ String password = parameters.getParameter(PASSWORD, request.getParameter(PASSWORD)); + getLogger().info("delete property called by '"+principal+"' for '"+uri+"'"); + try { Source source = resolver.resolveURI(uri); @@ -362,8 +365,6 @@ String src, Parameters parameters) throws Exception { - getLogger().debug("add principal permission called"); - Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); @@ -381,6 +382,8 @@ String password = parameters.getParameter(PASSWORD, request.getParameter(PASSWORD)); + getLogger().info("add principal permission called by '"+principal+"' for '"+uri+"'"); + try { Source source = resolver.resolveURI(uri); @@ -411,8 +414,6 @@ String src, Parameters parameters) throws Exception { - getLogger().debug("remove principal permission called"); - Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); @@ -430,6 +431,8 @@ String password = parameters.getParameter(PASSWORD, request.getParameter(PASSWORD)); + getLogger().info("remove principal permission called by '"+principal+"' for '"+uri+"'"); + try { Source source = resolver.resolveURI(uri); @@ -460,8 +463,6 @@ String src, Parameters parameters) throws Exception { - getLogger().debug("add principal group permission called"); - Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); @@ -479,6 +480,8 @@ String password = parameters.getParameter(PASSWORD, request.getParameter(PASSWORD)); + getLogger().info("add principal group permission called by '"+principal+"' for '"+uri+"'"); + try { Source source = resolver.resolveURI(uri); @@ -509,8 +512,6 @@ String src, Parameters parameters) throws Exception { - getLogger().debug("remove principal group permission called"); - Request request = ObjectModelHelper.getRequest(objectModel); String uri = parameters.getParameter(SOURCE_URI, request.getParameter(SOURCE_URI)); @@ -527,6 +528,8 @@ request.getParameter(PRINCIPAL)); String password = parameters.getParameter(PASSWORD, request.getParameter(PASSWORD)); + + getLogger().info("remove principal group permission called by '"+principal+"' for '"+uri+"'"); try { 1.6 +3 -3 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.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- SlidePrincipalProvider.java 22 Jul 2002 21:26:50 -0000 1.5 +++ SlidePrincipalProvider.java 30 Oct 2002 17:01:29 -0000 1.6 @@ -643,10 +643,10 @@ String name = userobject.getUri().substring(userspath.length()+1); // FIXME the CVS code from slide does only implement getRoles - /*Enumeration roles = this.security.getRoles(user); + Enumeration roles = this.security.getRoles(userobject); String role = null; if (roles.hasMoreElements()) - role = (String)children.nextElement();*/ + role = (String)roles.nextElement(); NodeRevisionDescriptors revisionDescriptors = content.retrieve(slidetoken, userobject.getUri()); 1.3 +21 -21 xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/PrincipalListGenerator.java Index: PrincipalListGenerator.java =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/src/org/apache/cocoon/generation/PrincipalListGenerator.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- PrincipalListGenerator.java 8 Jul 2002 08:15:13 -0000 1.2 +++ PrincipalListGenerator.java 30 Oct 2002 17:01:29 -0000 1.3 @@ -97,7 +97,7 @@ "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 PL_PREFIX = "pl"; private static final String LIST_ELEMENT_NAME = "list"; private static final String PRINCIPAL_ELEMENT_NAME = "principal"; @@ -138,54 +138,54 @@ PrincipalGroup[] principalgroups = principalprovider.getPrincipalGroups(this.principalcaller); this.contentHandler.startDocument(); - this.contentHandler.startPrefixMapping(PL_PREFIX,PL_NS); + this.contentHandler.startPrefixMapping("",PL_NS); this.contentHandler.startElement(PL_NS, LIST_ELEMENT_NAME, - PL_PREFIX+':'+LIST_ELEMENT_NAME, new AttributesImpl()); + 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()); + attributes.addAttribute("", 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()); + attributes.addAttribute("", 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()); + attributes.addAttribute("", 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); + PRINCIPAL_ELEMENT_NAME, attributes); + this.contentHandler.endElement(PL_NS, PRINCIPAL_ELEMENT_NAME, 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()); + attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", principalgroups[i].getName()); this.contentHandler.startElement(PL_NS, PRINCIPALGROUP_ELEMENT_NAME, - PL_PREFIX+':'+PRINCIPALGROUP_ELEMENT_NAME, attributes); + 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", + attributes.addAttribute("", NAME_ATTR_NAME, NAME_ATTR_NAME, "CDATA", members[j].getName()); + if (members[j].getRole()!=null) + attributes.addAttribute("", ROLE_ATTR_NAME, ROLE_ATTR_NAME, "CDATA", members[j].getRole()); + if (members[j].getPassword()!=null) + attributes.addAttribute("", 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); + PRINCIPAL_ELEMENT_NAME, attributes); + this.contentHandler.endElement(PL_NS, PRINCIPAL_ELEMENT_NAME, PRINCIPAL_ELEMENT_NAME); } - this.contentHandler.endElement(PL_NS, PRINCIPALGROUP_ELEMENT_NAME, PL_PREFIX+':'+PRINCIPALGROUP_ELEMENT_NAME); + this.contentHandler.endElement(PL_NS, PRINCIPALGROUP_ELEMENT_NAME, PRINCIPALGROUP_ELEMENT_NAME); } - this.contentHandler.endElement(PL_NS, LIST_ELEMENT_NAME, PL_PREFIX+':'+LIST_ELEMENT_NAME); + this.contentHandler.endElement(PL_NS, LIST_ELEMENT_NAME, LIST_ELEMENT_NAME); - this.contentHandler.endPrefixMapping(PL_PREFIX); + this.contentHandler.endPrefixMapping(""); this.contentHandler.endDocument(); } catch (ComponentException ce) { 1.6 +5 -5 xml-cocoon2/src/scratchpad/webapp/samples/slide/login-failed.html Index: login-failed.html =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/login-failed.html,v retrieving revision 1.5 retrieving revision 1.6 diff -u -r1.5 -r1.6 --- login-failed.html 25 Sep 2002 09:02:51 -0000 1.5 +++ login-failed.html 30 Oct 2002 17:01:29 -0000 1.6 @@ -1,7 +1,7 @@ <?xml version="1.0"?> <html> <head> - <title>Apache Cocoon @version@</title> + <title>Apache Cocoon 2.1-dev</title> <link rel="SHORTCUT ICON" href="favicon.ico"/> </head> <body bgcolor="#ffffff" link="#0086b2" vlink="#00698c" alink="#743e75"> @@ -9,7 +9,7 @@ <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> + <td width="30%" align="center"><font face="arial,helvetica,sanserif" color="#000000"><b>version 2.1-dev</b></font></td> </tr> <tr> <table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" align="center" width="100%"> @@ -47,12 +47,12 @@ <tr> <td>Username</td> - <td><input name="name" type="text" size="15" maxlength="40"/></td> + <td><input name="userid" type="text" size="15" maxlength="40"/></td> </tr> <tr> <td>Password</td> - <td><input name="pw" type="password" size="15" maxlength="40"/></td> + <td><input name="password" type="password" size="15" maxlength="40"/></td> </tr> <tr> @@ -88,7 +88,7 @@ <p align="center"> <font size="-1"> - Copyright © @year@ <a href="http://www.apache.org/">The Apache Software Foundation</a>.<br/> + Copyright © 1999-2002 <a href="http://www.apache.org/">The Apache Software Foundation</a>.<br/> All rights reserved. </font> </p> 1.7 +5 -5 xml-cocoon2/src/scratchpad/webapp/samples/slide/login.html Index: login.html =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/login.html,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- login.html 25 Sep 2002 09:02:51 -0000 1.6 +++ login.html 30 Oct 2002 17:01:29 -0000 1.7 @@ -1,7 +1,7 @@ <?xml version="1.0"?> <html> <head> - <title>Apache Cocoon @version@</title> + <title>Apache Cocoon 2.1-dev</title> <link rel="SHORTCUT ICON" href="favicon.ico"/> </head> <body bgcolor="#ffffff" link="#0086b2" vlink="#00698c" alink="#743e75"> @@ -9,7 +9,7 @@ <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> + <td width="30%" align="center"><font face="arial,helvetica,sanserif" color="#000000"><b>version 2.1-dev</b></font></td> </tr> <tr> <table bgcolor="#000000" border="0" cellspacing="2" cellpadding="2" align="center" width="100%"> @@ -47,12 +47,12 @@ <tr> <td>Username</td> - <td><input name="name" type="text" size="15" maxlength="40"/></td> + <td><input name="userid" type="text" size="15" maxlength="40"/></td> </tr> <tr> <td>Password</td> - <td><input name="pw" type="password" size="15" maxlength="40"/></td> + <td><input name="password" type="password" size="15" maxlength="40"/></td> </tr> <tr> @@ -84,7 +84,7 @@ <p align="center"> <font size="-1"> - Copyright © @year@ <a href="http://www.apache.org/">The Apache Software Foundation</a>.<br/> + Copyright © 1999-2002 <a href="http://www.apache.org/">The Apache Software Foundation</a>.<br/> All rights reserved. </font> </p> 1.3 +4 -5 xml-cocoon2/src/scratchpad/webapp/samples/slide/principal2auth.xsl Index: principal2auth.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/principal2auth.xsl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- principal2auth.xsl 25 Sep 2002 09:02:51 -0000 1.2 +++ principal2auth.xsl 30 Oct 2002 17:01:29 -0000 1.3 @@ -3,20 +3,19 @@ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:pl="http://xml.apache.org/cocoon/PrincipalListGenerator"> - <xsl:param name="pw"/> <xsl:param name="name"/> + <xsl:param name="password"/> <xsl:template match="pl:list"> <authentication> - <xsl:value-of select="$name"/>;<xsl:value-of select="$pw"/>; <xsl:apply-templates select="pl:principal"/> </authentication> </xsl:template> <xsl:template match="pl:principal"> - <xsl:if test="normalize-space(@pl:name) = $name and normalize-space(@pl:password) = $pw"> - <ID><xsl:value-of select="@pl:name"/></ID> - <role><xsl:value-of select="@pl:role"/></role> + <xsl:if test="normalize-space(@name) = $name and normalize-space(@password) = $password"> + <ID><xsl:value-of select="@name"/></ID> + <role><xsl:value-of select="@role"/></role> </xsl:if> </xsl:template> 1.5 +13 -13 xml-cocoon2/src/scratchpad/webapp/samples/slide/principal2html4users.xsl Index: principal2html4users.xsl =================================================================== RCS file: /home/cvs/xml-cocoon2/src/scratchpad/webapp/samples/slide/principal2html4users.xsl,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- principal2html4users.xsl 21 Jul 2002 22:50:55 -0000 1.4 +++ principal2html4users.xsl 30 Oct 2002 17:01:29 -0000 1.5 @@ -93,11 +93,11 @@ <tr> <form action="" method="post"> - <input type="hidden" name="cocoon-principal-name" value="{@pl:name}"/> + <input type="hidden" name="cocoon-principal-name" value="{@name}"/> <input type="hidden" name="method" value="doRemovePrincipal"/> <td align="left"> - <xsl:value-of select="@pl:name"/> + <xsl:value-of select="@name"/> </td> <td align="left"> @@ -106,18 +106,18 @@ </form> - <td align="left"><xsl:value-of select="@pl:role"/></td> + <td align="left"><xsl:value-of select="@role"/></td> <form action="" method="post"> - <input type="hidden" name="cocoon-principal-name" value="{@pl:name}"/> + <input type="hidden" name="cocoon-principal-name" value="{@name}"/> <input type="hidden" name="method" value="doRemovePrincipalGroupMember"/> <td align="left"> - <xsl:variable name="name" select="@pl:name"/> + <xsl:variable name="name" select="@name"/> <select name="cocoon-principal-group-name" - 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> + size="{count(../pl:group/pl:principal[@name=$name])}"> + <xsl:for-each select="../pl:group/pl:principal[@name=$name]"> + <option><xsl:value-of select="../@name"/></option> </xsl:for-each> </select> </td> @@ -135,14 +135,14 @@ <td align="left"></td> <form action="" method="post"> - <input type="hidden" name="cocoon-principal-name" value="{@pl:name}"/> + <input type="hidden" name="cocoon-principal-name" value="{@name}"/> <input type="hidden" name="method" value="doAddPrincipalGroupMember"/> <td align="left"> - <xsl:variable name="name" select="@pl:name"/> + <xsl:variable name="name" select="@name"/> <select name="cocoon-principal-group-name" size="1"> <xsl:for-each select="../pl:group"> - <option><xsl:value-of select="@pl:name"/></option> + <option><xsl:value-of select="@name"/></option> </xsl:for-each> </select> </td> @@ -216,11 +216,11 @@ <tr> <form action="" method="post"> - <input type="hidden" name="cocoon-principal-group-name" value="{@pl:name}"/> + <input type="hidden" name="cocoon-principal-group-name" value="{@name}"/> <input type="hidden" name="method" value="doRemovePrincipalGroup"/> <td align="left"> - <xsl:value-of select="@pl:name"/> + <xsl:value-of select="@name"/> </td> <td align="right"> 1.17 +52 -46 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.16 retrieving revision 1.17 diff -u -r1.16 -r1.17 --- sitemap.xmap 20 Oct 2002 12:25:45 -0000 1.16 +++ sitemap.xmap 30 Oct 2002 17:01:29 -0000 1.17 @@ -1,5 +1,8 @@ <?xml version="1.0"?> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0"> + +<!-- =========================== Components =================================== --> + <map:components> <map:generators default="file"> <map:generator name="sourcedescription" @@ -44,8 +47,6 @@ <map:action logger="sitemap.action.slide" name="principal-actions" src="org.apache.cocoon.acting.PrincipalMultiAction"/> - <map:action name="portal-auth" src="org.apache.cocoon.webapps.portal.acting.AuthAction"/> - <map:action name="auth-protect" logger="sitemap.action.auth-protect" src="org.apache.cocoon.webapps.authentication.acting.AuthAction"/> @@ -59,6 +60,8 @@ </map:components> +<!-- =========================== Views =================================== --> + <map:views> <map:view name="content" from-label="content"> <map:transform src="context://samples/common/style/xsl/html/simple-xml2html.xsl"/> @@ -74,19 +77,36 @@ </map:view> </map:views> +<!-- =========================== Resources =================================== --> + + <map:resources> + <map:resource name="description"> + <map:generate type="sourcedescription" src="slide://{1}?cocoon-source-principal={../../ID}"> + <map:parameter name="repository" value="slide"/> + <map:parameter name="namespace" value="myrepository"/> + <map:parameter name="properties" value="true"/> + <map:parameter name="permissions" value="true"/> + <map:parameter name="locks" value="true"/> + <map:parameter name="depth" value="1"/> + </map:generate> + </map:resource> + </map:resources> + +<!-- =========================== Pipelines ================================= --> + <map:pipelines> <map:component-configurations> <authentication-manager> <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/repository-authuser"/> + <authentication uri="cocoon:raw:/authenticate"/> </handler> </handlers> </authentication-manager> </map:component-configurations> - <map:pipeline><!-- internal-only="true">--> + <map:pipeline internal-only="true"> <map:match pattern="principallist"> <map:generate type="principallist"> @@ -96,33 +116,34 @@ <map:serialize type="xml"/> </map:match> - <map:match pattern="repository-authuser"> + <map:match pattern="authenticate"> <map:generate src="cocoon:/principallist"/> - <map:transform src="principal2auth.xsl"> + <map:transform type="xslt" src="principal2auth.xsl"> <!-- stylesheets seems to have a problem with XSLTC --> <map:parameter name="use-request-parameters" value="true"/> </map:transform> - <map:transform type="log"> - <map:parameter name="logfile" value="slide.log"/> - <map:parameter name="append" value="no"/> - </map:transform> - <map:serialize type="xml"/> </map:match> - <map:match pattern="repository-authlist"> - <map:generate src="cocoon:/principallist"/> - - <map:transform src="context://samples/common/style/xsl/html/simple-xml2html.xsl"/> + <!-- ============= Source description ============= --> + <map:match pattern="description/*/**"> + <map:generate type="sourcedescription" src="slide://{2}?cocoon-source-principal={1}"> + <map:parameter name="repository" value="slide"/> + <map:parameter name="namespace" value="myrepository"/> + <map:parameter name="properties" value="true"/> + <map:parameter name="permissions" value="true"/> + <map:parameter name="locks" value="true"/> + <map:parameter name="depth" value="1"/> + </map:generate> - <map:serialize type="html"/> + <map:serialize type="xml"/> </map:match> - <map:handle-errors> +<!-- <map:handle-errors> <map:transform src="context://samples/common/style/xsl/html/error2html.xsl"/> <map:serialize status-code="500"/> - </map:handle-errors> + </map:handle-errors>--> </map:pipeline> @@ -143,14 +164,14 @@ <map:match pattern="login"> <map:act type="auth-login"> <map:parameter name="handler" value="slidehandler"/> - <map:parameter name="parameter_userid" value="{request:name}"/> - <map:parameter name="parameter_password" value="{request:password}"/> - <map:redirect-to uri="{request:resource}"/> + <map:parameter name="parameter_name" value="{request-param:userid}"/> + <map:parameter name="parameter_password" value="{request-param:password}"/> + <map:redirect-to uri="{request-param:resource}"/> </map:act> <map:generate src="login-failed.html"/> <map:transform src="redirect4login.xsl"> - <map:parameter name="destination" value="{request:resource}"/> + <map:parameter name="destination" value="{request-param:resource}"/> </map:transform> <map:serialize/> </map:match> @@ -169,29 +190,14 @@ <map:act type="auth-protect"> <map:parameter name="handler" value="slidehandler"/> - <!-- ============= Source description ============= --> - <map:match pattern="description/**"> - <map:generate type="sourcedescription" src="slide://{1}?cocoon-source-principal={../ID}"> - <map:parameter name="repository" value="slide"/> - <map:parameter name="namespace" value="myrepository"/> -<!-- <map:parameter name="principal" value="{../ID}"/>--> - <map:parameter name="properties" value="true"/> - <map:parameter name="permissions" value="true"/> - <map:parameter name="locks" value="true"/> - <map:parameter name="depth" value="1"/> - </map:generate> - - <map:serialize type="xml"/> - </map:match> - <!-- ============= Source content ================== --> <map:match pattern="content/**"> <map:act type="source-actions"> - <map:parameter name="method" value="{request:method}"/> + <map:parameter name="method" value="{request-param:method}"/> <map:parameter name="cocoon-principal" value="{../ID}"/> </map:act> - <map:generate src="cocoon:/description/{1}"/> + <map:generate src="cocoon:/description/{../ID}/{1}"/> <map:transform src="description2html4content.xsl"/> <map:transform type="xinclude"/> <map:serialize type="html"/> @@ -200,11 +206,11 @@ <!-- ============= Source properties =============== --> <map:match pattern="properties/**"> <map:act type="source-actions"> - <map:parameter name="method" value="{request:method}"/> + <map:parameter name="method" value="{request-param:method}"/> <map:parameter name="cocoon-principal" value="{../ID}"/> </map:act> - <map:generate src="cocoon:/description/{1}"/> + <map:generate src="cocoon:/description/{../ID}/{1}"/> <map:transform src="description2html4properties.xsl"/> <map:serialize type="html"/> </map:match> @@ -212,12 +218,12 @@ <!-- ============= Source permissions ============== --> <map:match pattern="permissions/**"> <map:act type="source-actions"> - <map:parameter name="method" value="{request:method}"/> + <map:parameter name="method" value="{request-param:method}"/> <map:parameter name="cocoon-principal" value="{../ID}"/> </map:act> <map:aggregate element="document"> - <map:part src="cocoon:/description/{1}"/> + <map:part src="cocoon:/description/{../ID}/{1}"/> <map:part src="cocoon:/principallist"/> </map:aggregate> @@ -228,11 +234,11 @@ <!-- ============= Source locks ==================== --> <map:match pattern="locks/**"> <map:act type="source-actions"> - <map:parameter name="method" value="{request:method}"/> + <map:parameter name="method" value="{request-param:method}"/> <map:parameter name="cocoon-principal" value="{../ID}"/> </map:act> - <map:generate src="cocoon:/description/{1}"/> + <map:generate src="cocoon:/description/{../ID}/{1}"/> <map:transform src="description2html4locks.xsl"/> <map:serialize type="html"/> </map:match> @@ -246,7 +252,7 @@ <!-- ============= Repository users =============== --> <map:match pattern="users/**"> <map:act type="principal-actions"> - <map:parameter name="method" value="{request:method}"/> + <map:parameter name="method" value="{request-param:method}"/> <map:parameter name="cocoon-caller-principal-name" value="{../ID}"/> </map:act>
---------------------------------------------------------------------- In case of troubles, e-mail: [EMAIL PROTECTED] To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]