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/11/02 17:53:47 UTC

svn commit: r591397 - in /lenya/sandbox/pubs/docu: lenya/modules/sitetree/xslt/navigation/menu.xsl resources/shared/css/page.css xslt/page2xhtml.xsl

Author: andreas
Date: Fri Nov  2 09:53:39 2007
New Revision: 591397

URL: http://svn.apache.org/viewvc?rev=591397&view=rev
Log:
Updated layout

Modified:
    lenya/sandbox/pubs/docu/lenya/modules/sitetree/xslt/navigation/menu.xsl
    lenya/sandbox/pubs/docu/resources/shared/css/page.css
    lenya/sandbox/pubs/docu/xslt/page2xhtml.xsl

Modified: lenya/sandbox/pubs/docu/lenya/modules/sitetree/xslt/navigation/menu.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/lenya/modules/sitetree/xslt/navigation/menu.xsl?rev=591397&r1=591396&r2=591397&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/lenya/modules/sitetree/xslt/navigation/menu.xsl (original)
+++ lenya/sandbox/pubs/docu/lenya/modules/sitetree/xslt/navigation/menu.xsl Fri Nov  2 09:53:39 2007
@@ -6,9 +6,9 @@
   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
-
+  
+  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.
@@ -19,50 +19,96 @@
 <!-- $Id: menu.xsl 42703 2004-03-13 12:57:53Z gregor $ -->
 
 <xsl:stylesheet version="1.0"
-    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
-    xmlns:nav="http://apache.org/cocoon/lenya/navigation/1.0"
-    xmlns="http://www.w3.org/1999/xhtml"
-    exclude-result-prefixes="nav"
-    >
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:nav="http://apache.org/cocoon/lenya/navigation/1.0"
+  xmlns="http://www.w3.org/1999/xhtml"
+  exclude-result-prefixes="nav"
+  >
   
   
   <xsl:import href="template-fallback://lenya/modules/sitetree/xslt/navigation/menu.xsl"/>
-
+  
   <xsl:template match="nav:site/nav:node">
     <xsl:if test="parent::nav:site and descendant-or-self::nav:node[@current = 'true']">
-      <xsl:apply-templates select="nav:node"/>
+      <xsl:call-template name="children"/>
     </xsl:if>
   </xsl:template>
-
+  
+  
   <xsl:template match="nav:node/nav:node">
+    <xsl:param name="parent-id"/>
+    <xsl:variable name="id" select="concat($parent-id, position())"/>
+    <xsl:call-template name="item">
+      <xsl:with-param name="id" select="$id"/>
+    </xsl:call-template>
+  </xsl:template>
+  
+  
+  <xsl:template name="children">
+    <xsl:param name="id"/>
+    <xsl:if test="nav:node">
+      <ul id="menuitem-{$id}">
+        <xsl:attribute name="class">
+          <xsl:choose>
+            <xsl:when test="descendant-or-self::nav:node[@current = 'true']">open</xsl:when>
+            <xsl:otherwise>closed</xsl:otherwise>
+          </xsl:choose>
+        </xsl:attribute>
+        <xsl:apply-templates select="nav:node">
+          <xsl:with-param name="parent-id" select="concat($id, '.')"/>
+        </xsl:apply-templates>
+      </ul>
+    </xsl:if>
+  </xsl:template>
+  
+  
+  <xsl:template name="item">
+    <xsl:param name="id"/>
     <xsl:choose>
-      <xsl:when test="descendant-or-self::nav:node[@current = 'true']">
-        <div class="menublock-selected-{count(ancestor-or-self::nav:node) - 1}">
-          <xsl:call-template name="item"/>
-          <xsl:apply-templates select="nav:node"/>
-        </div>
+      <xsl:when test="@current = 'true'">
+        <xsl:call-template name="item-selected">
+          <xsl:with-param name="id" select="$id"/>
+        </xsl:call-template>
       </xsl:when>
       <xsl:otherwise>
-        <div class="menublock-{count(ancestor-or-self::nav:node) - 1}">
-          <xsl:call-template name="item"/>
-          <xsl:apply-templates select="nav:node"/>
-        </div>
+        <xsl:call-template name="item-default">
+          <xsl:with-param name="id" select="$id"/>
+        </xsl:call-template>
       </xsl:otherwise>
     </xsl:choose>
   </xsl:template>
   
-
+  
   <xsl:template name="item-default">
-    <div class="menuitem-{count(ancestor-or-self::nav:node) - 1}">
-      <a href="{@href}"><xsl:apply-templates select="nav:label"/></a>
-    </div>
+    <xsl:param name="id"/>
+    <li>
+      <a>
+        <xsl:choose>
+          <xsl:when test="@uuid">
+            <xsl:copy-of select="@href"/>
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:attribute name="onclick">javascript:toggleMenu('menuitem-<xsl:value-of select="$id"/>');</xsl:attribute>
+          </xsl:otherwise>
+        </xsl:choose>
+        <xsl:if test="not(@uuid)"></xsl:if>
+        <xsl:apply-templates select="nav:label"/>
+      </a>
+      <xsl:call-template name="children">
+        <xsl:with-param name="id" select="$id"/>
+      </xsl:call-template>
+    </li>
   </xsl:template>
   
   
   <xsl:template name="item-selected">
-    <div class="menuitem-selected-{count(ancestor-or-self::nav:node) - 1}">
-      <xsl:apply-templates select="nav:label"/>
-    </div>
+    <xsl:param name="id"/>
+    <li class="selected">
+      <span><xsl:apply-templates select="nav:label"/></span>
+      <xsl:call-template name="children">
+        <xsl:with-param name="id" select="$id"/>
+      </xsl:call-template>
+    </li>
   </xsl:template>
   
   

Modified: lenya/sandbox/pubs/docu/resources/shared/css/page.css
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/resources/shared/css/page.css?rev=591397&r1=591396&r2=591397&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/resources/shared/css/page.css (original)
+++ lenya/sandbox/pubs/docu/resources/shared/css/page.css Fri Nov  2 09:53:39 2007
@@ -107,26 +107,51 @@
     border-left: none;
     border-top: none;
     color: Maroon;
-    padding: 5px 0px 5px 0px;
+    padding: 5px 0px 5px .5em;
   background-color: #FFCCCC;
 }
 
+#menu ul {
+  list-style-type: none;
+  padding: 0;
+  margin: 0 1em .3em .5em;
+  font-size: medium;
+}
+
+#menu ul.closed li {
+  display: none;
+}
+
+#menu li {
+  background: url('/default/live/images/bullet.png') left .2em no-repeat;
+  padding-left: .7em;
+}
+
+#menu span, #menu a {
+  display: block;
+  margin: 0 0 .2em 0;
+  padding: 0 .3em;
+}
+
 #menu a {
     text-decoration: none;
     color: Maroon;
+    cursor: pointer;
 }
 
 #menu a:hover {
-    text-decoration: underline;
+  text-decoration: underline;
 }
 
+#menu li.selected span {
+  background-color: #FFEEEE;
+}
+
+
+/* -- old menu -- */
 
 .menublock-1, .menublock-selected-1 {
     padding: 0px;
-    /*
-    border-top: solid 1px #DDBBBB;
-    background: #FFCCCC;
-    */
 }
 
 .menublock-1 .menublock-2 { display: none; }
@@ -145,7 +170,6 @@
 .menuitem-1, .menuitem-selected-1 {
   margin: 10px 0px 0px 0px;
   padding: 2px 5px 2px 30px;
-  background: url('/default/live/images/bullet.png') 16px .4em no-repeat;
 }
 
 .menuitem-2, .menuitem-selected-2 {

Modified: lenya/sandbox/pubs/docu/xslt/page2xhtml.xsl
URL: http://svn.apache.org/viewvc/lenya/sandbox/pubs/docu/xslt/page2xhtml.xsl?rev=591397&r1=591396&r2=591397&view=diff
==============================================================================
--- lenya/sandbox/pubs/docu/xslt/page2xhtml.xsl (original)
+++ lenya/sandbox/pubs/docu/xslt/page2xhtml.xsl Fri Nov  2 09:53:39 2007
@@ -52,8 +52,8 @@
     <html>
       <head>
         <!-- 
-        <link rel="neutron-introspection" type="application/neutron+xml" href="{$root}{$document-path}/introspection.xml"/>
-         -->
+          <link rel="neutron-introspection" type="application/neutron+xml" href="{$root}{$document-path}/introspection.xml"/>
+        -->
         <link rel="neutron-introspection" type="application/neutron+xml"
           href="{$root}{$document-path}.xml?lenya.module=neutron&amp;lenya.action=introspect"/>
         <link rel="stylesheet" href="{$root}/css/page.css" type="text/css"/>
@@ -74,6 +74,17 @@
         <title><i18n:text>error-404</i18n:text></title>
         
         <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
+        <script language="javascript">
+          function toggleMenu(id) {
+          var element = document.getElementById(id);
+          if (element.className == 'open') {
+          element.className = 'closed';
+          }
+          else if (element.className == 'closed') {
+          element.className = 'open';
+          }
+          }
+        </script>
       </head>
       <body>
         <div id="page">



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org