Author: andreas
Date: Wed Aug 22 07:55:36 2007
New Revision: 568637
URL: http://svn.apache.org/viewvc?rev=568637&view=rev
Log:
Added menu module, e.g. for asynchronous menu loading
Added:
lenya/trunk/src/modules/menubar/
lenya/trunk/src/modules/menubar/config/
lenya/trunk/src/modules/menubar/config/module.xml
lenya/trunk/src/modules/menubar/resources/
lenya/trunk/src/modules/menubar/resources/images/
lenya/trunk/src/modules/menubar/resources/images/indicator.gif (with props)
lenya/trunk/src/modules/menubar/resources/javascript/
lenya/trunk/src/modules/menubar/resources/javascript/loadmenu.js
lenya/trunk/src/modules/menubar/sitemap.xmap
lenya/trunk/src/modules/menubar/xslt/
lenya/trunk/src/modules/menubar/xslt/convertMessages.xsl
lenya/trunk/src/modules/menubar/xslt/menu2xslt-ajax.xsl
Added: lenya/trunk/src/modules/menubar/config/module.xml
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/menubar/config/module.xml?rev=568637&view=auto
==============================================================================
--- lenya/trunk/src/modules/menubar/config/module.xml (added)
+++ lenya/trunk/src/modules/menubar/config/module.xml Wed Aug 22 07:55:36 2007
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Id: publication.xml 374687 2006-02-03 15:24:55Z michi $ -->
+
+<module xmlns="http://apache.org/lenya/module/1.0">
+ <id>org.apache.lenya.modules.menubar</id>
+ <package>org.apache.lenya.modules</package>
+ <version>0.1-dev</version>
+ <name>Menubar Module</name>
+ <lenya-version>@lenya.version@</lenya-version>
+ <description>Menubar module.</description>
+</module>
Added: lenya/trunk/src/modules/menubar/resources/images/indicator.gif
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/menubar/resources/images/indicator.gif?rev=568637&view=auto
==============================================================================
Binary file - no diff available.
Propchange: lenya/trunk/src/modules/menubar/resources/images/indicator.gif
------------------------------------------------------------------------------
svn:mime-type = application/octet-stream
Added: lenya/trunk/src/modules/menubar/resources/javascript/loadmenu.js
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/menubar/resources/javascript/loadmenu.js?rev=568637&view=auto
==============================================================================
--- lenya/trunk/src/modules/menubar/resources/javascript/loadmenu.js (added)
+++ lenya/trunk/src/modules/menubar/resources/javascript/loadmenu.js Wed Aug 22 07:55:36 2007
@@ -0,0 +1,49 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+dojo.require("dojo.logging.*");
+dojo.require("dojo.event.*");
+dojo.require("dojo.io.*");
+
+function loadMenu(e) {
+ var menuFunction = {
+ url: MENU_URL + "&lenya.module=menubar",
+ load: function(type, data, evt) {
+ var placeholderElement = document.getElementById("lenyaMenuPlaceholder");
+ var menuElement = document.getElementById("lenyaMenuContainer");
+ menuElement.removeChild(placeholderElement);
+ menuElement.appendChild(data.documentElement);
+ initialize();
+ },
+ error: function(type, error) {
+ alert(error.message);
+ dojo.log.error(error.message);
+ },
+ mimetype: "text/xml",
+ method: "GET"
+ };
+ dojo.io.bind(menuFunction);
+}
+
+/*
+* Customize this method for event-based loading.
+*/
+function initAjax() {
+ dojo.event.connect(dojo.byId("dojotest"), "onclick", "loadMenu");
+}
+
+dojo.addOnLoad(loadMenu);
Added: lenya/trunk/src/modules/menubar/sitemap.xmap
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/menubar/sitemap.xmap?rev=568637&view=auto
==============================================================================
--- lenya/trunk/src/modules/menubar/sitemap.xmap (added)
+++ lenya/trunk/src/modules/menubar/sitemap.xmap Wed Aug 22 07:55:36 2007
@@ -0,0 +1,122 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Id: global-sitemap.xmap 546840 2007-06-13 12:38:45Z andreas $ -->
+
+<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0">
+
+ <map:pipelines>
+
+ <map:pipeline internal-only="true">
+
+ <map:match pattern="ajaxmenu/*/*/**">
+ <map:generate src="fallback://lenya/content/util/empty.xml"/>
+ <map:transform src="xslt/menu2xslt-ajax.xsl">
+ <map:parameter name="publicationid" value="{1}"/>
+ <map:parameter name="area" value="{2}"/>
+ <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
+ <map:parameter name="queryString" value="{request:queryString}"/>
+ </map:transform>
+ <map:serialize type="xml"/>
+ </map:match>
+
+
+ <!-- menu-xml/modules -->
+ <!-- menu-xml/modules/{pub-id}/{area}.xml -->
+ <map:match pattern="menu-xml/modules/*/*.xml">
+ <map:generate src="aggregate-fallback://config/publication.xml"/>
+ <map:transform src="fallback://lenya/xslt/modules/modules2xinclude.xsl">
+ <map:parameter name="area" value="{2}"/>
+ </map:transform>
+ <map:transform type="xinclude"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ <!-- menu-xml/module/{area}/{module-id}.xml -->
+ <map:match pattern="menu-xml/module/*/*.xml">
+ <map:select type="resource-exists">
+ <map:when test="fallback://lenya/modules/{2}/menus.xmap">
+ <map:mount uri-prefix="menu-xml/module/{1}/" src="fallback://lenya/modules/{2}/menus.xmap" check-reload="true" reload-method="synchron" pass-through="true"/>
+ </map:when>
+ <map:otherwise>
+ <map:generate type="serverpages" src="fallback://lenya/content/menus/live.xsp"/>
+ <map:serialize type="xml"/>
+ </map:otherwise>
+ </map:select>
+ </map:match>
+
+ <!-- menu-xml/{publication-id}/admin/... -->
+ <map:match pattern="menu-xml/*/admin/**" internal-only="true">
+ <map:generate type="serverpages" src="lenya/content/menus/admin.xsp"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ <!-- menu-xml/{publication-id}/... -->
+ <map:match pattern="menu-xml/*/**" internal-only="true">
+ <map:mount uri-prefix="menu-xml/{1}/" src="{fallback:menus.xmap}" check-reload="true" reload-method="synchron" pass-through="true"/>
+ </map:match>
+
+ </map:pipeline>
+
+ <map:pipeline>
+
+ <!-- Lenya menubar -->
+ <!-- {publication-id}/{area}/... -->
+ <map:match pattern="*/*/**">
+
+ <map:aggregate element="menu" ns="http://apache.org/cocoon/lenya/menubar/1.0">
+ <map:part src="cocoon:/menu-xml/{1}/{2}/{3}" strip-root="true"/>
+ <map:part src="cocoon:/menu-xml/modules/{1}/{2}.xml" strip-root="true"/>
+ </map:aggregate>
+
+ <map:transform src="fallback://lenya/xslt/menu/merge-menus.xsl"/>
+
+ <map:transform src="fallback://lenya/xslt/menu/filter-menu.xsl">
+ <map:parameter name="tabGroup" value="{usecase:tabGroup:{request-param:lenya.usecase}}"/>
+ </map:transform>
+
+ <!-- Disable menu items according to usecase policies -->
+ <map:transform type="usecasemenu"/>
+
+ <map:transform src="fallback://lenya/xslt/menu/menu2xhtml.xsl">
+ <map:parameter name="publicationid" value="{1}"/>
+ <map:parameter name="area" value="{2}"/>
+ <map:parameter name="documenturl" value="{page-envelope:document-url}"/>
+ <map:parameter name="documentid" value="{page-envelope:document-id}"/>
+ <map:parameter name="userid" value="{access-control:user-id}"/>
+ <map:parameter name="servertime" value="{date-i18n:currentDate}"/>
+ <map:parameter name="workflowstate" value="{workflow:state}"/>
+ <map:parameter name="islive" value="{workflow:variable.is_live}"/>
+ <map:parameter name="usecase" value="{request-param:lenya.usecase}"/>
+ <map:parameter name="tabGroup" value="{usecase:tabGroup:{request-param:lenya.usecase}}"/>
+ <map:parameter name="newMessages" value="{inbox:newMessageCount}"/>
+ </map:transform>
+
+ <map:transform type="i18n">
+ <map:parameter name="locale" value="{request:locale}"/>
+ </map:transform>
+ <map:transform src="xslt/convertMessages.xsl"/>
+ <map:transform src="fallback://lenya/modules/prettyprinting/xslt/xml2nicexml.xsl"/>
+ <map:serialize type="xml"/>
+ </map:match>
+
+ </map:pipeline>
+
+ </map:pipelines>
+
+</map:sitemap>
Added: lenya/trunk/src/modules/menubar/xslt/convertMessages.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/menubar/xslt/convertMessages.xsl?rev=568637&view=auto
==============================================================================
--- lenya/trunk/src/modules/menubar/xslt/convertMessages.xsl (added)
+++ lenya/trunk/src/modules/menubar/xslt/convertMessages.xsl Wed Aug 22 07:55:36 2007
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Id: menu2xslt.xsl 520418 2007-03-20 15:03:34Z andreas $ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:menu="http://apache.org/cocoon/lenya/menubar/1.0"
+ exclude-result-prefixes="menu"
+ >
+
+ <!-- add only first message as title attribute -->
+ <xsl:template match="menu:message[preceding-sibling::menu:message]"/>
+
+ <xsl:template match="menu:message">
+ <xsl:attribute name="title">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <xsl:template match="@*|node()" priority="-1">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+
+</xsl:stylesheet>
Added: lenya/trunk/src/modules/menubar/xslt/menu2xslt-ajax.xsl
URL: http://svn.apache.org/viewvc/lenya/trunk/src/modules/menubar/xslt/menu2xslt-ajax.xsl?rev=568637&view=auto
==============================================================================
--- lenya/trunk/src/modules/menubar/xslt/menu2xslt-ajax.xsl (added)
+++ lenya/trunk/src/modules/menubar/xslt/menu2xslt-ajax.xsl Wed Aug 22 07:55:36 2007
@@ -0,0 +1,154 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- $Id: menu2xslt.xsl 520418 2007-03-20 15:03:34Z andreas $ -->
+
+<xsl:stylesheet version="1.0"
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:xso="http://apache.org/cocoon/lenya/xslt/1.0"
+ xmlns:menu="http://apache.org/cocoon/lenya/menubar/1.0"
+ exclude-result-prefixes="menu"
+ >
+
+ <xsl:param name="publicationid"/>
+ <xsl:param name="area"/>
+ <xsl:param name="documenturl"/>
+
+ <xsl:param name="queryString"/>
+
+ <xsl:variable name="querySuffix">
+ <xsl:choose>
+ <xsl:when test="$queryString != ''">
+ <xsl:text>?</xsl:text>
+ <xsl:value-of select="$queryString"/>
+ <xsl:text>&lenya.module=menubar</xsl:text>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:text>?lenya.module=menubar</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+
+ <xsl:namespace-alias stylesheet-prefix="xso" result-prefix="xsl"/>
+
+ <xsl:template match="/">
+
+ <xso:stylesheet version="1.0"
+ xmlns:xhtml="http://www.w3.org/1999/xhtml"
+ exclude-result-prefixes="xhtml">
+
+ <xso:output method="xml" indent="yes"/>
+
+ <xso:template match="/">
+ <html>
+ <head>
+ <xso:call-template name="title"/>
+ <script src="/lenya/menu/menu.js" type="text/javascript"> </script>
+ <!--
+ -->
+ <link href="/lenya/css/menu.css" rel="stylesheet" type="text/css"/>
+ <link rel="icon" href="/favicon.ico" type="image/ico"/>
+ <xso:apply-templates select="xhtml:html/xhtml:head/*[local-name() != 'title']"/>
+
+ <script type="text/javascript">
+ djConfig = { isDebug: false };
+ </script>
+ <script type="text/javascript" src="/cforms/dojo/dojo.js"> </script>
+ <script type="text/javascript">
+ MENU_URL = "<xsl:value-of select="concat('/', $publicationid, '/', $area, $documenturl, '?', $queryString)"/>";
+ </script>
+ <script type="text/javascript" src="/modules/menubar/javascript/loadmenu.js"> </script>
+ </head>
+ <body>
+ <xso:apply-templates select="xhtml:html/xhtml:body/@*"/>
+ <xsl:apply-templates select="xhtml:div[@id = 'lenya-logo']"/>
+ <div id="lenyaMenuContainer">
+ <div id="lenyaMenuPlaceholder"/>
+ </div>
+ <div id="lenya-cmsbody">
+ <xso:apply-templates select="xhtml:html/xhtml:body/node()"/>
+ </div>
+ <!--
+ <script type="text/javascript"> initialize(); </script>
+ -->
+ </body>
+ </html>
+ </xso:template>
+
+ <xso:template name="title">
+ <title>
+ Apache Lenya |
+ <xsl:value-of select="$publicationid"/> |
+ <xsl:value-of select="$area"/> |
+ <xsl:value-of select="$documenturl"/> |
+ <xso:value-of select="xhtml:html/xhtml:head/xhtml:title"/>
+ </title>
+ </xso:template>
+
+ <xso:template match="xhtml:script">
+ <xso:copy>
+ <xso:apply-templates select="@*|node()"/>
+ <xso:if test="not(.//text())"><xso:text> </xso:text></xso:if>
+ </xso:copy>
+ </xso:template>
+
+ <xso:template match="xhtml:*">
+ <xso:element name="{string('{local-name()}')}">
+ <xso:apply-templates select="@*|node()"/>
+ </xso:element>
+ </xso:template>
+
+
+ <xso:template match="@*|node()">
+ <xso:copy>
+ <xso:apply-templates select="@*|node()"/>
+ </xso:copy>
+ </xso:template>
+
+ </xso:stylesheet>
+
+ </xsl:template>
+
+
+ <xsl:template match="xhtml:*">
+ <xsl:element name="{local-name()}">
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:element>
+ </xsl:template>
+
+
+ <!-- add only first message as title attribute -->
+ <xsl:template match="menu:message[preceding-sibling::menu:message]"/>
+
+ <xsl:template match="menu:message">
+ <xsl:attribute name="title">
+ <xsl:value-of select="."/>
+ </xsl:attribute>
+ </xsl:template>
+
+
+ <xsl:template match="@*|node()">
+ <xsl:copy>
+ <xsl:apply-templates select="@*|node()"/>
+ </xsl:copy>
+ </xsl:template>
+
+
+</xsl:stylesheet>
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.