bug 1943: Shuffle widget for properties of type list now allowing /inclusion/; semantics for /exclusion/ are not so obvious, and perhaps this option should be
greyed. Shuffle widget for properties of type link may be broken, must be tested.
This commit is contained in:
parent
5b09885eb8
commit
f9fd11c101
|
@ -13,7 +13,7 @@
|
||||||
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
$Revision: 1.15 $
|
$Revision: 1.16 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
<!-- :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
|
||||||
|
|
|
@ -9,8 +9,8 @@
|
||||||
Transform ADL into (partial) controller classes
|
Transform ADL into (partial) controller classes
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.8 $
|
$Revision: 1.9 $
|
||||||
$Date: 2008-06-03 16:09:07 $
|
$Date: 2008-06-04 16:17:39 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
<!-- WARNING WARNING WARNING: Do NOT reformat this file!
|
||||||
|
@ -72,7 +72,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.8 $', 10)"/>
|
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.9 $', 10)"/>
|
||||||
//
|
//
|
||||||
// This file is automatically generated; DO NOT EDIT IT.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
|
@ -135,7 +135,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
//
|
//
|
||||||
// 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.8 $', 10)"/>
|
// adl2controllerclasses.xslt version <xsl:value-of select="substring( '$Revision: 1.9 $', 10)"/>
|
||||||
//
|
//
|
||||||
// This file is automatically generated; DO NOT EDIT IT.
|
// This file is automatically generated; DO NOT EDIT IT.
|
||||||
//
|
//
|
||||||
|
@ -416,6 +416,25 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
|
|
||||||
<xsl:for-each select="descendant::adl:property[@type='list']">
|
<xsl:for-each select="descendant::adl:property[@type='list']">
|
||||||
|
<xsl:variable name="farentityname" select="@entity"/>
|
||||||
|
<xsl:variable name="farkey" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]/@name"/>
|
||||||
|
<xsl:variable name="farkeybasetype">
|
||||||
|
<xsl:call-template name="base-type">
|
||||||
|
<xsl:with-param name="property" select="//adl:entity[@name=$farentityname]/adl:key/adl:property[position()=1]"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:variable name="foreignkey">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="@farkey">
|
||||||
|
<xsl:value-of select="@farkey"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<!-- If I haven't been told what the far side foreign key is, assume it has the
|
||||||
|
name of my entity -->
|
||||||
|
<xsl:value-of select="ancestor::adl:entity/@name"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
/* with a list we cannot just smash the old values! Instead we need to check
|
/* with a list we cannot just smash the old values! Instead we need to check
|
||||||
* each one and exclude it if no longer required */
|
* each one and exclude it if no longer required */
|
||||||
if ( Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>") != null)
|
if ( Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>") != null)
|
||||||
|
@ -440,21 +459,46 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
if ( ! found)
|
if ( ! found)
|
||||||
{
|
{
|
||||||
record.<xsl:value-of select="@name"/>.Remove( item);
|
record.<xsl:value-of select="@name"/>.Remove( item);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} /* foreach ( <xsl:value-of select="@entity"/> item ... */
|
} /* foreach ( <xsl:value-of select="@entity"/> item ... */
|
||||||
|
|
||||||
/* then add any on the included list which are not already members */
|
/* then add any on the included list which are not already members */
|
||||||
foreach ( string index in <xsl:value-of select="concat(@name, 'Values')"/>)
|
foreach ( string index in <xsl:value-of select="concat(@name, 'Values')"/>)
|
||||||
{
|
{
|
||||||
<xsl:variable name="entityname" select="@entity"/>
|
<xsl:value-of select="concat( $entityns, '.', @entity)"/> item =
|
||||||
<xsl:value-of select="@entity"/> item =
|
|
||||||
hibernator.CreateCriteria(typeof(<xsl:value-of select="@entity"/>))
|
hibernator.CreateCriteria(typeof(<xsl:value-of select="@entity"/>))
|
||||||
.Add(Expression.Eq("<xsl:value-of select="@entity"/>Id", index))
|
.Add(Expression.Eq("<xsl:value-of select="$farkey"/>", <xsl:choose>
|
||||||
.UniqueResult<<xsl:value-of select="$entityns"/>.<xsl:value-of select="@entity"/>>();
|
<xsl:when test="$farkeybasetype = 'string'">
|
||||||
|
index
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$farkeybasetype = 'integer'">
|
||||||
|
Int32.Parse( index)
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:message terminate="yes">
|
||||||
|
ADL: Error: keys of type <xsl:value-of select="$farkeybasetype"/> cannot yet be used
|
||||||
|
in lists
|
||||||
|
</xsl:message>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>))
|
||||||
|
.UniqueResult<<xsl:value-of select="concat( $entityns, '.', @entity)"/>>();
|
||||||
|
|
||||||
if ( ! record.<xsl:value-of select="@name"/>.Contains( item))
|
if ( ! record.<xsl:value-of select="@name"/>.Contains( item))
|
||||||
{
|
{
|
||||||
|
/* check whether it's already a child of another <xsl:value-of select="ancestor::adl:entity/@name"/>
|
||||||
|
* and, if it is, remove it */
|
||||||
|
<xsl:value-of select="concat( $entityns, '.', ancestor::adl:entity/@name)"/> oldparent =
|
||||||
|
<xsl:value-of select="concat( 'item.', $foreignkey)"/>;
|
||||||
|
if ( oldparent != null) {
|
||||||
|
oldparent.<xsl:value-of select="@name"/>.Remove( item);
|
||||||
|
hibernator.Save( oldparent);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* then add it to my <xsl:value-of select="@name"/> */
|
||||||
record.<xsl:value-of select="@name"/>.Add( item);
|
record.<xsl:value-of select="@name"/>.Add( item);
|
||||||
|
<xsl:value-of select="concat( 'item.', $foreignkey)"/> = record;
|
||||||
|
hibernator.Save( item);
|
||||||
}
|
}
|
||||||
} /* foreach ( string index... */
|
} /* foreach ( string index... */
|
||||||
} /* if ( Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>") != null) */
|
} /* if ( Form.GetValues( "<xsl:value-of select="concat( 'instance.', @name)"/>") != null) */
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
Transform ADL into velocity view templates
|
Transform ADL into velocity view templates
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.5 $
|
$Revision: 1.6 $
|
||||||
$Date: 2008-06-03 16:09:11 $
|
$Date: 2008-06-04 16:17:39 $
|
||||||
-->
|
-->
|
||||||
<!-- 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! -->
|
||||||
|
@ -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.5 $', 10)"/>
|
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.6 $', 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.5 $', 10)"/>
|
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.6 $', 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.5 $', 10)"/>
|
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.6 $', 10)"/>
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
#capturefor( title)
|
#capturefor( title)
|
||||||
#if ( $instance)
|
#if ( $instance)
|
||||||
|
@ -261,8 +261,18 @@
|
||||||
|
|
||||||
function performInitialisation()
|
function performInitialisation()
|
||||||
{
|
{
|
||||||
<xsl:for-each select="../adl:property[@type='link']">
|
<xsl:for-each select="../adl:property[@type='link' or @type='list']">
|
||||||
|
<xsl:variable name="propname" select="@name"/>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="not( @properties='listed')">
|
||||||
document.<xsl:value-of select="$formname"/>.<xsl:value-of select="@name"/>.submitHandler = shuffleSubmitHandler;
|
document.<xsl:value-of select="$formname"/>.<xsl:value-of select="@name"/>.submitHandler = shuffleSubmitHandler;
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test=".//field[@property=$propname]">
|
||||||
|
document.<xsl:value-of select="$formname"/>.<xsl:value-of select="@name"/>.submitHandler = shuffleSubmitHandler;
|
||||||
|
</xsl:when>
|
||||||
|
<!-- if we're not doing all properties, and if this property is not the property of a field,
|
||||||
|
we /don't/ set up a submit handler. -->
|
||||||
|
</xsl:choose>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:if test="fieldgroup">
|
<xsl:if test="fieldgroup">
|
||||||
switchtab( '<xsl:value-of select="fieldgroup[1]/@name"/>');
|
switchtab( '<xsl:value-of select="fieldgroup[1]/@name"/>');
|
||||||
|
@ -354,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.5 $', 10)"/>
|
Generated using adl2views.xsl <xsl:value-of select="substring( '$Revision: 1.6 $', 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'>
|
||||||
|
@ -363,7 +373,7 @@
|
||||||
|
|
||||||
function performInitialisation()
|
function performInitialisation()
|
||||||
{
|
{
|
||||||
<xsl:for-each select="../property[@type='link']">
|
<xsl:for-each select="../property[@type='link' or @type='list']">
|
||||||
document.<xsl:value-of select="$formname"/>.<xsl:value-of select="@name"/>.submitHandler = shuffleSubmitHandler;
|
document.<xsl:value-of select="$formname"/>.<xsl:value-of select="@name"/>.submitHandler = shuffleSubmitHandler;
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
var validator = new Validation('<xsl:value-of select="$formname"/>', {immediate : true, useTitles : true});
|
var validator = new Validation('<xsl:value-of select="$formname"/>', {immediate : true, useTitles : true});
|
||||||
|
@ -475,7 +485,7 @@
|
||||||
<xsl:for-each select="$form/ancestor::adl:entity/adl:key/adl:property">
|
<xsl:for-each select="$form/ancestor::adl:entity/adl:key/adl:property">
|
||||||
<xsl:variable name="keyname" select="@name"/>
|
<xsl:variable name="keyname" select="@name"/>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="$form/adl:field[@property=$keyname]">
|
<xsl:when test="$form//adl:field[@property=$keyname]">
|
||||||
<!-- it's already a field of the form - no need to add a hidden one -->
|
<!-- it's already a field of the form - no need to add a hidden one -->
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
|
@ -486,31 +496,6 @@
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:if test="$form/adl:fieldgroup">
|
|
||||||
<!-- div id="tabbar">
|
|
||||||
<xsl:for-each select="$form/adl:fieldgroup">
|
|
||||||
<span class="tab">
|
|
||||||
<xsl:attribute name="id">
|
|
||||||
<xsl:value-of select="concat( @name, 'tab')"/>
|
|
||||||
</xsl:attribute>
|
|
||||||
<a>
|
|
||||||
<xsl:attribute name="href">
|
|
||||||
<xsl:value-of select="concat( '#', @name, 'anchor')"/>
|
|
||||||
</xsl:attribute>
|
|
||||||
<xsl:attribute name="onclick">
|
|
||||||
switchtab( '<xsl:value-of select="@name"/>'); return false;
|
|
||||||
</xsl:attribute>
|
|
||||||
<xsl:call-template name="showprompt">
|
|
||||||
<xsl:with-param name="node" select="."/>
|
|
||||||
<xsl:with-param name="fallback" select="@name"/>
|
|
||||||
<xsl:with-param name="entity" select="$form/ancestor::adl:entity"/>
|
|
||||||
<xsl:with-param name="locale" select="$locale"/>
|
|
||||||
</xsl:call-template>
|
|
||||||
</a>
|
|
||||||
</span>
|
|
||||||
</xsl:for-each>
|
|
||||||
</div -->
|
|
||||||
</xsl:if>
|
|
||||||
<xsl:apply-templates select="$form/adl:fieldgroup"/>
|
<xsl:apply-templates select="$form/adl:fieldgroup"/>
|
||||||
<div class="non-pane">
|
<div class="non-pane">
|
||||||
<table>
|
<table>
|
||||||
|
@ -966,7 +951,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.5 $', 10)"/>
|
Generated using adl2views.xslt <xsl:value-of select="substring( '$Revision: 1.6 $', 10)"/>
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
|
|
||||||
#capturefor( title)
|
#capturefor( title)
|
||||||
|
@ -1005,7 +990,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.5 $', 10)"/>
|
Generated using adl2listview.xsl <xsl:value-of select="substring( '$Revision: 1.6 $', 10)"/>
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
<xsl:call-template name="install-scripts"/>
|
<xsl:call-template name="install-scripts"/>
|
||||||
</head>
|
</head>
|
||||||
|
|
Loading…
Reference in a new issue