[Bedework-commit] bedework r1972 -
trunk/deployment/webuser/webapp/resources/demoskins/default/default
svnadmin at bedework.org
svnadmin at bedework.org
Wed Nov 19 16:37:11 EST 2008
Author: johnsa
Date: 2008-11-19 16:37:10 -0500 (Wed, 19 Nov 2008)
New Revision: 1972
Modified:
trunk/deployment/webuser/webapp/resources/demoskins/default/default/default.xsl
Log:
added url-encode template and now encode guids
Modified: trunk/deployment/webuser/webapp/resources/demoskins/default/default/default.xsl
===================================================================
--- trunk/deployment/webuser/webapp/resources/demoskins/default/default/default.xsl 2008-11-18 21:54:58 UTC (rev 1971)
+++ trunk/deployment/webuser/webapp/resources/demoskins/default/default/default.xsl 2008-11-19 21:37:10 UTC (rev 1972)
@@ -1,5 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
-<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:stylesheet
+ version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:url="http://whatever/java/java.net.URLEncoder"
+ exclude-result-prefixes="url">
<xsl:output
method="xhtml"
indent="no"
@@ -976,7 +980,7 @@
<xsl:variable name="id" select="id"/>
<xsl:variable name="subscriptionId" select="subscription/id"/>
<xsl:variable name="calPath" select="calendar/encodedPath"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="recurrenceId" select="recurrenceId"/>
<tr>
<xsl:variable name="dateRangeStyle">
@@ -1126,7 +1130,7 @@
<xsl:template name="eventLinks">
<xsl:variable name="subscriptionId" select="subscription/id"/>
<xsl:variable name="calPath" select="calendar/encodedPath"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="recurrenceId" select="recurrenceId"/>
<xsl:if test="currentAccess/current-user-privilege-set/privilege/write-content">
<xsl:choose>
@@ -1289,7 +1293,7 @@
<xsl:param name="dayPos"/>
<xsl:variable name="subscriptionId" select="subscription/id"/>
<xsl:variable name="calPath" select="calendar/encodedPath"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="recurrenceId" select="recurrenceId"/>
<xsl:variable name="eventRootClass">
<xsl:choose>
@@ -1495,7 +1499,7 @@
<xsl:template match="event" mode="tasks">
<xsl:variable name="subscriptionId" select="subscription/id"/>
<xsl:variable name="calPath" select="calendar/encodedPath"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="recurrenceId" select="recurrenceId"/>
<li>
@@ -1516,7 +1520,7 @@
<xsl:template match="event">
<xsl:variable name="subscriptionId" select="subscription/id"/>
<xsl:variable name="calPath" select="calendar/encodedPath"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="recurrenceId" select="recurrenceId"/>
<xsl:variable name="statusClass">
<xsl:choose>
@@ -2100,7 +2104,7 @@
<xsl:variable name="subscriptionId" select="subscriptionId"/>
<xsl:variable name="calPathEncoded" select="form/calendar/encodedPath"/>
<xsl:variable name="calPath" select="form/calendar/path"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="recurrenceId" select="recurrenceId"/>
<input type="hidden" name="endType" value="date"/>
@@ -3962,7 +3966,7 @@
<form name="eventForm" method="post" action="{$event-addEventRefComplete}" id="standardForm" enctype="multipart/form-data">
<xsl:variable name="subscriptionId" select="subscription/id"/>
<xsl:variable name="calPath" select="calendar/path"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="recurrenceId" select="recurrenceId"/>
<input type="hidden" name="subid" value="{$subscriptionId}"/>
<input type="hidden" name="calPath" value="{$calPath}"/>
@@ -5837,7 +5841,7 @@
</tr>
<xsl:for-each select="events/event">
<xsl:sort select="lastmod" order="descending"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="subscriptionId" select="subscription/id"/>
<xsl:variable name="calPath" select="calendar/encodedPath"/>
<xsl:variable name="eventName" select="name"/>
@@ -5971,7 +5975,7 @@
</tr>
<xsl:for-each select="events/event">
<xsl:sort select="lastmod" order="descending"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="subscriptionId" select="subscription/id"/>
<xsl:variable name="calPath" select="calendar/encodedPath"/>
<xsl:variable name="eventName" select="name"/>
@@ -6076,7 +6080,7 @@
<xsl:variable name="subscriptionId" select="subscriptionId"/>
<xsl:variable name="calPathEncoded" select="form/calendar/encodedPath"/>
<xsl:variable name="calPath" select="form/calendar/path"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="recurrenceId" select="recurrenceId"/>
<!-- The name "eventForm" is referenced by several javascript functions. Do not
change it without modifying bedework.js -->
@@ -6612,7 +6616,7 @@
<xsl:template match="event" mode="attendeeReply">
<xsl:variable name="subscriptionId" select="subscription/id"/>
<xsl:variable name="calPath" select="calendar/encodedPath"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="recurrenceId" select="recurrenceId"/>
<xsl:variable name="statusClass">
<xsl:choose>
@@ -6858,7 +6862,7 @@
<form name="eventForm" method="post" action="{$event-addEventRefComplete}" id="standardForm" enctype="multipart/form-data">
<xsl:variable name="subscriptionId" select="subscription/id"/>
<xsl:variable name="calPath" select="calendar/path"/>
- <xsl:variable name="guid" select="guid"/>
+ <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable>
<xsl:variable name="recurrenceId" select="recurrenceId"/>
<input type="hidden" name="subid" value="{$subscriptionId}"/>
<input type="hidden" name="calPath" value="{$calPath}"/>
@@ -8273,4 +8277,53 @@
</xsl:otherwise>
</xsl:choose>
</xsl:template>
+
+ <!-- URL-encoding template Written by Mike J. Brown, mike at skew.org.
+ http://skew.org/xml/stylesheets/url-encode/ -->
+ <xsl:template name="url-encode">
+ <xsl:param name="str"/>
+
+ <!-- Characters we'll support. We could add control chars 0-31 and 127-159, but we won't. -->
+ <xsl:variable name="ascii"> !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:variable>
+ <xsl:variable name="latin1"> ¡¢£¤¥¦§¨©ª«¬®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:variable>
+
+ <!-- Characters that usually don't need to be escaped -->
+ <xsl:variable name="safe">!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:variable>
+
+ <xsl:variable name="hex">0123456789ABCDEF</xsl:variable>
+
+ <xsl:if test="$str">
+ <xsl:variable name="first-char" select="substring($str,1,1)"/>
+ <xsl:choose>
+ <xsl:when test="contains($safe,$first-char)">
+ <xsl:value-of select="$first-char"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:variable name="codepoint">
+ <xsl:choose>
+ <xsl:when test="contains($ascii,$first-char)">
+ <xsl:value-of select="string-length(substring-before($ascii,$first-char)) + 32"/>
+ </xsl:when>
+ <xsl:when test="contains($latin1,$first-char)">
+ <xsl:value-of select="string-length(substring-before($latin1,$first-char)) + 160"/>
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:message terminate="no">Warning: string contains a character that is out of range! Substituting "?".</xsl:message>
+ <xsl:text>63</xsl:text>
+ </xsl:otherwise>
+ </xsl:choose>
+ </xsl:variable>
+ <xsl:variable name="hex-digit1" select="substring($hex,floor($codepoint div 16) + 1,1)"/>
+ <xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/>
+ <xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/>
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="string-length($str) > 1">
+ <xsl:call-template name="url-encode">
+ <xsl:with-param name="str" select="substring($str,2)"/>
+ </xsl:call-template>
+ </xsl:if>
+ </xsl:if>
+ </xsl:template>
+
</xsl:stylesheet>
More information about the Bedework-commit
mailing list