Considerable progress on adjunct editing suite, but some lacunae remain.

This commit is contained in:
sb 2008-03-04 17:30:52 +00:00
parent 22567139f3
commit e423b325a4
4 changed files with 177 additions and 92 deletions

View file

@ -13,7 +13,7 @@
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --> <!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
<!-- <!--
$Revision: 1.12 $ $Revision: 1.13 $
--> -->
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: --> <!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
@ -109,8 +109,9 @@ that we can allow HTML block level entities within content elements -->
common SQL data types common SQL data types
geopos : a latitude/longitude pair (experimental and not yet implemented) geopos : a latitude/longitude pair (experimental and not yet implemented)
image : a raster image file, in jpeg|gif|png format (experimental, not yet implemented) image : a raster image file, in jpeg|gif|png format (experimental, not yet implemented)
message : an internationalised message, having different translations for different locales
--> -->
<!ENTITY % SpecialDataTypes "geopos|image" > <!ENTITY % SpecialDataTypes "geopos|image|message" >
<!-- all data types --> <!-- all data types -->
<!ENTITY % AllDataTypes "%ComplexDataTypes;|%SimpleDataTypes;|%SpecialDataTypes;" > <!ENTITY % AllDataTypes "%ComplexDataTypes;|%SimpleDataTypes;|%SpecialDataTypes;" >
@ -567,7 +568,7 @@ property[@type='entity']. TODO: Not complete, not yet strictly convinced it's th
to this list to this list
--> -->
<!ELEMENT auxlist (documentation?, (prompt|%FieldStuff;)*)> <!ELEMENT auxlist (documentation?, (prompt|%FieldStuff;)*)>
<!ATTLIST auxlist <!ATTLIST auxlist %PageAttrs;
property CDATA #REQUIRED property CDATA #REQUIRED
onselect CDATA #IMPLIED onselect CDATA #IMPLIED
canadd %Boolean; #IMPLIED> canadd %Boolean; #IMPLIED>

View file

@ -9,8 +9,8 @@
Transform ADL into (partial) controller classes Transform ADL into (partial) controller classes
$Author: sb $ $Author: sb $
$Revision: 1.11 $ $Revision: 1.12 $
$Date: 2008-03-03 17:35:28 $ $Date: 2008-03-04 17:30:52 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -61,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.11 $', 11)"/> select="substring( '$Revision: 1.12 $', 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)"/>
@ -520,6 +520,62 @@ namespace <xsl:value-of select="$controllerns"/> {
RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>", RenderViewWithFailover("<xsl:value-of select="concat( @name, '.vm')"/>",
"<xsl:value-of select="concat( @name, '.auto.vm')"/>"); "<xsl:value-of select="concat( @name, '.auto.vm')"/>");
} }
<xsl:if test="ancestor::adl:entity/adl:key/adl:property[@type='entity']">
<!-- if there's a key which is an entity, the actual entity can't be passed in.
So what will be passed in is the key value, from which we can find the entity -->
/// &lt;summary&gt;
/// Show the form named <xsl:value-of select="@name"/>, containing the indicated record. As
/// the primary key of the record is itself an entity, we need to first fetch that entity
/// &lt;/summary&gt;
<xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
<xsl:choose>
<xsl:when test="@type='entity'">
/// &lt;param name="<xsl:value-of select="concat( @name, '_Value')"/>"&gt;the key value of the key value of the record to show&lt;/param&gt;
</xsl:when>
<xsl:otherwise>
/// &lt;param name="<xsl:value-of select="@name"/>"&gt;the key value of the record to show&lt;/param&gt;
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
[AccessibleThrough(Verb.Get)]
public void <xsl:value-of select="@name"/>( <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
<xsl:choose>
<xsl:when test="@type='entity'">
<xsl:call-template name="csharp-base-type">
<xsl:with-param name="property" select="."/>
</xsl:call-template>
<xsl:value-of select="concat( ' ', @name, '_Value')"/>
</xsl:when>
<xsl:otherwise>
<xsl:call-template name="csharp-base-type">
<xsl:with-param name="property" select="."/>
</xsl:call-template>
<xsl:value-of select="concat( ' ', @name)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not( position() = last())">,</xsl:if>
</xsl:for-each>) {
ISession hibernator =
NHibernateHelper.GetCurrentSession( <xsl:if test="$authentication-layer = 'Database'">Session[ NHibernateHelper.USERTOKEN],
Session[NHibernateHelper.PASSTOKEN]</xsl:if>);
this.<xsl:value-of select="@name"/>( <xsl:for-each select="ancestor::adl:entity/adl:key/adl:property">
<xsl:choose>
<xsl:when test="@type='entity'">
<xsl:variable name="entity" select="@entity"/>
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat($entityns, '.', @entity)"/>))
.Add( Expression.Eq( "<xsl:value-of select="//adl:entity[@name=$entity]/adl:key/adl:property[position()=1]/@name"/>", <xsl:value-of select="concat( @name, '_Value')"/>))
.UniqueResult&lt;<xsl:value-of select="concat($entityns, '.', @entity)"/>&gt;()
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat( ' ', @name)"/>
</xsl:otherwise>
</xsl:choose>
<xsl:if test="not( position() = last())">,</xsl:if>
</xsl:for-each>);
}
</xsl:if>
/// &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
@ -599,6 +655,10 @@ namespace <xsl:value-of select="$controllerns"/> {
</xsl:template> </xsl:template>
<xsl:template match="adl:key">
<!-- the key shouldn't be matched directly - at least, not in this implementation -->
</xsl:template>
<xsl:template name="menu"> <xsl:template name="menu">
<xsl:param name="property"/> <xsl:param name="property"/>
<xsl:variable name="ename" select="$property/@entity"/> <xsl:variable name="ename" select="$property/@entity"/>

View file

@ -12,7 +12,7 @@
Convert ADL to MS-SQL Convert ADL to MS-SQL
$Author: sb $ $Author: sb $
$Revision: 1.10 $ $Revision: 1.11 $
--> -->
<xsl:output indent="no" encoding="UTF-8" method="text"/> <xsl:output indent="no" encoding="UTF-8" method="text"/>
@ -34,7 +34,7 @@
-- Application Description Language framework -- Application Description Language framework
-- --
-- Database for application <xsl:value-of select="@name"/> version <xsl:value-of select="@version"/> -- Database for application <xsl:value-of select="@name"/> version <xsl:value-of select="@version"/>
-- Generated for MS-SQL 2000+ using adl2mssql.xslt <xsl:value-of select="substring('$Revision: 1.10 $', 12)"/> -- Generated for MS-SQL 2000+ using adl2mssql.xslt <xsl:value-of select="substring('$Revision: 1.11 $', 12)"/>
-- --
-- Code generator (c) 2007 Cygnet Solutions Ltd -- Code generator (c) 2007 Cygnet Solutions Ltd
-- --
@ -181,7 +181,7 @@
------------------------------------------------------------------------------------------------- -------------------------------------------------------------------------------------------------
CREATE TABLE "<xsl:value-of select="$table"/>" CREATE TABLE "<xsl:value-of select="$table"/>"
( (
<xsl:for-each select="descendant::adl:property[@type!='link' and @type != 'list']"> <xsl:for-each select="descendant::adl:property[not( @type='link' or @type = 'list' or @concrete='false')]">
<xsl:apply-templates select="."/> <xsl:apply-templates select="."/>
<xsl:if test="position() != last()">,</xsl:if> <xsl:if test="position() != last()">,</xsl:if>
</xsl:for-each> </xsl:for-each>
@ -200,9 +200,9 @@
</xsl:template> </xsl:template>
<xsl:template match="adl:key"> <xsl:template match="adl:key">
<xsl:if test="adl:property"> <xsl:if test="adl:property[not( @concrete='false')]">
, ,
PRIMARY KEY( <xsl:for-each select="adl:property">"<xsl:call-template name="property-column-name"> PRIMARY KEY( <xsl:for-each select="adl:property[not( @concrete='false')]">"<xsl:call-template name="property-column-name">
<xsl:with-param name="property" select="."/> <xsl:with-param name="property" select="."/>
</xsl:call-template>"<xsl:if test="position() != last()">, </xsl:if></xsl:for-each>) </xsl:call-template>"<xsl:if test="position() != last()">, </xsl:if></xsl:for-each>)
</xsl:if> </xsl:if>
@ -455,7 +455,7 @@
<xsl:if test="myresponsibility='true'"> <xsl:if test="myresponsibility='true'">
</xsl:if> </xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="adl:property[@type='list']"> <xsl:template match="adl:property[@type='list']">
-- Suppressing output of property <xsl:value-of select="@name"/>, -- Suppressing output of property <xsl:value-of select="@name"/>,
-- as it is the 'one' end of a one-to-many relationship -- as it is the 'one' end of a one-to-many relationship

View file

@ -12,8 +12,8 @@
Transform ADL into velocity view templates Transform ADL into velocity view templates
$Author: sb $ $Author: sb $
$Revision: 1.7 $ $Revision: 1.8 $
$Date: 2008-03-03 17:35:28 $ $Date: 2008-03-04 17:30:52 $
--> -->
<!-- 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! -->
@ -27,17 +27,16 @@
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 <!-- whether or not to auto-generate site navigation - by default, don't -->
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"/>
<xsl:param name="generate-site-navigation"/> <xsl:param name="generate-site-navigation"/>
<!-- the current state of play is that we can only generate views with permissions for one group.
TODO: this isn't how it's supposed to be. It's supposed to be that at service time the system
checks which groups the current user is member of, and renders each widget with the most relaxed
permissions applicable to that user - but we don't yet have the parts in place to do that.
This variable selects which group's permissions should be used when generating widgets -->
<xsl:param name="permissions-group" select="public"/>
<!-- 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
@ -45,7 +44,7 @@
stored to CVS --> stored to CVS -->
<xsl:variable name="transform-rev1" <xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.7 $', 11)"/> select="substring( '$Revision: 1.8 $', 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)"/>
@ -65,18 +64,10 @@
<xsl:template match="adl:entity"> <xsl:template match="adl:entity">
<xsl:variable name="keyfield"> <xsl:variable name="keyfield">
<xsl:choose> <xsl:choose>
<xsl:when test="$abstract-key-name-convention='Name'"> <xsl:when test="adl:key/adl:property">
<xsl:value-of select="@name"/> <xsl:value-of select="adl:key/adl:property[position()=1]/@name"/>
</xsl:when> </xsl:when>
<xsl:when test="$abstract-key-name-convention = 'NameId'"> <xsl:otherwise>[none]</xsl:otherwise>
<xsl:value-of select="concat( @name, 'Id')"/>
</xsl:when>
<xsl:when test="$abstract-key-name-convention = 'Name_Id'">
<xsl:value-of select="concat( @name, '_Id')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Id'"/>
</xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
@ -193,9 +184,10 @@
${ScriptsHelper.InstallScript( "Sitewide")} ${ScriptsHelper.InstallScript( "Sitewide")}
${ScriptsHelper.InstallScript( "Behaviour")} ${ScriptsHelper.InstallScript( "Behaviour")}
${ScriptsHelper.InstallScript( "Epoch")} ${ScriptsHelper.InstallScript( "Epoch")}
${ScriptsHelper.InstallScript( "Panes")}
<script type='text/javascript' language='JavaScript1.2'> <script type='text/javascript' language='JavaScript1.2'>
var panes = new Array( <xsl:for-each select='fieldgroup'> var panes = new Array( <xsl:for-each select='adl:fieldgroup'>
"<xsl:value-of select='@name'/>"<xsl:choose> "<xsl:value-of select='@name'/>"<xsl:choose>
<xsl:when test="position() = last()"/> <xsl:when test="position() = last()"/>
<xsl:otherwise>,</xsl:otherwise> <xsl:otherwise>,</xsl:otherwise>
@ -250,7 +242,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="../adl:property[@required='true']"> <xsl:for-each select="ancestor::adl:entity//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;
@ -320,20 +312,7 @@
<!-- 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 -->
<xsl:variable name="keyfield"> <xsl:variable name="keyfield">
<xsl:choose> <xsl:value-of select="ancestor::adl:entity/adl:key/adl:property[position()=1]/@name"/>
<xsl:when test="$abstract-key-name-convention='Name'">
<xsl:value-of select="ancestor::adl:entity/@name"/>
</xsl:when>
<xsl:when test="$abstract-key-name-convention = 'NameId'">
<xsl:value-of select="concat( ancestor::adl:entity/@name, 'Id')"/>
</xsl:when>
<xsl:when test="$abstract-key-name-convention = 'Name_Id'">
<xsl:value-of select="concat( ancestor::adl:entity/@name, '_Id')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="'Id'"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable> </xsl:variable>
${FormHelper.HiddenField( "instance.<xsl:value-of select="$keyfield"/>")} ${FormHelper.HiddenField( "instance.<xsl:value-of select="$keyfield"/>")}
</xsl:otherwise> </xsl:otherwise>
@ -432,31 +411,39 @@
<xsl:template match="adl: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::adl:entity//adl:property[@name=$listprop]/@entity"/>
<xsl:variable name="nearent" select="ancestor::entity/@name"/> <xsl:variable name="nearent" select="ancestor::adl:entity/@name"/>
<xsl:variable name="farid"> <xsl:variable name="farid">
<xsl:choose> <xsl:value-of select="//adl:entity[@name=$farent]/adl:key//adl:property[position()=1]/@name"/>
<xsl:when test="//adl:entity[@name=$farent]/@natural-key">
<xsl:value-of select="//adl:entity[@name=$farent]/@natural-key"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat( $farent, 'Id')"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:variable name="farkey"> <xsl:variable name="farkey">
<xsl:value-of select="//adl:entity[@name=$farent]/adl:property[@entity=$nearent]/@name"/> <xsl:choose>
<xsl:when test="//adl:entity[@name=$farent]//adl:property[@entity=$nearent]/@farkey">
<xsl:value-of select="//adl:entity[@name=$farent]//adl:property[@entity=$nearent]/@farkey"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="//adl:entity[@name=$farent]//adl:property[@entity=$nearent]/@name"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:variable name="nearkey"> <xsl:variable name="nearkey">
<xsl:choose> <xsl:choose>
<xsl:when test="ancestor::adl:entity[@natural-key]"> <xsl:when test="ancestor::adl:entity/adl:key/adl:property[position()=1 and @type='entity']">
<xsl:value-of select="ancestor::adl:entity[@natural-key]"/> <xsl:value-of select="concat( ancestor::adl:entity/adl:key/adl:property[position()=1]/@name, '_Value')"/>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:value-of select="concat( $nearent, 'Id')"/> <xsl:value-of select="ancestor::adl:entity/adl:key/adl:property[position()=1]/@name"/>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:comment>
$listprop = <xsl:value-of select="$listprop"/>;
$farent = <xsl:value-of select="$farent"/>;
$nearent = <xsl:value-of select="$nearent"/>;
$farid = <xsl:value-of select="$farid"/>;
$farkey = <xsl:value-of select="$farkey"/>;
$nearkey = <xsl:value-of select="$nearkey"/>;
</xsl:comment>
<xsl:variable name="action" select="concat( '../', $farent, '/', @onselect)"/> <xsl:variable name="action" select="concat( '../', $farent, '/', @onselect)"/>
<xsl:if test="@canadd='true'"> <xsl:if test="@canadd='true'">
<tr> <tr>
@ -482,7 +469,7 @@
<!-- 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="//adl:entity[@name=$farent]/adl: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>
@ -502,15 +489,15 @@
<xsl:variable name="fieldprop" select="@property"/> <xsl:variable name="fieldprop" select="@property"/>
<td> <td>
<xsl:choose> <xsl:choose>
<xsl:when test="//adl:entity[@name=$farent]/adl: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="//adl:entity[@name=$farent]/adl:property[@name=$fieldprop]/adl: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="//adl:entity[@name=$farent]/adl:property[@name=$fieldprop]/adl: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"/>
@ -536,10 +523,9 @@
#end #end
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<!-- properties not listed, so therefore presumably all. TODO: This won't work, rewrite. Need to <!-- properties not listed, so therefore presumably all. -->
find the entity of the property this auxlist depends on, and then interrogate that -->
<tr> <tr>
<xsl:for-each select="ancestor::adl:entity/adl:property[@distinct='user']"> <xsl:for-each select="//adl:entity[@name=$farent]//adl:property[@distinct='user']">
<th> <th>
<xsl:choose> <xsl:choose>
<xsl:when test="adl:prompt[@locale=$locale]"> <xsl:when test="adl:prompt[@locale=$locale]">
@ -553,22 +539,43 @@
</xsl:for-each> </xsl:for-each>
<th>-</th> <th>-</th>
</tr> </tr>
#foreach( $instance in $instances) #foreach( $item in $instance.<xsl:value-of select="@property"/>)
#if ( $velocityCount % 2 == 0) #if ( $velocityCount % 2 == 0)
#set( $oddity = "even") #set( $oddity = "even")
#else #else
#set( $oddity = "odd") #set( $oddity = "odd")
#end #end
<tr class="$oddity"> <tr class="$oddity">
<xsl:for-each select="ancestor::adl:entity/adl:property[@distinct='user']"> <xsl:for-each select="//adl:entity[@name=$farent]//adl:property[@distinct='user']">
<td> <td>
$!instance.<xsl:value-of select="@name"/> <xsl:variable name="fieldprop" select="@name"/>
<xsl:choose>
<xsl:when test="@type='entity'">
#if ( $item.<xsl:value-of select="@name"/>)
$item.<xsl:value-of select="@name"/>.UserIdentifier
#end
</xsl:when>
<xsl:when test="adl:option">
<!-- if we can get a prompt value for the option, it would be better to
show it than the raw value-->
<xsl:for-each select="adl:option">
#if ( $item.<xsl:value-of select="$fieldprop"/> == '<xsl:value-of select="@value"/>')
<xsl:call-template name="showprompt">
<xsl:with-param name="fallback" select="@value"/>
</xsl:call-template>
#end
</xsl:for-each>
</xsl:when>
<xsl:otherwise>
$!item.<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</td> </td>
</xsl:for-each> </xsl:for-each>
<td> <td>
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat( $action, '.rails?', ../@name, 'Id=$instance.', ../@name, 'Id')"/> <xsl:value-of select="concat( $action, '.rails?', $farid, '=$item.', $farid)"/>
</xsl:attribute> </xsl:attribute>
Edit! Edit!
</a> </a>
@ -615,9 +622,9 @@
<xsl:value-of select="@property"/> <xsl:value-of select="@property"/>
</xsl:variable> </xsl:variable>
<xsl:choose> <xsl:choose>
<xsl:when test="ancestor::adl:entity/adl: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::adl:entity/adl: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>
@ -628,7 +635,7 @@
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<!-- it's presumably intended to be a computed field --> <!-- it's presumably intended to be a computed field -->
Computed field (<xsl:value-of select="@name"/>)? TODO: Not yet implememented <xsl:comment>Computed field (<xsl:value-of select="$propname"/>)? TODO: Not yet implememented</xsl:comment>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:template> </xsl:template>
@ -792,14 +799,15 @@
<xsl:variable name="permission"> <xsl:variable name="permission">
<xsl:choose> <xsl:choose>
<xsl:when test="adl:permission"> <xsl:when test="adl:permission">
<xsl:value-of select="adl:permission[position()=1]/@permission"/> <xsl:value-of select="adl:permission[@group=$permissions-group]/@permission"/>
</xsl:when> </xsl:when>
<xsl:when test="../adl:permission"> <xsl:when test="ancestor::adl:entity/adl:permission">
<xsl:value-of select="../adl:permission[position()=1]/@permission"/> <xsl:value-of select="ancestor::adl:entity/adl:permission[@group=$permissions-group]/@permission"/>
</xsl:when> </xsl:when>
<xsl:otherwise>none</xsl:otherwise> <xsl:otherwise>none</xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:if test="$permission != 'none'">
<tr> <tr>
<xsl:attribute name="class"> <xsl:attribute name="class">
<xsl:value-of select="$oddness"/> <xsl:value-of select="$oddness"/>
@ -831,6 +839,7 @@
is no current value, else a 'not authorised' message --> is no current value, else a 'not authorised' message -->
<!-- TODO: if $permission='noedit', then you should get an editable widget if there <!-- TODO: if $permission='noedit', then you should get an editable widget if there
is no current value, else just the value --> is no current value, else just the value -->
<!-- TODO: if required='true', then you should not get the firstoption stuff -->
<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)
@ -935,7 +944,7 @@
</xsl:if> </xsl:if>
<!-- TODO: generate javascript to do client-side validation --> <!-- TODO: generate javascript to do client-side validation -->
</xsl:when> </xsl:when>
<xsl:when test="option"> <xsl:when test="adl:option">
<!-- if a property has options, we definitely want a select widget--> <!-- if a property has options, we definitely want a select widget-->
<select> <select>
<xsl:attribute name="id"> <xsl:attribute name="id">
@ -947,7 +956,7 @@
<xsl:attribute name="title"> <xsl:attribute name="title">
<xsl:value-of select="normalize-space( $if-missing)"/> <xsl:value-of select="normalize-space( $if-missing)"/>
</xsl:attribute> </xsl:attribute>
<xsl:apply-templates select="option"/> <xsl:apply-templates select="adl:option"/>
</select> </select>
<script type="text/javascript" language="javascript"> <script type="text/javascript" language="javascript">
// &lt;![CDATA[ // &lt;![CDATA[
@ -995,6 +1004,7 @@
<xsl:apply-templates select="adl:help[@locale = $locale]"/> <xsl:apply-templates select="adl:help[@locale = $locale]"/>
</td> </td>
</tr> </tr>
</xsl:if>
</xsl:template> </xsl:template>
<xsl:template match="adl:prompt"> <xsl:template match="adl:prompt">
@ -1122,7 +1132,7 @@
<xsl:for-each select="adl: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::adl:entity/adl:property[@name=$pname]"/> <xsl:variable name="property" select="ancestor::adl:entity//adl:property[@name=$pname]"/>
<xsl:choose> <xsl:choose>
<xsl:when test="$property/adl:prompt[@locale=$locale]"> <xsl:when test="$property/adl:prompt[@locale=$locale]">
<xsl:value-of select="$property/adl:prompt[@locale=$locale]/@prompt"/> <xsl:value-of select="$property/adl:prompt[@locale=$locale]/@prompt"/>
@ -1148,15 +1158,15 @@
<td> <td>
<xsl:variable name="prop" select="@property"/> <xsl:variable name="prop" select="@property"/>
<xsl:choose> <xsl:choose>
<xsl:when test="ancestor::adl:entity/adl: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='message'"> <xsl:when test="ancestor::adl:entity//adl:property[@name=$prop]/@type='message'">
$t.Msg( $instance.<xsl:value-of select="$prop"/>) $t.Msg( $instance.<xsl:value-of select="$prop"/>)
</xsl:when> </xsl:when>
<xsl:when test="ancestor::adl:entity/adl:property[@name=$prop]/@type='entity'"> <xsl:when test="ancestor::adl:entity//adl:property[@name=$prop]/@type='entity'">
#if( $instance.<xsl:value-of select="$prop"/>) #if( $instance.<xsl:value-of select="$prop"/>)
$instance.<xsl:value-of select="$prop"/>.UserIdentifier $instance.<xsl:value-of select="$prop"/>.UserIdentifier
#end #end
@ -1177,7 +1187,14 @@
<xsl:otherwise>&amp;</xsl:otherwise> <xsl:otherwise>&amp;</xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:value-of select="concat( $sep, @name, '=$instance.', @name)"/> <xsl:choose>
<xsl:when test="@type='entity'">
<xsl:value-of select="concat( $sep, @name, '_Value=$instance.', @name, '_Value')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat( $sep, @name, '=$instance.', @name)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each> </xsl:for-each>
</xsl:variable> </xsl:variable>
<xsl:for-each select="ancestor::adl:entity/adl:form"> <xsl:for-each select="ancestor::adl:entity/adl:form">
@ -1198,7 +1215,7 @@
<xsl:otherwise> <xsl:otherwise>
<!-- properties are not 'listed' --> <!-- properties are not 'listed' -->
<tr> <tr>
<xsl:for-each select="ancestor::adl:entity/adl:property[@distinct='user']"> <xsl:for-each select="ancestor::adl:entity//adl:property[@distinct='user' and not( @type='link' or @type='list')]">
<th> <th>
<xsl:choose> <xsl:choose>
<xsl:when test="adl:prompt[@locale=$locale]"> <xsl:when test="adl:prompt[@locale=$locale]">
@ -1221,7 +1238,7 @@
#set( $oddity = "odd") #set( $oddity = "odd")
#end #end
<tr class="$oddity"> <tr class="$oddity">
<xsl:for-each select="ancestor::adl:entity/adl:property[@distinct='user']"> <xsl:for-each select="ancestor::adl:entity//adl:property[@distinct='user']">
<td> <td>
<xsl:choose> <xsl:choose>
<xsl:when test="@type='entity'"> <xsl:when test="@type='entity'">
@ -1245,7 +1262,14 @@
<xsl:otherwise>&amp;</xsl:otherwise> <xsl:otherwise>&amp;</xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
<xsl:value-of select="concat( $sep, @name, '=$instance.', @name)"/> <xsl:choose>
<xsl:when test="@type='entity'">
<xsl:value-of select="concat( $sep, @name, '_Value=$instance.', @name, '_Value')"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="concat( $sep, @name, '=$instance.', @name)"/>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each> </xsl:for-each>
</xsl:variable> </xsl:variable>
<xsl:for-each select="ancestor::adl:entity/adl:form"> <xsl:for-each select="ancestor::adl:entity/adl:form">