bug 1802 : adl2controllerclasses.xslt was generating collections for every menu a form might need, not for every menu the form did need. This had severe performance penalties. Sorted.
This commit is contained in:
parent
4efb909880
commit
7e8fcf62f5
|
@ -9,8 +9,8 @@
|
|||
Transform ADL into (partial) controller classes
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.21 $
|
||||
$Date: 2008-04-17 17:33:16 $
|
||||
$Revision: 1.22 $
|
||||
$Date: 2008-04-18 09:27:29 $
|
||||
-->
|
||||
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
|
@ -71,7 +71,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.21 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/>
|
||||
//
|
||||
// This file is automatically generated; DO NOT EDIT IT.
|
||||
//
|
||||
|
@ -128,7 +128,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
//
|
||||
// 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.21 $', 10)"/>
|
||||
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.22 $', 10)"/>
|
||||
//
|
||||
// This file is automatically generated; DO NOT EDIT IT.
|
||||
//
|
||||
|
@ -195,7 +195,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
|
||||
if ( record == null) {
|
||||
/* it seems to be new, create persistent object */
|
||||
AssertUserCanCreate()
|
||||
AssertUserCanCreate();
|
||||
try {
|
||||
record = new <xsl:value-of select="concat($entityns, '.', @name)"/>(<xsl:for-each select="adl:key/adl:property">
|
||||
<xsl:variable name="basetype">
|
||||
|
@ -405,8 +405,8 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
</xsl:if>);
|
||||
}
|
||||
|
||||
<xsl:call-template name="menus">
|
||||
<xsl:with-param name="entity" select="."/>
|
||||
<xsl:call-template name="formmenus">
|
||||
<xsl:with-param name="form" select="adl:form[position()=1]"/>
|
||||
</xsl:call-template>
|
||||
RenderViewWithFailover("<xsl:value-of select="concat( adl:form[position()=1]/@name, '.vm')"/>",
|
||||
"<xsl:value-of select="concat( adl:form[position()=1]/@name, '.auto.vm')"/>");
|
||||
|
@ -595,8 +595,8 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
ISession hibernator =
|
||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
||||
<xsl:call-template name="menus">
|
||||
<xsl:with-param name="entity" select="ancestor::adl:entity"/>
|
||||
<xsl:call-template name="formmenus">
|
||||
<xsl:with-param name="form" select="."/>
|
||||
</xsl:call-template>
|
||||
|
||||
<xsl:if test="$authentication-layer = 'Database'">
|
||||
|
@ -692,8 +692,8 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
</xsl:if>
|
||||
PropertyBag["instance"] = record;
|
||||
|
||||
<xsl:call-template name="menus">
|
||||
<xsl:with-param name="entity" select=".."/>
|
||||
<xsl:call-template name="formmenus">
|
||||
<xsl:with-param name="form" select="."/>
|
||||
</xsl:call-template>
|
||||
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>", "<xsl:value-of select="concat( @name, '.auto.vm')"/>");
|
||||
}
|
||||
|
@ -716,7 +716,46 @@ namespace <xsl:value-of select="$controllerns"/> {
|
|||
/* <xsl:apply-templates/> */
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="menus">
|
||||
<!-- produce all menus for a given form: harder, but more efficient -->
|
||||
<xsl:template name="formmenus">
|
||||
<xsl:param name="form"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$form/@properties = 'all'">
|
||||
<xsl:call-template name="entitymenus">
|
||||
<xsl:with-param name="entity" select="$form/ancestor::adl:entity"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:for-each select="$form//field">
|
||||
<xsl:variable name="propname" select="@property"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$form/ancestor::adl:entity/adl:property[@name=$propname and @type='entity']">
|
||||
/* produce a list of <xsl:value-of select="$form/ancestor::adl:entity/adl:property[@name=$propname]/@entity"/> to populate the select for <xsl:value-of select="@name"/> */
|
||||
<xsl:call-template name="menu">
|
||||
<xsl:with-param name="property" select="$form/ancestor::adl:entity/adl:property[@name=$propname]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$form/ancestor::adl:entity/adl:property[@name=$propname and @type='link']">
|
||||
/* produce a list of <xsl:value-of select="$form/ancestor::adl:entity/adl:property[@name=$propname]/@entity"/> to populate the LHS of the shuffle for <xsl:value-of select="@name"/> */
|
||||
<xsl:call-template name="menu">
|
||||
<xsl:with-param name="property" select="$form/ancestor::adl:entity/adl:property[@name=$propname]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:when test="$form/ancestor::adl:entity/adl:property[@name=$propname and @type='list']">
|
||||
/* produce a list of <xsl:value-of select="$form/ancestor::adl:entity/adl:property[@name=$propname]/@entity"/> to populate the multi-select for <xsl:value-of select="@name"/> */
|
||||
<xsl:call-template name="menu">
|
||||
<xsl:with-param name="property" select="$form/ancestor::adl:entity/adl:property[@name=$propname]"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:for-each>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- produce all menus for a given entity: easier, but less efficient -->
|
||||
<xsl:template name="entitymenus">
|
||||
<xsl:param name="entity"/>
|
||||
/* there's no way I can find of producing a set of just those entities
|
||||
* we'll need menus for. So we set up variables for all the menus we might
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
Transform ADL into velocity view templates
|
||||
|
||||
$Author: sb $
|
||||
$Revision: 1.13 $
|
||||
$Date: 2008-04-17 15:04:15 $
|
||||
$Revision: 1.14 $
|
||||
$Date: 2008-04-18 09:27:29 $
|
||||
-->
|
||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||
Whitespace (or lack of it) is significant! -->
|
||||
|
@ -93,7 +93,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.13 $', 10)"/>
|
||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.14 $', 10)"/>
|
||||
</xsl:comment>
|
||||
<xsl:call-template name="maybe-delete">
|
||||
<xsl:with-param name="entity" select="."/>
|
||||
|
@ -127,7 +127,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.13 $', 10)"/>
|
||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.14 $', 10)"/>
|
||||
</xsl:comment>
|
||||
<xsl:call-template name="install-scripts"/>
|
||||
</head>
|
||||
|
@ -213,7 +213,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.13 $', 10)"/>
|
||||
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.14 $', 10)"/>
|
||||
</xsl:comment>
|
||||
#capturefor( title)
|
||||
#if ( $instance)
|
||||
|
@ -334,7 +334,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.13 $', 10)"/>
|
||||
Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.14 $', 10)"/>
|
||||
</xsl:comment>
|
||||
<xsl:call-template name="install-scripts"/>
|
||||
<script type='text/javascript' language='JavaScript1.2'>
|
||||
|
@ -430,10 +430,8 @@
|
|||
</ul>
|
||||
#end
|
||||
#end
|
||||
#if ( $messages.Count == 0)
|
||||
<!-- if I try to test for $messages.Count > 0, I get the > copied straight through to
|
||||
the output instead of the entity value being substituted(?) -->
|
||||
#else
|
||||
#if( $messages)
|
||||
#if ( $messages.Count != 0)
|
||||
<div class="information">
|
||||
#foreach ( $message in $messages)
|
||||
<p>
|
||||
|
@ -442,6 +440,7 @@
|
|||
#end
|
||||
</div>
|
||||
#end
|
||||
#end
|
||||
<form method="post" onsubmit="invokeSubmitHandlers( this)">
|
||||
<xsl:attribute name="action">
|
||||
<xsl:value-of select="concat( $formname, 'SubmitHandler.rails')"/>
|
||||
|
@ -508,18 +507,22 @@
|
|||
<tr align="left" valign="top" class="actionDangerous">
|
||||
|
||||
<td class="actionDangerous" colspan="2">
|
||||
#if ( $instance)
|
||||
#if ( $instance.NoDeleteReason)
|
||||
[ $instance.NoDeleteReason ]
|
||||
#else
|
||||
To delete this record
|
||||
#end
|
||||
#end
|
||||
</td>
|
||||
<td class="actionDangerous" style="text-align:right">
|
||||
#if ( $instance)
|
||||
#if ( $instance.NoDeleteReason)
|
||||
<button type="submit" disabled="disabled" title="$instance.NoDeleteReason" name="command" value="delete">Delete this!</button>
|
||||
#else
|
||||
<button type="submit" name="command" value="delete">Delete this!</button>
|
||||
#end
|
||||
#end
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
@ -624,6 +627,7 @@
|
|||
-
|
||||
</th>
|
||||
</tr>
|
||||
#if ( $instance)
|
||||
#foreach( $item in $instance.<xsl:value-of select="@property"/>)
|
||||
#if ( $velocityCount % 2 == 0)
|
||||
#set( $oddity = "even")
|
||||
|
@ -666,7 +670,8 @@
|
|||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
#end
|
||||
#end <!-- foreach -->
|
||||
#end <!-- if ($instance) -->
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<!-- properties not listed, so therefore presumably all. -->
|
||||
|
@ -685,6 +690,7 @@
|
|||
</xsl:for-each>
|
||||
<th>-</th>
|
||||
</tr>
|
||||
#if ( $instance)
|
||||
#foreach( $item in $instance.<xsl:value-of select="@property"/>)
|
||||
#if ( $velocityCount % 2 == 0)
|
||||
#set( $oddity = "even")
|
||||
|
@ -727,7 +733,8 @@
|
|||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
#end
|
||||
#end <!-- foreach -->
|
||||
#end <!-- if ( $instance)-->
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
@ -800,8 +807,16 @@
|
|||
</td>
|
||||
<td class="widget" colspan="2">
|
||||
#if( $instance)
|
||||
<xsl:value-of select="concat( '$t.Msg( $instance.', @name, ')')"/>
|
||||
$FormHelper.HiddenField( "instance.<xsl:value-of select="@name"/>")
|
||||
#if( <xsl:value-of select="concat( '$t.Msg( $instance.', @name, ')')"/>)
|
||||
<xsl:value-of select="concat( '$t.Msg( $instance.', @name, ')')"/>
|
||||
$FormHelper.HiddenField( "instance.<xsl:value-of select="@name"/>")
|
||||
#else
|
||||
<input type="text">
|
||||
<xsl:attribute name="name">
|
||||
<xsl:value-of select="concat('i18n.instance.', @name)"/>
|
||||
</xsl:attribute>
|
||||
</input>
|
||||
#end
|
||||
#else
|
||||
<input type="text">
|
||||
<xsl:attribute name="name">
|
||||
|
@ -1308,7 +1323,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.13 $', 10)"/>
|
||||
Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.14 $', 10)"/>
|
||||
</xsl:comment>
|
||||
<xsl:call-template name="install-scripts"/>
|
||||
</head>
|
||||
|
|
Loading…
Reference in a new issue