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
|
Transform ADL into (partial) controller classes
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.21 $
|
$Revision: 1.22 $
|
||||||
$Date: 2008-04-17 17:33:16 $
|
$Date: 2008-04-18 09:27:29 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
<!-- 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
|
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||||
// Automatically generated from application description using
|
// 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.
|
// 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
|
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
|
||||||
// Automatically generated from application description using
|
// 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.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
|
@ -195,7 +195,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
|
|
||||||
if ( record == null) {
|
if ( record == null) {
|
||||||
/* it seems to be new, create persistent object */
|
/* it seems to be new, create persistent object */
|
||||||
AssertUserCanCreate()
|
AssertUserCanCreate();
|
||||||
try {
|
try {
|
||||||
record = new <xsl:value-of select="concat($entityns, '.', @name)"/>(<xsl:for-each select="adl:key/adl:property">
|
record = new <xsl:value-of select="concat($entityns, '.', @name)"/>(<xsl:for-each select="adl:key/adl:property">
|
||||||
<xsl:variable name="basetype">
|
<xsl:variable name="basetype">
|
||||||
|
@ -405,8 +405,8 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
</xsl:if>);
|
</xsl:if>);
|
||||||
}
|
}
|
||||||
|
|
||||||
<xsl:call-template name="menus">
|
<xsl:call-template name="formmenus">
|
||||||
<xsl:with-param name="entity" select="."/>
|
<xsl:with-param name="form" select="adl:form[position()=1]"/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
RenderViewWithFailover("<xsl:value-of select="concat( adl:form[position()=1]/@name, '.vm')"/>",
|
RenderViewWithFailover("<xsl:value-of select="concat( adl:form[position()=1]/@name, '.vm')"/>",
|
||||||
"<xsl:value-of select="concat( adl:form[position()=1]/@name, '.auto.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 =
|
ISession hibernator =
|
||||||
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
|
||||||
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
|
||||||
<xsl:call-template name="menus">
|
<xsl:call-template name="formmenus">
|
||||||
<xsl:with-param name="entity" select="ancestor::adl:entity"/>
|
<xsl:with-param name="form" select="."/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
|
|
||||||
<xsl:if test="$authentication-layer = 'Database'">
|
<xsl:if test="$authentication-layer = 'Database'">
|
||||||
|
@ -692,8 +692,8 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
PropertyBag["instance"] = record;
|
PropertyBag["instance"] = record;
|
||||||
|
|
||||||
<xsl:call-template name="menus">
|
<xsl:call-template name="formmenus">
|
||||||
<xsl:with-param name="entity" select=".."/>
|
<xsl:with-param name="form" select="."/>
|
||||||
</xsl:call-template>
|
</xsl:call-template>
|
||||||
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>", "<xsl:value-of select="concat( @name, '.auto.vm')"/>");
|
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:apply-templates/> */
|
||||||
</xsl:template>
|
</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"/>
|
<xsl:param name="entity"/>
|
||||||
/* there's no way I can find of producing a set of just those entities
|
/* 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
|
* 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
|
Transform ADL into velocity view templates
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.13 $
|
$Revision: 1.14 $
|
||||||
$Date: 2008-04-17 15:04:15 $
|
$Date: 2008-04-18 09:27:29 $
|
||||||
-->
|
-->
|
||||||
<!-- 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! -->
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
|
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
|
||||||
generated from ADL.
|
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:comment>
|
||||||
<xsl:call-template name="maybe-delete">
|
<xsl:call-template name="maybe-delete">
|
||||||
<xsl:with-param name="entity" select="."/>
|
<xsl:with-param name="entity" select="."/>
|
||||||
|
@ -127,7 +127,7 @@
|
||||||
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
|
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
|
||||||
generated from ADL.
|
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:comment>
|
||||||
<xsl:call-template name="install-scripts"/>
|
<xsl:call-template name="install-scripts"/>
|
||||||
</head>
|
</head>
|
||||||
|
@ -213,7 +213,7 @@
|
||||||
Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
||||||
generated from ADL.
|
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:comment>
|
||||||
#capturefor( title)
|
#capturefor( title)
|
||||||
#if ( $instance)
|
#if ( $instance)
|
||||||
|
@ -334,7 +334,7 @@
|
||||||
Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
|
||||||
generated from ADL.
|
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:comment>
|
||||||
<xsl:call-template name="install-scripts"/>
|
<xsl:call-template name="install-scripts"/>
|
||||||
<script type='text/javascript' language='JavaScript1.2'>
|
<script type='text/javascript' language='JavaScript1.2'>
|
||||||
|
@ -430,10 +430,8 @@
|
||||||
</ul>
|
</ul>
|
||||||
#end
|
#end
|
||||||
#end
|
#end
|
||||||
#if ( $messages.Count == 0)
|
#if( $messages)
|
||||||
<!-- if I try to test for $messages.Count > 0, I get the > copied straight through to
|
#if ( $messages.Count != 0)
|
||||||
the output instead of the entity value being substituted(?) -->
|
|
||||||
#else
|
|
||||||
<div class="information">
|
<div class="information">
|
||||||
#foreach ( $message in $messages)
|
#foreach ( $message in $messages)
|
||||||
<p>
|
<p>
|
||||||
|
@ -442,6 +440,7 @@
|
||||||
#end
|
#end
|
||||||
</div>
|
</div>
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
<form method="post" onsubmit="invokeSubmitHandlers( this)">
|
<form method="post" onsubmit="invokeSubmitHandlers( this)">
|
||||||
<xsl:attribute name="action">
|
<xsl:attribute name="action">
|
||||||
<xsl:value-of select="concat( $formname, 'SubmitHandler.rails')"/>
|
<xsl:value-of select="concat( $formname, 'SubmitHandler.rails')"/>
|
||||||
|
@ -508,18 +507,22 @@
|
||||||
<tr align="left" valign="top" class="actionDangerous">
|
<tr align="left" valign="top" class="actionDangerous">
|
||||||
|
|
||||||
<td class="actionDangerous" colspan="2">
|
<td class="actionDangerous" colspan="2">
|
||||||
|
#if ( $instance)
|
||||||
#if ( $instance.NoDeleteReason)
|
#if ( $instance.NoDeleteReason)
|
||||||
[ $instance.NoDeleteReason ]
|
[ $instance.NoDeleteReason ]
|
||||||
#else
|
#else
|
||||||
To delete this record
|
To delete this record
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
</td>
|
</td>
|
||||||
<td class="actionDangerous" style="text-align:right">
|
<td class="actionDangerous" style="text-align:right">
|
||||||
|
#if ( $instance)
|
||||||
#if ( $instance.NoDeleteReason)
|
#if ( $instance.NoDeleteReason)
|
||||||
<button type="submit" disabled="disabled" title="$instance.NoDeleteReason" name="command" value="delete">Delete this!</button>
|
<button type="submit" disabled="disabled" title="$instance.NoDeleteReason" name="command" value="delete">Delete this!</button>
|
||||||
#else
|
#else
|
||||||
<button type="submit" name="command" value="delete">Delete this!</button>
|
<button type="submit" name="command" value="delete">Delete this!</button>
|
||||||
#end
|
#end
|
||||||
|
#end
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
@ -624,6 +627,7 @@
|
||||||
-
|
-
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
#if ( $instance)
|
||||||
#foreach( $item in $instance.<xsl:value-of select="@property"/>)
|
#foreach( $item in $instance.<xsl:value-of select="@property"/>)
|
||||||
#if ( $velocityCount % 2 == 0)
|
#if ( $velocityCount % 2 == 0)
|
||||||
#set( $oddity = "even")
|
#set( $oddity = "even")
|
||||||
|
@ -666,7 +670,8 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
#end
|
#end <!-- foreach -->
|
||||||
|
#end <!-- if ($instance) -->
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<!-- properties not listed, so therefore presumably all. -->
|
<!-- properties not listed, so therefore presumably all. -->
|
||||||
|
@ -685,6 +690,7 @@
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<th>-</th>
|
<th>-</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
#if ( $instance)
|
||||||
#foreach( $item in $instance.<xsl:value-of select="@property"/>)
|
#foreach( $item in $instance.<xsl:value-of select="@property"/>)
|
||||||
#if ( $velocityCount % 2 == 0)
|
#if ( $velocityCount % 2 == 0)
|
||||||
#set( $oddity = "even")
|
#set( $oddity = "even")
|
||||||
|
@ -727,7 +733,8 @@
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
#end
|
#end <!-- foreach -->
|
||||||
|
#end <!-- if ( $instance)-->
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
@ -800,8 +807,16 @@
|
||||||
</td>
|
</td>
|
||||||
<td class="widget" colspan="2">
|
<td class="widget" colspan="2">
|
||||||
#if( $instance)
|
#if( $instance)
|
||||||
<xsl:value-of select="concat( '$t.Msg( $instance.', @name, ')')"/>
|
#if( <xsl:value-of select="concat( '$t.Msg( $instance.', @name, ')')"/>)
|
||||||
$FormHelper.HiddenField( "instance.<xsl:value-of select="@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
|
#else
|
||||||
<input type="text">
|
<input type="text">
|
||||||
<xsl:attribute name="name">
|
<xsl:attribute name="name">
|
||||||
|
@ -1308,7 +1323,7 @@
|
||||||
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"/>,
|
||||||
generated from ADL.
|
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:comment>
|
||||||
<xsl:call-template name="install-scripts"/>
|
<xsl:call-template name="install-scripts"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in a new issue