Fixes to generation of entity ant type menus - not 100% certain this is fully right yet.

This commit is contained in:
sb 2008-06-09 15:52:07 +00:00
parent a6b482259b
commit 090268cdbd
2 changed files with 35 additions and 16 deletions

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-06-06 15:52:48 $ $Date: 2008-06-09 15:52:07 $
--> -->
<!-- WARNING WARNING WARNING: Do NOT reformat this file! <!-- WARNING WARNING WARNING: Do NOT reformat this file!
@ -67,7 +67,7 @@
// //
// Automatically generated abstract super class for controllers for the // Automatically generated abstract super class for controllers for the
// <xsl:value-of select="/adl:application/@name"/> application; generated using // <xsl:value-of select="/adl:application/@name"/> application; generated using
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.11 $', 10)"/> // adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.12 $', 10)"/>
// //
// This file is automatically generated; DO NOT EDIT IT. // This file is automatically generated; DO NOT EDIT IT.
// //
@ -133,7 +133,7 @@
// //
// Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s // Controller for auto-generated forms for editing <xsl:value-of select="@name"/>s
// Automatically generated from application description using // Automatically generated from application description using
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.11 $', 10)"/> // adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.12 $', 10)"/>
// //
// This file is automatically generated; DO NOT EDIT IT. // This file is automatically generated; DO NOT EDIT IT.
// //
@ -194,8 +194,18 @@
<xsl:when test="$entity/@foreign='true'"> <xsl:when test="$entity/@foreign='true'">
/* Entity <xsl:value-of select="$entityname"/> is foreign..? */ /* Entity <xsl:value-of select="$entityname"/> is foreign..? */
<xsl:variable name="foreignkey" select="$entity/adl:key/adl:property[position()=1]/@name"/> <xsl:variable name="foreignkey" select="$entity/adl:key/adl:property[position()=1]/@name"/>
<xsl:variable name="userident">
<xsl:choose>
<xsl:when test="$entity//adl:property[@distinct='user' or @distinct='all']">
<xsl:value-of select="$entity//adl:property[@distinct='user' or @distinct='all'][position()=1]/@name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$foreignkey"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Register&lt;<xsl:value-of select="concat( $entityns, '.', $entityname)"/>&gt;( "", Register&lt;<xsl:value-of select="concat( $entityns, '.', $entityname)"/>&gt;( "",
new TypeMenuControl&lt;<xsl:value-of select="concat( $entityns, '.', $entityname)"/>&gt;( "<xsl:value-of select="$foreignkey"/>","<xsl:value-of select="$foreignkey"/>")); new TypeMenuControl&lt;<xsl:value-of select="concat( $entityns, '.', $entityname)"/>&gt;( "<xsl:value-of select="$foreignkey"/>","<xsl:value-of select="$userident"/>"));
</xsl:when> </xsl:when>
<xsl:otherwise> <xsl:otherwise>
Register&lt;<xsl:value-of select="concat( $entityns, '.', $entityname)"/>&gt;( "", EntityMenuControl&lt;<xsl:value-of select="concat( $entityns, '.', $entityname)"/>&gt;.Instance); Register&lt;<xsl:value-of select="concat( $entityns, '.', $entityname)"/>&gt;( "", EntityMenuControl&lt;<xsl:value-of select="concat( $entityns, '.', $entityname)"/>&gt;.Instance);

View file

@ -13,8 +13,8 @@
Transform ADL into velocity view templates Transform ADL into velocity view templates
$Author: sb $ $Author: sb $
$Revision: 1.9 $ $Revision: 1.10 $
$Date: 2008-06-09 11:31:52 $ $Date: 2008-06-09 15:52:37 $
--> -->
<!-- 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! -->
@ -54,7 +54,7 @@
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.
This variable selects which group's permissions should be used when generating widgets --> This variable selects which group's permissions should be used when generating widgets -->
<xsl:param name="permissions-group" select="public"/> <xsl:param name="permissions-group" select="'public'"/>
<!-- bug 1800 : the name of the Velocity layout to use. If you are to <!-- bug 1800 : the name of the Velocity layout to use. If you are to
be able to usefully define content in ADL, then the default ADL layout be able to usefully define content in ADL, then the default ADL layout
@ -124,7 +124,7 @@
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.9 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.10 $', 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="."/>
@ -162,7 +162,7 @@
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.9 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.10 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="install-scripts"/> <xsl:call-template name="install-scripts"/>
</head> </head>
@ -243,7 +243,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.9 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.10 $', 10)"/>
</xsl:comment> </xsl:comment>
#capturefor( title) #capturefor( title)
#if ( $instance) #if ( $instance)
@ -364,7 +364,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.9 $', 10)"/> Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.10 $', 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'>
@ -813,12 +813,18 @@
if they are not a member of a group which has write access, the widget should be if they are not a member of a group which has write access, the widget should be
disabled. I don't have time to implement this now as it is not trivial, but it is disabled. I don't have time to implement this now as it is not trivial, but it is
important! --> important! -->
<xsl:message terminate="no">
matched adl:property; groupname is '<xsl:value-of select="$permissions-group"/>'
</xsl:message>
<xsl:variable name="permission"> <xsl:variable name="permission">
<xsl:call-template name="property-permission"> <xsl:call-template name="property-permission">
<xsl:with-param name="property" select="."/> <xsl:with-param name="property" select="."/>
<xsl:with-param name="groupname" select ="$permissions-group"/> <xsl:with-param name="groupname" select="$permissions-group"/>
</xsl:call-template> </xsl:call-template>
</xsl:variable> </xsl:variable>
<xsl:message terminate="no">
matched adl:property; parmission = '<xsl:value-of select="$permission"/>'
</xsl:message>
<xsl:if test="$permission != 'none'"> <xsl:if test="$permission != 'none'">
<tr> <tr>
<xsl:attribute name="class"> <xsl:attribute name="class">
@ -962,7 +968,7 @@
Auto generated Velocity list for <xsl:value-of select="@name"/>, Auto generated Velocity list for <xsl:value-of select="@name"/>,
generated from ADL. generated from ADL.
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.9 $', 10)"/> Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.10 $', 10)"/>
</xsl:comment> </xsl:comment>
#capturefor( title) #capturefor( title)
@ -1001,7 +1007,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.9 $', 10)"/> Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.10 $', 10)"/>
</xsl:comment> </xsl:comment>
<xsl:call-template name="install-scripts"/> <xsl:call-template name="install-scripts"/>
</head> </head>
@ -1516,7 +1522,10 @@
--> -->
<xsl:template name="property-permission"> <xsl:template name="property-permission">
<xsl:param name="property"/> <xsl:param name="property"/>
<xsl:param name="groupname" select="public"/> <xsl:param name="groupname" select="'public'"/>
<xsl:message terminate="no">
property-permission: property is '<xsl:value-of select="concat( $property/ancestor::adl:entity/@name, ':', $property/@name)"/>'; groupname is '<xsl:value-of select="$groupname"/>'
</xsl:message>
<xsl:choose> <xsl:choose>
<xsl:when test="$property/adl:permission[@group=$groupname]"> <xsl:when test="$property/adl:permission[@group=$groupname]">
<xsl:value-of select="$property/adl:permission[@group=$groupname]/@permission"/> <xsl:value-of select="$property/adl:permission[@group=$groupname]/@permission"/>