Quite a lot more improvement on robustness and formatting

This commit is contained in:
sb 2008-05-09 16:12:12 +00:00
parent 0e392e6bb3
commit 7642f0bf02
4 changed files with 995 additions and 949 deletions

View file

@ -20,8 +20,8 @@
explicitly state the permission, even if it is 'none'. explicitly state the permission, even if it is 'none'.
$Author: sb $ $Author: sb $
$Revision: 1.8 $ $Revision: 1.9 $
$Date: 2008-02-28 14:52:08 $ $Date: 2008-05-09 16:12:12 $
--> -->
<xsl:stylesheet version="1.0" <xsl:stylesheet version="1.0"
@ -64,7 +64,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 adl2canonical.xslt <xsl:value-of select="substring('$Revision: 1.8 $', 12)"/> * Generated using adl2canonical.xslt <xsl:value-of select="substring('$Revision: 1.9 $', 12)"/>
* *
*************************************************************************** ***************************************************************************
</xsl:comment> </xsl:comment>
@ -407,14 +407,15 @@
NOTE that n-to-n properties cannot currently be user-distinct and are NOTE that n-to-n properties cannot currently be user-distinct and are
therefore not inspected --> therefore not inspected -->
<xsl:template name="unroll-user-distinct"> <xsl:template name="unroll-user-distinct">
<xsl:for-each select="ancestor::adl:entity/descendant::adl:property[@distinct='user']"> <xsl:for-each select="ancestor::adl:entity/descendant::adl:property[@distinct='user' or @distinct='all']">
<field> <field>
<xsl:attribute name="property"> <xsl:attribute name="property">
<xsl:value-of select="@name"/> <xsl:value-of select="@name"/>
</xsl:attribute> </xsl:attribute>
<xsl:apply-templates select="adl:prompt"/>
<xsl:apply-templates select="adl:help"/>
</field> </field>
</xsl:for-each> </xsl:for-each>
</xsl:template> </xsl:template>
</xsl:stylesheet> </xsl:stylesheet>

File diff suppressed because it is too large Load diff

View file

@ -8,8 +8,8 @@
Transform ADL into entity classes Transform ADL into entity classes
$Author: sb $ $Author: sb $
$Revision: 1.12 $ $Revision: 1.13 $
$Date: 2008-03-12 13:46:10 $ $Date: 2008-05-09 16:12:12 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -61,7 +61,7 @@
stored to CVS --> stored to CVS -->
<xsl:variable name="transform-rev1" <xsl:variable name="transform-rev1"
select="substring( '$Revision: 1.12 $', 11)"/> select="substring( '$Revision: 1.13 $', 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)"/>
@ -220,8 +220,8 @@
get { get {
StringBuilder result = new StringBuilder(); StringBuilder result = new StringBuilder();
<xsl:choose> <xsl:choose>
<xsl:when test="descendant::adl:property[@distinct='user']"> <xsl:when test="descendant::adl:property[@distinct='user' or @distinct='all']">
<xsl:for-each select="descendant::adl:property[@distinct='user']"> <xsl:for-each select="descendant::adl:property[@distinct='user' or @distinct='all']">
<xsl:choose> <xsl:choose>
<xsl:when test="@type='message'"> <xsl:when test="@type='message'">
if ( <xsl:value-of select="@name"/> != null) if ( <xsl:value-of select="@name"/> != null)

View file

@ -12,26 +12,32 @@
Transform ADL into velocity view templates Transform ADL into velocity view templates
$Author: sb $ $Author: sb $
$Revision: 1.15 $ $Revision: 1.16 $
$Date: 2008-04-18 10:06:47 $ $Date: 2008-05-09 16:12:12 $
--> -->
<!-- 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! -->
<!-- <!--
TODO: this transform BADLY needs to be refactored! It is /crap/! TODO: this transform BADLY needs to be refactored! It is /crap/!
--> -->
<xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/> <xsl:output method="xml" indent="yes" encoding="UTF-8" omit-xml-declaration="yes"/>
<!-- The locale for which these views are generated <!-- The locale for which these views are generated
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"/>
<!-- whether or not to auto-generate site navigation - by default, don't --> <!-- whether or not to auto-generate site navigation - by default, don't -->
<xsl:param name="generate-site-navigation"/> <xsl:param name="generate-site-navigation" select="'false'"/>
<!-- the current state of play is that we can only generate views with permissions for one group. <!-- whether or not to layout errors - they may be in the default layout -->
<xsl:param name="show-errors" select="'false'"/>
<!-- whether or not to layout messages - they may be in the default layout -->
<xsl:param name="show-messages" select="'false'"/>
<!-- 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 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 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. permissions applicable to that user - but we don't yet have the parts in place to do that.
@ -46,9 +52,14 @@
for making sure it loads all the scripts, etc, that an ADL controller for making sure it loads all the scripts, etc, that an ADL controller
expects. --> expects. -->
<xsl:param name="layout-name" select="adl-default-layout"/> <xsl:param name="layout-name" select="adl-default-layout"/>
<!-- bug 1800 : the name of the area (i.e. URL path part) to use -->
<xsl:param name="area-name" select="auto"/>
<xsl:template match="adl:application"> <xsl:template match="adl:application">
<output> <output>
<!-- 'output' is a dummy wrapper root tag to make the entire output work as
an XML document; the actual output later gets cut into chunks and the
wrapper tag is discarded. -->
<xsl:apply-templates select="adl: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 -->
@ -71,7 +82,7 @@
</xsl:template> </xsl:template>
<!-- generate views for an entity, assuming a non-empty layout - i.e. <!-- generate views for an entity, assuming a non-empty layout - i.e.
I'm not responsible for head, or for the body tag --> I'm not responsible for the html, the head, or for the body tag -->
<xsl:template match="adl:entity" mode="non-empty-layout"> <xsl:template match="adl:entity" mode="non-empty-layout">
<xsl:variable name="keyfield"> <xsl:variable name="keyfield">
<xsl:choose> <xsl:choose>
@ -93,55 +104,58 @@
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>, Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.15 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="maybe-delete"> <xsl:call-template name="maybe-delete">
<xsl:with-param name="entity" select="."/> <xsl:with-param name="entity" select="."/>
</xsl:call-template> </xsl:call-template>
</xsl:template> </xsl:template>
<!-- generate views for an entity, assuming a non-empty layout --> <!-- generate views for an entity, assuming an empty layout
<xsl:template match="adl:entity" mode="empty-layout"> (i.e. I'm responsible for html, head and body tags) -->
<xsl:variable name="keyfield"> <xsl:template match="adl:entity" mode="empty-layout">
<xsl:choose> <xsl:variable name="keyfield">
<xsl:when test="adl:key/adl:property"> <xsl:choose>
<xsl:value-of select="adl:key/adl:property[position()=1]/@name"/> <xsl:when test="adl:key/adl:property">
</xsl:when> <xsl:value-of select="adl:key/adl:property[position()=1]/@name"/>
<xsl:otherwise>[none]</xsl:otherwise> </xsl:when>
</xsl:choose> <xsl:otherwise>[none]</xsl:otherwise>
</xsl:variable> </xsl:choose>
</xsl:variable>
<xsl:apply-templates select="adl:form" mode="empty-layout"/> <xsl:apply-templates select="adl:form" mode="empty-layout"/>
<xsl:apply-templates select="adl:list" mode="empty-layout"/> <xsl:apply-templates select="adl:list" mode="empty-layout"/>
<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>
<xsl:text> [ cut here: next file '<xsl:value-of select="concat( @name, '/maybedelete.auto.vm')"/>' ]
</xsl:text> </xsl:comment>
<html> <xsl:text>
#set( $title = "<xsl:value-of select="concat( 'Really delete ', @name)"/> $instance.UserIdentifier") </xsl:text>
<head> <html>
<title>$!title</title> #set( $title = "<xsl:value-of select="concat( 'Really delete ', @name)"/> $instance.UserIdentifier")
<xsl:call-template name="head"/> <head>
<xsl:comment> <title>$!title</title>
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>, <xsl:call-template name="head"/>
generated from ADL. <xsl:comment>
Auto generated Velocity maybe-delete form for <xsl:value-of select="@name"/>,
generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.15 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="install-scripts"/> <xsl:call-template name="install-scripts"/>
</head> </head>
<body> <body>
<xsl:call-template name="top"/> <xsl:call-template name="top"/>
<xsl:call-template name="maybe-delete"> <xsl:call-template name="maybe-delete">
<xsl:with-param name="entity" select="."/> <xsl:with-param name="entity" select="."/>
</xsl:call-template> </xsl:call-template>
<xsl:call-template name="foot"/> <xsl:call-template name="foot"/>
</body> </body>
</html> </html>
</xsl:template> </xsl:template>
<!-- the guts of the maybe-delete form, whether or not we're using an empty layout --> <!-- the guts of the maybe-delete form, whether or not we're using an empty layout -->
<xsl:template name="maybe-delete"> <xsl:template name="maybe-delete">
<xsl:param name="entity"/> <xsl:param name="entity"/>
<form action="delete.rails" method="post"> <form action="delete.rails" method="post">
@ -213,7 +227,7 @@
Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>, Auto generated Velocity <xsl:value-of select="@name"/> form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.15 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/>
</xsl:comment> </xsl:comment>
#capturefor( title) #capturefor( title)
#if ( $instance) #if ( $instance)
@ -223,6 +237,7 @@
#end #end
#end #end
#capturefor( headextras) #capturefor( headextras)
<xsl:call-template name="head"/>
<script type='text/javascript' language='JavaScript1.2'> <script type='text/javascript' language='JavaScript1.2'>
var panes = new Array( <xsl:for-each select='adl: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>
@ -294,10 +309,12 @@
#capturefor(bodyattributes) #capturefor(bodyattributes)
onload="performInitialisation()" onload="performInitialisation()"
#end #end
<xsl:call-template name="top"/>
<xsl:call-template name="form-content"> <xsl:call-template name="form-content">
<xsl:with-param name="form" select="."/> <xsl:with-param name="form" select="."/>
</xsl:call-template> </xsl:call-template>
</xsl:template> <xsl:call-template name="foot"/>
</xsl:template>
<xsl:template match="adl:form" mode="empty-layout"> <xsl:template match="adl:form" mode="empty-layout">
<xsl:variable name="formname" select="@name"/> <xsl:variable name="formname" select="@name"/>
@ -334,7 +351,7 @@
Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>, Auto generated Velocity form for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.15 $', 10)"/> Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="install-scripts"/> <xsl:call-template name="install-scripts"/>
<script type='text/javascript' language='JavaScript1.2'> <script type='text/javascript' language='JavaScript1.2'>
@ -417,148 +434,156 @@
<!-- the content of a form, whether or not the layout is empty --> <!-- the content of a form, whether or not the layout is empty -->
<xsl:template name="form-content"> <xsl:template name="form-content">
<!-- an entity of type form --> <!-- an entity of type form -->
<xsl:param name="form"/> <xsl:param name="form"/>
<xsl:variable name="formname" select="$form/@name"/> <xsl:variable name="formname" select="$form/@name"/>
<div class="content"> <div class="content">
#if ( $errors) <xsl:if test="$show-errors = 'true'">
#if ( $errors.Count != 0) #if ( $errors)
<ul class="errors"> #if ( $errors.Count != 0)
#foreach( $e in $errors) <ul class="errors">
<li>$t.Enc($e)</li> #foreach($e in $errors)
#end #if($e.Message)
</ul> <li>$t.Error($e)</li>
#end #else
#end <li>$t.Enc($e)</li>
#if( $messages) #end
#if ( $messages.Count != 0) #end
<div class="information"> </ul>
#foreach ( $message in $messages) #end
<p> #end
$message </xsl:if>
</p> <xsl:if test="$show-messages = 'true'">
#end #if( $messages)
</div> #if ( $messages.Count != 0)
#end <ul class="information">
#end #foreach ( $message in $messages)
<form method="post" onsubmit="invokeSubmitHandlers( this)"> <li>$message</li>
<xsl:attribute name="action"> #end
<xsl:value-of select="concat( $formname, 'SubmitHandler.rails')"/> </ul>
</xsl:attribute> #end
<xsl:attribute name="name"> #end
<xsl:value-of select="$formname"/> </xsl:if>
</xsl:attribute> <form method="post" onsubmit="invokeSubmitHandlers( this)">
<xsl:attribute name="id"> <xsl:attribute name="action">
<xsl:value-of select="$formname"/> <xsl:value-of select="concat( $formname, 'SubmitHandler.rails')"/>
</xsl:attribute> </xsl:attribute>
<xsl:for-each select="$form/ancestor::adl:entity/adl:key/adl:property"> <xsl:attribute name="name">
<xsl:variable name="keyname" select="@name"/> <xsl:value-of select="$formname"/>
<xsl:choose> </xsl:attribute>
<xsl:when test="$form/adl:field[@property=$keyname]"> <xsl:attribute name="id">
<!-- it's already a field of the form - no need to add a hidden one --> <xsl:value-of select="$formname"/>
</xsl:when> </xsl:attribute>
<xsl:otherwise> <xsl:for-each select="$form/ancestor::adl:entity/adl:key/adl:property">
<!-- create a hidden widget for the natural primary key --> <xsl:variable name="keyname" select="@name"/>
${FormHelper.HiddenField( "instance.<xsl:value-of select="$keyname"/>")} <xsl:choose>
</xsl:otherwise> <xsl:when test="$form/adl:field[@property=$keyname]">
</xsl:choose> <!-- it's already a field of the form - no need to add a hidden one -->
</xsl:for-each> </xsl:when>
<xsl:if test="$form/adl:fieldgroup"> <xsl:otherwise>
<div id="tabbar"> <!-- create a hidden widget for the natural primary key -->
<xsl:for-each select="$form/adl:fieldgroup"> ${FormHelper.HiddenField( "instance.<xsl:value-of select="$keyname"/>")}
<span class="tab"> </xsl:otherwise>
<xsl:attribute name="id"> </xsl:choose>
<xsl:value-of select="concat( @name, 'tab')"/> </xsl:for-each>
</xsl:attribute> <xsl:if test="$form/adl:fieldgroup">
<a> <div id="tabbar">
<xsl:attribute name="href"> <xsl:for-each select="$form/adl:fieldgroup">
<xsl:value-of select="concat( '#', @name, 'anchor')"/> <span class="tab">
</xsl:attribute> <xsl:attribute name="id">
<xsl:attribute name="onclick"> <xsl:value-of select="concat( @name, 'tab')"/>
switchtab( '<xsl:value-of select="@name"/>'); return false; </xsl:attribute>
</xsl:attribute> <a>
<xsl:call-template name="showprompt"> <xsl:attribute name="href">
<xsl:with-param name="fallback" select="@name"/> <xsl:value-of select="concat( '#', @name, 'anchor')"/>
</xsl:call-template> </xsl:attribute>
</a> <xsl:attribute name="onclick">
</span> switchtab( '<xsl:value-of select="@name"/>'); return false;
</xsl:for-each> </xsl:attribute>
</div> <xsl:call-template name="showprompt">
</xsl:if> <xsl:with-param name="node" select="."/>
<xsl:apply-templates select="$form/adl:fieldgroup"/> <xsl:with-param name="fallback" select="@name"/>
<div class="pane"> </xsl:call-template>
<table> </a>
<xsl:choose> </span>
<xsl:when test="@properties='listed'"> </xsl:for-each>
<xsl:apply-templates select="$form/adl:field|adl:auxlist|adl:verb"/> </div>
</xsl:when> </xsl:if>
<xsl:otherwise> <xsl:apply-templates select="$form/adl:fieldgroup"/>
<xsl:apply-templates select="$form/ancestor::adl:entity/adl:property"/> <div class="pane">
</xsl:otherwise> <table>
</xsl:choose> <xsl:choose>
<tr class="actionSafe"> <xsl:when test="@properties='listed'">
<td class="actionSafe" colspan="2"> <xsl:apply-templates select="$form/adl:field|adl:auxlist|adl:verb"/>
To save this record </xsl:when>
</td> <xsl:otherwise>
<td class="actionSafe" style="text-align:right"> <xsl:apply-templates select="$form/ancestor::adl:entity/adl:property"/>
<button type="submit" name="command" value="store">Save this!</button> </xsl:otherwise>
</td> </xsl:choose>
</tr> <tr class="actionSafe">
<tr align="left" valign="top" class="actionDangerous"> <td class="actionSafe" colspan="2">
To save this record
</td>
<td class="actionSafe" style="text-align:right">
<button type="submit" name="command" value="store">Save this!</button>
</td>
</tr>
<tr align="left" valign="top" class="actionDangerous">
<td class="actionDangerous" colspan="2"> <td class="actionDangerous" colspan="2">
#if ( $instance) #if ( $instance)
#if ( $instance.NoDeleteReason) #if ( $instance.NoDeleteReason)
[ $instance.NoDeleteReason ] [ $instance.NoDeleteReason ]
#else #else
To delete this record To delete this record
#end #end
#end #end
</td> </td>
<td class="actionDangerous" style="text-align:right"> <td class="actionDangerous" style="text-align:right">
#if ( $instance) #if ( $instance)
#if ( $instance.NoDeleteReason) #if ( $instance.NoDeleteReason)
<button type="submit" disabled="disabled" title="$instance.NoDeleteReason" name="command" value="delete">Delete this!</button> <button type="submit" disabled="disabled" title="$instance.NoDeleteReason" name="command" value="delete">Delete this!</button>
#else #else
<button type="submit" name="command" value="delete">Delete this!</button> <button type="submit" name="command" value="delete">Delete this!</button>
#end #end
#end #end
</td> </td>
</tr> </tr>
</table> </table>
</div> </div>
</form> </form>
</div> </div>
</xsl:template> </xsl:template>
<xsl:template match="adl: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')"/>
</xsl:attribute> </xsl:attribute>
<xsl:attribute name="style"> <xsl:attribute name="style">
<xsl:choose> <xsl:choose>
<xsl:when test="position() = 1"/> <xsl:when test="position() = 1"/>
<xsl:otherwise>display: none</xsl:otherwise> <xsl:otherwise>display: none</xsl:otherwise>
</xsl:choose> </xsl:choose>
</xsl:attribute> </xsl:attribute>
<a> <a>
<xsl:attribute name="name"> <xsl:attribute name="name">
<xsl:value-of select="concat( @name, 'anchor')"/> <xsl:value-of select="concat( @name, 'anchor')"/>
</xsl:attribute> </xsl:attribute>
<h3> <h3>
<xsl:call-template name="showprompt"> <xsl:call-template name="showprompt">
<xsl:with-param name="fallback" select="@name"/> <xsl:with-param name="node" select="."/>
</xsl:call-template> <xsl:with-param name="fallback" select="@name"/>
</h3> </xsl:call-template>
</a> </h3>
<table> </a>
<xsl:apply-templates select="adl:field|adl:verb|adl:auxlist"/> <table>
</table> <xsl:apply-templates select="adl:field|adl:verb|adl:auxlist"/>
</div> </table>
</xsl:template> </div>
</xsl:template>
<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::adl:entity//adl:property[@name=$listprop]/@entity"/> <xsl:variable name="farent" select="ancestor::adl:entity//adl:property[@name=$listprop]/@entity"/>
<xsl:variable name="nearent" select="ancestor::adl:entity/@name"/> <xsl:variable name="nearent" select="ancestor::adl:entity/@name"/>
@ -650,6 +675,7 @@
<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="node" select="."/>
<xsl:with-param name="fallback" select="@value"/> <xsl:with-param name="fallback" select="@value"/>
</xsl:call-template> </xsl:call-template>
#end #end
@ -676,16 +702,12 @@
<xsl:otherwise> <xsl:otherwise>
<!-- properties not listed, so therefore presumably all. --> <!-- properties not listed, so therefore presumably all. -->
<tr> <tr>
<xsl:for-each select="//adl:entity[@name=$farent]//adl:property[@distinct='user']"> <xsl:for-each select="//adl:entity[@name=$farent]//adl:property[@distinct='user' or @distinct='all']">
<th> <th>
<xsl:choose> <xsl:call-template name="showprompt">
<xsl:when test="adl:prompt[@locale=$locale]"> <xsl:with-param name="node" select="."/>
<xsl:value-of select="adl:prompt[@locale=$locale]/@prompt"/> <xsl:with-param name="fallback" select="@name"/>
</xsl:when> </xsl:call-template>
<xsl:otherwise>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</th> </th>
</xsl:for-each> </xsl:for-each>
<th>-</th> <th>-</th>
@ -698,7 +720,7 @@
#set( $oddity = "odd") #set( $oddity = "odd")
#end #end
<tr class="$oddity"> <tr class="$oddity">
<xsl:for-each select="//adl:entity[@name=$farent]//adl:property[@distinct='user']"> <xsl:for-each select="//adl:entity[@name=$farent]//adl:property[@distinct='user' or @distinct='all']">
<td> <td>
<xsl:variable name="fieldprop" select="@name"/> <xsl:variable name="fieldprop" select="@name"/>
<xsl:choose> <xsl:choose>
@ -713,6 +735,7 @@
<xsl:for-each select="adl:option"> <xsl:for-each select="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="node" select="."/>
<xsl:with-param name="fallback" select="@value"/> <xsl:with-param name="fallback" select="@value"/>
</xsl:call-template> </xsl:call-template>
#end #end
@ -763,6 +786,7 @@
<xsl:value-of select="@verb"/> <xsl:value-of select="@verb"/>
</xsl:attribute> </xsl:attribute>
<xsl:call-template name="showprompt"> <xsl:call-template name="showprompt">
<xsl:with-param name="node" select="."/>
<xsl:with-param name="fallback" select="@verb"/> <xsl:with-param name="fallback" select="@verb"/>
</xsl:call-template> </xsl:call-template>
</button> </button>
@ -802,6 +826,7 @@
</xsl:attribute> </xsl:attribute>
<td class="label"> <td class="label">
${FormHelper.LabelFor( "instance.<xsl:value-of select="@name"/>", "<xsl:call-template name="showprompt"> ${FormHelper.LabelFor( "instance.<xsl:value-of select="@name"/>", "<xsl:call-template name="showprompt">
<xsl:with-param name="node" select="."/>
<xsl:with-param name="fallback" select="@name"/> <xsl:with-param name="fallback" select="@name"/>
</xsl:call-template>")} </xsl:call-template>")}
</td> </td>
@ -840,6 +865,7 @@
</xsl:attribute> </xsl:attribute>
<td class="label" rowspan="2"> <td class="label" rowspan="2">
${FormHelper.LabelFor( "instance.<xsl:value-of select="@name"/>", "<xsl:call-template name="showprompt"> ${FormHelper.LabelFor( "instance.<xsl:value-of select="@name"/>", "<xsl:call-template name="showprompt">
<xsl:with-param name="node" select="."/>
<xsl:with-param name="fallback" select="@name"/> <xsl:with-param name="fallback" select="@name"/>
</xsl:call-template>")} </xsl:call-template>")}
</td> </td>
@ -906,15 +932,11 @@
<xsl:value-of select="$oddness"/> <xsl:value-of select="$oddness"/>
</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:call-template name="showprompt">
<xsl:when test="adl:prompt[@locale = $locale]"> <xsl:with-param name="node" select="."/>
<xsl:apply-templates select="adl:prompt[@locale = $locale]"/> <xsl:with-param name="fallback" select="@name"/>
</xsl:when> </xsl:call-template>")}
<xsl:otherwise> </td>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>")}
</td>
<td class="widget" colspan="2"> <td class="widget" colspan="2">
${FormHelper.TextArea( "instance.<xsl:value-of select="@name"/>", "%{rows='8', cols='60', title='<xsl:value-of select="$if-missing"/>'}")} ${FormHelper.TextArea( "instance.<xsl:value-of select="@name"/>", "%{rows='8', cols='60', title='<xsl:value-of select="$if-missing"/>'}")}
</td> </td>
@ -1249,15 +1271,11 @@
<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:call-template name="showprompt">
<xsl:when test="adl:prompt[@locale=$locale]"> <xsl:with-param name="node" select="."/>
<xsl:value-of select="adl:prompt[@locale=$locale]/@prompt"/> <xsl:with-param name="fallback" select="@value"/>
</xsl:when> </xsl:call-template>
<xsl:otherwise> </option>
<xsl:value-of select="@value"/>
</xsl:otherwise>
</xsl:choose>
</option>
</xsl:template> </xsl:template>
<!-- layout of lists --> <!-- layout of lists -->
@ -1284,12 +1302,17 @@
</xsl:choose> </xsl:choose>
</xsl:variable> </xsl:variable>
#capturefor( title) #capturefor( title)
<xsl:value-of select="normalize-space( concat( 'List ', $withpluralsuffix))"/> <xsl:value-of select="normalize-space( concat( 'List ', $withpluralsuffix))"/>
#end #end
<xsl:call-template name="list"> #capturefor( headextras)
<xsl:call-template name="head"/>
#end
<xsl:call-template name="top"/>
<xsl:call-template name="list">
<xsl:with-param name="list" select="."/> <xsl:with-param name="list" select="."/>
</xsl:call-template> </xsl:call-template>
</xsl:template> <xsl:call-template name="foot"/>
</xsl:template>
<!-- layout of a list assuming an empty layout --> <!-- layout of a list assuming an empty layout -->
<xsl:template match="adl:list" mode="empty-layout"> <xsl:template match="adl:list" mode="empty-layout">
@ -1300,7 +1323,8 @@
<xsl:text> <xsl:text>
</xsl:text> </xsl:text>
<xsl:variable name="withpluralsuffix"> <xsl:variable name="withpluralsuffix">
<!-- English-laguage syntactic sugar of entity name --> <!-- English-laguage syntactic sugar of entity name. TODO (bug 1896): This really /must/ not be here.
some means of doing i18n syntactic sugar needs to be spliced in. -->
<xsl:choose> <xsl:choose>
<xsl:when test="../@name='Person'">People</xsl:when> <xsl:when test="../@name='Person'">People</xsl:when>
<xsl:when test="starts-with( substring(../@name, string-length(../@name) ), 's')"> <xsl:when test="starts-with( substring(../@name, string-length(../@name) ), 's')">
@ -1323,7 +1347,7 @@
Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>, Auto generated Velocity list for <xsl:value-of select="ancestor::adl:entity/@name"/>,
generated from ADL. generated from ADL.
Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.15 $', 10)"/> Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.16 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="install-scripts"/> <xsl:call-template name="install-scripts"/>
</head> </head>
@ -1393,14 +1417,10 @@
<th> <th>
<xsl:variable name="pname" select="@property"/> <xsl:variable name="pname" select="@property"/>
<xsl:variable name="property" select="$list/ancestor::adl:entity//adl:property[@name=$pname]"/> <xsl:variable name="property" select="$list/ancestor::adl:entity//adl:property[@name=$pname]"/>
<xsl:choose> <xsl:call-template name="showprompt">
<xsl:when test="$property/adl:prompt[@locale=$locale]"> <xsl:with-param name="node" select="$property"/>
<xsl:value-of select="$property/adl:prompt[@locale=$locale]/@prompt"/> <xsl:with-param name="fallback" select="@property"/>
</xsl:when> </xsl:call-template>
<xsl:otherwise>
<xsl:value-of select="@property"/>
</xsl:otherwise>
</xsl:choose>
</th> </th>
</xsl:for-each> </xsl:for-each>
<xsl:for-each select="$list/ancestor::adl:entity/adl:form"> <xsl:for-each select="$list/ancestor::adl:entity/adl:form">
@ -1478,17 +1498,13 @@
<xsl:otherwise> <xsl:otherwise>
<!-- properties are not 'listed' --> <!-- properties are not 'listed' -->
<tr> <tr>
<xsl:for-each select="$list/ancestor::adl:entity//adl:property[@distinct='user' and not( @type='link' or @type='list')]"> <xsl:for-each select="$list/ancestor::adl:entity//adl:property[(@distinct='user' or @distinct='all') and not( @type='link' or @type='list')]">
<th> <th>
<xsl:choose> <xsl:call-template name="showprompt">
<xsl:when test="adl:prompt[@locale=$locale]"> <xsl:with-param name="node" select="."/>
<xsl:value-of select="adl:prompt[@locale=$locale]/@prompt"/> <xsl:with-param name="fallback" select="@name"/>
</xsl:when> </xsl:call-template>
<xsl:otherwise> </th>
<xsl:value-of select="@name"/>
</xsl:otherwise>
</xsl:choose>
</th>
</xsl:for-each> </xsl:for-each>
<xsl:for-each select="$list/ancestor::adl:entity/adl:form"> <xsl:for-each select="$list/ancestor::adl:entity/adl:form">
<th>-</th> <th>-</th>
@ -1501,7 +1517,7 @@
#set( $oddity = "odd") #set( $oddity = "odd")
#end #end
<tr class="$oddity"> <tr class="$oddity">
<xsl:for-each select="$list/ancestor::adl:entity//adl:property[@distinct='user']"> <xsl:for-each select="$list/ancestor::adl:entity//adl:property[@distinct='user' or @distinct='all']">
<td> <td>
<xsl:choose> <xsl:choose>
<xsl:when test="@type = 'date'"> <xsl:when test="@type = 'date'">
@ -1586,17 +1602,65 @@
${ScriptsHelper.InstallScript( "Panes")} ${ScriptsHelper.InstallScript( "Panes")}
</xsl:template> </xsl:template>
<xsl:template match="navigation">
foobar!
</xsl:template>
<xsl:template match="adl:navigation">
<xsl:variable name="pagename" select="@name"/>
<ul class="generatednav">
<xsl:choose>
<xsl:when test="@include='list'">
<xsl:for-each select="//adl:entity[adl:list[@name=$pagename]]">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '$siteRoot', '/', $area-name, '/', @name, '/', adl:list[position()=1]/@name, '.rails')"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
</li>
</xsl:for-each>
</xsl:when>
<xsl:when test="@include='form'">
<xsl:for-each select="//adl:entity[adl:form[@name=$pagename]]">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '$siteRoot', '/', $area-name, '/', @name, '/', adl:list[position()=1]/@name, '.rails')"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
</li>
</xsl:for-each>
</xsl:when>
<xsl:when test="@include='page'">
<xsl:for-each select="//adl:entity[adl:page[@name=$pagename]]">
<li>
<a>
<xsl:attribute name="href">
<xsl:value-of select="concat( '$siteRoot', '/', $area-name, '/', @name, '/', adl:list[position()=1]/@name, '.rails')"/>
</xsl:attribute>
<xsl:value-of select="@name"/>
</a>
</li>
</xsl:for-each>
</xsl:when>
</xsl:choose>
</ul>
</xsl:template>
<xsl:template name="head"> <xsl:template name="head">
<xsl:choose> <xsl:choose>
<xsl:when test="adl:head"> <xsl:when test="adl:head">
<xsl:for-each select="adl:head/*"> <xsl:for-each select="adl:head/*">
<xsl:copy-of select="."/> <xsl:apply-templates select="."/>
</xsl:for-each> </xsl:for-each>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:for-each select="//adl:content/adl:head/*"> <xsl:for-each select="//adl:content/adl:head/*">
<xsl:copy-of select="."/> <xsl:apply-templates select="."/>
</xsl:for-each> </xsl:for-each>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
@ -1606,22 +1670,22 @@
<xsl:choose> <xsl:choose>
<xsl:when test="adl:top"> <xsl:when test="adl:top">
<xsl:for-each select="adl:top/*"> <xsl:for-each select="adl:top/*">
<xsl:copy-of select="."/> <xsl:apply-templates select="."/>
</xsl:for-each> </xsl:for-each>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:for-each select="//adl:content/adl:top/*"> <xsl:for-each select="//adl:content/adl:top/*">
<xsl:copy-of select="."/> <xsl:apply-templates select="."/>
</xsl:for-each> </xsl:for-each>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
<xsl:if test="$generate-site-navigation"> <xsl:if test="$generate-site-navigation = 'true'">
<ul class="generatednav"> <ul class="generatednav">
<xsl:for-each select="//adl:entity[adl:list[@name='list']]"> <xsl:for-each select="//adl:entity[adl:list[@name='list']]">
<li> <li>
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="concat( '$siteRoot', '/auto/', @name, '/', adl:list[position()=1]/@name, '.rails')"/> <xsl:value-of select="concat( '$siteRoot', '/', $area-name, '/', @name, '/', adl:list[position()=1]/@name, '.rails')"/>
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="@name"/> <xsl:value-of select="@name"/>
</a> </a>
@ -1635,12 +1699,12 @@
<xsl:choose> <xsl:choose>
<xsl:when test="adl:foot"> <xsl:when test="adl:foot">
<xsl:for-each select="adl:foot/*"> <xsl:for-each select="adl:foot/*">
<xsl:copy-of select="."/> <xsl:apply-templates select="."/>
</xsl:for-each> </xsl:for-each>
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
<xsl:for-each select="//adl:content/adl:foot/*"> <xsl:for-each select="//adl:content/adl:foot/*">
<xsl:copy-of select="."/> <xsl:apply-templates select="."/>
</xsl:for-each> </xsl:for-each>
</xsl:otherwise> </xsl:otherwise>
</xsl:choose> </xsl:choose>
@ -1652,6 +1716,7 @@
<xsl:template name="showprompt"> <xsl:template name="showprompt">
<xsl:param name="fallback" select="Unknown"/> <xsl:param name="fallback" select="Unknown"/>
<xsl:param name="node" select="."/> <xsl:param name="node" select="."/>
<xsl:param name="locale" select="'en-GB'"/>
<xsl:choose> <xsl:choose>
<xsl:when test="$node/adl:prompt[@locale=$locale]"> <xsl:when test="$node/adl:prompt[@locale=$locale]">
<xsl:value-of select="$node/adl:prompt[@locale=$locale][1]/@prompt"/> <xsl:value-of select="$node/adl:prompt[@locale=$locale][1]/@prompt"/>