More work on i18n and caching; also, work on the views generator.

This commit is contained in:
sb 2008-03-03 17:35:28 +00:00
parent 698c014b0d
commit 22567139f3
4 changed files with 73 additions and 29 deletions

View file

@ -13,13 +13,21 @@
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --> <!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- <!--
$Revision: 1.11 $ $Revision: 1.12 $
--> -->
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --> <!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- Before we start: some useful definitions --> <!-- Before we start: some useful definitions -->
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --> <!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- some basic character entities inherited from HTML. Actually we probably ought to
import all the HTML4 character entity files, and possibly the HTML4 Strict DTD (so
that we can allow HTML block level entities within content elements -->
<!ENTITY nbsp "&#160;">
<!ENTITY pound "&#163;">
<!ENTITY copy "&#169;">
<!-- boolean means true or false --> <!-- boolean means true or false -->
<!ENTITY % Boolean "(true|false)" > <!ENTITY % Boolean "(true|false)" >

View file

@ -9,8 +9,8 @@
Transform ADL into (partial) controller classes Transform ADL into (partial) controller classes
$Author: sb $ $Author: sb $
$Revision: 1.10 $ $Revision: 1.11 $
$Date: 2008-02-27 17:38:41 $ $Date: 2008-03-03 17:35:28 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -61,7 +61,7 @@
with the revision number of the generated file if the generated file is with the revision number of the generated file if the generated file is
stored to CVS --> stored to CVS -->
<xsl:variable name="transform-rev1" <xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.10 $', 11)"/> select="substring( '$Revision: 1.11 $', 11)"/>
<xsl:variable name="transform-revision" <xsl:variable name="transform-revision"
select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/> select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
@ -129,7 +129,8 @@ namespace <xsl:value-of select="$controllerns"/> {
/// ///
/// DO NOT EDIT THIS FILE! /// DO NOT EDIT THIS FILE!
/// &lt;/summary&gt; /// &lt;/summary&gt;
[ControllerDetails("<xsl:value-of select="@name"/>", Area = "auto")] [ Layout("empty"), Rescue("generalerror"),
ControllerDetails("<xsl:value-of select="@name"/>", Area = "auto")]
public partial class <xsl:value-of select="@name"/>Controller : BaseController { public partial class <xsl:value-of select="@name"/>Controller : BaseController {
<xsl:if test="adl:form"> <xsl:if test="adl:form">

View file

@ -8,8 +8,8 @@
Transform ADL into entity classes Transform ADL into entity classes
$Author: sb $ $Author: sb $
$Revision: 1.8 $ $Revision: 1.9 $
$Date: 2008-02-29 16:28:51 $ $Date: 2008-03-03 17:35:28 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -61,7 +61,7 @@
stored to CVS --> stored to CVS -->
<xsl:variable name="transform-rev1" <xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.8 $', 11)"/> select="substring( '$Revision: 1.9 $', 11)"/>
<xsl:variable name="transform-revision" <xsl:variable name="transform-revision"
select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/> select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
@ -242,23 +242,28 @@
<xsl:for-each select="adl:property[@distinct='user']"> <xsl:for-each select="adl:property[@distinct='user']">
<xsl:choose> <xsl:choose>
<xsl:when test="@type='message'"> <xsl:when test="@type='message'">
result.Append( <xsl:value-of select="concat( @name, '.LocalText')"/>); if ( <xsl:value-of select="@name"/> != null)
result.Append( <xsl:value-of select="concat( @name, '.LocalText')"/>);
</xsl:when> </xsl:when>
<xsl:when test="@type='entity'"> <xsl:when test="@type='entity'">
<!-- TODO: this is dangerous and could potentially give rise to <!-- TODO: this is dangerous and could potentially give rise to
infinite loops; find a way of stopping it running away! --> infinite loops; find a way of stopping it running away! -->
result.Append( <xsl:value-of select="concat( @name, '.UserIdentifier')"/>); if ( <xsl:value-of select="@name"/> != null)
result.Append( <xsl:value-of select="concat( @name, '.UserIdentifier')"/>);
</xsl:when> </xsl:when>
<xsl:when test="@type='date'"> <xsl:when test="@type='date'">
<!-- if what we've got is just a date, we only want to see the date part of it --> <!-- if what we've got is just a date, we only want to see the date part of it -->
result.Append(<xsl:value-of select="@name"/>.ToString( "d")); if ( <xsl:value-of select="@name"/> != null)
result.Append(<xsl:value-of select="@name"/>.ToString( "d"));
</xsl:when> </xsl:when>
<xsl:when test="@type='time'"> <xsl:when test="@type='time'">
<!-- if what we've got is just a time, we only want to see the time part of it --> <!-- if what we've got is just a time, we only want to see the time part of it -->
result.Append(<xsl:value-of select="@name"/>.ToString( "t")); if ( <xsl:value-of select="@name"/> != null)
result.Append(<xsl:value-of select="@name"/>.ToString( "t"));
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
result.Append(<xsl:value-of select="@name"/>); if ( <xsl:value-of select="@name"/> != null)
result.Append(<xsl:value-of select="@name"/>);
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:choose> <xsl:choose>

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" <xsl:stylesheet version="1.0"
xmlns="http://cygnets.co.uk/schemas/adl-1.2" xmlns="http://cygnets.co.uk/schemas/adl-1.2"
xmlns:adl="http://cygnets.co.uk/schemas/adl-1.2" xmlns:adl="http://cygnets.co.uk/schemas/adl-1.2"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
@ -12,8 +12,8 @@
Transform ADL into velocity view templates Transform ADL into velocity view templates
$Author: sb $ $Author: sb $
$Revision: 1.6 $ $Revision: 1.7 $
$Date: 2008-02-29 16:28:51 $ $Date: 2008-03-03 17:35:28 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
Whitespace (or lack of it) is significant! --> Whitespace (or lack of it) is significant! -->
@ -36,6 +36,8 @@
--> -->
<xsl:param name="abstract-key-name-convention" select="Id"/> <xsl:param name="abstract-key-name-convention" select="Id"/>
<xsl:param name="generate-site-navigation"/>
<!-- what's all this about? the objective is to get the revision number of the <!-- what's all this about? the objective is to get the revision number of the
transform into the output, /without/ getting that revision number overwritten transform into the output, /without/ getting that revision number overwritten
@ -43,7 +45,7 @@
stored to CVS --> stored to CVS -->
<xsl:variable name="transform-rev1" <xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.6 $', 11)"/> select="substring( '$Revision: 1.7 $', 11)"/>
<xsl:variable name="transform-revision" <xsl:variable name="transform-revision"
select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/> select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
@ -86,10 +88,9 @@
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<html> <html>
<xsl:comment>
#set( $title = "<xsl:value-of select="concat( 'Really delete ', @name)"/> $instance.UserIdentifier") #set( $title = "<xsl:value-of select="concat( 'Really delete ', @name)"/> $instance.UserIdentifier")
</xsl:comment>
<head> <head>
<title>$!title</title>
<xsl:call-template name="head"/> <xsl:call-template name="head"/>
<xsl:comment> <xsl:comment>
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>, Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
@ -171,6 +172,7 @@
#end #end
</xsl:comment> </xsl:comment>
<head> <head>
<title>$!title</title>
<xsl:call-template name="head"/> <xsl:call-template name="head"/>
<xsl:comment> <xsl:comment>
Application Description Language framework Application Description Language framework
@ -182,7 +184,6 @@
</xsl:comment> </xsl:comment>
${ScriptsHelper.InstallScript( "ShuffleWidget")} ${ScriptsHelper.InstallScript( "ShuffleWidget")}
${Ajax.InstallScripts()} ${Ajax.InstallScripts()}
${FormHelper.InstallScripts()} ${FormHelper.InstallScripts()}
${Validation.InstallScripts()} ${Validation.InstallScripts()}
@ -1048,6 +1049,7 @@
<html> <html>
<head> <head>
#set( $title = "<xsl:value-of select="normalize-space( concat( 'List ', $withpluralsuffix))"/>") #set( $title = "<xsl:value-of select="normalize-space( concat( 'List ', $withpluralsuffix))"/>")
<title>$!title</title>
<xsl:call-template name="head"/> <xsl:call-template name="head"/>
<xsl:comment> <xsl:comment>
Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>, Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>,
@ -1261,9 +1263,9 @@
</tr> </tr>
#end #end
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</table> </table>
</div> </div>
<xsl:call-template name="foot"/> <xsl:call-template name="foot"/>
</body> </body>
</html> </html>
@ -1271,13 +1273,19 @@
<!-- overall page layout --> <!-- overall page layout -->
<xsl:template match="adl:content"/>
<xsl:template name="head"> <xsl:template name="head">
<xsl:choose> <xsl:choose>
<xsl:when test="adl:head"> <xsl:when test="adl:head">
<xsl:apply-templates select="adl:head/*"/> <xsl:for-each select="adl:head/*">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:apply-templates select="//adl:content/adl:head/*"/> <xsl:for-each select="//adl:content/adl:head/*">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
@ -1285,21 +1293,43 @@
<xsl:template name="top"> <xsl:template name="top">
<xsl:choose> <xsl:choose>
<xsl:when test="adl:top"> <xsl:when test="adl:top">
<xsl:apply-templates select="adl:top/*"/> <xsl:for-each select="adl:top/*">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:apply-templates select="//adl:content/adl:top/*"/> <xsl:for-each select="//adl:content/adl:top/*">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:if test="$generate-site-navigation">
<ul class="generatednav">
<xsl:for-each select="//adl:entity[adl:list[@name='list']]">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '$siteRoot', '/auto/', @name, '/', adl:list[position()=1]/@name, '.rails')"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
</li>
</xsl:for-each>
</ul>
</xsl:if>
</xsl:template> </xsl:template>
<xsl:template name="foot"> <xsl:template name="foot">
<xsl:choose> <xsl:choose>
<xsl:when test="adl:foot"> <xsl:when test="adl:foot">
<xsl:apply-templates select="adl:foot/*"/> <xsl:for-each select="adl:foot/*">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:apply-templates select="//adl:content/adl:foot/*"/> <xsl:for-each select="//adl:content/adl:foot/*">
<xsl:copy-of select="."/>
</xsl:for-each>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>