Now with working (but very slow) user-editable internationalised messages

This commit is contained in:
sb 2008-02-27 17:38:41 +00:00
parent f28dae3038
commit 0cac7bfba9
7 changed files with 300 additions and 170 deletions

View file

@ -13,7 +13,7 @@
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --> <!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- <!--
$Revision: 1.10 $ $Revision: 1.11 $
--> -->
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --> <!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
@ -96,8 +96,16 @@
--> -->
<!ENTITY % ComplexDataTypes "entity|link|list|defined" > <!ENTITY % ComplexDataTypes "entity|link|list|defined" >
<!--
data types which require special handling - which don't simply map onto
common SQL data types
geopos : a latitude/longitude pair (experimental and not yet implemented)
image : a raster image file, in jpeg|gif|png format (experimental, not yet implemented)
-->
<!ENTITY % SpecialDataTypes "geopos|image" >
<!-- all data types --> <!-- all data types -->
<!ENTITY % AllDataTypes "%ComplexDataTypes;|%SimpleDataTypes;" > <!ENTITY % AllDataTypes "%ComplexDataTypes;|%SimpleDataTypes;|%SpecialDataTypes;" >
<!-- content, for things like pages (i.e. forms, lists, pages) --> <!-- content, for things like pages (i.e. forms, lists, pages) -->
<!ENTITY % Content "head|top|foot" > <!ENTITY % Content "head|top|foot" >

View file

@ -9,8 +9,8 @@
Transform ADL into (partial) controller classes Transform ADL into (partial) controller classes
$Author: sb $ $Author: sb $
$Revision: 1.9 $ $Revision: 1.10 $
$Date: 2008-02-21 12:40:23 $ $Date: 2008-02-27 17:38:41 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -39,7 +39,6 @@
<!-- Whether to authenticate at application or at database layer. <!-- Whether to authenticate at application or at database layer.
If not 'Application', then 'Database'. --> If not 'Application', then 'Database'. -->
<xsl:param name="authentication-layer" select="Application"/> <xsl:param name="authentication-layer" select="Application"/>
<!-- <!--
The convention to use for naming auto-generated abstract primary keys. Known values are The convention to use for naming auto-generated abstract primary keys. Known values are
Id - the autogenerated primary key, if any, is called just 'Id' Id - the autogenerated primary key, if any, is called just 'Id'
@ -62,7 +61,7 @@
with the revision number of the generated file if the generated file is with the revision number of the generated file if the generated file is
stored to CVS --> stored to CVS -->
<xsl:variable name="transform-rev1" <xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.9 $', 11)"/> select="substring( '$Revision: 1.10 $', 11)"/>
<xsl:variable name="transform-revision" <xsl:variable name="transform-revision"
select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/> select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
@ -130,6 +129,7 @@ namespace <xsl:value-of select="$controllerns"/> {
/// ///
/// DO NOT EDIT THIS FILE! /// DO NOT EDIT THIS FILE!
/// &lt;/summary&gt; /// &lt;/summary&gt;
[ControllerDetails("<xsl:value-of select="@name"/>", Area = "auto")]
public partial class <xsl:value-of select="@name"/>Controller : BaseController { public partial class <xsl:value-of select="@name"/>Controller : BaseController {
<xsl:if test="adl:form"> <xsl:if test="adl:form">
@ -312,11 +312,13 @@ namespace <xsl:value-of select="$controllerns"/> {
{ {
/* the session may be polluted; create a new session */ /* the session may be polluted; create a new session */
NHibernateHelper.CloseSession(); NHibernateHelper.CloseSession();
hibernator = NHibernateHelper.GetCurrentSession(Session[ NHibernateHelper.USERTOKEN], hibernator = NHibernateHelper.GetCurrentSession(<xsl:if test="$authentication-layer = 'Database'">
Session[NHibernateHelper.PASSTOKEN]); Session[ NHibernateHelper.USERTOKEN],
} Session[NHibernateHelper.PASSTOKEN]
</xsl:if>);
<xsl:call-template name="menus"> }
<xsl:call-template name="menus">
<xsl:with-param name="entity" select="."/> <xsl:with-param name="entity" select="."/>
</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')"/>",
@ -422,8 +424,8 @@ namespace <xsl:value-of select="$controllerns"/> {
if ( Form[ "<xsl:value-of select="concat( 'instance.', @name)"/>" ] == null) if ( Form[ "<xsl:value-of select="concat( 'instance.', @name)"/>" ] == null)
{ {
AddError( <xsl:choose> AddError( <xsl:choose>
<xsl:when test="ifmissing[@locale=$locale]"> <xsl:when test="adl:ifmissing[@locale=$locale]">
<xsl:apply-templates select="ifmissing[@locale=$locale]"/> <xsl:apply-templates select="adl:ifmissing[@locale=$locale]"/>
</xsl:when> </xsl:when>
<xsl:otherwise>"You must supply a value for <xsl:value-of select="@name"/>"</xsl:otherwise> <xsl:otherwise>"You must supply a value for <xsl:value-of select="@name"/>"</xsl:otherwise>
</xsl:choose>); </xsl:choose>);
@ -455,13 +457,13 @@ namespace <xsl:value-of select="$controllerns"/> {
[AccessibleThrough(Verb.Post)] [AccessibleThrough(Verb.Post)]
public void <xsl:value-of select="concat( @name, 'SubmitHandler')"/>( ) public void <xsl:value-of select="concat( @name, 'SubmitHandler')"/>( )
{ {
string command = Form[ "command"]; string command = Form[ "command"];
if ( command == null) if ( command == null)
{ {
throw new Exception( "No command?"); throw new Exception( "No command?");
} }
else else
<xsl:for-each select=".//verb"> <xsl:for-each select=".//verb">
if ( command.Equals( "<xsl:value-of select="@verb"/>")) if ( command.Equals( "<xsl:value-of select="@verb"/>"))
{ {
@ -521,16 +523,26 @@ namespace <xsl:value-of select="$controllerns"/> {
/// &lt;summary&gt; /// &lt;summary&gt;
/// Show the form named <xsl:value-of select="@name"/>, containing the indicated record /// Show the form named <xsl:value-of select="@name"/>, containing the indicated record
/// &lt;/summary&gt; /// &lt;/summary&gt;
/// &lt;param name="<xsl:value-of select="concat( ../@name, 'Id')"/>"&gt;the key value of the record to show&lt;/param&gt; <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
/// &lt;param name="<xsl:value-of select="@name"/>"&gt;the key value of the record to show&lt;/param&gt;
</xsl:for-each>
[AccessibleThrough(Verb.Get)] [AccessibleThrough(Verb.Get)]
public void <xsl:value-of select="@name"/>( <xsl:value-of select="concat($keytype, ' ', ../@name, 'Id')"/>) public void <xsl:value-of select="@name"/>( <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
<xsl:call-template name="csharp-type">
<xsl:with-param name="property" select="."/>
</xsl:call-template>
<xsl:value-of select="concat( ' ', @name)"/>
<xsl:if test="not( position() = last())">,</xsl:if>
</xsl:for-each>)
{ {
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:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/> record = <xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/> record =
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>)) hibernator.CreateCriteria(typeof(<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>))
.Add(Expression.Eq("<xsl:value-of select="$key"/>", <xsl:value-of select="../@name"/>Id)) <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
.Add(Expression.Eq("<xsl:value-of select="@name"/>", <xsl:value-of select="@name"/>))
</xsl:for-each>
.UniqueResult&lt;<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>&gt;(); .UniqueResult&lt;<xsl:value-of select="concat($entityns, '.', ancestor::adl:entity/@name)"/>&gt;();
<xsl:if test="$authentication-layer = 'Database'"> <xsl:if test="$authentication-layer = 'Database'">

View file

@ -8,8 +8,8 @@
Transform ADL into entity classes Transform ADL into entity classes
$Author: sb $ $Author: sb $
$Revision: 1.6 $ $Revision: 1.7 $
$Date: 2008-02-20 12:09:53 $ $Date: 2008-02-27 17:38:41 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -51,7 +51,7 @@
stored to CVS --> stored to CVS -->
<xsl:variable name="transform-rev1" <xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.6 $', 11)"/> select="substring( '$Revision: 1.7 $', 11)"/>
<xsl:variable name="transform-revision" <xsl:variable name="transform-revision"
select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/> select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
@ -214,6 +214,9 @@
<xsl:when test="adl:property[@distinct='user']"> <xsl:when test="adl:property[@distinct='user']">
<xsl:for-each select="adl:property[@distinct='user']"> <xsl:for-each select="adl:property[@distinct='user']">
<xsl:choose> <xsl:choose>
<xsl:when test="@type='message'">
result.Append( <xsl:value-of select="concat( @name, '.LocalText')"/>);
</xsl:when>
<xsl:when test="@type='entity'"> <xsl:when test="@type='entity'">
<!-- TODO: this is dangerous and could potentially give rise to <!-- TODO: this is dangerous and could potentially give rise to
infinite loops; find a way of stopping it running away! --> infinite loops; find a way of stopping it running away! -->
@ -221,14 +224,14 @@
</xsl:when> </xsl:when>
<xsl:when test="@type='date'"> <xsl:when test="@type='date'">
<!-- if what we've got is just a date, we only want to see the date part of it --> <!-- if what we've got is just a date, we only want to see the date part of it -->
result.Append(<xsl:value-of select="concat( '_', @name)"/>.ToString( "d")); result.Append(<xsl:value-of select="@name"/>.ToString( "d"));
</xsl:when> </xsl:when>
<xsl:when test="@type='time'"> <xsl:when test="@type='time'">
<!-- if what we've got is just a time, we only want to see the time part of it --> <!-- if what we've got is just a time, we only want to see the time part of it -->
result.Append(<xsl:value-of select="concat( '_', @name)"/>.ToString( "t")); result.Append(<xsl:value-of select="@name"/>.ToString( "t"));
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
result.Append(<xsl:value-of select="concat( '_', @name)"/>); result.Append(<xsl:value-of select="@name"/>);
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:choose> <xsl:choose>
@ -312,6 +315,7 @@
<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... -->
<xsl:when test="@type='message'"/>
<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'"/>

View file

@ -12,7 +12,7 @@
Transform ADL to Hibernate Transform ADL to Hibernate
$Author: sb $ $Author: sb $
$Revision: 1.8 $ $Revision: 1.9 $
--> -->
<!-- <!--
@ -63,7 +63,7 @@
* THIS FILE IS AUTOMATICALLY GENERATED AND SHOULD NOT * THIS FILE IS AUTOMATICALLY GENERATED AND SHOULD NOT
* BE MANUALLY EDITED. * BE MANUALLY EDITED.
* *
* Generated using adl2hibernate.xslt revision <xsl:value-of select="substring('$Revision: 1.8 $', 12)"/> * Generated using adl2hibernate.xslt revision <xsl:value-of select="substring('$Revision: 1.9 $', 12)"/>
* *
*************************************************************************** ***************************************************************************
</xsl:comment> </xsl:comment>
@ -264,7 +264,18 @@
stored in the database --> stored in the database -->
</xsl:template> </xsl:template>
<xsl:template match="adl:property[@type='message']">
<many-to-one class="Message">
<xsl:attribute name="name">
<xsl:value-of select="@name"/>
</xsl:attribute>
<xsl:if test="@column">
<xsl:attribute name="column">
<xsl:value-of select="@column"/>
</xsl:attribute>
</xsl:if>
</many-to-one>
</xsl:template>
<xsl:template match="adl:property[@type='entity']"> <xsl:template match="adl:property[@type='entity']">
<!-- a property of type entity translates to a Hibernate many-to-one, <!-- a property of type entity translates to a Hibernate many-to-one,

View file

@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8" ?> <?xml version="1.0" encoding="UTF-8" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:stylesheet version="1.0"
xmlns="http://cygnets.co.uk/schemas/adl-1.2"
xmlns:adl="http://cygnets.co.uk/schemas/adl-1.2"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- <!--
Application Description Language framework Application Description Language framework
adl2views.xsl adl2views.xsl
@ -9,8 +12,8 @@
Transform ADL into velocity view templates Transform ADL into velocity view templates
$Author: sb $ $Author: sb $
$Revision: 1.4 $ $Revision: 1.5 $
$Date: 2008-02-21 12:40:23 $ $Date: 2008-02-27 17:38:41 $
--> -->
<!-- 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! -->
@ -24,6 +27,15 @@
TODO: we need to generate views for each available locale, but this is not TODO: we need to generate views for each available locale, but this is not
yet implemented. When it is we will almost certainly still need a 'default locale' --> yet implemented. When it is we will almost certainly still need a 'default locale' -->
<xsl:param name="locale" select="en-UK"/> <xsl:param name="locale" select="en-UK"/>
<!--
The convention to use for naming auto-generated abstract primary keys. Known values are
Id - the autogenerated primary key, if any, is called just 'Id'
Name - the autogenerated primary key has the same name as the entity
NameId - the name of the auto generated primary key is the name of the entity followed by 'Id'
Name_Id - the name of the auto generated primary key is the name of the entity followed by '_Id'
-->
<xsl:param name="abstract-key-name-convention" select="Id"/>
<!-- what's all this about? the objective is to get the revision number of the <!-- what's all this about? the objective is to get the revision number of the
transform into the output, /without/ getting that revision number overwritten transform into the output, /without/ getting that revision number overwritten
@ -31,26 +43,26 @@
stored to CVS --> stored to CVS -->
<xsl:variable name="transform-rev1" <xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.4 $', 11)"/> select="substring( '$Revision: 1.5 $', 11)"/>
<xsl:variable name="transform-revision" <xsl:variable name="transform-revision"
select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/> select="substring( $transform-rev1, 0, string-length( $transform-rev1) - 1)"/>
<xsl:template match="application"> <xsl:template match="adl:application">
<output> <output>
<xsl:apply-templates select="entity"/> <xsl:apply-templates select="adl:entity"/>
<!-- make sure extraneous junk doesn't get into the last file generated, <!-- make sure extraneous junk doesn't get into the last file generated,
by putting it into a separate file --> by putting it into a separate file -->
<xsl:comment> [ cut here: next file 'tail.txt' ] </xsl:comment> <xsl:comment> [ cut here: next file 'tail.txt' ] </xsl:comment>
</output> </output>
</xsl:template> </xsl:template>
<xsl:template match="entity[@foreign='true']"/> <xsl:template match="adl:entity[@foreign='true']"/>
<!-- Don't bother generating anything for foreign entities --> <!-- Don't bother generating anything for foreign entities -->
<xsl:template match="entity"> <xsl:template match="adl:entity">
<xsl:apply-templates select="form"/> <xsl:apply-templates select="adl:form"/>
<xsl:apply-templates select="list"/> <xsl:apply-templates select="adl:list"/>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<xsl:comment> [ cut here: next file '<xsl:value-of select="concat( @name, '/maybedelete.auto.vm')"/>' ] </xsl:comment> <xsl:comment> [ cut here: next file '<xsl:value-of select="concat( @name, '/maybedelete.auto.vm')"/>' ] </xsl:comment>
@ -115,10 +127,10 @@
<!-- layout of forms --> <!-- layout of forms -->
<xsl:template match="form"> <xsl:template match="adl:form">
<xsl:variable name="formname" select="@name"/> <xsl:variable name="formname" select="@name"/>
<xsl:variable name="aoran"> <xsl:variable name="aoran">
<xsl:variable name="initial" select="substring( ancestor::entity/@name, 1, 1)"/> <xsl:variable name="initial" select="substring( ancestor::adl:entity/@name, 1, 1)"/>
<xsl:choose> <xsl:choose>
<xsl:when test="$initial = 'A'">an</xsl:when> <xsl:when test="$initial = 'A'">an</xsl:when>
<xsl:when test="$initial = 'E'">an</xsl:when> <xsl:when test="$initial = 'E'">an</xsl:when>
@ -130,15 +142,15 @@
</xsl:variable> </xsl:variable>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<xsl:comment> [ cut here: next file '<xsl:value-of select="concat( ancestor::entity/@name, '/', @name)"/>.auto.vm' ] </xsl:comment> <xsl:comment> [ cut here: next file '<xsl:value-of select="concat( ancestor::adl:entity/@name, '/', @name)"/>.auto.vm' ] </xsl:comment>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<html> <html>
<xsl:comment> <xsl:comment>
#if ( $instance) #if ( $instance)
#set( $title = "<xsl:value-of select="concat( 'Edit ', ' ', ancestor::entity/@name)"/> $instance.UserIdentifier") #set( $title = "<xsl:value-of select="concat( 'Edit ', ' ', ancestor::adl:entity/@name)"/> $instance.UserIdentifier")
#else #else
#set( $title = "Add a new <xsl:value-of select="ancestor::entity/@name"/>") #set( $title = "Add a new <xsl:value-of select="ancestor::adl:entity/@name"/>")
#end #end
</xsl:comment> </xsl:comment>
<head> <head>
@ -146,7 +158,7 @@
<xsl:comment> <xsl:comment>
Application Description Language framework Application Description Language framework
Auto generated Velocity form for <xsl:value-of select="ancestor::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="$transform-revision"/> Generated using adl2views.xsl <xsl:value-of select="$transform-revision"/>
@ -158,7 +170,7 @@
${FormHelper.InstallScripts()} ${FormHelper.InstallScripts()}
${Validation.InstallScripts()} ${Validation.InstallScripts()}
${Scriptaculous.InstallScripts()} ${Scriptaculous.InstallScripts()}
${DateTime.InstallScripts()} ${DateTimeHelper.InstallScripts()}
${ScriptsHelper.InstallScript( "Sitewide")} ${ScriptsHelper.InstallScript( "Sitewide")}
${ScriptsHelper.InstallScript( "Behaviour")} ${ScriptsHelper.InstallScript( "Behaviour")}
@ -187,8 +199,8 @@
<xsl:for-each select="//definition"> <xsl:for-each select="//definition">
<xsl:variable name="errormsg"> <xsl:variable name="errormsg">
<xsl:choose> <xsl:choose>
<xsl:when test="help[@locale=$locale]"> <xsl:when test="adl:help[@locale=$locale]">
<xsl:apply-templates select="help[@locale=$locale]"/> <xsl:apply-templates select="adl:help[@locale=$locale]"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
Does not meet the format requirements for <xsl:value-of select="@name"/> Does not meet the format requirements for <xsl:value-of select="@name"/>
@ -220,7 +232,7 @@
<script type="text/javascript" language='JavaScript1.2' src="../script/panes.js"></script> <script type="text/javascript" language='JavaScript1.2' src="../script/panes.js"></script>
<style type="text/css"> <style type="text/css">
<xsl:for-each select="../property[@required='true']"> <xsl:for-each select="../adl:property[@required='true']">
#<xsl:value-of select="concat( 'advice-required-instance_', @name)"/> #<xsl:value-of select="concat( 'advice-required-instance_', @name)"/>
{ {
color: white; color: white;
@ -269,14 +281,14 @@
<xsl:value-of select="$formname"/> <xsl:value-of select="$formname"/>
</xsl:attribute> </xsl:attribute>
<xsl:choose> <xsl:choose>
<xsl:when test="ancestor::entity/@natural-key"> <xsl:when test="ancestor::adl:entity/@natural-key">
<xsl:variable name="keyfield" select="ancestor::entity/@natural-key"/> <xsl:variable name="keyfield" select="ancestor::adl:entity/@natural-key"/>
<xsl:choose> <xsl:choose>
<xsl:when test="@properties='all'"> <xsl:when test="@properties='all'">
<!-- no need to emit a hidden widget for the natural key, as there will be a <!-- no need to emit a hidden widget for the natural key, as there will be a
non-hidden one anyway --> non-hidden one anyway -->
</xsl:when> </xsl:when>
<xsl:when test="field[@name=$keyfield]"> <xsl:when test="adl:field[@name=$keyfield]">
<!-- no need to emit a hidden widget for the natural key, as there will be a <!-- no need to emit a hidden widget for the natural key, as there will be a
non-hidden one anyway --> non-hidden one anyway -->
</xsl:when> </xsl:when>
@ -289,12 +301,12 @@
<xsl:otherwise> <xsl:otherwise>
<!-- there isn't a natural primary key; create a hidden widget <!-- there isn't a natural primary key; create a hidden widget
for the abstract primary key --> for the abstract primary key -->
${FormHelper.HiddenField( "instance.<xsl:value-of select="ancestor::entity/@name"/>Id")} ${FormHelper.HiddenField( "instance.<xsl:value-of select="ancestor::adl:entity/@name"/>Id")}
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:if test="fieldgroup"> <xsl:if test="adl:fieldgroup">
<div id="tabbar"> <div id="tabbar">
<xsl:for-each select="fieldgroup"> <xsl:for-each select="adl:fieldgroup">
<span class="tab"> <span class="tab">
<xsl:attribute name="id"> <xsl:attribute name="id">
<xsl:value-of select="concat( @name, 'tab')"/> <xsl:value-of select="concat( @name, 'tab')"/>
@ -312,15 +324,15 @@
</xsl:for-each> </xsl:for-each>
</div> </div>
</xsl:if> </xsl:if>
<xsl:apply-templates select="fieldgroup"/> <xsl:apply-templates select="adl:fieldgroup"/>
<div class="pane"> <div class="pane">
<table> <table>
<xsl:choose> <xsl:choose>
<xsl:when test="@properties='listed'"> <xsl:when test="@properties='listed'">
<xsl:apply-templates select="field|auxlist|verb"/> <xsl:apply-templates select="adl:field|adl:auxlist|adl:verb"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:apply-templates select="ancestor::entity/property"/> <xsl:apply-templates select="ancestor::adl:entity/adl:property"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<tr class="actionSafe"> <tr class="actionSafe">
@ -357,7 +369,7 @@
</html> </html>
</xsl:template> </xsl:template>
<xsl:template match="fieldgroup"> <xsl:template match="adl:fieldgroup">
<div class="pane"> <div class="pane">
<xsl:attribute name="id"> <xsl:attribute name="id">
<xsl:value-of select="concat( @name, 'pane')"/> <xsl:value-of select="concat( @name, 'pane')"/>
@ -379,19 +391,19 @@
</h3> </h3>
</a> </a>
<table> <table>
<xsl:apply-templates select="field|verb|auxlist"/> <xsl:apply-templates select="adl:field|adl:verb|adl:auxlist"/>
</table> </table>
</div> </div>
</xsl:template> </xsl:template>
<xsl:template match="auxlist"> <xsl:template match="adl:auxlist">
<xsl:variable name="listprop" select="@property"/> <xsl:variable name="listprop" select="@property"/>
<xsl:variable name="farent" select="ancestor::entity/property[@name=$listprop]/@entity"/> <xsl:variable name="farent" select="ancestor::entity/property[@name=$listprop]/@entity"/>
<xsl:variable name="nearent" select="ancestor::entity/@name"/> <xsl:variable name="nearent" select="ancestor::entity/@name"/>
<xsl:variable name="farid"> <xsl:variable name="farid">
<xsl:choose> <xsl:choose>
<xsl:when test="//entity[@name=$farent]/@natural-key"> <xsl:when test="//adl:entity[@name=$farent]/@natural-key">
<xsl:value-of select="//entity[@name=$farent]/@natural-key"/> <xsl:value-of select="//adl:entity[@name=$farent]/@natural-key"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="concat( $farent, 'Id')"/> <xsl:value-of select="concat( $farent, 'Id')"/>
@ -399,12 +411,12 @@
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:variable name="farkey"> <xsl:variable name="farkey">
<xsl:value-of select="//entity[@name=$farent]/property[@entity=$nearent]/@name"/> <xsl:value-of select="//adl:entity[@name=$farent]/adl:property[@entity=$nearent]/@name"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="nearkey"> <xsl:variable name="nearkey">
<xsl:choose> <xsl:choose>
<xsl:when test="ancestor::entity[@natural-key]"> <xsl:when test="ancestor::adl:entity[@natural-key]">
<xsl:value-of select="ancestor::entity[@natural-key]"/> <xsl:value-of select="ancestor::adl:entity[@natural-key]"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="concat( $nearent, 'Id')"/> <xsl:value-of select="concat( $nearent, 'Id')"/>
@ -430,13 +442,13 @@
<xsl:choose> <xsl:choose>
<xsl:when test="@properties='listed'"> <xsl:when test="@properties='listed'">
<tr> <tr>
<xsl:for-each select="field"> <xsl:for-each select="adl:field">
<xsl:variable name="fieldprop" select="@property"/> <xsl:variable name="fieldprop" select="@property"/>
<th> <th>
<!-- Getting the prompt for the field from a property of another entity is a bit <!-- Getting the prompt for the field from a property of another entity is a bit
complex... --> complex... -->
<xsl:call-template name="showprompt"> <xsl:call-template name="showprompt">
<xsl:with-param name="node" select="//entity[@name=$farent]/property[@name=$fieldprop]"/> <xsl:with-param name="node" select="//adl:entity[@name=$farent]/adl:property[@name=$fieldprop]"/>
<xsl:with-param name="fallback" select="@property"/> <xsl:with-param name="fallback" select="@property"/>
</xsl:call-template> </xsl:call-template>
</th> </th>
@ -452,19 +464,19 @@
#set( $oddity = "odd") #set( $oddity = "odd")
#end #end
<tr class="$oddity"> <tr class="$oddity">
<xsl:for-each select="field"> <xsl:for-each select="adl:field">
<xsl:variable name="fieldprop" select="@property"/> <xsl:variable name="fieldprop" select="@property"/>
<td> <td>
<xsl:choose> <xsl:choose>
<xsl:when test="//entity[@name=$farent]/property[@name=$fieldprop]/@type='entity'"> <xsl:when test="//adl:entity[@name=$farent]/adl:property[@name=$fieldprop]/@type='entity'">
#if ( $item.<xsl:value-of select="@property"/>) #if ( $item.<xsl:value-of select="@property"/>)
$item.<xsl:value-of select="@property"/>.UserIdentifier $item.<xsl:value-of select="@property"/>.UserIdentifier
#end #end
</xsl:when> </xsl:when>
<xsl:when test="//entity[@name=$farent]/property[@name=$fieldprop]/option"> <xsl:when test="//adl:entity[@name=$farent]/adl:property[@name=$fieldprop]/adl:option">
<!-- if we can get a prompt value for the option, it would be better to <!-- if we can get a prompt value for the option, it would be better to
show it than the raw value--> show it than the raw value-->
<xsl:for-each select="//entity[@name=$farent]/property[@name=$fieldprop]/option"> <xsl:for-each select="//adl:entity[@name=$farent]/adl:property[@name=$fieldprop]/adl:option">
#if ( $item.<xsl:value-of select="$fieldprop"/> == '<xsl:value-of select="@value"/>') #if ( $item.<xsl:value-of select="$fieldprop"/> == '<xsl:value-of select="@value"/>')
<xsl:call-template name="showprompt"> <xsl:call-template name="showprompt">
<xsl:with-param name="fallback" select="@value"/> <xsl:with-param name="fallback" select="@value"/>
@ -493,11 +505,11 @@
<!-- properties not listed, so therefore presumably all. TODO: This won't work, rewrite. Need to <!-- properties not listed, so therefore presumably all. TODO: This won't work, rewrite. Need to
find the entity of the property this auxlist depends on, and then interrogate that --> find the entity of the property this auxlist depends on, and then interrogate that -->
<tr> <tr>
<xsl:for-each select="ancestor::entity/property[@distinct='user']"> <xsl:for-each select="ancestor::adl:entity/adl:property[@distinct='user']">
<th> <th>
<xsl:choose> <xsl:choose>
<xsl:when test="prompt[@locale=$locale]"> <xsl:when test="adl:prompt[@locale=$locale]">
<xsl:value-of select="prompt[@locale=$locale]/@prompt"/> <xsl:value-of select="adl:prompt[@locale=$locale]/@prompt"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="@name"/> <xsl:value-of select="@name"/>
@ -514,7 +526,7 @@
#set( $oddity = "odd") #set( $oddity = "odd")
#end #end
<tr class="$oddity"> <tr class="$oddity">
<xsl:for-each select="ancestor::entity/property[@distinct='user']"> <xsl:for-each select="ancestor::adl:entity/adl:property[@distinct='user']">
<td> <td>
$!instance.<xsl:value-of select="@name"/> $!instance.<xsl:value-of select="@name"/>
</td> </td>
@ -533,7 +545,7 @@
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<xsl:template match="verb"> <xsl:template match="adl:verb">
<xsl:variable name="class"> <xsl:variable name="class">
<xsl:choose> <xsl:choose>
<xsl:when test="@dangerous='true'">actionDangerous</xsl:when> <xsl:when test="@dangerous='true'">actionDangerous</xsl:when>
@ -546,7 +558,7 @@
<xsl:attribute name="class"> <xsl:attribute name="class">
<xsl:value-of select="$class"/> <xsl:value-of select="$class"/>
</xsl:attribute> </xsl:attribute>
<xsl:apply-templates select="help[@locale = $locale]"/> <xsl:apply-templates select="adl:help[@locale = $locale]"/>
</td> </td>
<td style="text-align:right"> <td style="text-align:right">
<xsl:attribute name="class"> <xsl:attribute name="class">
@ -564,14 +576,14 @@
</tr> </tr>
</xsl:template> </xsl:template>
<xsl:template match="field"> <xsl:template match="adl:field">
<xsl:variable name="propname"> <xsl:variable name="propname">
<xsl:value-of select="@property"/> <xsl:value-of select="@property"/>
</xsl:variable> </xsl:variable>
<xsl:choose> <xsl:choose>
<xsl:when test="ancestor::entity/property[@name=$propname]"> <xsl:when test="ancestor::adl:entity/adl:property[@name=$propname]">
<!-- there is a real property --> <!-- there is a real property -->
<xsl:apply-templates select="ancestor::entity/property[@name=$propname]"> <xsl:apply-templates select="ancestor::adl:entity/adl:property[@name=$propname]">
<xsl:with-param name="oddness"> <xsl:with-param name="oddness">
<xsl:choose> <xsl:choose>
<xsl:when test="position() mod 2 = 0">even</xsl:when> <xsl:when test="position() mod 2 = 0">even</xsl:when>
@ -586,8 +598,34 @@
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<xsl:template match="adl:property[@type='message']">
<!-- HIHGLY experimental - an internationalised message -->
<xsl:param name="oddness" select="odd"/>
<tr>
<xsl:attribute name="class">
<xsl:value-of select="$oddness"/>
</xsl:attribute>
<td class="label" title="To edit this text, select it">
${FormHelper.LabelFor( "instance.<xsl:value-of select="@name"/>", "<xsl:call-template name="showprompt">
<xsl:with-param name="fallback" select="@name"/>
</xsl:call-template>")}
</td>
<td class="widget" colspan="2">
<xsl:variable name="url">
$siteRoot/I18nMessage/edit.rails?Message_Id=<xsl:value-of select="concat( '$instance.', @name, '.MessageId')"/>
</xsl:variable>
<a target="_blank" class="i18nmessage">
<xsl:attribute name="href">
<xsl:value-of select="normalize-space( $url)"/>
</xsl:attribute>
<xsl:value-of select="concat( '$instance.', @name, '.LocalText')"/>
</a>
</td>
</tr>
</xsl:template>
<xsl:template match="property[@type='link']"> <xsl:template match="adl:property[@type='link']">
<!-- note! this template is only intended to match properties in the context of a form: <!-- note! this template is only intended to match properties in the context of a form:
it may be we need to add a mode to indicate this! --> it may be we need to add a mode to indicate this! -->
<!-- for links we implement a shuffle widget, which extends over both columns --> <!-- for links we implement a shuffle widget, which extends over both columns -->
@ -639,13 +677,13 @@
</xsl:choose> </xsl:choose>
</xsl:attribute> </xsl:attribute>
<td class="help" colspan="2"> <td class="help" colspan="2">
<xsl:apply-templates select="help[@locale = $locale]"/> <xsl:apply-templates select="adl:help[@locale = $locale]"/>
</td> </td>
</tr> </tr>
</xsl:template> </xsl:template>
<xsl:template match="property[@type='text']"> <xsl:template match="adl:property[@type='text']">
<!-- note! this template is only intended to match properties in the context of a form: <!-- note! this template is only intended to match properties in the context of a form:
it may be we need to add a mode to indicate this! --> it may be we need to add a mode to indicate this! -->
<!-- text box widgets, like shuffle widgets, extend over both columns --> <!-- text box widgets, like shuffle widgets, extend over both columns -->
@ -666,8 +704,8 @@
</xsl:attribute> </xsl:attribute>
<td class="label" rowspan="2"> <td class="label" rowspan="2">
${FormHelper.LabelFor( "instance.<xsl:value-of select="@name"/>", "<xsl:choose> ${FormHelper.LabelFor( "instance.<xsl:value-of select="@name"/>", "<xsl:choose>
<xsl:when test="prompt[@locale = $locale]"> <xsl:when test="adl:prompt[@locale = $locale]">
<xsl:apply-templates select="prompt[@locale = $locale]"/> <xsl:apply-templates select="adl:prompt[@locale = $locale]"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="@name"/> <xsl:value-of select="@name"/>
@ -686,12 +724,12 @@
</xsl:choose> </xsl:choose>
</xsl:attribute> </xsl:attribute>
<td class="help" colspan="2"> <td class="help" colspan="2">
<xsl:apply-templates select="help[@locale = $locale]"/> <xsl:apply-templates select="adl:help[@locale = $locale]"/>
</td> </td>
</tr> </tr>
</xsl:template> </xsl:template>
<xsl:template match="property"> <xsl:template match="adl:property">
<xsl:param name="oddness" select="odd"/> <xsl:param name="oddness" select="odd"/>
<!-- note! this template is only intended to match properties in the context of a form: <!-- note! this template is only intended to match properties in the context of a form:
it may be we need to add a mode to indicate this! --> it may be we need to add a mode to indicate this! -->
@ -704,8 +742,8 @@
important! --> important! -->
<xsl:variable name="if-missing"> <xsl:variable name="if-missing">
<xsl:choose> <xsl:choose>
<xsl:when test="if-missing[@locale = $locale]"> <xsl:when test="adl:if-missing[@locale = $locale]">
<xsl:value-of select="if-missing[@locale = $locale]"/> <xsl:value-of select="adl:if-missing[@locale = $locale]"/>
</xsl:when> </xsl:when>
<xsl:when test="@required='true'"> <xsl:when test="@required='true'">
You must provide a value for <xsl:value-of select="@name"/> You must provide a value for <xsl:value-of select="@name"/>
@ -727,11 +765,11 @@
Helper class? --> Helper class? -->
<xsl:variable name="permission"> <xsl:variable name="permission">
<xsl:choose> <xsl:choose>
<xsl:when test="permission"> <xsl:when test="adl:permission">
<xsl:value-of select="permission[position()=1]/@permission"/> <xsl:value-of select="adl:permission[position()=1]/@permission"/>
</xsl:when> </xsl:when>
<xsl:when test="../permission"> <xsl:when test="../adl:permission">
<xsl:value-of select="../permission[position()=1]/@permission"/> <xsl:value-of select="../adl:permission[position()=1]/@permission"/>
</xsl:when> </xsl:when>
<xsl:otherwise>none</xsl:otherwise> <xsl:otherwise>none</xsl:otherwise>
</xsl:choose> </xsl:choose>
@ -759,7 +797,7 @@
of UserIdentifiers of UserIdentifiers
--> -->
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="concat('$instance.', @name)"/> <xsl:value-of select="concat('$!instance.', @name)"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:when> </xsl:when>
@ -770,14 +808,14 @@
<xsl:when test="@type='entity'"> <xsl:when test="@type='entity'">
<!-- a menu of the appropriate entity --> <!-- a menu of the appropriate entity -->
#if ( $instance) #if ( $instance)
${FormHelper.Select( "instance.<xsl:value-of select="@name"/>", $instance.<xsl:value-of select="@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{firstoption='[unset]', firstoptionvalue='-1', text='UserIdentifier', value='<xsl:value-of select="concat( @entity, 'Id')"/>', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )} ${FormHelper.Select( "instance.<xsl:value-of select="@name"/>", $instance.<xsl:value-of select="@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{firstoption='[unset]', firstoptionvalue='-1', text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
#else #else
${FormHelper.Select( "instance.<xsl:value-of select="@name"/>", $<xsl:value-of select="@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{firstoption='[unset]', firstoptionvalue='-1', text='UserIdentifier', value='<xsl:value-of select="concat( @entity, 'Id')"/>', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )} ${FormHelper.Select( "instance.<xsl:value-of select="@name"/>", $<xsl:value-of select="@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{firstoption='[unset]', firstoptionvalue='-1', text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
#end #end
</xsl:when> </xsl:when>
<xsl:when test="@type='list'"> <xsl:when test="@type='list'">
<!-- a multi-select menu of the appropriate entity --> <!-- a multi-select menu of the appropriate entity -->
${FormHelper.Select( "instance.<xsl:value-of select="@name"/>", $instance.<xsl:value-of select="@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{multiple='multiple', size='8', text='UserIdentifier', value='<xsl:value-of select="concat( @entity, 'Id')"/>', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )} ${FormHelper.Select( "instance.<xsl:value-of select="@name"/>", $instance.<xsl:value-of select="@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{multiple='multiple', size='8', text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
</xsl:when> </xsl:when>
<xsl:when test="@type='defined'"> <xsl:when test="@type='defined'">
<!-- likely to be hardest of all... --> <!-- likely to be hardest of all... -->
@ -785,28 +823,28 @@
<xsl:value-of select="@definition"/> <xsl:value-of select="@definition"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="maximum"> <xsl:variable name="maximum">
<xsl:value-of select="/application/definition[@name=$definition]/@maximum"/> <xsl:value-of select="//adl:definition[@name=$definition]/@maximum"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="minimum"> <xsl:variable name="minimum">
<xsl:value-of select="/application/definition[@name=$definition]/@minimum"/> <xsl:value-of select="//adl:definition[@name=$definition]/@minimum"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="validationpattern"> <xsl:variable name="validationpattern">
<xsl:value-of select="/application/definition[@name=$definition]/@pattern"/> <xsl:value-of select="//adl:definition[@name=$definition]/@pattern"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="definedtype"> <xsl:variable name="definedtype">
<xsl:value-of select="/application/definition[@name=$definition]/@type"/> <xsl:value-of select="//adl:definition[@name=$definition]/@type"/>
</xsl:variable> </xsl:variable>
<xsl:variable name="definedsize"> <xsl:variable name="definedsize">
<xsl:value-of select="/application/definition[@name=$definition]/@size"/> <xsl:value-of select="//adl:definition[@name=$definition]/@size"/>
</xsl:variable> </xsl:variable>
<input type="text"> <input type="text">
<xsl:attribute name="class"> <xsl:attribute name="class">
<xsl:if test="@required='true'">required </xsl:if> <xsl:if test="@required='true'">required </xsl:if>
<xsl:choose> <xsl:choose>
<xsl:when test="/application/definition[@name=$definition]/@pattern"> <xsl:when test="//adl:definition[@name=$definition]/@pattern">
<xsl:value-of select="concat( 'validate-custom-', $definition)"/> <xsl:value-of select="concat( 'validate-custom-', $definition)"/>
</xsl:when> </xsl:when>
<xsl:when test="/application/definition[@name=$definition]/@minimum"> <xsl:when test="//adl:definition[@name=$definition]/@minimum">
<xsl:value-of select="concat( 'validate-custom-', $definition)"/> <xsl:value-of select="concat( 'validate-custom-', $definition)"/>
</xsl:when> </xsl:when>
<xsl:when test="$definedtype='integer'">validate-digits</xsl:when> <xsl:when test="$definedtype='integer'">validate-digits</xsl:when>
@ -886,13 +924,15 @@
<xsl:apply-templates select="option"/> <xsl:apply-templates select="option"/>
</select> </select>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
#set ( <xsl:value-of select="concat( '$', @name, '_sel_opt')"/>="<xsl:value-of select="concat( @name, '-$instance.', @name)"/>") // &lt;![CDATA[
#set ( <xsl:value-of select="concat( '$', @name, '_sel_opt')"/>="<xsl:value-of select="concat( @name, '-$instance.', @name)"/>")
option = document.getElementById( "<xsl:value-of select="concat( '$', @name, '_sel_opt')"/>"); option = document.getElementById( "<xsl:value-of select="concat( '$', @name, '_sel_opt')"/>");
if ( option != null) if ( option != null)
{ {
option.selected = true; option.selected = true;
} }
// ]]&gt;
</script> </script>
</xsl:when> </xsl:when>
<xsl:when test="@type='boolean'"> <xsl:when test="@type='boolean'">
@ -926,28 +966,28 @@
</xsl:choose> </xsl:choose>
</td> </td>
<td class="help"> <td class="help">
<xsl:apply-templates select="help[@locale = $locale]"/> <xsl:apply-templates select="adl:help[@locale = $locale]"/>
</td> </td>
</tr> </tr>
</xsl:template> </xsl:template>
<xsl:template match="prompt"> <xsl:template match="adl:prompt">
<xsl:value-of select="@prompt"/> <xsl:value-of select="@prompt"/>
</xsl:template> </xsl:template>
<xsl:template match="help"> <xsl:template match="adl:help">
<xsl:apply-templates/> <xsl:apply-templates/>
</xsl:template> </xsl:template>
<xsl:template match="option"> <xsl:template match="adl:option">
<option> <option>
<xsl:attribute name="id"><xsl:value-of select="../@name"/>-<xsl:value-of select="@value"/></xsl:attribute> <xsl:attribute name="id"><xsl:value-of select="../@name"/>-<xsl:value-of select="@value"/></xsl:attribute>
<xsl:attribute name="value"> <xsl:attribute name="value">
<xsl:value-of select="@value"/> <xsl:value-of select="@value"/>
</xsl:attribute> </xsl:attribute>
<xsl:choose> <xsl:choose>
<xsl:when test="prompt[@locale=$locale]"> <xsl:when test="adl:prompt[@locale=$locale]">
<xsl:value-of select="prompt[@locale=$locale]/@prompt"/> <xsl:value-of select="adl:prompt[@locale=$locale]/@prompt"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="@value"/> <xsl:value-of select="@value"/>
@ -958,7 +998,7 @@
<!-- layout of lists --> <!-- layout of lists -->
<xsl:template match="list"> <xsl:template match="adl:list">
<xsl:variable name="action" select="@onselect"/> <xsl:variable name="action" select="@onselect"/>
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
@ -985,7 +1025,7 @@
#set( $title = "<xsl:value-of select="normalize-space( concat( 'List ', $withpluralsuffix))"/>") #set( $title = "<xsl:value-of select="normalize-space( concat( 'List ', $withpluralsuffix))"/>")
<xsl:call-template name="head"/> <xsl:call-template name="head"/>
<xsl:comment> <xsl:comment>
Auto generated Velocity list for <xsl:value-of select="ancestor::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="$transform-revision"/> Generated using adl2listview.xsl <xsl:value-of select="$transform-revision"/>
@ -994,7 +1034,7 @@
${FormHelper.InstallScripts()} ${FormHelper.InstallScripts()}
${Validation.InstallScripts()} ${Validation.InstallScripts()}
${Scriptaculous.InstallScripts()} ${Scriptaculous.InstallScripts()}
${DateTime.InstallScripts()} ${DateTimeHelper.InstallScripts()}
${ScriptsHelper.InstallScript( "Behaviour")} ${ScriptsHelper.InstallScript( "Behaviour")}
${ScriptsHelper.InstallScript( "Sitewide")} ${ScriptsHelper.InstallScript( "Sitewide")}
@ -1027,7 +1067,7 @@
#if($instances.HasLast) $PaginationHelper.CreatePageLink( $instances.LastIndex, "&gt;&gt;" ) #end #if($instances.HasLast) $PaginationHelper.CreatePageLink( $instances.LastIndex, "&gt;&gt;" ) #end
#if(!$instances.HasLast) &gt;&gt; #end #if(!$instances.HasLast) &gt;&gt; #end
</span> </span>
<xsl:if test="../form"> <xsl:if test="../adl:form">
<span class="add"> <span class="add">
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
@ -1052,13 +1092,13 @@
<xsl:choose> <xsl:choose>
<xsl:when test="@properties='listed'"> <xsl:when test="@properties='listed'">
<tr> <tr>
<xsl:for-each select="field"> <xsl:for-each select="adl:field">
<th> <th>
<xsl:variable name="pname" select="@property"/> <xsl:variable name="pname" select="@property"/>
<xsl:variable name="property" select="ancestor::entity/property[@name=$pname]"/> <xsl:variable name="property" select="ancestor::adl:entity/adl:property[@name=$pname]"/>
<xsl:choose> <xsl:choose>
<xsl:when test="$property/prompt[@locale=$locale]"> <xsl:when test="$property/adl:prompt[@locale=$locale]">
<xsl:value-of select="$property/prompt[@locale=$locale]/@prompt"/> <xsl:value-of select="$property/adl:prompt[@locale=$locale]/@prompt"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="@property"/> <xsl:value-of select="@property"/>
@ -1066,7 +1106,9 @@
</xsl:choose> </xsl:choose>
</th> </th>
</xsl:for-each> </xsl:for-each>
<th>-</th> <xsl:for-each select="ancestor::adl:entity/adl:form">
<th>-</th>
</xsl:for-each>
</tr> </tr>
#foreach( $instance in $instances) #foreach( $instance in $instances)
#if ( $velocityCount % 2 == 0) #if ( $velocityCount % 2 == 0)
@ -1075,39 +1117,62 @@
#set( $oddity = "odd") #set( $oddity = "odd")
#end #end
<tr class="$oddity"> <tr class="$oddity">
<xsl:for-each select="field"> <xsl:for-each select="adl:field">
<td> <td>
<xsl:variable name="prop" select="@property"/> <xsl:variable name="prop" select="@property"/>
<xsl:choose> <xsl:choose>
<xsl:when test="ancestor::entity/property[@name=$prop]/@type = 'date'"> <xsl:when test="ancestor::adl:entity/adl:property[@name=$prop]/@type = 'date'">
#if ( $instance.<xsl:value-of select="@property"/>) #if ( $instance.<xsl:value-of select="@property"/>)
$instance.<xsl:value-of select="@property"/>.ToString( 'd') $instance.<xsl:value-of select="@property"/>.ToString( 'd')
#end #end
</xsl:when> </xsl:when>
<xsl:when test="ancestor::adl:entity/adl:property[@name=$prop]/@type='entity'">
#if( $instance.<xsl:value-of select="$prop"/>)
$instance.<xsl:value-of select="$prop"/>.UserIdentifier
#end
</xsl:when>
<xsl:otherwise> <xsl:otherwise>
$!instance.<xsl:value-of select="@property"/> $!instance.<xsl:value-of select="@name"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</td> </td>
</xsl:for-each> </xsl:for-each>
<td> <xsl:variable name="keys">
<a> <!-- assemble keys in a Velocity-friendly format, then splice it into
<xsl:attribute name="href"> the HREF below -->
<xsl:value-of select="concat( $action, '.rails?', ../@name, 'Id=$instance.', ../@name, 'Id')"/> <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
</xsl:attribute> <xsl:variable name="sep">
Edit! <xsl:choose>
</a> <xsl:when test="position()=1">?</xsl:when>
</td> <xsl:otherwise>&amp;</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:value-of select="concat( $sep, @name, '=$instance.', @name)"/>
</xsl:for-each>
</xsl:variable>
<xsl:for-each select="ancestor::adl:entity/adl:form">
<!-- by default create a link to each form declared for the entity.
We probably need a means of overriding this -->
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat( @name, '.rails', $keys)"/>
</xsl:attribute>
<xsl:value-of select="@name"/>!
</a>
</td>
</xsl:for-each>
</tr> </tr>
#end #end <!-- of iteration foreach( $instance in $instances) -->
</xsl:when> </xsl:when> <!-- close of @properties='listed ' -->
<xsl:otherwise> <xsl:otherwise>
<!-- properties are not 'listed' -->
<tr> <tr>
<xsl:for-each select="ancestor::entity/property[@distinct='user']"> <xsl:for-each select="ancestor::adl:entity/adl:property[@distinct='user']">
<th> <th>
<xsl:choose> <xsl:choose>
<xsl:when test="prompt[@locale=$locale]"> <xsl:when test="adl:prompt[@locale=$locale]">
<xsl:value-of select="prompt[@locale=$locale]/@prompt"/> <xsl:value-of select="adl:prompt[@locale=$locale]/@prompt"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="@name"/> <xsl:value-of select="@name"/>
@ -1115,7 +1180,9 @@
</xsl:choose> </xsl:choose>
</th> </th>
</xsl:for-each> </xsl:for-each>
<th>-</th> <xsl:for-each select="ancestor::adl:entity/adl:form">
<th>-</th>
</xsl:for-each>
</tr> </tr>
#foreach( $instance in $instances) #foreach( $instance in $instances)
#if ( $velocityCount % 2 == 0) #if ( $velocityCount % 2 == 0)
@ -1124,22 +1191,48 @@
#set( $oddity = "odd") #set( $oddity = "odd")
#end #end
<tr class="$oddity"> <tr class="$oddity">
<xsl:for-each select="ancestor::entity/property[@distinct='user']"> <xsl:for-each select="ancestor::adl:entity/adl:property[@distinct='user']">
<td> <td>
$!instance.<xsl:value-of select="@name"/> <xsl:choose>
<xsl:when test="@type='entity'">
#if( $instance.<xsl:value-of select="@name"/>)
$instance.<xsl:value-of select="@name"/>.UserIdentifier
#end
</xsl:when>
<xsl:otherwise>
$!instance.<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</td> </td>
</xsl:for-each> </xsl:for-each>
<td> <xsl:variable name="keys">
<a> <!-- assemble keys in a Velocity-friendly format, then splice it into
<xsl:attribute name="href"> the HREF below -->
<xsl:value-of select="concat( $action, '.rails?', ../@name, 'Id=$instance.', ../@name, 'Id')"/> <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
</xsl:attribute> <xsl:variable name="sep">
Edit! <xsl:choose>
</a> <xsl:when test="position()=1">?</xsl:when>
</td> <xsl:otherwise>&amp;</xsl:otherwise>
</tr> </xsl:choose>
#end </xsl:variable>
</xsl:otherwise> <xsl:value-of select="concat( $sep, @name, '=$instance.', @name)"/>
</xsl:for-each>
</xsl:variable>
<xsl:for-each select="ancestor::adl:entity/adl:form">
<!-- by default create a link to each form declared for the entity.
We probably need a means of overriding this -->
<td>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat( @name, '.rails?', $keys)"/>
</xsl:attribute>
<xsl:value-of select="@name"/>!
</a>
</td>
</xsl:for-each>
</tr>
#end
</xsl:otherwise>
</xsl:choose> </xsl:choose>
</table> </table>
</div> </div>
@ -1152,33 +1245,33 @@
<xsl:template name="head"> <xsl:template name="head">
<xsl:choose> <xsl:choose>
<xsl:when test="head"> <xsl:when test="adl:head">
<xsl:apply-templates select="head/*"/> <xsl:apply-templates select="adl:head/*"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:apply-templates select="/application/content/head/*"/> <xsl:apply-templates select="//adl:content/adl:head/*"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<xsl:template name="top"> <xsl:template name="top">
<xsl:choose> <xsl:choose>
<xsl:when test="top"> <xsl:when test="adl:top">
<xsl:apply-templates select="top/*"/> <xsl:apply-templates select="adl:top/*"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:apply-templates select="/application/content/top/*"/> <xsl:apply-templates select="//adl:content/adl:top/*"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
<xsl:template name="foot"> <xsl:template name="foot">
<xsl:choose> <xsl:choose>
<xsl:when test="foot"> <xsl:when test="adl:foot">
<xsl:apply-templates select="foot/*"/> <xsl:apply-templates select="adl:foot/*"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:apply-templates select="/application/content/foot/*"/> <xsl:apply-templates select="//adl:content/adl:foot/*"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
@ -1190,11 +1283,11 @@
<xsl:param name="fallback" select="Unknown"/> <xsl:param name="fallback" select="Unknown"/>
<xsl:param name="node" select="."/> <xsl:param name="node" select="."/>
<xsl:choose> <xsl:choose>
<xsl:when test="$node/prompt[@locale=$locale]"> <xsl:when test="$node/adl:prompt[@locale=$locale]">
<xsl:value-of select="$node/prompt[@locale=$locale][1]/@prompt"/> <xsl:value-of select="$node/adl:prompt[@locale=$locale][1]/@prompt"/>
</xsl:when> </xsl:when>
<xsl:when test="$node/prompt[@locale='default']"> <xsl:when test="$node/adl:prompt[@locale='default']">
<xsl:value-of select="$node/prompt[@locale='default'][1]/@prompt"/> <xsl:value-of select="$node/adl:prompt[@locale='default'][1]/@prompt"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="$fallback"/> <xsl:value-of select="$fallback"/>

View file

@ -10,8 +10,8 @@
one place for ease of maintenance one place for ease of maintenance
$Author: sb $ $Author: sb $
$Revision: 1.3 $ $Revision: 1.4 $
$Date: 2008-02-07 16:35:00 $ $Date: 2008-02-27 17:38:41 $
--> -->
<xsl:stylesheet version="1.0" <xsl:stylesheet version="1.0"
@ -32,6 +32,7 @@
<xsl:value-of select="/adl:application/adl:typedef[@name=$definition]/@type"/> <xsl:value-of select="/adl:application/adl:typedef[@name=$definition]/@type"/>
</xsl:when> </xsl:when>
<xsl:when test="$property/@type='serial'">integer</xsl:when> <xsl:when test="$property/@type='serial'">integer</xsl:when>
<xsl:when test="$property/@type='message'">integer</xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="$property/@type"/> <xsl:value-of select="$property/@type"/>
</xsl:otherwise> </xsl:otherwise>

View file

@ -10,8 +10,8 @@
one place for ease of maintenance one place for ease of maintenance
$Author: sb $ $Author: sb $
$Revision: 1.3 $ $Revision: 1.4 $
$Date: 2008-02-13 09:52:42 $ $Date: 2008-02-27 17:38:42 $
--> -->
<xsl:stylesheet version="1.0" <xsl:stylesheet version="1.0"
@ -62,6 +62,7 @@
</xsl:call-template> </xsl:call-template>
</xsl:variable> </xsl:variable>
<xsl:choose> <xsl:choose>
<xsl:when test="$property/@type = 'message'">Message</xsl:when>
<xsl:when test="$base-type = 'link'"> <xsl:when test="$base-type = 'link'">
ICollection&lt;<xsl:value-of select="@entity"/>&gt; ICollection&lt;<xsl:value-of select="@entity"/>&gt;
</xsl:when> </xsl:when>