Working hierarchical permissions when generating widgets; working sort of menus; many other improvements.
This commit is contained in:
parent
cadaf246f4
commit
9a6b02cd6b
|
@ -9,8 +9,8 @@
|
||||||
Transform ADL into (partial) controller classes
|
Transform ADL into (partial) controller classes
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.14 $
|
$Revision: 1.15 $
|
||||||
$Date: 2008-03-10 17:01:26 $
|
$Date: 2008-03-12 13:46:10 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- 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.14 $', 11)"/>
|
select="substring( '$Revision: 1.15 $', 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)"/>
|
||||||
|
|
||||||
|
@ -463,6 +463,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
</xsl:if>
|
</xsl:if>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* ---- [ cut here: next file 'junk'] ------------------------- */
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="adl:property[@required='true']">
|
<xsl:template match="adl:property[@required='true']">
|
||||||
|
@ -677,7 +678,8 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
|
|
||||||
<xsl:template name="menus">
|
<xsl:template name="menus">
|
||||||
<xsl:param name="entity"/>
|
<xsl:param name="entity"/>
|
||||||
<xsl:for-each select="$entity/adl:property[@type='entity']">
|
<xsl:for-each select="$entity//adl:property[@type='entity']">
|
||||||
|
<!-- $entity//adl:property because it is possible to have type='entity' in the key -->
|
||||||
/* produce a list of <xsl:value-of select="@entity"/> to populate the menu for <xsl:value-of select="@name"/> */
|
/* produce a list of <xsl:value-of select="@entity"/> to populate the menu for <xsl:value-of select="@name"/> */
|
||||||
<xsl:call-template name="menu">
|
<xsl:call-template name="menu">
|
||||||
<xsl:with-param name="property" select="."/>
|
<xsl:with-param name="property" select="."/>
|
||||||
|
@ -685,6 +687,7 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
|
|
||||||
</xsl:for-each>
|
</xsl:for-each>
|
||||||
<xsl:for-each select="$entity/adl:property[@type='link']">
|
<xsl:for-each select="$entity/adl:property[@type='link']">
|
||||||
|
<!-- $entity/adl:property because it is not possible to have type='link' in the key -->
|
||||||
/* produce a list of <xsl:value-of select="@entity"/> to populate the LHS of the shuffle for <xsl:value-of select="@name"/> */
|
/* produce a list of <xsl:value-of select="@entity"/> to populate the LHS of the shuffle for <xsl:value-of select="@name"/> */
|
||||||
<xsl:call-template name="menu">
|
<xsl:call-template name="menu">
|
||||||
<xsl:with-param name="property" select="."/>
|
<xsl:with-param name="property" select="."/>
|
||||||
|
@ -705,10 +708,9 @@ namespace <xsl:value-of select="$controllerns"/> {
|
||||||
|
|
||||||
<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="entity" select="//adl:entity[@name=$property/@entity]"/>
|
||||||
<xsl:variable name="entity" select="//adl:entity[@name=$ename]"/>
|
|
||||||
PropertyBag["<xsl:value-of select="concat('all_', $property/@name)"/>"] =
|
PropertyBag["<xsl:value-of select="concat('all_', $property/@name)"/>"] =
|
||||||
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', $property/@entity)"/>))<xsl:for-each select="$entity/property[@distinct='user']">
|
hibernator.CreateCriteria(typeof(<xsl:value-of select="concat( $entityns, '.', $entity/@name)"/>))<xsl:for-each select="$entity//adl:property[@distinct='user']">
|
||||||
<xsl:value-of select="concat('.AddOrder( new Order( "', @name, '", true))')"/>
|
<xsl:value-of select="concat('.AddOrder( new Order( "', @name, '", true))')"/>
|
||||||
</xsl:for-each>.List<<xsl:value-of select="concat( $entityns, '.', $property/@entity)"/>>();
|
</xsl:for-each>.List<<xsl:value-of select="concat( $entityns, '.', $property/@entity)"/>>();
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
|
@ -8,8 +8,8 @@
|
||||||
Transform ADL into entity classes
|
Transform ADL into entity classes
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.11 $
|
$Revision: 1.12 $
|
||||||
$Date: 2008-03-10 17:01:26 $
|
$Date: 2008-03-12 13:46:10 $
|
||||||
-->
|
-->
|
||||||
|
|
||||||
<!-- 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.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)"/>
|
||||||
|
|
||||||
|
@ -220,8 +220,8 @@
|
||||||
get {
|
get {
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="adl:property[@distinct='user']">
|
<xsl:when test="descendant::adl:property[@distinct='user']">
|
||||||
<xsl:for-each select="adl:property[@distinct='user']">
|
<xsl:for-each select="descendant::adl:property[@distinct='user']">
|
||||||
<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)
|
||||||
|
@ -301,7 +301,7 @@
|
||||||
<xsl:apply-templates select="descendant::adl:property"/>
|
<xsl:apply-templates select="descendant::adl:property"/>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* ---- [ cut here: next file 'junk'] ------------------------- */
|
||||||
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
Transform ADL into velocity view templates
|
Transform ADL into velocity view templates
|
||||||
|
|
||||||
$Author: sb $
|
$Author: sb $
|
||||||
$Revision: 1.10 $
|
$Revision: 1.11 $
|
||||||
$Date: 2008-03-10 17:01:26 $
|
$Date: 2008-03-12 13:46:10 $
|
||||||
-->
|
-->
|
||||||
<!-- 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! -->
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
stored to CVS -->
|
stored to CVS -->
|
||||||
|
|
||||||
<xsl:variable name="transform-rev1"
|
<xsl:variable name="transform-rev1"
|
||||||
select="substring( '$Revision: 1.10 $', 11)"/>
|
select="substring( '$Revision: 1.11 $', 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)"/>
|
||||||
|
|
||||||
|
@ -89,13 +89,13 @@
|
||||||
|
|
||||||
Generated using adl2views.xslt <xsl:value-of select="$transform-revision"/>
|
Generated using adl2views.xslt <xsl:value-of select="$transform-revision"/>
|
||||||
</xsl:comment>
|
</xsl:comment>
|
||||||
|
${ShuffleWidgetHelper.InstallScripts()}
|
||||||
${Ajax.InstallScripts()}
|
${Ajax.InstallScripts()}
|
||||||
${FormHelper.InstallScripts()}
|
${FormHelper.InstallScripts()}
|
||||||
${Validation.InstallScripts()}
|
${Validation.InstallScripts()}
|
||||||
${Scriptaculous.InstallScripts()}
|
${Scriptaculous.InstallScripts()}
|
||||||
|
|
||||||
${ScriptsHelper.InstallScript( "Behaviour")}
|
${ScriptsHelper.InstallScript( "Behaviour")}
|
||||||
${ScriptsHelper.InstallScript( "ShuffleWidget")}
|
|
||||||
${ScriptsHelper.InstallScript( "Sitewide")}
|
${ScriptsHelper.InstallScript( "Sitewide")}
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
@ -270,18 +270,14 @@
|
||||||
<body onload="performInitialisation()">
|
<body onload="performInitialisation()">
|
||||||
<xsl:call-template name="top"/>
|
<xsl:call-template name="top"/>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
#if ( $Flash.errors)
|
#if ( $errors)
|
||||||
<div class="warning">
|
#if ( $errors.Count != 0)
|
||||||
<h2>Errors were encountered</h2>
|
<ul class="errors">
|
||||||
|
#foreach( $e in $errors)
|
||||||
<ul>
|
<li>$t.Enc($e)</li>
|
||||||
#foreach ($error in $Flash.errors)
|
|
||||||
<li>
|
|
||||||
$error
|
|
||||||
</li>
|
|
||||||
#end
|
#end
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
#end
|
||||||
#end
|
#end
|
||||||
#if ( $messages.Count == 0)
|
#if ( $messages.Count == 0)
|
||||||
<!-- if I try to test for $messages.Count > 0, I get the > copied straight through to
|
<!-- if I try to test for $messages.Count > 0, I get the > copied straight through to
|
||||||
|
@ -783,39 +779,15 @@
|
||||||
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:variable name="if-missing">
|
|
||||||
<xsl:choose>
|
|
||||||
<xsl:when test="adl:if-missing[@locale = $locale]">
|
|
||||||
<xsl:value-of select="adl:if-missing[@locale = $locale]"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="@required='true'">
|
|
||||||
You must provide a value for <xsl:value-of select="@name"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="@type='defined'">
|
|
||||||
The value for <xsl:value-of select="@name"/> must be <xsl:value-of select="@definition"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:when test="@type='entity'">
|
|
||||||
The value for <xsl:value-of select="@name"/> must be an instance of <xsl:value-of select="@entity"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>
|
|
||||||
The value for <xsl:value-of select="@name"/> must be <xsl:value-of select="@type"/>
|
|
||||||
</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
|
||||||
<!-- TODO: this is a one-database-role permission model, because that's all SRU needs.
|
<!-- TODO: this is a one-database-role permission model, because that's all SRU needs.
|
||||||
Different permissions for different database groups is much more complex! Also, this
|
Different permissions for different database groups is much more complex! Also, this
|
||||||
handles permissions on only properties and entities, not on forms. Perhaps we need a
|
handles permissions on only properties and entities, not on forms. Perhaps we need a
|
||||||
Helper class? -->
|
Helper class? -->
|
||||||
<xsl:variable name="permission">
|
<xsl:variable name="permission">
|
||||||
<xsl:choose>
|
<xsl:call-template name="property-permission">
|
||||||
<xsl:when test="adl:permission">
|
<xsl:with-param name="property" select="."/>
|
||||||
<xsl:value-of select="adl:permission[@group=$permissions-group]/@permission"/>
|
<xsl:with-param name="groupname" select ="$permissions-group"/>
|
||||||
</xsl:when>
|
</xsl:call-template>
|
||||||
<xsl:when test="ancestor::adl:entity/adl:permission">
|
|
||||||
<xsl:value-of select="ancestor::adl:entity/adl:permission[@group=$permissions-group]/@permission"/>
|
|
||||||
</xsl:when>
|
|
||||||
<xsl:otherwise>none</xsl:otherwise>
|
|
||||||
</xsl:choose>
|
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:if test="$permission != 'none'">
|
<xsl:if test="$permission != 'none'">
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -836,36 +808,106 @@
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@type='entity'">
|
<xsl:when test="@type='entity'">
|
||||||
<xsl:value-of select="concat('$instance.', @name, '.UserIdentifier')"/>
|
<xsl:value-of select="concat('$instance.', @name, '.UserIdentifier')"/>
|
||||||
|
${FormHelper.HiddenField( <xsl:value-of select="concat('$instance.', @name, '.KeyString')"/>)}
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<!-- TODO: if @type='list' or 'link', should generate Velocity to generate ul list
|
<!-- TODO: if @type='list' or 'link', should generate Velocity to generate ul list
|
||||||
of UserIdentifiers
|
of UserIdentifiers
|
||||||
-->
|
-->
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="concat('$!instance.', @name)"/>
|
<xsl:value-of select="concat('$instance.', @name)"/>
|
||||||
|
${FormHelper.HiddenField( <xsl:value-of select="concat('$instance.', @name)"/>)}
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
|
<xsl:when test="$permission='insert' or $permission='noedit'">
|
||||||
|
#if ($instance.<xsl:value-of select="@name"/>)
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="@type='entity'">
|
||||||
|
<xsl:value-of select="concat('$instance.', @name, '.UserIdentifier')"/>
|
||||||
|
${FormHelper.HiddenField( <xsl:value-of select="concat('$instance.', @name, '.KeyString')"/>)}
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:value-of select="concat('$instance.', @name)"/>
|
||||||
|
${FormHelper.HiddenField( <xsl:value-of select="concat('$instance.', @name)"/>)}
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
#else
|
||||||
|
<xsl:call-template name="widget">
|
||||||
|
<xsl:with-param name="property" select="."/>
|
||||||
|
</xsl:call-template>
|
||||||
|
#end
|
||||||
|
</xsl:when>
|
||||||
<!-- TODO: if $permission='insert', then you should get an editable widget if there
|
<!-- TODO: if $permission='insert', then you should get an editable widget if there
|
||||||
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:otherwise>
|
||||||
<xsl:when test="@type='entity'">
|
<xsl:call-template name="widget">
|
||||||
|
<xsl:with-param name="property" select="."/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</td>
|
||||||
|
<td class="help">
|
||||||
|
<xsl:apply-templates select="adl:help[@locale = $locale]"/>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</xsl:if>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- render an appropriate widget for the indicated property
|
||||||
|
property: a property element
|
||||||
|
-->
|
||||||
|
<xsl:template name="widget">
|
||||||
|
<xsl:param name="property"/>
|
||||||
|
<xsl:variable name="if-missing">
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="adl:if-missing[@locale = $locale]">
|
||||||
|
<xsl:value-of select="adl:if-missing[@locale = $locale]"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$property/@required='true'">
|
||||||
|
You must provide a value for <xsl:value-of select="$property/@name"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$property/@type='defined'">
|
||||||
|
The value for <xsl:value-of select="$property/@name"/> must be <xsl:value-of select="$property/@definition"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$property/@type='entity'">
|
||||||
|
The value for <xsl:value-of select="$property/@name"/> must be an instance of <xsl:value-of select="$property/@entity"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
The value for <xsl:value-of select="$property/@name"/> must be <xsl:value-of select="$property/@type"/>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$property/@type='entity'">
|
||||||
<!-- a menu of the appropriate entity -->
|
<!-- a menu of the appropriate entity -->
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$property/@required='true'">
|
||||||
|
<!-- if required='true', then you should not get the firstoption stuff -->
|
||||||
#if ( $instance)
|
#if ( $instance)
|
||||||
${FormHelper.Select( "instance.<xsl:value-of select="@name"/>", $instance.<xsl:value-of select="@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{firstoption='[unset]', firstoptionvalue='-1', text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
|
${FormHelper.Select( "instance.<xsl:value-of select="$property/@name"/>", $instance.<xsl:value-of select="$property/@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
|
||||||
#else
|
#else
|
||||||
${FormHelper.Select( "instance.<xsl:value-of select="@name"/>", $<xsl:value-of select="@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{firstoption='[unset]', firstoptionvalue='-1', text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
|
${FormHelper.Select( "instance.<xsl:value-of select="$property/@name"/>", $<xsl:value-of select="$property/@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
|
||||||
#end
|
#end
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type='list'">
|
<xsl:otherwise>
|
||||||
<!-- a multi-select menu of the appropriate entity -->
|
#if ( $instance)
|
||||||
${FormHelper.Select( "instance.<xsl:value-of select="@name"/>", $instance.<xsl:value-of select="@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{multiple='multiple', size='8', text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
|
${FormHelper.Select( "instance.<xsl:value-of select="$property/@name"/>", $instance.<xsl:value-of select="$property/@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{firstoption='[unset]', firstoptionvalue='-1', text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
|
||||||
|
#else
|
||||||
|
${FormHelper.Select( "instance.<xsl:value-of select="$property/@name"/>", $<xsl:value-of select="$property/@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{firstoption='[unset]', firstoptionvalue='-1', text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
|
||||||
|
#end
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type='defined'">
|
<xsl:when test="$property/@type='list'">
|
||||||
|
<!-- a multi-select menu of the appropriate entity -->
|
||||||
|
${FormHelper.Select( "instance.<xsl:value-of select="$property/@name"/>", $instance.<xsl:value-of select="$property/@name"/>, <xsl:value-of select="concat( '$all_', @name)"/>, "%{multiple='multiple', size='8', text='UserIdentifier', value='KeyString', title='<xsl:value-of select="normalize-space( $if-missing)"/>'}" )}
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$property/@type='defined'">
|
||||||
<!-- likely to be hardest of all... -->
|
<!-- likely to be hardest of all... -->
|
||||||
<xsl:variable name="definition">
|
<xsl:variable name="definition">
|
||||||
<xsl:value-of select="@definition"/>
|
<xsl:value-of select="$property/@definition"/>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="maximum">
|
<xsl:variable name="maximum">
|
||||||
<xsl:value-of select="//adl:definition[@name=$definition]/@maximum"/>
|
<xsl:value-of select="//adl:definition[@name=$definition]/@maximum"/>
|
||||||
|
@ -884,7 +926,7 @@
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<input type="text">
|
<input type="text">
|
||||||
<xsl:attribute name="class">
|
<xsl:attribute name="class">
|
||||||
<xsl:if test="@required='true'">required </xsl:if>
|
<xsl:if test="$property/@required='true'">required </xsl:if>
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="//adl:definition[@name=$definition]/@pattern">
|
<xsl:when test="//adl:definition[@name=$definition]/@pattern">
|
||||||
<xsl:value-of select="concat( 'validate-custom-', $definition)"/>
|
<xsl:value-of select="concat( 'validate-custom-', $definition)"/>
|
||||||
|
@ -922,7 +964,9 @@
|
||||||
</xsl:attribute>
|
</xsl:attribute>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
<xsl:attribute name="value">$!instance.<xsl:value-of select="@name"/></xsl:attribute>
|
<xsl:attribute name="value">
|
||||||
|
$!instance.<xsl:value-of select="$property/@name"/>
|
||||||
|
</xsl:attribute>
|
||||||
<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>
|
||||||
|
@ -946,7 +990,7 @@
|
||||||
</div>
|
</div>
|
||||||
<script type="text/javascript" language="javascript">
|
<script type="text/javascript" language="javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
new Control.Slider('<xsl:value-of select="@name"/>-slider','<xsl:value-of select="@name"/>-track',{
|
new Control.Slider('<xsl:value-of select="$property/@name"/>-slider','<xsl:value-of select="$property/@name"/>-track',{
|
||||||
onSlide:function(v){$('<xsl:value-of select="concat( 'instance_', @name)"/>').value = <xsl:value-of select="$minimum"/>+ Math.floor(v*(<xsl:value-of select="$maximum - $minimum"/>))}
|
onSlide:function(v){$('<xsl:value-of select="concat( 'instance_', @name)"/>').value = <xsl:value-of select="$minimum"/>+ Math.floor(v*(<xsl:value-of select="$maximum - $minimum"/>))}
|
||||||
})
|
})
|
||||||
// ]]>
|
// ]]>
|
||||||
|
@ -980,51 +1024,48 @@
|
||||||
// ]]>
|
// ]]>
|
||||||
</script>
|
</script>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type='boolean'">
|
<xsl:when test="$property/@type='boolean'">
|
||||||
${FormHelper.CheckboxField( "instance.<xsl:value-of select="@name"/>")}
|
${FormHelper.CheckboxField( "instance.<xsl:value-of select="$property/@name"/>")}
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type='date'">
|
<xsl:when test="$property/@type='date'">
|
||||||
<xsl:variable name="class"><xsl:if test="@required='true'">required </xsl:if>date-field validate-date</xsl:variable>
|
<xsl:variable name="class">
|
||||||
${FormHelper.TextField( "instance.<xsl:value-of select="@name"/>", "%{class='<xsl:value-of select="$class"/>', textformat='d', size='10', maxlength='10'}")}
|
<xsl:if test="$property/@required='true'">required </xsl:if>date-field validate-date
|
||||||
|
</xsl:variable>
|
||||||
|
${FormHelper.TextField( "instance.<xsl:value-of select="$property/@name"/>", "%{class='<xsl:value-of select="$class"/>', textformat='d', size='10', maxlength='10'}")}
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:variable name="class">
|
<xsl:variable name="class">
|
||||||
<xsl:if test="@required='true'">required </xsl:if><xsl:choose>
|
<xsl:if test="$property/@required='true'">required </xsl:if>
|
||||||
<xsl:when test="@type='integer'">validate-digits</xsl:when>
|
<xsl:choose>
|
||||||
<xsl:when test="@type='real'">validate-number</xsl:when>
|
<xsl:when test="$property/@type='integer'">validate-digits</xsl:when>
|
||||||
<xsl:when test="@type='money'">validate-number</xsl:when>
|
<xsl:when test="$property/@type='real'">validate-number</xsl:when>
|
||||||
|
<xsl:when test="$property/@type='money'">validate-number</xsl:when>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="size">
|
<xsl:variable name="size">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@size < 60">
|
<xsl:when test="$property/@size < 60">
|
||||||
<xsl:value-of select="@size"/>
|
<xsl:value-of select="$property/@size"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:when test="@type='integer'">8</xsl:when>
|
<xsl:when test="$property/@type='integer'">8</xsl:when>
|
||||||
<xsl:when test="@type='real'">8</xsl:when>
|
<xsl:when test="$property/@type='real'">8</xsl:when>
|
||||||
<xsl:when test="@type='money'">8</xsl:when>
|
<xsl:when test="$property/@type='money'">8</xsl:when>
|
||||||
<xsl:otherwise>60</xsl:otherwise>
|
<xsl:otherwise>60</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
<xsl:variable name="maxlength">
|
<xsl:variable name="maxlength">
|
||||||
<xsl:choose>
|
<xsl:choose>
|
||||||
<xsl:when test="@size >= 60">
|
<xsl:when test="$property/@size >= 60">
|
||||||
<xsl:value-of select="@size"/>
|
<xsl:value-of select="$property/@size"/>
|
||||||
</xsl:when>
|
</xsl:when>
|
||||||
<xsl:otherwise>
|
<xsl:otherwise>
|
||||||
<xsl:value-of select="$size"/>
|
<xsl:value-of select="$size"/>
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:variable>
|
</xsl:variable>
|
||||||
${FormHelper.TextField( "instance.<xsl:value-of select="@name"/>", "%{class='<xsl:value-of select="$class"/>', title='<xsl:value-of select="normalize-space( $if-missing)"/>', size='<xsl:value-of select="$size"/>', maxlength='<xsl:value-of select="$maxlength"/>'}")}
|
${FormHelper.TextField( "instance.<xsl:value-of select="$property/@name"/>", "%{class='<xsl:value-of select="$class"/>', title='<xsl:value-of select="normalize-space( $if-missing)"/>', size='<xsl:value-of select="$size"/>', maxlength='<xsl:value-of select="$maxlength"/>'}")}
|
||||||
</xsl:otherwise>
|
</xsl:otherwise>
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</td>
|
|
||||||
<td class="help">
|
|
||||||
<xsl:apply-templates select="adl:help[@locale = $locale]"/>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</xsl:if>
|
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
<xsl:template match="adl:prompt">
|
<xsl:template match="adl:prompt">
|
||||||
|
@ -1409,6 +1450,51 @@
|
||||||
</xsl:choose>
|
</xsl:choose>
|
||||||
</xsl:template>
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- find, as a string, the permission which applies to this property in the context of the named group.
|
||||||
|
NOTE: recurses up the group hierarchy - if it has cycles that's your problem, buster.
|
||||||
|
property: a property element
|
||||||
|
groupname: a string, being the name of a group
|
||||||
|
-->
|
||||||
|
<xsl:template name="property-permission">
|
||||||
|
<xsl:param name="property"/>
|
||||||
|
<xsl:param name="groupname" select="public"/>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$property/adl:permission[@group=$groupname]">
|
||||||
|
<xsl:value-of select="$property/adl:permission[@group=$groupname]/@permission"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="$property/ancestor::adl:entity/adl:permission[@group=$groupname]">
|
||||||
|
<xsl:value-of select="$property/ancestor::adl:entity/adl:permission[@group=$groupname]/@permission"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:when test="//adl:group[@name=$groupname]/@parent">
|
||||||
|
<xsl:call-template name="property-permission">
|
||||||
|
<xsl:with-param name="property" select="$property"/>
|
||||||
|
<xsl:with-param name="groupname" select="//adl:group[@name=$groupname]/@parent"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>none</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
<!-- find, as a string, the permission which applies to this field in the context of the named group
|
||||||
|
field: a field element
|
||||||
|
groupname: a string, being the name of a group
|
||||||
|
-->
|
||||||
|
<xsl:template name="field-permission">
|
||||||
|
<xsl:param name="field"/>
|
||||||
|
<xsl:param name="groupname"/>
|
||||||
|
<xsl:choose>
|
||||||
|
<xsl:when test="$field/adl:permission[@group=$groupname]">
|
||||||
|
<xsl:value-of select="$field/adl:permission[@group=$groupname]/@permission"/>
|
||||||
|
</xsl:when>
|
||||||
|
<xsl:otherwise>
|
||||||
|
<xsl:call-template name="property-permission">
|
||||||
|
<xsl:with-param name="property" select="$field/ancestor::adl:entity//adl:property[@name=$field/@name]"/>
|
||||||
|
<xsl:with-param name="groupname" select="$groupname"/>
|
||||||
|
</xsl:call-template>
|
||||||
|
</xsl:otherwise>
|
||||||
|
</xsl:choose>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
<!-- just copy anything we can't match -->
|
<!-- just copy anything we can't match -->
|
||||||
<xsl:template match="@* | node()">
|
<xsl:template match="@* | node()">
|
||||||
<xsl:copy>
|
<xsl:copy>
|
||||||
|
|
Loading…
Reference in a new issue