Almost completely working with Andrew's new SmartForm stuff.

This commit is contained in:
sb 2008-05-16 15:26:20 +00:00
parent 7673552477
commit 41f45eb3cd
3 changed files with 606 additions and 824 deletions

View file

@ -9,8 +9,8 @@
Transform ADL into (partial) controller classes
$Author: sb $
$Revision: 1.27 $
$Date: 2008-05-16 11:12:48 $
$Revision: 1.28 $
$Date: 2008-05-16 15:26:20 $
-->
<!-- 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.27 $', 10)"/>
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.28 $', 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.27 $', 10)"/>
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.28 $', 10)"/>
//
// This file is automatically generated; DO NOT EDIT IT.
//
@ -704,6 +704,10 @@ namespace <xsl:value-of select="$controllerns"/> {
{
AssertUserCanRead();
/* we don't actually instantiate this local variable; it exists to that
* TypedPropertyBag can do introspection to infer property types */
<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/> record = null;
ISession hibernator =
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
@ -715,7 +719,7 @@ namespace <xsl:value-of select="$controllerns"/> {
<xsl:call-template name="formmenus">
<xsl:with-param name="form" select="."/>
</xsl:call-template>
lastentry = "trailing-comma-avoidance" /* yes, it's a hack */
instance = record
};
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>",
@ -906,8 +910,8 @@ namespace <xsl:value-of select="$controllerns"/> {
<!-- produce all menus for a given form: harder, but more efficient -->
<xsl:template name="formmenus">
<!-- an entity assumed to be of type adl:form -->
<xsl:param name="form"/>
/* set up menus for the form, if required */
<xsl:choose>
<xsl:when test="$form/@properties = 'all'">
<xsl:call-template name="entitymenus">

File diff suppressed because it is too large Load diff

View file

@ -10,8 +10,8 @@
one place for ease of maintenance
$Author: sb $
$Revision: 1.4 $
$Date: 2008-02-27 17:38:41 $
$Revision: 1.5 $
$Date: 2008-05-16 15:26:20 $
-->
<xsl:stylesheet version="1.0"
@ -21,38 +21,55 @@
exclude-result-prefixes="adl">
<!-- return the base ADL type of the property which is passed as a parameter -->
<xsl:template name="base-type">
<xsl:param name="property"/>
<xsl:choose>
<xsl:when test="$property/@type='defined'">
<xsl:variable name="definition">
<xsl:value-of select="$property/@typedef"/>
</xsl:variable>
<xsl:value-of select="/adl:application/adl:typedef[@name=$definition]/@type"/>
</xsl:when>
<xsl:when test="$property/@type='serial'">integer</xsl:when>
<xsl:when test="$property/@type='message'">integer</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$property/@type"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- return the base ADL type of the property which is passed as a parameter -->
<xsl:template name="base-type">
<xsl:param name="property"/>
<xsl:choose>
<xsl:when test="$property/@type='defined'">
<xsl:variable name="definition">
<xsl:value-of select="$property/@typedef"/>
</xsl:variable>
<xsl:value-of select="/adl:application/adl:typedef[@name=$definition]/@type"/>
</xsl:when>
<xsl:when test="$property/@type='serial'">integer</xsl:when>
<xsl:when test="$property/@type='message'">integer</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$property/@type"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- return the size of the type of the property which is passed as a parameter -->
<xsl:template name="base-size">
<xsl:param name="property"/>
<xsl:choose>
<xsl:when test="$property/@type='defined'">
<xsl:variable name="definition">
<xsl:value-of select="$property/@typedef"/>
</xsl:variable>
<xsl:value-of select="/adl:application/adl:typedef[@name=$definition]/@size"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$property/@size"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- return the size of the type of the property which is passed as a parameter -->
<xsl:template name="base-size">
<xsl:param name="property"/>
<xsl:variable name="base-type">
<xsl:call-template name="base-type">
<xsl:with-param name="property" select="$property"/>
</xsl:call-template>
</xsl:variable>
<xsl:choose>
<xsl:when test="$property/@type='defined'">
<xsl:variable name="definition">
<xsl:value-of select="$property/@typedef"/>
</xsl:variable>
<xsl:value-of select="/adl:application/adl:typedef[@name=$definition]/@size"/>
</xsl:when>
<!-- type='text' should really be unlimited, but in the real world it isn't.
Furthermore, setting null values may currently break the smart form components
parser -->
<xsl:when test="$base-type='text'">4294967296</xsl:when>
<xsl:when test="$base-type='integer'">8</xsl:when>
<xsl:when test="$base-type='real'">8</xsl:when>
<xsl:when test="$base-type='money'">10</xsl:when>
<xsl:when test="$base-type='date'">10</xsl:when>
<xsl:when test="$base-type='time'">8</xsl:when>
<xsl:when test="$property/@size &gt; 0">
<xsl:value-of select="$property/@size"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$base-type"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>