cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sylv...@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/woody/samples/resources woody-advanced-field-styling.xsl woody-calendar-styling.xsl woody-field-styling.xsl woody-page-styling.xsl woody-samples-styling.xsl
Date Tue, 09 Dec 2003 21:18:04 GMT
sylvain     2003/12/09 13:18:04

  Modified:    src/blocks/woody/samples/resources woody-field-styling.xsl
                        woody-page-styling.xsl woody-samples-styling.xsl
  Added:       src/blocks/woody/samples/resources
                        woody-advanced-field-styling.xsl
                        woody-calendar-styling.xsl
  Log:
  First pass at modularizing the styling
  
  Revision  Changes    Path
  1.25      +27 -139   cocoon-2.1/src/blocks/woody/samples/resources/woody-field-styling.xsl
  
  Index: woody-field-styling.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-field-styling.xsl,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- woody-field-styling.xsl	8 Dec 2003 20:28:32 -0000	1.24
  +++ woody-field-styling.xsl	9 Dec 2003 21:18:04 -0000	1.25
  @@ -4,44 +4,18 @@
                   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                   xmlns:wi="http://apache.org/cocoon/woody/instance/1.0"
                   exclude-result-prefixes="wi">
  +  
  +  <xsl:param name="resources-uri">resources</xsl:param>
   
  -  <!-- must be called in <head> to load calendar script and setup the CSS -->
  +  <!-- must be called in <head>  -->
     <xsl:template name="woody-field-head">
  -    <xsl:param name="uri" select="'resources'"/>
  -    <xsl:param name="div">woody_calendarDiv</xsl:param>
  -
  -    <!-- use this for debugging
  -    <script src="{$uri}/mattkruse-lib/AnchorPosition.js" language="JavaScript" type="text/javascript"/>
  -    <script src="{$uri}/mattkruse-lib/CalendarPopup.js" language="JavaScript" type="text/javascript"/>
  -    <script src="{$uri}/mattkruse-lib/date.js" language="JavaScript" type="text/javascript"/>
  -    <script src="{$uri}/mattkruse-lib/OptionTransfer.js" language="JavaScript" type="text/javascript"/>
  -    <script src="{$uri}/mattkruse-lib/PopupWindow.js" language="JavaScript" type="text/javascript"/>
  -    <script src="{$uri}/mattkruse-lib/selectbox.js" language="JavaScript" type="text/javascript"/>
  -    -->
  -    <script src="{$uri}/mattkruse-lib.js" language="JavaScript" type="text/javascript"/>
  -
  -    <script src="{$uri}/woody-lib.js" language="JavaScript" type="text/javascript"/>
  -    <script language="JavaScript" type="text/javascript">
  -      // Setup calendar
  -      <xsl:choose>
  -        <xsl:when test="$div">
  -      var woody_calendar = CalendarPopup('<xsl:value-of select="$div"/>');
  -        </xsl:when>
  -        <xsl:otherwise>
  -      var woody_calendar = CalendarPopup();
  -        </xsl:otherwise>
  -      </xsl:choose>
  -      woody_calendar.setWeekStartDay(1);
  -      woody_calendar.showYearNavigation();
  -      woody_calendar.showYearNavigationInput();
  -      //FIXME: avoid this and simply write them in the CSS?
  -      document.write(woody_calendar.getStyles());
  -    </script>
  +    <script src="{$resources-uri}/mattkruse-lib/AnchorPosition.js" language="JavaScript"
type="text/javascript"/>
  +    <script src="{$resources-uri}/mattkruse-lib/PopupWindow.js" language="JavaScript"
type="text/javascript"/>
  +    <script src="{$resources-uri}/woody-lib.js" language="JavaScript" type="text/javascript"/>
     </xsl:template>
   
     <!--+
  -      | must be called in <head> to load help popups, calendar script,
  -      | and setup the CSS
  +      | must be called in <body>
         +-->
     <xsl:template name="woody-field-body">
       <xsl:attribute name="onload">woody_onload(); <xsl:value-of select="@onload"/></xsl:attribute>
  @@ -49,7 +23,6 @@
         // Register woody startup function
         document.body.onload = woody_init;
       </script-->
  -    <div id="woody_calendarDiv" style="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;"/>
     </xsl:template>
   
     <!--+
  @@ -58,7 +31,7 @@
     <xsl:template match="wi:field">
       <input name="{@id}" id="{@id}" value="{wi:value}" title="{wi:hint}">
         <xsl:if test="wi:styling">
  -        <xsl:copy-of select="wi:styling/@*"/>
  +        <xsl:copy-of select="wi:styling/@*[not(name() = 'submit-on-change')]"/>
         </xsl:if>
         <xsl:if test="wi:styling/@submit-on-change='true'">
           <xsl:attribute name="onchange">woody_submitForm(this)</xsl:attribute>
  @@ -67,6 +40,9 @@
       <xsl:apply-templates select="." mode="common"/>
     </xsl:template>
   
  +  <!--+
  +      | 
  +      +-->
     <xsl:template match="wi:*" mode="common">
       <!-- validation message -->
       <xsl:apply-templates select="wi:validation-message"/>
  @@ -77,6 +53,9 @@
       <xsl:apply-templates select="wi:help"/>
     </xsl:template>
   
  +  <!--+
  +      | 
  +      +-->
     <xsl:template match="wi:help">
       <div class="woody-help" id="help{generate-id()}" style="visibility:hidden; position:absolute;">
         <xsl:apply-templates select="node()"/>
  @@ -87,6 +66,9 @@
       <a id="{generate-id()}" href="#" onclick="helpWin{generate-id()}.showPopup('{generate-id()}');return
false;"><img border="0" src="resources/help.gif"/></a>
     </xsl:template>
   
  +  <!--+
  +      | 
  +      +-->
     <xsl:template match="wi:validation-message">
       <a href="#" class="woody-validation-message-indicator" onclick="alert('{normalize-space(.)}');return
false;">&#160;!&#160;</a>
     </xsl:template>
  @@ -94,7 +76,7 @@
     <!--+
         | Hidden wi:field : produce input with type='hidden'
         +-->
  -  <xsl:template match="wi:field[wi:styling[@type='hidden']]" priority="2">
  +  <xsl:template match="wi:field[wi:styling/@type='hidden']" priority="2">
       <input type="hidden" name="{@id}" id="{@id}" value="{wi:value}">
         <xsl:if test="wi:styling/@submit-on-change='true'">
           <xsl:attribute name="onchange">woody_submitForm(this)</xsl:attribute>
  @@ -201,7 +183,7 @@
     <!--+
         | wi:field with a selection list and @type 'output'
         +-->
  -  <xsl:template match="wi:field[wi:selection-list and wi:styling[@type='output']]" priority="3">
  +  <xsl:template match="wi:field[wi:selection-list and wi:styling/@type='output']" priority="3">
       <xsl:variable name="value" select="wi:value"/>
       <xsl:variable name="selected" select="wi:selection-list/wi:item[@value = $value]"/>
       <xsl:choose>
  @@ -217,13 +199,14 @@
     <!--+
         | wi:field with @type 'textarea'
         +-->
  -  <xsl:template match="wi:field[wi:styling[@type='textarea']]">
  +  <xsl:template match="wi:field[wi:styling/@type='textarea']">
       <textarea id="{@id}" name="{@id}" title="{wi:hint}">
         <xsl:if test="wi:styling/@submit-on-change='true'">
           <xsl:attribute name="onchange">woody_submitForm(this)</xsl:attribute>
         </xsl:if>
  -      <xsl:copy-of select="wi:styling/@*[not(name() = 'type')]"/>
  -      <xsl:copy-of select="wi:value/node()"/>
  +      <xsl:copy-of select="wi:styling/@*[not(name() = 'type' or name() ='submit-on-change')]"/>
  +      <!-- remove carriage-returns (occurs on certain versions of IE and doubles linebreaks
at each submit) -->
  +      <xsl:copy-of select="translate(wi:value/node(), '&#13;','')"/>
       </textarea>
       <xsl:apply-templates select="." mode="common"/>
     </xsl:template>
  @@ -231,32 +214,11 @@
     <!--+
         | wi:field with @type 'output' : rendered as text
         +-->
  -  <xsl:template match="wi:field[wi:styling[@type='output']]" priority="2">
  +  <xsl:template match="wi:field[wi:styling/@type='output']" priority="2">
       <xsl:copy-of select="wi:value/node()"/>
     </xsl:template>
   
     <!--+
  -      | wi:field with @type 'date' : use CalendarPopup
  -      +-->
  -  <xsl:template match="wi:field[wi:styling[@type='date']]">
  -    <xsl:variable name="id" select="generate-id()"/>
  -    <xsl:variable name="format">
  -      <xsl:choose>
  -        <xsl:when test="wi:styling/@format"><xsl:value-of select="wi:styling/@format"/></xsl:when>
  -        <xsl:otherwise>yyyy-MM-dd</xsl:otherwise>
  -      </xsl:choose>
  -    </xsl:variable>
  -    <input id="{@id}" name="{@id}" value="{wi:value}">
  -      <xsl:if test="wi:styling/@submit-on-change='true'">
  -        <xsl:attribute name="onchange">woody_submitForm(this)</xsl:attribute>
  -      </xsl:if>
  -      <xsl:copy-of select="wi:styling/@*[not(name() = 'type')]"/>
  -    </input>
  -    <a href="#" onClick="woody_calendar.select(woody_getForm(this)['{@id}'],'{generate-id()}','{$format}');
return false;" NAME="{generate-id()}" ID="{generate-id()}"><img src="resources/cal.gif"
border="0" alt="Calendar"/></a>
  -    <xsl:apply-templates select="." mode="common"/>
  -  </xsl:template>
  -
  -  <!--+
         | wi:output
         +-->
     <xsl:template match="wi:output">
  @@ -271,6 +233,7 @@
         <xsl:if test="wi:styling/@submit-on-change='true'">
           <xsl:attribute name="onchange">woody_submitForm(this)</xsl:attribute>
         </xsl:if>
  +      <xsl:copy-of select="@*[not(name() = 'submit-on-change')]"/>
         <xsl:if test="wi:value/text() = 'true'">
           <xsl:attribute name="checked">true</xsl:attribute>
         </xsl:if>
  @@ -281,7 +244,7 @@
     <!--+
         | wi:booleanfield with @type 'output' : rendered as text
         +-->
  -  <xsl:template match="wi:booleanfield[wi:styling[@type='output']]">
  +  <xsl:template match="wi:booleanfield[wi:styling/@type='output']">
       <xsl:choose>
         <xsl:when test="wi:value = 'true'">
           yes
  @@ -319,7 +282,7 @@
     <!--+
         | wi:multivaluefield : produce a list of checkboxes
         +-->
  -  <xsl:template match="wi:multivaluefield[wi:styling[@list-type='checkbox']]">
  +  <xsl:template match="wi:multivaluefield[wi:styling/@list-type='checkbox']">
       <xsl:variable name="id" select="@id"/>
       <xsl:variable name="values" select="wi:values/wi:value/text()"/>
   
  @@ -369,81 +332,6 @@
         </select>
       </span>
       <xsl:apply-templates select="." mode="common"/>
  -  </xsl:template>
  -
  -  <!--+
  -      | wi:multivaluefield : produce a double selection list
  -      +-->
  -  <xsl:template match="wi:multivaluefield[wi:styling[@list-type='double-listbox']]">
  -    <xsl:variable name="id" select="@id"/>
  -    <xsl:variable name="values" select="wi:values/wi:value/text()"/>
  -    <xsl:variable name="size">
  -      <xsl:choose>
  -        <xsl:when test="wi:styling/@listbox-size">
  -          <xsl:value-of select="wi:styling/@listbox-size"/>
  -        </xsl:when>
  -        <xsl:otherwise>
  -          <xsl:text>5</xsl:text>
  -        </xsl:otherwise>
  -      </xsl:choose>
  -    </xsl:variable>
  -
  -    <span  class="woody-doubleList" title="{wi:hint}">
  -      <table>
  -        <tr>
  -          <td>
  -            <!-- select for the unselected values -->
  -            <select ondblclick="opt{generate-id()}.transferRight()" id="{@id}.unselected"
name="{@id}.unselected" size="{$size}" multiple="multiple">
  -              <xsl:for-each select="wi:selection-list/wi:item">
  -                <xsl:variable name="value" select="@value"/>
  -                <xsl:if test="not($values[. = $value])">
  -                  <option value="{$value}">
  -                    <xsl:copy-of select="wi:label/node()"/>
  -                  </option>
  -                </xsl:if>
  -              </xsl:for-each>
  -            </select>
  -          </td>
  -          <td align="center" valign="middle">
  -            <!-- command buttons -->
  -            <!-- strangely, IE adds an extra blank line if there only a button on a
line. So we surround it with nbsp -->
  -            <xsl:text>&#160;</xsl:text>
  -            <input type="button" value="&gt;" onclick="opt{generate-id()}.transferRight()"/>
  -            <xsl:text>&#160;</xsl:text>
  -            <br/>
  -            <xsl:text>&#160;</xsl:text>
  -            <input type="button" value="&gt;&gt;" onclick="opt{generate-id()}.transferAllRight()"/>
  -            <xsl:text>&#160;</xsl:text>
  -            <br/>
  -            <xsl:text>&#160;</xsl:text>
  -            <input type="button" value="&lt;" onclick="opt{generate-id()}.transferLeft()"/>
  -            <xsl:text>&#160;</xsl:text>
  -            <br/>
  -            <xsl:text>&#160;</xsl:text>
  -            <input type="button" value="&lt;&lt;" onclick="opt{generate-id()}.transferAllLeft()"/>
  -            <xsl:text>&#160;</xsl:text>
  -            <br/>
  -            <xsl:apply-templates select="." mode="common"/>
  -          </td>
  -          <td>
  -            <!-- select for the selected values -->
  -            <select ondblclick="opt{generate-id()}.transferLeft()" id="{@id}" name="{@id}"
size="{$size}" multiple="multiple">
  -              <xsl:for-each select="wi:selection-list/wi:item">
  -                <xsl:variable name="value" select="@value"/>
  -                <xsl:if test="$values[. = $value]">
  -                  <option value="{$value}">
  -                    <xsl:copy-of select="wi:label/node()"/>
  -                  </option>
  -                </xsl:if>
  -              </xsl:for-each>
  -            </select>
  -          </td>
  -        </tr>
  -      </table>
  -      <script language="JavaScript">
  -        var opt<xsl:value-of select="generate-id()"/> = woody_createOptionTransfer('<xsl:value-of
select="@id"/>');
  -      </script>
  -    </span>
     </xsl:template>
   
     <!--+
  
  
  
  1.9       +14 -0     cocoon-2.1/src/blocks/woody/samples/resources/woody-page-styling.xsl
  
  Index: woody-page-styling.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-page-styling.xsl,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- woody-page-styling.xsl	21 Nov 2003 20:12:55 -0000	1.8
  +++ woody-page-styling.xsl	9 Dec 2003 21:18:04 -0000	1.9
  @@ -198,6 +198,20 @@
       </tr>
     </xsl:template>
   
  +  <!-- action : on a single line -->
  +  <xsl:template match="wi:action" mode="group-columns-content">
  +    <tr>
  +      <td colspan="2"><xsl:apply-templates select="."/></td>
  +    </tr>
  +  </xsl:template>
  +
  +  <!-- any other element : on a single line -->
  +  <xsl:template match="*" mode="group-columns-content">
  +    <tr>
  +      <td colspan="2"><xsl:apply-templates select="."/></td>
  +    </tr>
  +  </xsl:template>
  +
     <!-- double-list multivaluefield : lists under the label -->
     <xsl:template match="wi:multivaluefield[wi:styling/@list-type='double-listbox']" mode="group-columns-content">
       <tr align="center">
  
  
  
  1.4       +20 -4     cocoon-2.1/src/blocks/woody/samples/resources/woody-samples-styling.xsl
  
  Index: woody-samples-styling.xsl
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/samples/resources/woody-samples-styling.xsl,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- woody-samples-styling.xsl	7 Nov 2003 16:38:43 -0000	1.3
  +++ woody-samples-styling.xsl	9 Dec 2003 21:18:04 -0000	1.4
  @@ -3,25 +3,41 @@
   <xsl:stylesheet version="1.0"
                   xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
     
  -  <xsl:include href="woody-page-styling.xsl"/>
  +  <!-- Location of the resources directory, where JS libs and icons are stored -->
  +  <xsl:param name="resources-uri">resources</xsl:param>
  +  
  +  <!-- Include styling stylesheets -->
  +  <!-- FIXME: xalan silently ignores non-existing stylesheets (such as when there's
a typo in the name)
  +       ==> Is it in the XSLT spec? -->
     <xsl:include href="woody-field-styling.xsl"/>
  +  <xsl:include href="woody-page-styling.xsl"/>
  +  <xsl:include href="woody-calendar-styling.xsl"/>
  +  <xsl:include href="woody-advanced-field-styling.xsl"/>
     
  -  <!-- head and body stuff required to use the calendar popup -->
     <xsl:template match="head">
       <xsl:copy>
         <xsl:apply-templates/>
         <!-- insert the head snippets required by the styling stylesheets -->
  -      <xsl:call-template name="woody-page-head"/>
         <xsl:call-template name="woody-field-head"/>
  +      <xsl:call-template name="woody-page-head"/>
  +      <xsl:call-template name="woody-calendar-head"/>
  +      <xsl:call-template name="woody-advanced-field-head"/>
  +      
         <link rel="stylesheet" type="text/css" href="resources/woody.css"/>
  +      
  +      <xsl:call-template name="woody-calendar-css"/>
       </xsl:copy>
     </xsl:template>
     
     <xsl:template match="body">
       <xsl:copy>
  +      <!--xsl:copy-of select="@*"/-->
  +      
         <!-- insert the body  snippets required by the styling stylesheets -->
  -      <xsl:call-template name="woody-page-body"/>
         <xsl:call-template name="woody-field-body"/>
  +      <xsl:call-template name="woody-page-body"/>
  +      <xsl:call-template name="woody-calendar-body"/>
  +      <xsl:call-template name="woody-advanced-field-body"/>
         <xsl:apply-templates/>
       </xsl:copy>
     </xsl:template>
  
  
  
  1.1                  cocoon-2.1/src/blocks/woody/samples/resources/woody-advanced-field-styling.xsl
  
  Index: woody-advanced-field-styling.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:wi="http://apache.org/cocoon/woody/instance/1.0"
                  exclude-result-prefixes="wi">
  
    <xsl:param name="resources-uri">resources</xsl:param>
  
    <!--+
        | must be called in <head>
        +-->
    <xsl:template name="woody-advanced-field-head">
      <script src="{$resources-uri}/mattkruse-lib/OptionTransfer.js" language="JavaScript"
type="text/javascript"/>
      <script src="{$resources-uri}/mattkruse-lib/selectbox.js" language="JavaScript" type="text/javascript"/>
    </xsl:template>
  
    <!--+
        | must be called in <body> to load help popups, calendar script,
        | and setup the CSS
        +-->
    <xsl:template name="woody-advanced-field-body">
      <!-- nothing here for now -->
    </xsl:template>
  
  
    <!--+
        | wi:multivaluefield with list-type='double-listbox' styling
        +-->
    <xsl:template match="wi:multivaluefield[wi:styling/@list-type='double-listbox']">
      <xsl:variable name="id" select="@id"/>
      <xsl:variable name="values" select="wi:values/wi:value/text()"/>
      <xsl:variable name="size">
        <xsl:choose>
          <xsl:when test="wi:styling/@listbox-size">
            <xsl:value-of select="wi:styling/@listbox-size"/>
          </xsl:when>
          <xsl:otherwise>
            <xsl:text>5</xsl:text>
          </xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
  
      <span class="woody-doubleList" title="{wi:hint}">
        <table>
          <xsl:if test="wi:styling/wi:available-label|wi:styling/wi:selected-label">
            <tr>
              <th>
                <xsl:copy-of select="wi:styling/wi:available-label/node()"/>
              </th>
              <th> </th>
              <th>
                <xsl:copy-of select="wi:styling/wi:selected-label/node()"/>
              </th>
            </tr>
          </xsl:if>
          <tr>
            <td>
              <!-- select for the unselected values -->
              <select id="{@id}.unselected" name="{@id}.unselected" size="{$size}" multiple="multiple"
                      ondblclick="opt{generate-id()}.transferRight()">
                <xsl:for-each select="wi:selection-list/wi:item">
                  <xsl:variable name="value" select="@value"/>
                  <xsl:if test="not($values[. = $value])">
                    <option value="{$value}">
                      <xsl:copy-of select="wi:label/node()"/>
                    </option>
                  </xsl:if>
                </xsl:for-each>
              </select>
            </td>
            <td align="center" valign="middle">
              <!-- command buttons -->
              <!-- strangely, IE adds an extra blank line if there only a button on a line.
So we surround it with nbsp -->
              <xsl:text>&#160;</xsl:text>
              <input type="button" value="&gt;" onclick="opt{generate-id()}.transferRight()"/>
              <xsl:text>&#160;</xsl:text>
              <br/>
              <xsl:text>&#160;</xsl:text>
              <input type="button" value="&gt;&gt;" onclick="opt{generate-id()}.transferAllRight()"/>
              <xsl:text>&#160;</xsl:text>
              <br/>
              <xsl:text>&#160;</xsl:text>
              <input type="button" value="&lt;" onclick="opt{generate-id()}.transferLeft()"/>
              <xsl:text>&#160;</xsl:text>
              <br/>
              <xsl:text>&#160;</xsl:text>
              <input type="button" value="&lt;&lt;" onclick="opt{generate-id()}.transferAllLeft()"/>
              <xsl:text>&#160;</xsl:text>
              <br/>
              <xsl:apply-templates select="." mode="common"/>
            </td>
            <td>
              <!-- select for the selected values -->
              <select ondblclick="opt{generate-id()}.transferLeft()" id="{@id}" name="{@id}"
size="{$size}" multiple="multiple">
                <xsl:for-each select="wi:selection-list/wi:item">
                  <xsl:variable name="value" select="@value"/>
                  <xsl:if test="$values[. = $value]">
                    <option value="{$value}">
                      <xsl:copy-of select="wi:label/node()"/>
                    </option>
                  </xsl:if>
                </xsl:for-each>
              </select>
            </td>
          </tr>
        </table>
        <script language="JavaScript" type="text/javascript">
          var opt<xsl:value-of select="generate-id()"/> = woody_createOptionTransfer('<xsl:value-of
select="@id"/>');
        </script>
      </span>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  
  1.1                  cocoon-2.1/src/blocks/woody/samples/resources/woody-calendar-styling.xsl
  
  Index: woody-calendar-styling.xsl
  ===================================================================
  <?xml version="1.0"?>
  
  <xsl:stylesheet version="1.0"
                  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                  xmlns:wi="http://apache.org/cocoon/woody/instance/1.0"
                  exclude-result-prefixes="wi">
    
    <xsl:param name="resources-uri">resources</xsl:param>
  
    <!-- must be called in <head> to load calendar script and setup the CSS -->
    <xsl:template name="woody-calendar-head">
      <!-- assume these have been loaded by woody-field-styling
        <script src="{$resources-uri}/mattkruse-lib/PopupWindow.js" language="JavaScript"
type="text/javascript"/>
        <script src="{$resources-uri}/mattkruse-lib/AnchorPosition.js" language="JavaScript"
type="text/javascript"/>
      -->
      <script src="{$resources-uri}/mattkruse-lib/CalendarPopup.js" language="JavaScript"
type="text/javascript"/>
      <script src="{$resources-uri}/mattkruse-lib/date.js" language="JavaScript" type="text/javascript"/>
  
  
      <script language="JavaScript" type="text/javascript">
        // Setup calendar
        var woody_calendar = CalendarPopup('woody_calendarDiv');
        woody_calendar.setWeekStartDay(1);
        woody_calendar.showYearNavigation();
        woody_calendar.showYearNavigationInput();
        woody_calendar.setCssPrefix("woody_");
      </script>
    </xsl:template>
    
    <xsl:template name="woody-calendar-css">
      <style type="text/css">
        .woody_cpYearNavigation, .woody_cpMonthNavigation {
          background-color:#C0C0C0;
          text-align:center;
          vertical-align:center;
          text-decoration:none;
          color:#000000;
          font-weight:bold;
        }
        
        .woody_cpDayColumnHeader, .woody_cpYearNavigation, .woody_cpMonthNavigation, .woody_cpCurrentMonthDate,
.woody_cpCurrentMonthDateDisabled, .woody_cpOtherMonthDate, .woody_cpOtherMonthDateDisabled,
.woody_cpCurrentDate, .woody_cpCurrentDateDisabled, .woody_cpTodayText, .woody_cpTodayTextDisabled,
.woody_cpText {
          font-family:arial;
          font-size:8pt;
        }
        
        TD.woody_cpDayColumnHeader {
          text-align:right;
          border:solid thin #C0C0C0;
          border-width:0 0 1 0;
        }
        
        .woody_cpCurrentMonthDate, .woody_cpOtherMonthDate, .woody_cpCurrentDate  {
          text-align:right;
          text-decoration:none;
        }
        
        .woody_cpCurrentMonthDateDisabled, .woody_cpOtherMonthDateDisabled, .woody_cpCurrentDateDisabled
{
          color:#D0D0D0;
          text-align:right;
          text-decoration:line-through;
        }
        
        .woody_cpCurrentMonthDate, .woody_cpCurrentDate {
          color:#000000;
        }
        
        .woody_cpOtherMonthDate {
          color:#808080;
        }
        
        TD.woody_cpCurrentDate {
          color:white; background-color: #C0C0C0;
          border-width:1;
          border:solid thin #800000;
        }
        
        TD.woody_cpCurrentDateDisabled {
          border-width:1;
          border:solid thin #FFAAAA;
        }
        
        TD.woody_cpTodayText, TD.woody_cpTodayTextDisabled {
          border:solid thin #C0C0C0;
          border-width:1 0 0 0;
        }
        
        A.woody_cpTodayText, SPAN.woody_cpTodayTextDisabled {
          height:20px;
        }
        
        A.woody_cpTodayText {
          color:black;
        }
        
        .woody_cpTodayTextDisabled {
          color:#D0D0D0;
        }
        
        .woody_cpBorder {
          border:solid thin #808080;
        }
      </style>
    </xsl:template>
  
    <!--+
        | must be called in <body> 
        +-->
    <xsl:template name="woody-calendar-body">
      <div id="woody_calendarDiv" style="position:absolute;visibility:hidden;background-color:white;layer-background-color:white;"/>
    </xsl:template>
  
    <!--+
        | wi:field with @type 'date' : use CalendarPopup
        +-->
    <xsl:template match="wi:field[wi:styling/@type='date']">
      <xsl:variable name="id" select="generate-id()"/>
      
      <!-- FIXME: should use the format used by the convertor -->
      <xsl:variable name="format">
        <xsl:choose>
          <xsl:when test="wi:styling/@format"><xsl:value-of select="wi:styling/@format"/></xsl:when>
          <xsl:otherwise>yyyy-MM-dd</xsl:otherwise>
        </xsl:choose>
      </xsl:variable>
      
      <!-- regular input -->
      <input id="{@id}" name="{@id}" value="{wi:value}">
        <xsl:if test="wi:styling/@submit-on-change='true'">
          <xsl:attribute name="onchange">woody_submitForm(this)</xsl:attribute>
        </xsl:if>
        <xsl:copy-of select="wi:styling/@*[not(name() = 'type' or name() = 'submit-on-change')]"/>
      </input>
      
      <!-- calendar popup -->
      <a href="#" name="{generate-id()}" id="{generate-id()}"
         onClick="woody_calendar.select(woody_getForm(this)['{@id}'],'{generate-id()}','{$format}');
return false;">
        <img src="{$resources-uri}/cal.gif" border="0" alt="Calendar"/>
      </a>
  
      <!-- common stuff -->
      <xsl:apply-templates select="." mode="common"/>
    </xsl:template>
  
  </xsl:stylesheet>
  
  
  

Mime
View raw message