Changeset 1181

Show
Ignore:
Timestamp:
12/27/06 12:11:21
Author:
johnsa
Message:

admin and user client: consolidate some xsl logic

Files:

Legend:

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

    r1180 r1181  
    10181018              <xsl:if test="form/recurrence/bymonthday"> 
    10191019                on the 
    1020                 <xsl:for-each select="form/recurrence/bymonthday/val"> 
    1021                   <xsl:if test="position() != 1 and position() = last()"> and </xsl:if> 
    1022                   <xsl:value-of select="."/><xsl:choose> 
    1023                     <xsl:when test="substring(., string-length(.)-1, 2) = '11' or 
    1024                                     substring(., string-length(.)-1, 2) = '12' or 
    1025                                     substring(., string-length(.)-1, 2) = '13'">th</xsl:when> 
    1026                     <xsl:when test="substring(., string-length(.), 1) = '1'">st</xsl:when> 
    1027                     <xsl:when test="substring(., string-length(.), 1) = '2'">nd</xsl:when> 
    1028                     <xsl:when test="substring(., string-length(.), 1) = '3'">rd</xsl:when> 
    1029                     <xsl:otherwise>th</xsl:otherwise> 
    1030                   </xsl:choose> 
    1031                   <xsl:if test="position() != last()">, </xsl:if> 
    1032                 </xsl:for-each> 
     1020                <xsl:apply-templates select="form/recurrence/bymonthday/val" mode="weekMonthYearNumbers"/> 
    10331021                day<xsl:if test="form/recurrence/bymonthday/val[position()=2]">s</xsl:if> of the month 
    10341022              </xsl:if> 
     
    10361024              <xsl:if test="form/recurrence/byyearday"> 
    10371025                on the 
    1038                 <xsl:for-each select="form/recurrence/byyearday/val"> 
    1039                   <xsl:if test="position() != 1 and position() = last()"> and </xsl:if> 
    1040                   <xsl:value-of select="."/><xsl:choose> 
    1041                     <xsl:when test="substring(., string-length(.)-1, 2) = '11' or 
    1042                                     substring(., string-length(.)-1, 2) = '12' or 
    1043                                     substring(., string-length(.)-1, 2) = '13'">th</xsl:when> 
    1044                     <xsl:when test="substring(., string-length(.), 1) = '1'">st</xsl:when> 
    1045                     <xsl:when test="substring(., string-length(.), 1) = '2'">nd</xsl:when> 
    1046                     <xsl:when test="substring(., string-length(.), 1) = '3'">rd</xsl:when> 
    1047                     <xsl:otherwise>th</xsl:otherwise> 
    1048                   </xsl:choose> 
    1049                   <xsl:if test="position() != last()">, </xsl:if> 
    1050                 </xsl:for-each> 
     1026                <xsl:apply-templates select="form/recurrence/byyearday/val" mode="weekMonthYearNumbers"/> 
    10511027                day<xsl:if test="form/recurrence/byyearday/val[position()=2]">s</xsl:if> of the year 
    10521028              </xsl:if> 
     
    10541030              <xsl:if test="form/recurrence/byweekno"> 
    10551031                in the 
    1056                 <xsl:for-each select="form/recurrence/byweekno/val"> 
    1057                   <xsl:if test="position() != 1 and position() = last()"> and </xsl:if> 
    1058                   <xsl:value-of select="."/><xsl:choose> 
    1059                     <xsl:when test="substring(., string-length(.)-1, 2) = '11' or 
    1060                                     substring(., string-length(.)-1, 2) = '12' or 
    1061                                     substring(., string-length(.)-1, 2) = '13'">th</xsl:when> 
    1062                     <xsl:when test="substring(., string-length(.), 1) = '1'">st</xsl:when> 
    1063                     <xsl:when test="substring(., string-length(.), 1) = '2'">nd</xsl:when> 
    1064                     <xsl:when test="substring(., string-length(.), 1) = '3'">rd</xsl:when> 
    1065                     <xsl:otherwise>th</xsl:otherwise> 
    1066                   </xsl:choose> 
    1067                   <xsl:if test="position() != last()">, </xsl:if> 
    1068                 </xsl:for-each> 
     1032                <xsl:apply-templates select="form/recurrence/byweekno/val" mode="weekMonthYearNumbers"/> 
    10691033                week<xsl:if test="form/recurrence/byweekno/val[position()=2]">s</xsl:if> of the year 
    10701034              </xsl:if> 
     
    17311695  </xsl:template> 
    17321696 
     1697  <xsl:template match="val" mode="weekMonthYearNumbers"> 
     1698    <xsl:if test="position() != 1 and position() = last()"> and </xsl:if> 
     1699    <xsl:value-of select="."/><xsl:choose> 
     1700      <xsl:when test="substring(., string-length(.)-1, 2) = '11' or 
     1701                      substring(., string-length(.)-1, 2) = '12' or 
     1702                      substring(., string-length(.)-1, 2) = '13'">th</xsl:when> 
     1703      <xsl:when test="substring(., string-length(.), 1) = '1'">st</xsl:when> 
     1704      <xsl:when test="substring(., string-length(.), 1) = '2'">nd</xsl:when> 
     1705      <xsl:when test="substring(., string-length(.), 1) = '3'">rd</xsl:when> 
     1706      <xsl:otherwise>th</xsl:otherwise> 
     1707    </xsl:choose> 
     1708    <xsl:if test="position() != last()">, </xsl:if> 
     1709  </xsl:template> 
     1710 
    17331711  <xsl:template name="byDayChkBoxList"> 
    17341712    <xsl:param name="name"/> 
  • trunk/deployment/webuser/webapp/resources/demoskins/default/default/default.xsl

    r1180 r1181  
    22822282              <xsl:if test="form/recurrence/bymonthday"> 
    22832283                on the 
    2284                 <xsl:for-each select="form/recurrence/bymonthday/val"> 
    2285                   <xsl:if test="position() != 1 and position() = last()"> and </xsl:if> 
    2286                   <xsl:value-of select="."/><xsl:choose> 
    2287                     <xsl:when test="substring(., string-length(.)-1, 2) = '11' or 
    2288                                     substring(., string-length(.)-1, 2) = '12' or 
    2289                                     substring(., string-length(.)-1, 2) = '13'">th</xsl:when> 
    2290                     <xsl:when test="substring(., string-length(.), 1) = '1'">st</xsl:when> 
    2291                     <xsl:when test="substring(., string-length(.), 1) = '2'">nd</xsl:when> 
    2292                     <xsl:when test="substring(., string-length(.), 1) = '3'">rd</xsl:when> 
    2293                     <xsl:otherwise>th</xsl:otherwise> 
    2294                   </xsl:choose> 
    2295                   <xsl:if test="position() != last()">, </xsl:if> 
    2296                 </xsl:for-each> 
     2284                <xsl:apply-templates select="form/recurrence/bymonthday/val" mode="weekMonthYearNumbers"/> 
    22972285                day<xsl:if test="form/recurrence/bymonthday/val[position()=2]">s</xsl:if> of the month 
    22982286              </xsl:if> 
     
    23002288              <xsl:if test="form/recurrence/byyearday"> 
    23012289                on the 
    2302                 <xsl:for-each select="form/recurrence/byyearday/val"> 
    2303                   <xsl:if test="position() != 1 and position() = last()"> and </xsl:if> 
    2304                   <xsl:value-of select="."/><xsl:choose> 
    2305                     <xsl:when test="substring(., string-length(.)-1, 2) = '11' or 
    2306                                     substring(., string-length(.)-1, 2) = '12' or 
    2307                                     substring(., string-length(.)-1, 2) = '13'">th</xsl:when> 
    2308                     <xsl:when test="substring(., string-length(.), 1) = '1'">st</xsl:when> 
    2309                     <xsl:when test="substring(., string-length(.), 1) = '2'">nd</xsl:when> 
    2310                     <xsl:when test="substring(., string-length(.), 1) = '3'">rd</xsl:when> 
    2311                     <xsl:otherwise>th</xsl:otherwise> 
    2312                   </xsl:choose> 
    2313                   <xsl:if test="position() != last()">, </xsl:if> 
    2314                 </xsl:for-each> 
     2290                <xsl:apply-templates select="form/recurrence/byyearday/val" mode="weekMonthYearNumbers"/> 
    23152291                day<xsl:if test="form/recurrence/byyearday/val[position()=2]">s</xsl:if> of the year 
    23162292              </xsl:if> 
     
    23182294              <xsl:if test="form/recurrence/byweekno"> 
    23192295                in the 
    2320                 <xsl:for-each select="form/recurrence/byweekno/val"> 
    2321                   <xsl:if test="position() != 1 and position() = last()"> and </xsl:if> 
    2322                   <xsl:value-of select="."/><xsl:choose> 
    2323                     <xsl:when test="substring(., string-length(.)-1, 2) = '11' or 
    2324                                     substring(., string-length(.)-1, 2) = '12' or 
    2325                                     substring(., string-length(.)-1, 2) = '13'">th</xsl:when> 
    2326                     <xsl:when test="substring(., string-length(.), 1) = '1'">st</xsl:when> 
    2327                     <xsl:when test="substring(., string-length(.), 1) = '2'">nd</xsl:when> 
    2328                     <xsl:when test="substring(., string-length(.), 1) = '3'">rd</xsl:when> 
    2329                     <xsl:otherwise>th</xsl:otherwise> 
    2330                   </xsl:choose> 
    2331                   <xsl:if test="position() != last()">, </xsl:if> 
    2332                 </xsl:for-each> 
     2296                <xsl:apply-templates select="form/recurrence/byweekno/val" mode="weekMonthYearNumbers"/> 
    23332297                week<xsl:if test="form/recurrence/byweekno/val[position()=2]">s</xsl:if> of the year 
    23342298              </xsl:if> 
     
    28512815  </xsl:template> 
    28522816 
     2817  <xsl:template match="val" mode="weekMonthYearNumbers"> 
     2818    <xsl:if test="position() != 1 and position() = last()"> and </xsl:if> 
     2819    <xsl:value-of select="."/><xsl:choose> 
     2820      <xsl:when test="substring(., string-length(.)-1, 2) = '11' or 
     2821                      substring(., string-length(.)-1, 2) = '12' or 
     2822                      substring(., string-length(.)-1, 2) = '13'">th</xsl:when> 
     2823      <xsl:when test="substring(., string-length(.), 1) = '1'">st</xsl:when> 
     2824      <xsl:when test="substring(., string-length(.), 1) = '2'">nd</xsl:when> 
     2825      <xsl:when test="substring(., string-length(.), 1) = '3'">rd</xsl:when> 
     2826      <xsl:otherwise>th</xsl:otherwise> 
     2827    </xsl:choose> 
     2828    <xsl:if test="position() != last()">, </xsl:if> 
     2829  </xsl:template> 
     2830 
    28532831  <xsl:template name="byDayChkBoxList"> 
    28542832    <xsl:param name="name"/>