Minor fix to the file upload code.

This commit is contained in:
simon 2010-07-21 21:27:31 +00:00
parent f64be419fe
commit b528b71c28

View file

@ -8,16 +8,16 @@
Transform ADL into C# entity classes Transform ADL into C# entity classes
$Author: simon $ $Author: simon $
$Revision: 1.29 $ $Revision: 1.30 $
$Date: 2010-07-20 19:53:40 $ $Date: 2010-07-21 21:27:31 $
--> -->
<!-- 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! -->
<xsl:stylesheet version="1.0" <xsl:stylesheet version="1.0"
xmlns:xsl="http://bowyer.journeyman.cc/adl/1.4/" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:exsl="http://exslt.org/common" xmlns:exsl="http://exslt.org/common"
xmlns:adl="http://bowyer.journeyman.cc/adl/1.4/" xmlns:adl="http://libs.cygnets.co.uk/adl/1.4/"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"> xmlns:msxsl="urn:schemas-microsoft-com:xslt">
<xsl:include href="csharp-type-include.xslt"/> <xsl:include href="csharp-type-include.xslt"/>
@ -70,7 +70,7 @@
// (c)2007 Cygnet Solutions Ltd // (c)2007 Cygnet Solutions Ltd
// //
// Automatically generated from application description using // Automatically generated from application description using
// adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.29 $', 10)"/> // adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.30 $', 10)"/>
// //
// <xsl:value-of select="/adl:application/@revision"/> // <xsl:value-of select="/adl:application/@revision"/>
// //
@ -97,7 +97,7 @@
/// &lt;/summary&gt; /// &lt;/summary&gt;
/// &lt;remarks&gt; /// &lt;remarks&gt;
/// Automatically generated from description of group <xsl:value-of select="@name"/> /// Automatically generated from description of group <xsl:value-of select="@name"/>
/// using adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.29 $', 10)"/>. /// using adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.30 $', 10)"/>.
/// ///
/// DO NOT EDIT THIS FILE! /// DO NOT EDIT THIS FILE!
/// &lt;/remarks&gt; /// &lt;/remarks&gt;
@ -123,7 +123,7 @@
// (c)2007 Cygnet Solutions Ltd // (c)2007 Cygnet Solutions Ltd
// //
// Automatically generated from application description using // Automatically generated from application description using
// adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.29 $', 10)"/> // adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.30 $', 10)"/>
// //
// <xsl:value-of select="/adl:application/@revision"/> // <xsl:value-of select="/adl:application/@revision"/>
// //
@ -159,7 +159,7 @@
/// &lt;/summary&gt; /// &lt;/summary&gt;
/// &lt;remarks&gt; /// &lt;remarks&gt;
/// Automatically generated from description of entity <xsl:value-of select="@name"/> /// Automatically generated from description of entity <xsl:value-of select="@name"/>
/// using adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.29 $', 10)"/>. /// using adl2entityclass.xsl revision <xsl:value-of select="substring( '$Revision: 1.30 $', 10)"/>.
/// Note that manually maintained parts of this class may be defined in /// Note that manually maintained parts of this class may be defined in
/// a separate file called <xsl:value-of select="@name"/>.manual.cs, q.v. /// a separate file called <xsl:value-of select="@name"/>.manual.cs, q.v.
/// ///
@ -446,6 +446,7 @@
</xsl:call-template> </xsl:call-template>
</xsl:variable> </xsl:variable>
<xsl:variable name="nullable-decoration"> <xsl:variable name="nullable-decoration">
<!-- TODO: this construct is used more than once and should be refactored into a named template -->
<xsl:choose> <xsl:choose>
<xsl:when test="@required='true'"/> <xsl:when test="@required='true'"/>
<!-- when required is 'true' null is not permitted anyway; otherwise... --> <!-- when required is 'true' null is not permitted anyway; otherwise... -->
@ -453,6 +454,7 @@
<xsl:when test="$base-type='entity'"/> <xsl:when test="$base-type='entity'"/>
<xsl:when test="$base-type='string'"/> <xsl:when test="$base-type='string'"/>
<xsl:when test="$base-type='text'"/> <xsl:when test="$base-type='text'"/>
<xsl:when test="$base-type='image'"/>
<!-- entities and strings are always nullable, don't need decoration --> <!-- entities and strings are always nullable, don't need decoration -->
<xsl:when test="$base-type='list'"/> <xsl:when test="$base-type='list'"/>
<xsl:when test="$base-type='link'"/> <xsl:when test="$base-type='link'"/>
@ -689,7 +691,14 @@
value = value.Substring( 0, <xsl:value-of select="@size"/>); value = value.Substring( 0, <xsl:value-of select="@size"/>);
} }
</xsl:if> </xsl:if>
<xsl:if test="@type = 'image' or @type = 'uploadable'">
if ( ! String.IsNullOrEmpty(value)) {
/* don't set uploadables to null - the 'file' html widget will return null
* when no new file is uploaded. This of course means you can't unset an
* upload once you've set one, but I don't see a workaround for this just now. */
</xsl:if>
<xsl:value-of select="concat( ' _', @name)"/> = value; <xsl:value-of select="concat( ' _', @name)"/> = value;
<xsl:if test="@type = 'image' or @type = 'uploadable'">}</xsl:if>
} }
} }
@ -835,6 +844,7 @@
<xsl:when test="$base-type='entity'"/> <xsl:when test="$base-type='entity'"/>
<xsl:when test="$base-type='string'"/> <xsl:when test="$base-type='string'"/>
<xsl:when test="$base-type='text'"/> <xsl:when test="$base-type='text'"/>
<xsl:when test="$base-type='image'"/>
<!-- entities and strings are always nullable, don't need decoration --> <!-- entities and strings are always nullable, don't need decoration -->
<xsl:when test="$base-type='list'"/> <xsl:when test="$base-type='list'"/>
<xsl:when test="$base-type='link'"/> <xsl:when test="$base-type='link'"/>