From ee4ae42fc420e274dac25097fd813e0bcd077986 Mon Sep 17 00:00:00 2001 From: sb <sb> Date: Wed, 28 Jan 2009 12:10:02 +0000 Subject: [PATCH] A number of very minor fixes: (1) when generating constructors, generate a reverence for the StylesHelper, as it is used in views we generate. (2) when generating lists, don't layout columns whose contents are themselves lists. --- transforms/adl2controllerclasses.xslt | 9 +- transforms/adl2views.xslt | 171 +++++++++++++++----------- 2 files changed, 101 insertions(+), 79 deletions(-) diff --git a/transforms/adl2controllerclasses.xslt b/transforms/adl2controllerclasses.xslt index 568ac2b..84cfd88 100755 --- a/transforms/adl2controllerclasses.xslt +++ b/transforms/adl2controllerclasses.xslt @@ -9,8 +9,8 @@ Transform ADL into (partial) controller classes $Author: sb $ - $Revision: 1.22 $ - $Date: 2008-10-31 13:10:22 $ + $Revision: 1.23 $ + $Date: 2009-01-28 12:10:02 $ --> <!-- WARNING WARNING WARNING: Do NOT reformat this file! @@ -67,7 +67,7 @@ // // Automatically generated abstract super class for controllers for the // <xsl:value-of select="/adl:application/@name"/> application; generated using - // adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/> + // adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.23 $', 10)"/> // // <xsl:value-of select="/adl:application/@revision"/> // @@ -135,7 +135,7 @@ // // Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s // Automatically generated from application description using - // adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/> + // adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.23 $', 10)"/> // // This file is automatically generated; DO NOT EDIT IT. // @@ -180,6 +180,7 @@ Rescue("<xsl:value-of select="$rescue-name"/>"), </xsl:if> ControllerDetails("<xsl:value-of select="@name"/>", Area = "<xsl:value-of select="$area-name"/>"), + Helper(typeof(StylesHelper), "StylesHelper"), Helper(typeof(<xsl:value-of select="concat( @name, 'FieldHelper')"/>), "<xsl:value-of select="concat( @name, 'FieldHelper')"/>") ] public partial class <xsl:value-of select="concat( @name, 'Controller')"/> : <xsl:value-of select="concat( 'Abstract', /adl:application/@name, 'Controller')"/> { diff --git a/transforms/adl2views.xslt b/transforms/adl2views.xslt index f216418..7c42aef 100755 --- a/transforms/adl2views.xslt +++ b/transforms/adl2views.xslt @@ -13,8 +13,8 @@ Transform ADL into velocity view templates $Author: sb $ - $Revision: 1.16 $ - $Date: 2008-10-31 14:35:06 $ + $Revision: 1.17 $ + $Date: 2009-01-28 12:10:02 $ --> <!-- WARNING WARNING WARNING: Do NOT reformat this file! Whitespace (or lack of it) is significant! --> @@ -124,7 +124,7 @@ Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>, generated from ADL. - Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> + Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/> </xsl:comment> <xsl:call-template name="maybe-delete"> <xsl:with-param name="entity" select="."/> @@ -161,7 +161,7 @@ Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>, generated from ADL. - Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> + Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/> <xsl:value-of select="/adl:application/@revision"/> </xsl:comment> @@ -244,7 +244,7 @@ Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>, generated from ADL. - Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> + Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/> <xsl:value-of select="/adl:application/@revision"/> </xsl:comment> @@ -366,7 +366,7 @@ Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>, generated from ADL. - Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> + Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/> <xsl:value-of select="/adl:application/@revision"/> </xsl:comment> @@ -972,7 +972,7 @@ Auto generated Velocity list for <xsl:value-of select="@name"/>, generated from ADL. - Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> + Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/> </xsl:comment> #capturefor( title) @@ -1010,7 +1010,7 @@ Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>, generated from ADL. - Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/> + Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.17 $', 10)"/> </xsl:comment> <xsl:call-template name="install-scripts"/> </head> @@ -1093,14 +1093,21 @@ <table> <tr> <xsl:for-each select="$fields"> - <th> - <xsl:call-template name="showprompt"> - <xsl:with-param name="node" select="."/> - <xsl:with-param name="fallback" select="@property"/> - <xsl:with-param name="entity" select="$entity"/> - <xsl:with-param name="locale" select="$locale"/> - </xsl:call-template> - </th> + <xsl:choose> + <xsl:when test="@type='list'"> + <!-- suppress layout of columns which are themselves lists --> + </xsl:when> + <xsl:otherwise> + <th> + <xsl:call-template name="showprompt"> + <xsl:with-param name="node" select="."/> + <xsl:with-param name="fallback" select="@property"/> + <xsl:with-param name="entity" select="$entity"/> + <xsl:with-param name="locale" select="$locale"/> + </xsl:call-template> + </th> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> <xsl:for-each select="$entity/adl:form"> <th>-</th> @@ -1109,42 +1116,49 @@ <xsl:if test="$can-search = 'true'"> <tr class="search"> <xsl:for-each select="$fields"> - <td class="search"> - <xsl:variable name="pname" select="@property"/> - <xsl:variable name="property" select="$entity//adl:property[@name=$pname]"/> - <xsl:variable name="size"> - <xsl:choose> - <xsl:when test="$property/@type='string'"> + <xsl:choose> + <xsl:when test="@type='list'"> + <!-- suppress layout of columns which are themselves lists --> + </xsl:when> + <xsl:otherwise> + <td class="search"> + <xsl:variable name="pname" select="@property"/> + <xsl:variable name="property" select="$entity//adl:property[@name=$pname]"/> + <xsl:variable name="size"> <xsl:choose> - <xsl:when test="$property/@size > 20">20</xsl:when> - <xsl:otherwise> - <xsl:value-of select="$property/@size"/> - </xsl:otherwise> + <xsl:when test="$property/@type='string'"> + <xsl:choose> + <xsl:when test="$property/@size > 20">20</xsl:when> + <xsl:otherwise> + <xsl:value-of select="$property/@size"/> + </xsl:otherwise> + </xsl:choose> + </xsl:when> + <xsl:when test="$property/@type='integer'">8</xsl:when> + <xsl:when test="$property/@type='real'">8</xsl:when> + <xsl:when test="$property/@type='money'">8</xsl:when> + <!-- xsl:when test="$property/@type='message'">20</xsl:when doesn't work yet --> + <xsl:when test="$property/@type='text'">20</xsl:when> + <!-- xsl:when test="$property/@type='enity'">20</xsl:when doesn't work yet --> + <xsl:otherwise>0</xsl:otherwise> </xsl:choose> - </xsl:when> - <xsl:when test="$property/@type='integer'">8</xsl:when> - <xsl:when test="$property/@type='real'">8</xsl:when> - <xsl:when test="$property/@type='money'">8</xsl:when> - <!-- xsl:when test="$property/@type='message'">20</xsl:when doesn't work yet --> - <xsl:when test="$property/@type='text'">20</xsl:when> - <!-- xsl:when test="$property/@type='enity'">20</xsl:when doesn't work yet --> - <xsl:otherwise>0</xsl:otherwise> - </xsl:choose> - </xsl:variable> - <xsl:if test="$size != 0"> - <input> - <xsl:attribute name="name"> - <xsl:value-of select="concat('search_',$property/@name)"/> - </xsl:attribute> - <xsl:attribute name="size"> - <xsl:value-of select="$size"/> - </xsl:attribute> - <xsl:attribute name="value"> - <xsl:value-of select="concat( '$!search_', $property/@name)"/> - </xsl:attribute> - </input> - </xsl:if> - </td> + </xsl:variable> + <xsl:if test="$size != 0"> + <input> + <xsl:attribute name="name"> + <xsl:value-of select="concat('search_',$property/@name)"/> + </xsl:attribute> + <xsl:attribute name="size"> + <xsl:value-of select="$size"/> + </xsl:attribute> + <xsl:attribute name="value"> + <xsl:value-of select="concat( '$!search_', $property/@name)"/> + </xsl:attribute> + </input> + </xsl:if> + </td> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> </tr> </xsl:if> @@ -1158,31 +1172,38 @@ <xsl:for-each select="$fields"> <xsl:variable name="pname" select="@property"/> <xsl:variable name="property" select="$entity//adl:property[@name=$pname]"/> - <td> - <xsl:choose> - <xsl:when test="not( $property/@name)"> - <!-- shouldn't happen. There is definitely a bug here, because it does happen - but it shouldn't --> - </xsl:when> - <xsl:when test="$property/@type = 'date'"> - #if ( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) - <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>.ToString( 'd') - #end - </xsl:when> - <xsl:when test="$property/@type='message'"> - #if ( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) - $t.Msg( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) - #end - </xsl:when> - <xsl:when test="$property/@type='entity'"> - #if( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) - <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name, '.UserIdentifier')"/> - #end - </xsl:when> - <xsl:otherwise> - <xsl:value-of select="concat( '$!', $entity/@name, '.', $property/@name)"/> - </xsl:otherwise> - </xsl:choose> - </td> + <xsl:choose> + <xsl:when test="@type='list'"> + <!-- suppress layout of columns which are themselves lists --> + </xsl:when> + <xsl:otherwise> + <td> + <xsl:choose> + <xsl:when test="not( $property/@name)"> + <!-- shouldn't happen. There is definitely a bug here, because it does happen - but it shouldn't --> + </xsl:when> + <xsl:when test="$property/@type = 'date'"> + #if ( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) + <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>.ToString( 'd') + #end + </xsl:when> + <xsl:when test="$property/@type='message'"> + #if ( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) + $t.Msg( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) + #end + </xsl:when> + <xsl:when test="$property/@type='entity'"> + #if( <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name)"/>) + <xsl:value-of select="concat( '$', $entity/@name, '.', $property/@name, '.UserIdentifier')"/> + #end + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat( '$!', $entity/@name, '.', $property/@name)"/> + </xsl:otherwise> + </xsl:choose> + </td> + </xsl:otherwise> + </xsl:choose> </xsl:for-each> <xsl:variable name="keys"> <!-- assemble keys in a Velocity-friendly format, then splice it into