You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lenya.apache.org by gr...@apache.org on 2005/02/12 21:43:00 UTC
svn commit: r153545 - in lenya/trunk/src/webapp/lenya:
pubs/default/usecase-bxe.xmap xslt/bxe/link.xsl xslt/bxe/sitetree2tree.xsl
Author: gregor
Date: Sat Feb 12 12:42:59 2005
New Revision: 153545
URL: http://svn.apache.org/viewcvs?view=rev&rev=153545
Log:
Made insert link popup work again by switching to XHTML serialization.
Modified:
lenya/trunk/src/webapp/lenya/pubs/default/usecase-bxe.xmap
lenya/trunk/src/webapp/lenya/xslt/bxe/link.xsl
lenya/trunk/src/webapp/lenya/xslt/bxe/sitetree2tree.xsl
Modified: lenya/trunk/src/webapp/lenya/pubs/default/usecase-bxe.xmap
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/pubs/default/usecase-bxe.xmap?view=diff&r1=153544&r2=153545
==============================================================================
--- lenya/trunk/src/webapp/lenya/pubs/default/usecase-bxe.xmap (original)
+++ lenya/trunk/src/webapp/lenya/pubs/default/usecase-bxe.xmap Sat Feb 12 12:42:59 2005
@@ -33,10 +33,10 @@
<map:select type="parameter">
<map:parameter name="statusCode" value="{statusCode}"/>
<map:when test="">
- <map:serialize type="html" />
+ <map:serialize type="xhtml" />
</map:when>
<map:otherwise>
- <map:serialize type="html" status-code="{statusCode}"/>
+ <map:serialize type="xhtml" status-code="{statusCode}"/>
</map:otherwise>
</map:select>
</map:resource>
@@ -268,7 +268,7 @@
</map:transform>
</map:otherwise>
</map:select>
- <map:serialize type="html"/>
+ <map:serialize type="xhtml"/>
</map:handle-errors>
</map:pipeline>
Modified: lenya/trunk/src/webapp/lenya/xslt/bxe/link.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/xslt/bxe/link.xsl?view=diff&r1=153544&r2=153545
==============================================================================
--- lenya/trunk/src/webapp/lenya/xslt/bxe/link.xsl (original)
+++ lenya/trunk/src/webapp/lenya/xslt/bxe/link.xsl Sat Feb 12 12:42:59 2005
@@ -40,6 +40,16 @@
<xsl:param name="defaultlanguage"/>
<xsl:variable name="extension"><xsl:if test="$documentextension != ''">.</xsl:if><xsl:value-of select="$documentextension"/></xsl:variable>
+
+<!-- Decide whether to load the sitetree incrementally.
+ true: The sitetree.js will only contain the root node of the tree.
+ All other nodes will be loaded dynamically by tree.js when needed.
+ Useful for large trees.
+ false: The sitetree.js will contain the whole sitetree structure and tree.js
+ won't load anything dynamically. Useful for small trees or for browsers
+ which don't support xmlhttp requests.
+-->
+ <xsl:variable name="incremental-loading" select="'true'"/>
<xsl:template match="/">
<page:page>
@@ -47,7 +57,7 @@
<page:body>
<script type="text/javascript" src="{$contextprefix}/{$publicationid}/{$area}/info-sitetree/ua.js"> </script>
<script type="text/javascript" src="{$contextprefix}/{$publicationid}/{$area}/info-sitetree/tree.js"> </script>
- <script type="text/javascript" src="{$contextprefix}/{$publicationid}/{$area}/{$documenturl}?lenya.usecase=bxe&lenya.step=link-tree&language={$chosenlanguage}"> </script>
+ <script type="text/javascript" src="{$contextprefix}/{$publicationid}/{$area}/{$documenturl}?lenya.usecase=bxe&lenya.step=link-tree&language={$chosenlanguage}&incremental={$incremental-loading}"> </script>
<script>
var url;
window.onload = insertText
Modified: lenya/trunk/src/webapp/lenya/xslt/bxe/sitetree2tree.xsl
URL: http://svn.apache.org/viewcvs/lenya/trunk/src/webapp/lenya/xslt/bxe/sitetree2tree.xsl?view=diff&r1=153544&r2=153545
==============================================================================
--- lenya/trunk/src/webapp/lenya/xslt/bxe/sitetree2tree.xsl (original)
+++ lenya/trunk/src/webapp/lenya/xslt/bxe/sitetree2tree.xsl Sat Feb 12 12:42:59 2005
@@ -15,21 +15,29 @@
limitations under the License.
-->
-<!-- $Id: sitetree2tree.xsl,v 1.3 2004/04/13 12:21:01 gregor Exp $ -->
+<!-- $Id$ -->
+
+<!--
+ Converts a sitetree into a javascript array suitable for the tree widget.
+-->
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:s="http://apache.org/cocoon/lenya/navigation/1.0">
-<xsl:output omit-xml-declaration="yes" encoding = "iso-8859-1" />
+<xsl:import href="../util/string-functions.xsl"/>
+
+<xsl:output omit-xml-declaration="yes"/>
<xsl:param name="contextprefix"/>
<xsl:param name="publicationid"/>
<xsl:param name="chosenlanguage"/>
<xsl:param name="defaultlanguage"/>
<xsl:param name="cutdocumentid"/>
+<xsl:param name="incremental"/>
+<xsl:param name="areas"/>
-<xsl:template match="lenya">
+<xsl:template match="/">
<xsl:param name="parentPath"/>
// You can find instructions for this file at http://www.treeview.net
@@ -39,14 +47,34 @@
USEFRAMES = 0
USEICONS = 0
WRAPTEXT = 1
-PERSERVESTATE = 0
+PRESERVESTATE = 1
HIGHLIGHT = 1
HIGHLIGHT_BG = "#DDDCCF"
HIGHLIGHT_COLOR = "#666666"
CONTEXT_PREFIX = "<xsl:value-of select="$contextprefix"/>";
+PUBLICATION_ID = "<xsl:value-of select="$publicationid"/>";
+CHOSEN_LANGUAGE = "<xsl:value-of select="$chosenlanguage"/>";
+DEFAULT_LANGUAGE = "<xsl:value-of select="$defaultlanguage"/>";
+CUT_DOCUMENT_ID = "<xsl:value-of select="$cutdocumentid"/>";
+ALL_AREAS = "<xsl:value-of select="$areas"/>"
+PIPELINE_PATH = '/authoring/info-sitetree/sitetree-fragment.xml'
+<xsl:choose>
+ <xsl:when test="$incremental='true'">
+INCREMENTAL_LOADING = true;
+ </xsl:when>
+ <xsl:otherwise>
+INCREMENTAL_LOADING = false;
+ </xsl:otherwise>
+</xsl:choose>
+
+<!-- incremental loading does not work with the preserve state mechanism (cookies) -->
+if (INCREMENTAL_LOADING) PRESERVESTATE=0;
foldersTree = gFld("<strong><xsl:value-of select="$publicationid"/></strong>")
- <xsl:apply-templates select="s:site"/>
+
+ <xsl:if test="$incremental!='true'">
+ <xsl:apply-templates select="lenya/s:site"/>
+ </xsl:if>
//Set this string if Treeview and other configuration files may also be loaded in the same session
foldersTree.treeID = "t2"
@@ -103,13 +131,24 @@
<xsl:variable name="pre" select="concat($no-language-pre, $protected-pre, $cut-pre)"/>
<xsl:variable name="post" select="concat($cut-post, $protected-post, $no-language-post)"/>
+ <xsl:choose>
+ <xsl:when test="descendant::s:node">
<xsl:value-of select="generate-id(.)"/>
= insFld(
<xsl:value-of select="generate-id(..)"/>,
gFld("<span style=\"padding: 0px 5px;\"><xsl:value-of select="$pre"/><xsl:call-template name="getLabel"/><xsl:value-of select="$post"/></span>"
<xsl:value-of select="$link"/>)
);
-
+ </xsl:when>
+ <xsl:otherwise>
+ insDoc(<xsl:value-of select="generate-id(..)"/>,
+ gLnk(
+ "S",
+ "<span style=\"padding: 0px 5px;\"><xsl:value-of select="$pre"/><xsl:call-template name="getLabel"/></span>"
+ <xsl:value-of select="$link"/>)
+ );
+ </xsl:otherwise>
+ </xsl:choose>
<xsl:apply-templates>
<xsl:with-param name="parentPath"><xsl:value-of select="$parentPath"/>/<xsl:value-of select="@id"/></xsl:with-param>
</xsl:apply-templates>
@@ -118,17 +157,50 @@
<xsl:template name="getLabel">
<xsl:choose>
<xsl:when test="s:label[lang($chosenlanguage)]">
- <xsl:value-of select="s:label[lang($chosenlanguage)]"/>
+ <xsl:call-template name="escape-characters">
+ <xsl:with-param name="input" select="s:label[lang($chosenlanguage)]"/>
+ </xsl:call-template>
</xsl:when>
<xsl:when test="s:label[lang($defaultlanguage)]">
- <xsl:value-of select="s:label[lang($defaultlanguage)]"/>
+ <xsl:call-template name="escape-characters">
+ <xsl:with-param name="input" select="s:label[lang($defaultlanguage)]"/>
+ </xsl:call-template>
</xsl:when>
<xsl:otherwise>
- <xsl:value-of select="s:label"/>
+ <xsl:call-template name="escape-characters">
+ <xsl:with-param name="input" select="s:label"/>
+ </xsl:call-template>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<xsl:template match="s:label"/>
+
+
+<xsl:template name="escape-characters">
+ <xsl:param name="input"/>
+ <xsl:variable name="escape-lt">
+ <xsl:call-template name="search-and-replace">
+ <xsl:with-param name="input" select="$input"/>
+ <xsl:with-param name="search-string"><</xsl:with-param>
+ <xsl:with-param name="replace-string">&lt;</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="escape-gt">
+ <xsl:call-template name="search-and-replace">
+ <xsl:with-param name="input" select="$escape-lt"/>
+ <xsl:with-param name="search-string">></xsl:with-param>
+ <xsl:with-param name="replace-string">&gt;</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:variable name="escape-quot">
+ <xsl:call-template name="search-and-replace">
+ <xsl:with-param name="input" select="$escape-gt"/>
+ <xsl:with-param name="search-string">"</xsl:with-param>
+ <xsl:with-param name="replace-string">\"</xsl:with-param>
+ </xsl:call-template>
+ </xsl:variable>
+ <xsl:value-of select="$escape-quot"/>
+</xsl:template>
</xsl:stylesheet>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@lenya.apache.org
For additional commands, e-mail: commits-help@lenya.apache.org