Changeset 1972

Show
Ignore:
Timestamp:
11/19/08 16:37:10
Author:
johnsa
Message:

added url-encode template and now encode guids

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/deployment/webuser/webapp/resources/demoskins/default/default/default.xsl

    r1971 r1972  
    11<?xml version="1.0" encoding="UTF-8"?> 
    2 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> 
     2<xsl:stylesheet 
     3  version="1.0" 
     4  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
     5  xmlns:url="http://whatever/java/java.net.URLEncoder" 
     6  exclude-result-prefixes="url"> 
    37<xsl:output 
    48  method="xhtml" 
     
    977981              <xsl:variable name="subscriptionId" select="subscription/id"/> 
    978982              <xsl:variable name="calPath" select="calendar/encodedPath"/> 
    979               <xsl:variable name="guid" select="guid"/
     983              <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    980984              <xsl:variable name="recurrenceId" select="recurrenceId"/> 
    981985              <tr> 
     
    11271131    <xsl:variable name="subscriptionId" select="subscription/id"/> 
    11281132    <xsl:variable name="calPath" select="calendar/encodedPath"/> 
    1129     <xsl:variable name="guid" select="guid"/
     1133    <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    11301134    <xsl:variable name="recurrenceId" select="recurrenceId"/> 
    11311135    <xsl:if test="currentAccess/current-user-privilege-set/privilege/write-content"> 
     
    12901294    <xsl:variable name="subscriptionId" select="subscription/id"/> 
    12911295    <xsl:variable name="calPath" select="calendar/encodedPath"/> 
    1292     <xsl:variable name="guid" select="guid"/
     1296    <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    12931297    <xsl:variable name="recurrenceId" select="recurrenceId"/> 
    12941298    <xsl:variable name="eventRootClass"> 
     
    14961500    <xsl:variable name="subscriptionId" select="subscription/id"/> 
    14971501    <xsl:variable name="calPath" select="calendar/encodedPath"/> 
    1498     <xsl:variable name="guid" select="guid"/
     1502    <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    14991503    <xsl:variable name="recurrenceId" select="recurrenceId"/> 
    15001504 
     
    15171521    <xsl:variable name="subscriptionId" select="subscription/id"/> 
    15181522    <xsl:variable name="calPath" select="calendar/encodedPath"/> 
    1519     <xsl:variable name="guid" select="guid"/
     1523    <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    15201524    <xsl:variable name="recurrenceId" select="recurrenceId"/> 
    15211525    <xsl:variable name="statusClass"> 
     
    21012105    <xsl:variable name="calPathEncoded" select="form/calendar/encodedPath"/> 
    21022106    <xsl:variable name="calPath" select="form/calendar/path"/> 
    2103     <xsl:variable name="guid" select="guid"/
     2107    <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    21042108    <xsl:variable name="recurrenceId" select="recurrenceId"/> 
    21052109    <input type="hidden" name="endType" value="date"/> 
     
    39633967      <xsl:variable name="subscriptionId" select="subscription/id"/> 
    39643968      <xsl:variable name="calPath" select="calendar/path"/> 
    3965       <xsl:variable name="guid" select="guid"/
     3969      <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    39663970      <xsl:variable name="recurrenceId" select="recurrenceId"/> 
    39673971      <input type="hidden" name="subid" value="{$subscriptionId}"/> 
     
    58385842      <xsl:for-each select="events/event"> 
    58395843        <xsl:sort select="lastmod" order="descending"/> 
    5840         <xsl:variable name="guid" select="guid"/
     5844        <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    58415845        <xsl:variable name="subscriptionId" select="subscription/id"/> 
    58425846        <xsl:variable name="calPath" select="calendar/encodedPath"/> 
     
    59725976      <xsl:for-each select="events/event"> 
    59735977        <xsl:sort select="lastmod" order="descending"/> 
    5974         <xsl:variable name="guid" select="guid"/
     5978        <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    59755979        <xsl:variable name="subscriptionId" select="subscription/id"/> 
    59765980        <xsl:variable name="calPath" select="calendar/encodedPath"/> 
     
    60776081    <xsl:variable name="calPathEncoded" select="form/calendar/encodedPath"/> 
    60786082    <xsl:variable name="calPath" select="form/calendar/path"/> 
    6079     <xsl:variable name="guid" select="guid"/
     6083    <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    60806084    <xsl:variable name="recurrenceId" select="recurrenceId"/> 
    60816085    <!-- The name "eventForm" is referenced by several javascript functions. Do not 
     
    66136617    <xsl:variable name="subscriptionId" select="subscription/id"/> 
    66146618    <xsl:variable name="calPath" select="calendar/encodedPath"/> 
    6615     <xsl:variable name="guid" select="guid"/
     6619    <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    66166620    <xsl:variable name="recurrenceId" select="recurrenceId"/> 
    66176621    <xsl:variable name="statusClass"> 
     
    68596863      <xsl:variable name="subscriptionId" select="subscription/id"/> 
    68606864      <xsl:variable name="calPath" select="calendar/path"/> 
    6861       <xsl:variable name="guid" select="guid"/
     6865      <xsl:variable name="guid"><xsl:call-template name="url-encode"><xsl:with-param name="str" select="guid"/></xsl:call-template></xsl:variable
    68626866      <xsl:variable name="recurrenceId" select="recurrenceId"/> 
    68636867      <input type="hidden" name="subid" value="{$subscriptionId}"/> 
     
    82748278    </xsl:choose> 
    82758279  </xsl:template> 
     8280 
     8281  <!-- URL-encoding template Written by Mike J. Brown, mike@skew.org. 
     8282       http://skew.org/xml/stylesheets/url-encode/ --> 
     8283  <xsl:template name="url-encode"> 
     8284    <xsl:param name="str"/> 
     8285 
     8286    <!-- Characters we'll support. We could add control chars 0-31 and 127-159, but we won't. --> 
     8287    <xsl:variable name="ascii"> !"#$%&amp;'()*+,-./0123456789:;&lt;=&gt;?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~</xsl:variable> 
     8288    <xsl:variable name="latin1"> ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ</xsl:variable> 
     8289 
     8290    <!-- Characters that usually don't need to be escaped --> 
     8291    <xsl:variable name="safe">!'()*-.0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz~</xsl:variable> 
     8292 
     8293    <xsl:variable name="hex">0123456789ABCDEF</xsl:variable> 
     8294 
     8295    <xsl:if test="$str"> 
     8296      <xsl:variable name="first-char" select="substring($str,1,1)"/> 
     8297      <xsl:choose> 
     8298        <xsl:when test="contains($safe,$first-char)"> 
     8299          <xsl:value-of select="$first-char"/> 
     8300        </xsl:when> 
     8301        <xsl:otherwise> 
     8302          <xsl:variable name="codepoint"> 
     8303            <xsl:choose> 
     8304              <xsl:when test="contains($ascii,$first-char)"> 
     8305                <xsl:value-of select="string-length(substring-before($ascii,$first-char)) + 32"/> 
     8306              </xsl:when> 
     8307              <xsl:when test="contains($latin1,$first-char)"> 
     8308                <xsl:value-of select="string-length(substring-before($latin1,$first-char)) + 160"/> 
     8309              </xsl:when> 
     8310              <xsl:otherwise> 
     8311                <xsl:message terminate="no">Warning: string contains a character that is out of range! Substituting "?".</xsl:message> 
     8312                <xsl:text>63</xsl:text> 
     8313              </xsl:otherwise> 
     8314            </xsl:choose> 
     8315          </xsl:variable> 
     8316        <xsl:variable name="hex-digit1" select="substring($hex,floor($codepoint div 16) + 1,1)"/> 
     8317        <xsl:variable name="hex-digit2" select="substring($hex,$codepoint mod 16 + 1,1)"/> 
     8318        <xsl:value-of select="concat('%',$hex-digit1,$hex-digit2)"/> 
     8319        </xsl:otherwise> 
     8320      </xsl:choose> 
     8321      <xsl:if test="string-length($str) &gt; 1"> 
     8322        <xsl:call-template name="url-encode"> 
     8323          <xsl:with-param name="str" select="substring($str,2)"/> 
     8324        </xsl:call-template> 
     8325      </xsl:if> 
     8326    </xsl:if> 
     8327  </xsl:template> 
     8328 
    82768329</xsl:stylesheet>