You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by an...@apache.org on 2007/09/21 16:48:16 UTC
svn commit: r578152 - in /lenya/sandbox/modules/person: ./ config/
config/cocoon-xconf/ resources/ resources/schemas/ samples/ xslt/
Author: andreas
Date: Fri Sep 21 07:48:15 2007
New Revision: 578152
URL: http://svn.apache.org/viewvc?rev=578152&view=rev
Log:
Adding person module
Added:
lenya/sandbox/modules/person/
lenya/sandbox/modules/person/config/
lenya/sandbox/modules/person/config/cocoon-xconf/
lenya/sandbox/modules/person/config/cocoon-xconf/resourcetype-person.xconf
lenya/sandbox/modules/person/config/menu.xsp
lenya/sandbox/modules/person/config/module.xml
lenya/sandbox/modules/person/menus.xmap
lenya/sandbox/modules/person/resources/
lenya/sandbox/modules/person/resources/schemas/
lenya/sandbox/modules/person/resources/schemas/foaf.rng
lenya/sandbox/modules/person/samples/
lenya/sandbox/modules/person/samples/foaf.xml
lenya/sandbox/modules/person/sitemap.xmap
lenya/sandbox/modules/person/xslt/
lenya/sandbox/modules/person/xslt/foaf2vcard.xsl
lenya/sandbox/modules/person/xslt/foaf2xhtml.xsl
Added: lenya/sandbox/modules/person/config/cocoon-xconf/resourcetype-person.xconf
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/person/config/cocoon-xconf/resourcetype-person.xconf?rev=578152&view=auto
==============================================================================
--- lenya/sandbox/modules/person/config/cocoon-xconf/resourcetype-person.xconf (added)
+++ lenya/sandbox/modules/person/config/cocoon-xconf/resourcetype-person.xconf Fri Sep 21 07:48:15 2007
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<xconf xpath="/cocoon/resource-types"
+ unless="/cocoon/resource-types/component-instance[@name = 'person']">
+
+ <component-instance name="person" logger="lenya.resourcetypes"
+ class="org.apache.lenya.cms.publication.ResourceTypeImpl">
+
+ <schema namespace="http://relaxng.org/ns/structure/0.9"
+ uri="fallback://lenya/modules/person/resources/schemas/foaf.rng"/>
+
+ <sample mime-type="application/xml" uri="fallback://lenya/modules/person/samples/foaf.xml"/>
+
+ <format name="xhtml" uri="cocoon://modules/person/xhtml.xml"/>
+ <format name="xhtml-include" uri="cocoon://modules/person/xhtml-include.xml"/>
+ <format name="icon" uri="cocoon://modules/person/icon"/>
+ <format name="webdavGET" uri="cocoon://modules/person/davget.xml"/>
+ <format name="vCard" uri="cocoon://modules/person/vcard.txt"/>
+
+ </component-instance>
+
+</xconf>
\ No newline at end of file
Added: lenya/sandbox/modules/person/config/menu.xsp
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/person/config/menu.xsp?rev=578152&view=auto
==============================================================================
--- lenya/sandbox/modules/person/config/menu.xsp (added)
+++ lenya/sandbox/modules/person/config/menu.xsp Fri Sep 21 07:48:15 2007
@@ -0,0 +1,53 @@
+<?xml version="1.0"?>
+<xsp:page
+ language="java"
+ xmlns:xsp="http://apache.org/xsp"
+ xmlns:i18n="http://apache.org/cocoon/i18n/2.1"
+ xmlns:uc="http://apache.org/cocoon/lenya/usecase/1.0"
+ xmlns:input="http://apache.org/cocoon/xsp/input/1.0"
+ xmlns="http://apache.org/cocoon/lenya/menubar/1.0">
+
+ <xsp:structure>
+ <xsp:include>org.apache.lenya.cms.publication.Document</xsp:include>
+ </xsp:structure>
+
+ <menu>
+ <menus>
+ <menu i18n:attr="name" name="File">
+ <block areas="site authoring">
+ <item uc:usecase="sitemanagement.create" href="?doctype=person">
+ <i18n:translate>
+ <i18n:text>New ... Document</i18n:text>
+ <i18n:param>Person</i18n:param>
+ </i18n:translate>
+ </item>
+ </block>
+ </menu>
+ <menu i18n:attr="name" name="Edit">
+ <xsp:logic>
+ try {
+ Object doc = <input:get-attribute module="page-envelope"
+ as="object" name="document"/>;
+ if (doc instanceof Document && ((Document) doc).exists()) {
+ String doctype = <input:get-attribute module="page-envelope"
+ as="string" name="document-type"/>;
+ if ("person".equals(doctype)) {
+ <block areas="authoring">
+ <item uc:usecase="bxe.edit" href="?">
+ <i18n:text>With BXE</i18n:text>
+ </item>
+ <item uc:usecase="editors.oneform" href="?">
+ <i18n:text>With one Form</i18n:text>
+ </item>
+ </block>
+ }
+ }
+ }
+ catch (Exception e) {
+ throw new ProcessingException("Error during menu generation: ", e);
+ }
+ </xsp:logic>
+ </menu>
+ </menus>
+ </menu>
+</xsp:page>
\ No newline at end of file
Added: lenya/sandbox/modules/person/config/module.xml
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/person/config/module.xml?rev=578152&view=auto
==============================================================================
--- lenya/sandbox/modules/person/config/module.xml (added)
+++ lenya/sandbox/modules/person/config/module.xml Fri Sep 21 07:48:15 2007
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="http://apache.org/lenya/module/1.0">
+ <id>org.yourproject.lenya.modules.person</id>
+ <package>org.yourproject.lenya.modules</package>
+ <version>0.1-dev</version>
+ <name>person</name>
+ <lenya-version>@lenya.version@</lenya-version>
+ <description>Resource type to store person details</description>
+</module>
\ No newline at end of file
Added: lenya/sandbox/modules/person/menus.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/person/menus.xmap?rev=578152&view=auto
==============================================================================
--- lenya/sandbox/modules/person/menus.xmap (added)
+++ lenya/sandbox/modules/person/menus.xmap Fri Sep 21 07:48:15 2007
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+ <map:pipelines>
+ <map:pipeline>
+ <map:match pattern="**">
+ <map:generate type="serverpages"
+ src="fallback://lenya/modules/person/config/menu.xsp"/>
+ <map:serialize type="xml"/>
+ </map:match>
+ </map:pipeline>
+ </map:pipelines>
+</map:sitemap>
\ No newline at end of file
Added: lenya/sandbox/modules/person/resources/schemas/foaf.rng
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/person/resources/schemas/foaf.rng?rev=578152&view=auto
==============================================================================
--- lenya/sandbox/modules/person/resources/schemas/foaf.rng (added)
+++ lenya/sandbox/modules/person/resources/schemas/foaf.rng Fri Sep 21 07:48:15 2007
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <start>
+ <element name="rdf:RDF">
+ <element name="foaf:Person">
+ <attribute name="rdf:ID"><data type="NCName"/></attribute>
+ <element name="foaf:title"><text/></element>
+ <element name="foaf:givenname"><text/></element>
+ <element name="foaf:family_name"><text/></element>
+ <element name="foaf:mbox">
+ <attribute name="rdf:resource">
+ <data type="anyURI"/>
+ </attribute>
+ </element>
+ <element name="foaf:phone">
+ <attribute name="rdf:resource">
+ <data type="NMTOKEN"/>
+ </attribute>
+ </element>
+ <element name="foaf:workplaceHomepage">
+ <attribute name="rdf:resource">
+ <data type="anyURI"/>
+ </attribute>
+ </element>
+ </element>
+ </element>
+ </start>
+</grammar>
Added: lenya/sandbox/modules/person/samples/foaf.xml
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/person/samples/foaf.xml?rev=578152&view=auto
==============================================================================
--- lenya/sandbox/modules/person/samples/foaf.xml (added)
+++ lenya/sandbox/modules/person/samples/foaf.xml Fri Sep 21 07:48:15 2007
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<rdf:RDF
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/">
+ <foaf:Person rdf:ID="me">
+ <foaf:title>Mr</foaf:title>
+ <foaf:givenname>Homer</foaf:givenname>
+ <foaf:family_name>Simpson</foaf:family_name>
+ <foaf:mbox rdf:resource="mailto:chunkylover53@aol.com"/>
+ <foaf:phone rdf:resource="tel:555-555-555"/>
+ <foaf:workplaceHomepage rdf:resource="http://powerplantspringfield.com"/>
+ </foaf:Person>
+</rdf:RDF>
\ No newline at end of file
Added: lenya/sandbox/modules/person/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/person/sitemap.xmap?rev=578152&view=auto
==============================================================================
--- lenya/sandbox/modules/person/sitemap.xmap (added)
+++ lenya/sandbox/modules/person/sitemap.xmap Fri Sep 21 07:48:15 2007
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+ <map:pipelines>
+ <map:pipeline>
+
+ <!-- webdav GET matcher -->
+ <map:match pattern="davget.xml">
+ <map:act type="set-header">
+ <map:parameter name="Last-Modified" value="{date-iso8601-rfc822:{page-envelope:document-lastmodified}}" />
+ <map:generate src="lenya-document:{page-envelope:document-uuid}"/>
+ <map:transform type="uuid2url"/>
+ <map:transform type="proxy">
+ <map:parameter name="urls" value="absolute"/>
+ </map:transform>
+ <map:serialize type="xml"/>
+ </map:act>
+ </map:match>
+
+ <!-- {format}.{type} -->
+ <map:match pattern="*.*">
+ <map:generate src="cocoon:/{1}.{2}/{page-envelope:publication-id}/{page-envelope:area}/{page-envelope:document-uuid}/{page-envelope:document-language}"/>
+ <map:select type="parameter">
+ <map:parameter name="parameter-selector-test" value="{2}"/>
+ <map:when test="xml">
+ <map:serialize type="xml"/>
+ </map:when>
+ <map:when test="txt">
+ <map:serialize type="text"/>
+ </map:when>
+ </map:select>
+ </map:match>
+
+ <!-- {format}.xml/{pubId}/{area}/{uuid}/{language} -->
+ <map:match pattern="*.*/*/*/*/*">
+ <map:generate src="lenya-document:{5},lang={6}{link:rev}"/>
+ <map:transform src="fallback://lenya/modules/person/xslt/foaf2{1}.xsl">
+ <map:parameter name="rendertype" value="{request-param:rendertype}"/>
+ </map:transform>
+ <map:select type="parameter">
+ <map:parameter name="parameter-selector-test" value="{2}"/>
+ <map:when test="xml">
+ <map:serialize type="xml"/>
+ </map:when>
+ <map:when test="txt">
+ <map:serialize type="text"/>
+ </map:when>
+ </map:select>
+ </map:match>
+
+ <!-- The icon for person nodes in the sitetree. -->
+ <map:match pattern="icon/*/*/*/*">
+ <map:read src="fallback://lenya/modules/person/resources/icons/person.gif"/>
+ </map:match>
+
+ </map:pipeline>
+ </map:pipelines>
+</map:sitemap>
Added: lenya/sandbox/modules/person/xslt/foaf2vcard.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/person/xslt/foaf2vcard.xsl?rev=578152&view=auto
==============================================================================
--- lenya/sandbox/modules/person/xslt/foaf2vcard.xsl (added)
+++ lenya/sandbox/modules/person/xslt/foaf2vcard.xsl Fri Sep 21 07:48:15 2007
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+ <xsl:output method="text"/>
+
+ <xsl:template match="rdf:RDF">
+ <xsl:text>begin:vcard</xsl:text>
+ <xsl:call-template name="linebreak"/>
+ <xsl:apply-templates select="foaf:Person"/>
+ <xsl:call-template name="linebreak"/>
+ <xsl:text>version:3.0</xsl:text>
+ <xsl:call-template name="linebreak"/>
+ <xsl:text>end:vcard</xsl:text>
+ </xsl:template>
+
+ <xsl:template name="linebreak">
+<xsl:text>
+</xsl:text>
+ </xsl:template>
+
+ <xsl:template match="foaf:Person">
+ <xsl:variable name="mbox" select="foaf:mbox/@rdf:resource"/>
+ <xsl:variable name="phone" select="foaf:phone/@rdf:resource"/>
+ <xsl:variable name="homepage" select="foaf:workplaceHomepage/@rdf:resource"/>
+ <xsl:text>title:</xsl:text><xsl:value-of select="foaf:title"/>
+ <xsl:call-template name="linebreak"/>
+ <xsl:text>fn:</xsl:text><xsl:value-of select="foaf:givenname"/> <xsl:value-of select="foaf:family_name"/>
+ <xsl:call-template name="linebreak"/>
+ <xsl:text>n:</xsl:text><xsl:value-of select="foaf:givenname"/>
+ <xsl:call-template name="linebreak"/>
+ <xsl:text>email:</xsl:text><xsl:value-of select="substring-after($mbox, 'mailto:')"/>
+ <xsl:call-template name="linebreak"/>
+ <xsl:text>tel:</xsl:text><xsl:value-of select="substring-after($phone, 'tel:')"/>
+ <xsl:call-template name="linebreak"/>
+ <xsl:text>homepage:</xsl:text><xsl:value-of select="$homepage"/>
+ </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
Added: lenya/sandbox/modules/person/xslt/foaf2xhtml.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/modules/person/xslt/foaf2xhtml.xsl?rev=578152&view=auto
==============================================================================
--- lenya/sandbox/modules/person/xslt/foaf2xhtml.xsl (added)
+++ lenya/sandbox/modules/person/xslt/foaf2xhtml.xsl Fri Sep 21 07:48:15 2007
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:foaf="http://xmlns.com/foaf/0.1/"
+ xmlns="http://www.w3.org/1999/xhtml">
+
+ <xsl:param name="rendertype"/>
+
+ <xsl:template match="rdf:RDF">
+ <html>
+ <body>
+ <div id="body">
+ <xsl:apply-templates select="foaf:Person"/>
+ </div>
+ </body>
+ </html>
+ </xsl:template>
+
+ <xsl:template name="bxeAttribute">
+ <xsl:param name="element"/>
+ <xsl:if test="$rendertype = 'edit'">
+ <xsl:attribute name="bxe_xpath">
+ /rdf:RDF/foaf:Person/foaf:<xsl:value-of select="$element"/>
+ </xsl:attribute>
+ </xsl:if>
+ </xsl:template>
+
+
+ <xsl:template match="foaf:Person">
+ <h2>Person Details</h2>
+ <table class="person">
+ <tr>
+ <th>Title:</th>
+ <td>
+ <xsl:call-template name="bxeAttribute">
+ <xsl:with-param name="element">title</xsl:with-param>
+ </xsl:call-template>
+ <xsl:value-of select="foaf:title"/>
+ </td>
+ </tr>
+ <tr>
+ <th>Given name:</th>
+ <td>
+ <xsl:call-template name="bxeAttribute">
+ <xsl:with-param name="element">givenname</xsl:with-param>
+ </xsl:call-template>
+ <xsl:value-of select="foaf:givenname"/>
+ </td>
+ </tr>
+ <tr>
+ <th>Family name:</th>
+ <td>
+ <xsl:call-template name="bxeAttribute">
+ <xsl:with-param name="element">family_name</xsl:with-param>
+ </xsl:call-template>
+ <xsl:value-of select="foaf:family_name"/>
+ </td>
+ </tr>
+ <tr>
+ <th>E-Mail:</th>
+ <td>
+ <xsl:variable name="mbox" select="foaf:mbox/@rdf:resource"/>
+ <a href="{$mbox}">
+ <xsl:value-of select="substring-after($mbox, 'mailto:')"/>
+ </a>
+ </td>
+ </tr>
+ <tr>
+ <th>Phone:</th>
+ <td>
+ <xsl:variable name="phone" select="foaf:phone/@rdf:resource"/>
+ <xsl:value-of select="substring-after($phone, 'tel:')"/>
+ </td>
+ </tr>
+ <tr>
+ <th>Homepage:</th>
+ <td>
+ <xsl:variable name="homepage" select="foaf:workplaceHomepage/@rdf:resource"/>
+ <a href="{$homepage}"><xsl:value-of select="$homepage"/></a>
+ </td>
+ </tr>
+ </table>
+ </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org